-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.xml
171 lines (139 loc) · 6.21 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?xml version="1.0"?>
<project name="TaskDistribution" default="run" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
Ant/ivy based build.xml file for TaskDistribution. Needs ant to run
</description>
<property name="version" value="1.0"/>
<property name="root.dir" value="${basedir}"/>
<property name="src.dir" value="${root.dir}/src"/>
<property name="compile.dir" value="${root.dir}/classes"/>
<property name="lib.dir" value="${root.dir}/lib"/>
<property name="dist.dir" value="${root.dir}/dist"/>
<property name="tmp.dir" value="${root.dir}/tmp"/>
<property name="javadoc.dir" value="${dist.dir}/javadoc"/>
<property name="conf.dir" value="${root.dir}/conf"/>
<property name="bin.dir" value="${root.dir}/bin"/>
<property name="javadoc.packages" value="org.taskdistribution.*"/>
<property name="timestamp" value=".timestamp"/>
<property name="maven.executable" value="mvn"/>
<property name="ivy.version" value="2.4.0" />
<path id="jg.classpath">
<pathelement location="${compile.dir}"/>
<pathelement location="${conf.dir}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<target name="check-lib-exists">
<available file="${lib.dir}" type="dir" property="lib.dir.exists"/>
</target>
<target name="check-ivy-exists">
<mkdir dir="${lib.dir}"/>
<pathconvert property="ivy.exists" pathsep=" " setonempty="false">
<path>
<fileset dir="${lib.dir}" includes="ivy*.jar" />
</path>
</pathconvert>
</target>
<target name="check-jars-exist">
<mkdir dir="${lib.dir}"/>
<pathconvert property="jars.exist" pathsep=" " setonempty="false">
<path>
<fileset dir="${lib.dir}" excludes="ivy*.jar" />
</path>
</pathconvert>
</target>
<target name="get-ivy" description="Fetches ivy from a maven repo" depends="check-ivy-exists" unless="ivy.exists">
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"
dest="${lib.dir}" usetimestamp="true"/>
</target>
<target name="retrieve" depends="check-jars-exist,get-ivy,define-ivy-task" unless="jars.exist"
description="Retrieves all dependent libs defined in ivy.xml unless already present">
<ivy:retrieve type="jar,bundle" transitive="false"/>
</target>
<target name="define-ivy-task">
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="jg.classpath"/>
</target>
<target name="prepare" depends="retrieve">
<property environment="env"/>
<mkdir dir="${compile.dir}"/>
</target>
<target name="compile" depends="prepare" description="Compiles all Java files">
<javac destdir="${compile.dir}"
source="1.8"
target="1.8"
classpathref="jg.classpath"
includeantruntime="false"
debug="on"
deprecation="off"
optimize="off"
listfiles="false"
includes="org/taskdistribution/**">
<src path="${src.dir}"/>
</javac>
</target>
<target name="run" description="Run the demo with default props">
<java classname="org.taskdistribution.Server" classpathref="jg.classpath" fork="true">
<jvmarg value="-Djava.net.preferIPv4Stack=true"/>
</java>
</target>
<target name="jar"
description="Compiles and creates JARs in ./dist"
depends="jgroups.jar">
</target>
<target name="jgroups.jar"
description="Creates the jgroups.jar (includes everything)"
depends="clean,compile">
<mkdir dir="${dist.dir}"/>
<xmlproperty file="${ant.file}" collapseAttributes="true"/>
<property name="-savemanifest" value="${conf.dir}/MANIFEST.MF"/>
<property name="-output" value="${conf.dir}"/>
<jar destfile="${dist.dir}/taskdistribution-${version}.jar"
basedir="${compile.dir}"
manifest="${conf.dir}/MANIFEST.MF"
includes="org/jgroups/**">
<fileset dir="${conf.dir}" includes="*.dtd, *.xml, jg-messages*.properties" excludes="*-service.xml"/>
<fileset dir="${root.dir}">
<include name="README*"/>
</fileset>
</jar>
</target>
<!-- generate java doc -->
<target name="javadoc"
depends="prepare,check-javadoc" unless="javadoc.exists"
description="Creates Javadoc documentation in ./dist/javadoc">
<mkdir dir="${javadoc.dir}"/>
<javadoc packagenames="${javadoc.packages}"
sourcepath="${src.dir}"
destdir="${javadoc.dir}"
classpathref="jg.classpath"
author="true"
version="true"
use="true"
bottom="Copyright © 1998-2014 Bela Ban / Red Hat. All Rights Reserved."
useexternalfile="yes"
doctitle="TaskDistribution">
<!-- The tag option for Javadoc is available in Java 1.4 or later. -->
<tag name="todo" description="To do:"/>
</javadoc>
</target>
<target name="check-javadoc" description="Checks whether the ./dist/javadoc dir exists">
<available file="${javadoc.dir}" type="dir" property="javadoc.exists"/>
</target>
<target name="clean"
description="Removes all class files and ./dist">
<delete dir="${compile.dir}" failonerror="false"/>
<delete dir="${dist.dir}" failonerror="false"/>
<delete dir="${tmp.dir}" failonerror="false"/>
<delete file="${conf.dir}/MANIFEST.MF" failonerror="false"/>
<delete>
<fileset dir="${root.dir}" defaultexcludes="no">
<include name="**/*~"/>
</fileset>
</delete>
</target>
<target name="clean-all" depends="clean" description="Also removes lib">
<delete dir="${lib.dir}" failonerror="false"/>
</target>
</project>