forked from MinecraftForge/FML
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
473 lines (438 loc) · 21.2 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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
30 Mar 2012 13:35:40
FML
The Forge Mod Loader
cpw
====================================================================== -->
<project name="FML" default="jenkinsbuild">
<description>The Forge Mod Loader</description>
<target name="writeversion" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${basedir}" failonerror="true">
<arg value="${basedir}/getversion.py" />
<arg value="${mcp.home}" />
</exec>
<propertyfile file="fmlversion.properties">
<entry key="fmlbuild.build.number" type="int" value="${version.build}" />
<entry key="fmlbuild.deobfuscation.hash" type="string" value="${deobf.checksum}" />
</propertyfile>
</target>
<target name="buildenvsetup">
<tstamp>
<format pattern="yyMMddHHmmss" property="timestamp" />
</tstamp>
<property environment="env" />
<property name="modname" value="fml" />
<condition property="mcp.home" value="${env.WORKSPACE}/mcp" else="${basedir}/mcp">
<isset property="env.WORKSPACE" />
</condition>
<property name="fml.python.dir" location="${basedir}/python" />
<property name="fml.lzma.dir" location="${basedir}/lzmabin" />
<condition property="python.exe" value="${fml.python.dir}/python_fml" else="python">
<os family="Windows" />
</condition>
<condition property="lzma.exe" value="${fml.lzma.dir}/xz.exe" else="xz">
<os family="Windows" />
</condition>
<condition property="mcp.exists">
<available file="${mcp.home}/runtime/commands.py" />
</condition>
<condition property="signature.exists">
<available file="${env.JENKINS_HOME}/fmlsigned.properties" />
</condition>
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
<property name="mcp.srcdir" location="${mcp.home}/src" />
<property name="client.mcp.srcdir" location="${mcp.srcdir}/minecraft" />
<property name="clean.mcp.srcdir" location="${mcp.home}/src-base" />
<property name="patch.mcp.srcdir" location="${mcp.home}/src-work" />
<property name="tmp.mcp.srcdir" location="${mcp.home}/src-tmp" />
<property name="renamed.mcp.srcdir" location="${mcp.home}/src-renamed" />
<property name="common.src.dir" location="${basedir}/common" />
<property name="client.src.dir" location="${basedir}/client" />
<property name="patch.src.dir" location="${basedir}/patches" />
<property name="fml.conf.dir" location="${basedir}/conf" />
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
<isset property="env.BUILD_NUMBER" />
</condition>
<available file="eclipse" property="eclipse.exists" />
</target>
<target name="makeversion" depends="buildenvsetup">
<antcall target="writeversion" />
<property file="fmlversion.properties" />
<property name="build.number" value="${fmlbuild.major.number}.${fmlbuild.minor.number}.${fmlbuild.revision.number}" />
<property name="version.major" value="${fmlbuild.major.number}" />
<property name="version.minor" value="${fmlbuild.minor.number}" />
<property name="version.rev" value="${fmlbuild.revision.number}" />
<property name="version.minecraft" value="${fmlbuild.mcversion}" />
<property name="version.branch" value="${fmlbuild.branch}" />
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
</target>
<target name="makeclean" depends="buildenvsetup" if="mcp.exists">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/cleanup.py" />
<arg value="-f" />
</exec>
</target>
<target name="clean" depends="buildenvsetup,makeclean" if="mcp.exists">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${basedir}/decompile.py" />
<arg value="--mcp-dir" />
<arg value="${mcp.home}" />
<arg value="--fml-dir" />
<arg value="${basedir}" />
<arg value="--gen-conf" />
</exec>
</target>
<target name="reobfuscate" depends="buildenvsetup,recompile">
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
<arg value="${mcp.home}/runtime/reobfuscate.py" />
</exec>
<fail message="Reobfuscation failed">
<condition>
<not>
<and>
<available file="${mcp.home}/temp/client.md5" />
<available file="${mcp.home}/temp/client_reobf.md5" />
</and>
</not>
</condition>
</fail>
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${basedir}/generatechangedfilelist.py" />
<arg value="${mcp.home}" />
<arg value="${basedir}/difflist.txt" />
</exec>
</target>
<target name="recompile" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
<arg value="${mcp.home}/runtime/recompile.py" />
</exec>
<fail message="Compilation failed">
<condition>
<not>
<available file="${mcp.home}/bin/minecraft/net/minecraft/client/Minecraft.class" />
</not>
</condition>
</fail>
</target>
<target name="merge-client" depends="buildenvsetup">
<copy todir="${client.mcp.srcdir}" overwrite="true" verbose="true">
<fileset dir="${client.src.dir}" includes="**/*.java" />
</copy>
</target>
<target name="merge-common" depends="buildenvsetup,build-deobf-data">
<copy todir="${client.mcp.srcdir}" overwrite="true" verbose="true">
<fileset dir="${common.src.dir}" includes="**/*.java" />
<fileset dir="${basedir}" includes="deobfuscation_data-${version.minecraft}.lzma"/>
</copy>
</target>
<target name="merge-source" depends="buildenvsetup,merge-client,merge-common" />
<target name="build-universal" depends="buildenvsetup,merge-client,merge-common,reobfuscate,makeversion,makebinpatches">
<condition property="universal.jarname" value="${modname}-universal-${version.minecraft}-${version}" else="${modname}-universal-${version.minecraft}-${version}-${version.branch}">
<equals arg1="${version.branch}" arg2="master" />
</condition>
<mkdir dir="${basedir}/target" />
<path id="server.classpath">
<pathelement path="${mcp.home}/jars/libraries/net/minecraft/launchwrapper/1.3/launchwrapper-1.3.jar"/>
<pathelement path="${mcp.home}/jars/libraries/org/ow2/asm/asm-all/4.1/asm-all-4.1.jar"/>
<pathelement path="${mcp.home}/jars/libraries/lzma/lzma/0.0.1/lzma-0.0.1.jar"/>
<pathelement path="${mcp.home}/jars/libraries/net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar"/>
<pathelement path="${mcp.home}/jars/libraries/org/scala-lang/scala-library/2.10.2/scala-library-2.10.2.jar"/>
<pathelement path="${mcp.home}/jars/libraries/org/scala-lang/scala-compiler/2.10.2/scala-compiler-2.10.2.jar"/>
<pathelement path="${mcp.home}/jars/minecraft_server.${version.minecraft}.jar"/>
</path>
<manifestclasspath property="server.jar.classpath" jarfile="${mcp.home}/jars/minecraft_server.jar">
<classpath refid="server.classpath" />
</manifestclasspath>
<jar destfile="${basedir}/target/${universal.jarname}.jar" duplicate="preserve">
<manifest>
<attribute name="Main-Class" value="cpw.mods.fml.relauncher.ServerLaunchWrapper" />
<attribute name="Class-Path" value="${server.jar.classpath}" />
</manifest>
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" excludes="*.class,net/minecraft/**/*.class" />
</jar>
<antcall target="signjar" />
<zip update="true" destfile="${basedir}/target/${universal.jarname}.jar">
<fileset dir="${basedir}" includes="binpatches.pack.lzma,deobfuscation_data-${version.minecraft}.lzma"/>
<fileset dir="${client.mcp.obfoutput}" includes="*.class" />
<zipfileset dir="${basedir}" includes="fmlversion.properties" />
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" />
<zipfileset dir="${client.src.dir}" includes="mcplogo.png" />
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt" />
<zipfileset dir="${common.src.dir}" includes="*.cfg" />
<mappedresources>
<concat>
<fileset dir="${basedir}/install" includes="README.txt" />
<filterchain>
<replacetokens>
<token key="MAJOR" value="${version.major}" />
<token key="MINOR" value="${version.minor}" />
<token key="REV" value="${version.rev}" />
<token key="BUILD" value="${version.build}" />
<token key="MCVERSION" value="${version.minecraft}" />
</replacetokens>
</filterchain>
</concat>
<mergemapper to="README-fml.txt" />
</mappedresources>
</zip>
</target>
<target name="build-installer" depends="build-universal">
<condition property="version.fullname" value="${version.minecraft}-${version}" else="${version.minecraft}-${version}-${version.branch}">
<equals arg1="${version.branch}" arg2="master" />
</condition>
<tstamp>
<format property="current.time" pattern="yyyy-MM-dd'T'HH:mm:ssZ" />
</tstamp>
<delete file="${basedir}/installer_base.jar" />
<delete file="${basedir}/install_profile.json" />
<get src="http://files.minecraftforge.net/installer/forge-installer-1.3-shrunk.jar" dest="${basedir}/installer_base.jar" />
<copy file="${basedir}/jsons/${version.minecraft}-rel.json" tofile="${basedir}/install_profile.json" />
<copy file="${basedir}/installer_base.jar" tofile="${basedir}/target/${modname}-installer-${version.fullname}.jar" />
<replace file="${basedir}/install_profile.json">
<replaceFilter token="@version@" value="${version}" />
<replaceFilter token="@minecraft_version@" value="${version.minecraft}" />
<replaceFilter token="@timestamp@" value="${current.time}" />
<replaceFilter token="@universal_jar@" value="${modname}-universal-${version.fullname}.jar" />
</replace>
<jar destfile="${basedir}/target/${modname}-installer-${version.fullname}.jar" update="true">
<zipfileset dir="${basedir}" includes="install_profile.json" />
<zipfileset dir="${basedir}/jsons" includes="big_logo.png" />
<zipfileset dir="${basedir}/target" includes="${modname}-universal-${version.fullname}.jar" />
</jar>
<delete file="${basedir}/install_profile.json" />
</target>
<target name="build-source-pack" depends="makeversion">
<property name="srcpack.jarname" value="${modname}-src-${version.minecraft}-${version}-${version.branch}" />
<zip destfile="${basedir}/target/${srcpack.jarname}.zip">
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt,difflist.txt,commands.patch,mcp_merge.cfg,mc_versions.cfg" prefix="fml" />
<zipfileset dir="${basedir}/jsons" includes="${version.minecraft}-dev.json" fullpath="fml/fml.json"/>
<zipfileset dir="${basedir}" includes="deobfuscation_data-${version.minecraft}.lzma" prefix="fml/common" />
<zipfileset dir="${common.src.dir}" includes="**/*.java" prefix="fml/common" />
<zipfileset dir="${client.src.dir}" includes="**/*.java" prefix="fml/client" />
<zipfileset dir="${client.src.dir}" includes="mcp.png" prefix="fml/client" />
<zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml/common" />
<zipfileset dir="${common.src.dir}" includes="*.cfg" prefix="fml/common" />
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" prefix="fml/common" />
<zipfileset dir="${patch.src.dir}" includes="**/*.patch" prefix="fml/patches" />
<zipfileset dir="${fml.conf.dir}" prefix="fml/conf" />
<zipfileset dir="${fml.python.dir}" prefix="fml/python" />
<mappedresources>
<concat>
<fileset dir="${basedir}/install" includes="README.txt" />
<filterchain>
<replacetokens>
<token key="MAJOR" value="${version.major}" />
<token key="MINOR" value="${version.minor}" />
<token key="REV" value="${version.rev}" />
<token key="BUILD" value="${version.build}" />
<token key="MCVERSION" value="${version.minecraft}" />
</replacetokens>
</filterchain>
</concat>
<mergemapper to="fml/README-fml.txt" />
</mappedresources>
<zipfileset dir="${basedir}/install" excludes="README.txt,fml.pyc" prefix="fml" />
</zip>
</target>
<target name="build-deobf-data" depends="makeversion">
<mkdir dir="build-tmp-deobf" />
<copy todir="build-tmp-deobf">
<mappedresources>
<fileset dir="${mcp.home}/conf" includes="packaged.srg" />
<globmapper from="packaged.srg" to="deobfuscation_data-${version.minecraft}" />
</mappedresources>
</copy>
<exec executable="${lzma.exe}">
<arg line="--format=lzma"/>
<arg line="build-tmp-deobf/deobfuscation_data-${version.minecraft}"/>
<arg line="-v"/>
</exec>
<copy todir="${basedir}">
<fileset dir="build-tmp-deobf" includes="*.lzma" />
</copy>
<antcall target="writeversion" />
<delete dir="build-tmp-deobf" />
</target>
<target name="build" depends="buildenvsetup,build-deobf-data,merge-client,merge-common,build-universal,build-installer,build-source-pack" />
<target name="jenkinsbuild" depends="buildenvsetup,jenkinsfmldecompile,patch,build" />
<target name="patch" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/applypatches.py" />
<arg value="${basedir}" />
<arg value="${mcp.srcdir}" />
<arg value="${mcp.home}" />
</exec>
</target>
<target name="setupenvironment" depends="buildenvsetup">
<input message="This will clean the mcp environment at ${mcp.home} and backup any src-work folder there (src-base will be erased). Continue?" validargs="y,n" addproperty="do.continue" />
<condition property="do.not.continue">
<equals arg1="n" arg2="${do.continue}" />
</condition>
<fail if="do.not.continue">You have decided not to continue. This script will stop now.</fail>
<echo>Preparing the MCP environment at ${mcp.home}</echo>
<antcall target="fmldecompile" />
<echo>Moving old patched sources at ${patch.mcp.srcdir} out of the way</echo>
<move todir="${mcp.home}/src-work${timestamp}" failonerror="false" verbose="true">
<fileset dir="${patch.mcp.srcdir}" />
</move>
<echo>Deleting old patch references at ${clean.mcp.srcdir}</echo>
<delete dir="${clean.mcp.srcdir}" failonerror="false" />
<echo>Creating new patch references at ${clean.mcp.srcdir}</echo>
<copy todir="${clean.mcp.srcdir}">
<fileset dir="${mcp.srcdir}" />
</copy>
<antcall target="cleanargo" />
<antcall target="patch" />
<echo>Creating clean patched references at ${patch.mcp.srcdir}</echo>
<copy todir="${patch.mcp.srcdir}">
<fileset dir="${mcp.srcdir}" />
</copy>
<antcall target="writeversion" />
<delete>
<fileset dir="${basedir}" includes="deobfuscation_data-*.lzma" />
</delete>
<antcall target="build-deobf-data" />
<copy todir="${common.src.dir}">
<fileset dir="${basedir}" includes="deobfuscation_data-*.lzma" />
</copy>
<antcall target="makeeclipse" />
<echo>Setup complete! You should now be able to open ${basedir}/eclipse as a workspace in eclipse and import/refresh the FML project</echo>
</target>
<target name="fmldecompile" depends="buildenvsetup,makeclean">
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/decompile.py" />
<arg value="--mcp-dir" />
<arg value="${mcp.home}" />
<arg value="--fml-dir" />
<arg value="${basedir}" />
<arg value="--gen-conf" />
</exec>
</target>
<target name="jenkinsfmldecompile" depends="buildenvsetup,makeclean">
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/decompile.py" />
<arg value="--mcp-dir" />
<arg value="${mcp.home}" />
<arg value="--fml-dir" />
<arg value="${basedir}" />
</exec>
</target>
<target name="repatch" depends="buildenvsetup,checkpatches">
<echo>Moving old patched sources at ${mcp.home}/src-work out of the way</echo>
<move todir="${mcp.home}/src-work${timestamp}" failonerror="false" verbose="true">
<fileset dir="${patch.mcp.srcdir}" />
</move>
<delete dir="${mcp.srcdir}" />
<copy todir="${mcp.srcdir}">
<fileset dir="${clean.mcp.srcdir}" />
</copy>
<antcall target="cleanargo" />
<antcall target="patch" />
<copy todir="${patch.mcp.srcdir}">
<fileset dir="${mcp.srcdir}" />
</copy>
</target>
<target name="repatchclean" depends="buildenvsetup">
<delete dir="${mcp.srcdir}" />
<copy todir="${mcp.srcdir}">
<fileset dir="${clean.mcp.srcdir}" />
</copy>
<antcall target="cleanargo" />
<antcall target="patch" />
</target>
<target name="cleanargo" depends="buildenvsetup">
<delete dir="${client.mcp.srcdir}/argo" />
<delete dir="${client.mcp.srcdir}/org" />
</target>
<target name="checkpatches" depends="buildenvsetup">
<uptodate property="checkUptodate.uptodate">
<srcfiles dir="${patch.mcp.srcdir}" includes="**/*.java">
<present targetdir="${patch.src.dir}">
<globmapper from="*.java" to="*.java.patch" />
</present>
</srcfiles>
<globmapper from="*.java" to="${patch.src.dir}/*.java.patch" />
</uptodate>
<fail unless="checkUptodate.uptodate">
A patch is out of date. Update your patches!
</fail>
</target>
<target name="updatepatches" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/update_patches.py" />
<arg value="${mcp.home}" />
<arg value="${basedir}" />
</exec>
</target>
<target name="makeeclipse" depends="buildenvsetup" unless="eclipse.exists">
<echo>
Extracting fresh eclipse workspace to ${basedir}/eclipse
</echo>
<unzip src="${basedir}/eclipse-workspace-dev.zip" dest="${basedir}" />
</target>
<target name="makerenamedsource" depends="buildenvsetup,repatch,merge-client,merge-common,reobfuscate">
<copy todir="${tmp.mcp.srcdir}">
<fileset dir="${mcp.srcdir}" />
</copy>
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/updatenames.py" />
<arg value="-f" />
</exec>
<copy todir="${renamed.mcp.srcdir}">
<fileset dir="${mcp.srcdir}" />
</copy>
<move todir="${mcp.srcdir}">
<fileset dir="${tmp.mcp.srcdir}" />
</move>
</target>
<target name="signjar" depends="buildenvsetup,makeversion" if="signature.exists">
<condition property="universal.jarname" value="${modname}-universal-${version.minecraft}-${version}" else="${modname}-universal-${version.minecraft}-${version}-${version.branch}">
<equals arg1="${version.branch}" arg2="master" />
</condition>
<property file="${env.JENKINS_HOME}/fmlsigned.properties" prefix="sign" />
<echo>${env.JENKINS_HOME} ${universal.jarname} ${sign.KEYPASS}</echo>
<signjar alias="FML" jar="${basedir}/target/${universal.jarname}.zip" keypass="${sign.KEYPASS}" keystore="${env.JENKINS_HOME}/${sign.KEYSTORE}" storepass="${sign.STOREPASS}" verbose="true" />
</target>
<target name="makebinpatches" depends="buildenvsetup,makeversion">
<path id="diffset.libs">
<pathelement path="${mcp.home}/jars/libraries/com/google/guava/guava/14.0/guava-14.0.jar"/>
<pathelement path="${mcp.home}/jars/libraries/org/ow2/asm/asm-debug-all/4.1/asm-debug-all-4.1.jar"/>
<pathelement path="${mcp.home}/jars/libraries/lzma/lzma/0.0.1/lzma-0.0.1.jar"/>
<pathelement path="${mcp.obfoutput}/minecraft"/>
</path>
<delete dir="${basedir}/binpatch" verbose="true"/>
<java classname="cpw.mods.fml.common.patcher.GenDiffSet" classpathref="diffset.libs">
<arg path="${mcp.home}/jars/versions/${version.minecraft}/${version.minecraft}.jar.backup"/>
<arg path="${mcp.obfoutput}/minecraft"/>
<arg path="${basedir}/deobfuscation_data-${version.minecraft}.lzma"/>
<arg path="${basedir}/binpatch/client"/>
<arg value="false"/>
</java>
<java classname="cpw.mods.fml.common.patcher.GenDiffSet" classpathref="diffset.libs">
<arg path="${mcp.home}/jars/minecraft_server.${version.minecraft}.jar.backup"/>
<arg path="${mcp.obfoutput}/minecraft"/>
<arg path="${basedir}/deobfuscation_data-${version.minecraft}.lzma"/>
<arg path="${basedir}/binpatch/server"/>
<arg value="true"/>
</java>
<mkdir dir="binpatch-tmp"/>
<zip destfile="binpatch-tmp/binpatches.jar" basedir="${basedir}">
<include name="binpatch/**/*.binpatch"/>
</zip>
<apply executable="pack200">
<arg line="--no-gzip"/>
<arg line="binpatch-tmp/binpatches.pack"/>
<fileset dir="binpatch-tmp" includes="binpatches.jar"/>
</apply>
<apply executable="${lzma.exe}">
<arg line="--format=lzma"/>
<arg line="-v"/>
<fileset dir="binpatch-tmp" includes="binpatches.pack"/>
</apply>
<move file="binpatch-tmp/binpatches.pack.lzma" todir="${basedir}"/>
<delete dir="binpatch-tmp" failonerror="false"/>
</target>
</project>