forked from evgs/Bombus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
262 lines (219 loc) · 9.68 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
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
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="" default="jar" basedir=".">
<description>Builds, tests, and runs the project .</description>
<import file="nbproject/build-impl.xml"/>
<!-- release tasks -->
<target name="for-release-configs">
<antcall inheritrefs="false" inheritall="false" target="${target.to.call}">
<param name="config.active" value="Release"/>
</antcall>
<antcall inheritrefs="false" inheritall="false" target="${target.to.call}">
<param name="config.active" value="ReleaseJZLIB"/>
</antcall>
</target>
<target name="rebuild-release">
<antcall target="for-release-configs">
<param value="rebuild" name="target.to.call"/>
</antcall>
</target>
<target name="rebuild-midp2-release">
<antcall inheritrefs="false" inheritall="false" target="rebuild">
<param name="config.active" value="Release"/>
</antcall>
</target>
<target name="rebuild-jzlib-release">
<antcall inheritrefs="false" inheritall="false" target="rebuild">
<param name="config.active" value="ReleaseJZLIB"/>
</antcall>
</target>
<target name="deploy-release">
<antcall target="for-release-configs">
<param value="deploy" name="target.to.call"/>
</antcall>
<!-- version patch in arch packer
<copy file="pack.cmd.txt" tofile="pack.cmd" overwrite="true" />
<replace
file="pack.cmd"
propertyFile="resources/.version">
<replacefilter
token="$BOMBUSREV$"
property="bombus.revision"/>
</replace> -->
<!-- version patch in server files -->
<copy file="private/config.php.txt" tofile="ftp/config.php" overwrite="true" />
<property file="resources/.version" />
<replace
file="ftp/config.php"
token="$BOMBUSVERSION$"
value="${bombus.version}"/>
<delete>
<fileset dir="ftp" includes="bombus*.*" />
</delete>
<tstamp>
<format property="bombus.tstamp" pattern="MM_dd"/>
</tstamp>
<property name="destfile" location="ftp/bombus_${bombus.revision}(all)${bombus.tstamp}" />
<zip destfile="${destfile}.zip">
<zipfileset dir="ftp/midp2.0" prefix="midp2.0"/>
<zipfileset dir="ftp/midp2.0z" prefix="midp2.0-ZLIB"/>
<zipfileset file="changelog.txt"/>
<zipfileset file="copying.txt"/>
</zip>
<tar destfile="${destfile}.tar">
<tarfileset dir="ftp/midp2.0" prefix="midp2.0"/>
<tarfileset dir="ftp/midp2.0z" prefix="midp2.0-ZLIB"/>
<tarfileset file="changelog.txt"/>
<tarfileset file="copying.txt"/>
</tar>
<bzip2 src="${destfile}.tar" destfile="${destfile}.tar.bz2"/>
<delete>
<fileset dir="ftp" includes="bombus*.tar" />
</delete>
</target>
<!-- prepare version patch -->
<target name="post-init">
<exec executable="svnversion" output="resources/.svnrev" />
<loadfile srcFile="resources/.svnrev" property="bombus.svnrev"/>
<copy file="resources/version.properties" tofile="resources/.version" overwrite="true" />
<replace
file="resources/.version"
token="$WCREV$"
value="${bombus.svnrev}"/>
</target>
<!-- old version patcher
<target name="post-init-tsvn">
<property name="versionPatcher" location="C:/Program Files/TortoiseSVN/bin/SubWCRev.exe" />
<property name="file_in" location="resources\version.properties "/>
<property name="file_out" location="resources\.version "/>
<exec executable="${versionPatcher}" >
<arg value="."/>
<arg value="${file_in}"/>
<arg value="${file_out}"/>
</exec>
</target>
-->
<!-- version patch in Sources -->
<target name="post-preprocess">
<property file="resources/.version" />
<replace
file="${preprocessed.dir}\Info\Version.java"
token="$BOMBUSVERSION$"
value="${bombus.version}"/>
</target>
<!-- version patch in manifest -->
<target name="pre-jar" depends="create-jad">
<property file="resources/.version" />
<replace file="${build.dir}/manifest.mf"
token="$BOMBUSVERSION$"
value="${bombus.version}"/>
<replace file="${build.dir}/manifest.mf"
token="$MIDLETVERSION$"
value="${bombus.midlet}"/>
</target>
<target name="post-jar">
<!-- version patch in jad -->
<property file="resources/.version" />
<replace file="${dist.dir}/Bombus.jad"
token="$BOMBUSVERSION$"
value="${bombus.version}"/>
<replace file="${dist.dir}/Bombus.jad"
token="$MIDLETVERSION$"
value="${bombus.midlet}"/>
</target>
<!-- overrided to change bootclasspath -->
<target depends="pre-load-properties,exists.config.active,exists.netbeans.user,exists.user.properties.file" name="load-properties">
<loadproperties srcfile="nbproject/project.properties">
<filterchain>
<containsregex replace="\1" pattern="^configs\.${config.active}\.(.*)"/>
<concatfilter prepend="nbproject/project.properties"/>
<containsregex pattern="^platform.active=|^deployment.method=|^bombus.bootclasspath="/>
</filterchain>
</loadproperties>
<property name="bombus.bootclasspath" value=""/>
<echo message="${bombus.bootclasspath}"/>
<loadproperties srcfile="${user.properties.file}">
<filterchain>
<replaceregex replace="platform." pattern="^platforms\.${platform.active}\."/>
<replaceregex replace="deployment.scriptfile=" pattern="^deployment\.${deployment.method}\.scriptfile="/>
</filterchain>
</loadproperties>
<!-- patching bootclasspath -->
<loadproperties srcfile="nbproject/project.properties">
<filterchain>
<containsregex replace="platform.bootclasspath=\1${bombus.bootclasspath}" pattern="^configs\.${config.active}\.platform\.bootclasspath=(.*)"/>
</filterchain>
</loadproperties>
<loadproperties srcfile="nbproject/project.properties">
<filterchain>
<containsregex replace="platform.bootclasspath=\1${bombus.bootclasspath}" pattern="^platform\.bootclasspath=(.*)"/>
</filterchain>
</loadproperties>
<loadproperties srcfile="nbproject/project.properties">
<filterchain>
<containsregex replace="\1" pattern="^configs\.${config.active}\.(.*)"/>
<concatfilter prepend="nbproject/project.properties"/>
</filterchain>
</loadproperties>
<echo message="Modified bootclasspath=${platform.bootclasspath}" />
</target>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
pre-init: called before initialization of project properties
post-init: called after initialization of project properties
pre-preprocess: called before text preprocessing of sources
post-preprocess: called after text preprocessing of sources
pre-compile: called before source compilation
post-compile: called after source compilation
pre-obfuscate: called before obfuscation
post-obfuscate: called after obfuscation
pre-preverify: called before preverification
post-preverify: called after preverification
pre-jar: called before jar building
post-jar: called after jar building
pre-clean: called before cleaning build products
post-clean: called after cleaning build products
Example of pluging a my-special-task after the compilation could look like
<target name="post-compile">
<my-special-task>
<fileset dir="${build.classes.dir}"/>
</my-special-task>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Other way how to customize the build is by overriding existing main targets.
The target of interest are:
preprocess: preprocessing
extract-libs: extraction of libraries and resources
compile: compilation
create-jad: construction of jad and jar manifest source
obfuscate: obfuscation
preverify: preverification
jar: jar archive building
run: execution
debug: execution in debug mode
javadoc: javadoc generation
Example of overriding the target for project execution could look like
<target name="run" depends="init,jar">
<my-special-exec jadfile="${dist.dir}/${dist.jad}"/>
</target>
Be careful about correct dependencies when overriding original target.
Again, for list of available properties which you can use check the target
you are overriding in nbproject/build-impl.xml file.
A special target for-all-configs can be used to run some specific targets for
all project configurations in a sequence. File nbproject/build-impl.xml
already contains some "for-all" targets:
jar-all
javadoc-all
clean-all
Example of definition of target iterating over all project configurations:
<target name="jar-all">
<property name="target.to.call" value="jar"/>
<antcall target="for-all-configs"/>
</target>
-->
</project>