-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.xml
More file actions
276 lines (236 loc) · 9.21 KB
/
build.xml
File metadata and controls
276 lines (236 loc) · 9.21 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<?xml version="1.0" encoding="UTF-8"?>
<project name="Bootstrap" default="package-output" basedir=".">
<target name="init-constants" depends="check-module-info, delete-properties, hackant17">
<!-- enable logging of the build output-->
<record name="${basedir}/build.log" append="no" />
<!-- try to load a local properties file -->
<fail message="Please copy scripts/run.sh.sample to scripts/run.sh and possibly adjust the Java launching parameters." unless="isRunShAvail" />
<fail message="Please create a folder called 'lib' and put the log4j library in there. Bootstrap has been tested with version log4j-1.2.14, but should also work with more recent versions." unless="isLibAvail" />
<!-- do not change these properties here, do change project.properties file, instead -->
<property name="build.path" value="build"/>
<property name="source.java" value="${basedir}/src/main/java" />
<property name="tests.java" value="${basedir}/src/test/java" />
<property name="examples.java" value="${basedir}/src/examples" />
<patternset id="thirdparty.patternset">
<include name="*.jar" />
</patternset>
<!-- The combined library classpath -->
<path id="thirdparty.classpath">
<fileset dir="lib">
<patternset refid="thirdparty.patternset" />
</fileset>
</path>
<!-- The classpath required to build classes. -->
<path id="javac.classpath">
<path refid="thirdparty.classpath" />
</path>
<path id="javac.classpath.core">
<path refid="thirdparty.classpath" />
</path>
</target>
<target name="hackant17-properties">
<available property="ant17.works" classname="org.apache.tools.ant.taskdefs.optional.EchoProperties" />
</target>
<target name="hackant17" depends="hackant17-properties" unless="ant17.works">
<taskdef name="propertyfile" classname="org.apache.tools.ant.taskdefs.optional.PropertyFile">
<classpath>
<fileset dir="${ant.home}/lib">
<include name="ant-nodeps.jar" />
</fileset>
</classpath>
</taskdef>
</target>
<!-- ================================================================== -->
<!-- clean the whole output folder -->
<!-- ================================================================== -->
<target name="clean" depends="init-constants">
<record name="${basedir}/build.log" action="stop" />
<delete file="${base-dir}/build.log" quiet="true" failonerror="false" />
<delete dir="${build.path}/classes" />
<delete dir="${basedir}/output" />
</target>
<!-- Compile all class files -->
<target name="compile-classes" depends="revision, init-constants">
<mkdir dir="${build.path}/classes" />
<javac destdir="${build.path}/classes"
optimize="${maven.compile.optimize}"
debug="${maven.compile.debug}"
depend="${javac.depend}"
verbose="${maven.compile.verbose}"
deprecation="${maven.compile.deprecation}"
includeAntRuntime="${javac.include.ant.runtime}"
includeJavaRuntime="${javac.include.java.runtime}"
failonerror="true">
<src path="${source.java}" />
<classpath refid="javac.classpath" />
</javac>
</target>
<target name="compile-examples" depends="revision, init-constants">
<mkdir dir="${build.path}/classes-example" />
<javac destdir="${build.path}/classes-example"
optimize="${maven.compile.optimize}"
debug="${maven.compile.debug}"
depend="${javac.depend}"
verbose="${maven.compile.verbose}"
deprecation="${maven.compile.deprecation}"
includeAntRuntime="${javac.include.ant.runtime}"
includeJavaRuntime="${javac.include.java.runtime}"
failonerror="true">
<src path="${examples.java}" />
<classpath refid="javac.classpath" />
<classpath path="${build.path}/classes">
</classpath>
</javac>
</target>
<target name="compile" depends="compile-classes, current-number" description="Compile all source files for the core module.">
<copy todir="${build.path}/classes">
<fileset dir="${source.java}">
<exclude name="**/*.class" />
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<target name="jar" depends="compile,current-number,current-time" description="Builds jars for core module.">
<delete dir="${basedir}/output" />
<mkdir dir="${basedir}/output" />
<echo file="${build.path}/classes/de/ismll/bootstrap/version.info" message="${build.number}" append="false">
</echo>
<echo file="${build.path}/classes/de/ismll/bootstrap/module.info" message="${time.current}" append="false">
</echo>
<jar jarfile="${basedir}/output/${module.name}-${build.number}.jar">
<fileset dir="${build.path}/classes" includes="**" />
</jar>
</target>
<target name="jar-examples" depends="compile-examples,current-number" description="Builds example jar.">
<jar jarfile="${basedir}/output/${module.name}-examples-${build.number}.jar">
<fileset dir="${build.path}/classes-example" includes="**" />
</jar>
</target>
<target name="jar-wsource" depends="compile" description="Builds jars for core module.">
<jar jarfile="${basedir}/output/${module.name}-${build.number}-src.jar">
<fileset dir="${build.path}/classes" includes="**" />
<fileset dir="${source.java}" includes="**/*.java" />
</jar>
</target>
<target name="package-output" depends="jar,jar-examples" description="Builds jars for core module.">
<mkdir dir="${basedir}/output/licences" />
<copy todir="${basedir}/output">
<fileset dir="lib">
<include name="log4j-*.jar" />
</fileset>
<fileset dir=".">
<include name="README.md" />
</fileset>
<fileset dir="${basedir}/scripts">
<include name="*.sh" />
<include name="*.bat" />
</fileset>
</copy>
<copy todir="${basedir}/output/licences">
<fileset dir="licences">
<include name="*" />
</fileset>
</copy>
<chmod perm="0755">
<fileset dir="${basedir}/output">
<include name="**/*.sh" />
</fileset>
</chmod>
</target>
<target name="release" depends="jar" description="Builds jars for core module.">
<delete dir="${basedir}/release" />
<mkdir dir="${basedir}/release" />
<mkdir dir="${basedir}/release/lib" />
<mkdir dir="${basedir}/release/scripts" />
<mkdir dir="${basedir}/release/examples" />
<copy todir="${basedir}/release/lib">
<fileset dir="${basedir}/output">
<include name="**/*" />
<exclude name="log4j*.jar"/>
<exclude name="**/*.sh"/>
</fileset>
</copy>
<copy todir="${basedir}/release/examples">
<fileset dir="${examples.java}">
<include name="**/*" />
</fileset>
</copy>
<copy todir="${basedir}/release">
<fileset dir="${basedir}/releasebase">
<include name="**/*" />
</fileset>
</copy>
<copy todir="${basedir}/release/scripts">
<fileset dir="${basedir}/output">
<include name="*.sh" />
</fileset>
</copy>
<chmod perm="0755">
<fileset dir="${basedir}/release/scripts">
<include name="**/*.sh" />
</fileset>
</chmod>
</target>
<target name="check-module-info">
<property file="project.properties" />
<!--<echo message="${module.name}"/>-->
<available file="${basedir}/scripts/run.sh" property="isRunShAvail" />
<available file="${basedir}/lib" property="isLibAvail" />
</target>
<target name="delete-properties" depends="check-module-info" unless="module.name">
<delete file="project.properties"/>
<fail unless="module.name" message="Property module.name was not found. Have you copied project.properties.sample to project.properties and adjusted the parameters???"/>
</target>
<target name="current-number">
<property name="build.number" value="${build.major.number}.${build.minor.number}.${build.revision.number}" />
</target>
<target name="dist">
<antcall target="minor">
</antcall>
</target>
<target name="revision" depends="hackant17">
<propertyfile file="project.properties">
<entry key="build.revision.number" type="int" operation="+"
value="1" pattern="00" />
</propertyfile>
<propertyfile file="project.properties.sample">
<entry key="build.revision.number" type="int" operation="+"
value="1" pattern="00" />
</propertyfile>
</target>
<target name="minor">
<propertyfile file="project.properties">
<entry key="build.minor.number" type="int" operation="+" value="1"
pattern="00" />
<entry key="build.revision.number" type="int" value="0"
pattern="00" />
</propertyfile>
<propertyfile file="project.properties.sample">
<entry key="build.minor.number" type="int" operation="+" value="1"
pattern="00" />
<entry key="build.revision.number" type="int" value="0"
pattern="00" />
</propertyfile>
</target>
<target name="major">
<propertyfile file="project.properties">
<entry key="build.major.number" type="int" operation="+" value="1"
pattern="00" />
<entry key="build.minor.number" type="int" value="0" pattern="00" />
<entry key="build.revision.number" type="int" value="0"
pattern="00" />
</propertyfile>
<propertyfile file="project.properties.sample">
<entry key="build.major.number" type="int" operation="+" value="1"
pattern="00" />
<entry key="build.minor.number" type="int" value="0" pattern="00" />
<entry key="build.revision.number" type="int" value="0"
pattern="00" />
</propertyfile>
</target>
<target name="current-time">
<tstamp>
<format property="time.current" pattern="yyyy/MM/dd" locale="en,UK"/>
</tstamp>
</target>
</project>