build_liteloader.xml
14.4 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
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
<?xml version="1.0" encoding="UTF-8" ?>
<project name="liteloader" basedir="." default="development">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="tasks/ant-contrib.jar" />
<!-- Versions !!IMPORTANT -->
<property name="version" value="1.8.0_00" />
<property name="mcversion" value="1.8" />
<property name="author" value="Mumfrey" />
<!-- Project definitions and dependencies -->
<property name="upstream" value="" />
<property name="project" value="LiteLoader" />
<property name="md5set" value="mcp" />
<property name="outmd5set" value="liteloader" />
<property name="tweakclass" value="com.mumfrey.liteloader.launch.LiteLoaderTweaker" />
<property name="mcp.dir" location="../../.." />
<property name="build.dir" location="${mcp.dir}/build" />
<property name="eclipse.dir" location="${mcp.dir}/eclipse" />
<property name="temp.dir" location="${mcp.dir}/temp" />
<property name="md5.dir" location="${mcp.dir}/md5" />
<property name="libs.dir" location="${mcp.dir}/lib" />
<property name="src.dir" location="${build.dir}/src"/>
<property name="mc.src.dir" location="${mcp.dir}/src/minecraft" />
<property name="mc.bin.dir" location="${mcp.dir}/bin/minecraft" />
<property name="mc.libs.dir" location="${mcp.dir}/jars/libraries" />
<property name="dist.dir" location="${build.dir}/dist" />
<property name="filetype" value="jar" />
<property name="python_windows" location="${mcp.dir}/runtime/bin/python/python_mcp.exe" />
<property name="python_linux" location="/usr/bin/python" />
<property environment="env" />
<target name="setup_client">
<property name="clientjar" value="true" />
<property name="suffix" value="" />
<property name="javadocpath" value="docs" />
</target>
<target name="setup_core">
<property name="suffix" value="-core" />
<property name="javadocpath" value="coredocs" />
</target>
<target name="setup_development">
<property name="skipremoval" value="DEV" />
<property name="md5.outfile" value="${md5.dir}/client_${outmd5set}.md5" />
<property name="artefact.name" value="${ant.project.name}${suffix}-${mcversion}" />
<property name="stage.dir" location="${build.dir}/stage/${ant.project.name}/${version}" />
<property name="meta.version" value="${version}" />
</target>
<target name="setup_production">
<property name="skipremoval" value="" />
<property name="md5.outfile" value="${md5.dir}/client_${outmd5set}_production.md5" />
<property name="artefact.name" value="${ant.project.name}${suffix}-${mcversion}" />
<property name="stage.dir" location="${build.dir}/stage/${ant.project.name}/${version}" />
<property name="meta.version" value="${version}" />
</target>
<target name="setup_jenkins">
<property name="skipremoval" value="" />
<property name="md5.outfile" value="${md5.dir}/client_${outmd5set}_production.md5" />
<property name="artefact.name" value="${ant.project.name}${suffix}-${mcversion}-SNAPSHOT" />
<property name="stage.dir" location="${build.dir}/stage" />
<property name="brand" value="${mcversion}-SNAPSHOT-r${env.SVN_REVISION}-b${env.BUILD_NUMBER}-${env.BUILD_ID}" />
<property name="meta.version" value="${version} [${brand}]" />
<property name="jenkins" value="" />
</target>
<!-- Main target -->
<target name="development" depends="setup_client, setup_development, build" description="Entry point for MCP and upstream builds" />
<target name="production" depends="setup_client, setup_production, build, javadoc, mcpjar" description="Entry point for production builds" />
<target name="jenkins" depends="setup_client, setup_jenkins, build, javadoc, mcpjar" description="Entry point for CI builds" />
<target name="core" depends="setup_core, setup_jenkins, build, javadoc, mcpjar" description="Entry point for CI builds" />
<target name="build" description="Perform all tasks for a client build" depends="init, recompile, reobfuscate, savemd5, stage, jar" >
</target>
<target name="clean">
<echo level="info" message="Cleaning output directories" />
<delete dir="${src.dir}" />
<delete dir="${mcp.dir}/reobf" />
</target>
<target name="contributesource" description="Contribute an upstream project source code to the source path">
<echo level="info" message="Contributing project ${lib}" />
<copy todir="${src.dir}" verbose="false" overwrite="true" failonerror="false">
<fileset dir="${eclipse.dir}/${lib}/java${sub}">
<exclude name="**/debug" />
<exclude name="**/debug/*.java" />
</fileset>
<fileset dir="${eclipse.dir}/${lib}/src${sub}" />
<filterchain>
<linecontains negate="true">
<contains value="@MCPONLY${skipremoval}" />
</linecontains>
</filterchain>
</copy>
</target>
<target name="contributeclientsource" description="Contribute client source if building a client jar" if="clientjar">
<antcall target="contributesource">
<param name="lib" value="${project}" />
<param name="sub" value="/client" />
</antcall>
</target>
<target name="contributeresources" description="Contribute resources to the staging path">
<echo level="info" message="Contributing project resources for ${lib}" />
<copy todir="${stage.dir}" verbose="false" failonerror="false">
<fileset dir="${eclipse.dir}/${lib}/resources" excludes=".svn/**">
<exclude name="**/Thumbs.db" />
<exclude name="**/minecraft.key" />
</fileset>
</copy>
</target>
<target name="findmd5dir">
<echo level="info" message="Searching for existing MD5 directory..." />
<condition property="md5dir.exists">
<available file="${md5.dir}" type="dir"/>
</condition>
</target>
<target name="findmd5" depends="findmd5dir">
<echo level="info" message="Searching for existing MD5 sets..." />
<condition property="md5set.exists">
<available file="${md5.dir}/client_${md5set}.md5" type="file"/>
</condition>
</target>
<target name="seedmd5" depends="findmd5" unless="md5set.exists">
<echo level="info" message="MD5 sets not found, seeding..." />
<ant target="genmd5" antfile="seed_md5.xml" inheritall="true" />
</target>
<target name="notifymd5ok" depends="findmd5" if="md5set.exists">
<echo level="info" message="MD5 sets already exist, skipping MD5 set seeding" />
</target>
<target name="preparemd5" description="Copy patched MD5 to the temp directory" depends="seedmd5, notifymd5ok, clean">
<echo level="info" message="Prepare exclusion MD5s, using exclusion set "${md5set}"" />
<copy tofile="${temp.dir}/client.md5" file="${md5.dir}/client_${md5set}.md5" failonerror="true" verbose="true" overwrite="true" />
</target>
<target name="prepare" description="Prepare source for MCP" depends="preparemd5">
<echo level="info" message="Prepare sources for compile" />
<echo level="info" message="Contributing libs" />
<copy todir="${libs.dir}" verbose="true" overwrite="true">
<fileset dir="${eclipse.dir}/LiteLoader/lib">
<exclude name="**/authlib*.jar" />
<exclude name="**/log4j*.jar" />
</fileset>
</copy>
<echo level="info" message="Contributing MC source" />
<copy todir="${src.dir}" verbose="false" overwrite="true">
<fileset dir="${mc.src.dir}" />
</copy>
<echo level="info" message="Contributing upstream projects" />
<foreach list="${upstream}" param="lib" target="contributesource" />
<antcall target="contributesource">
<param name="lib" value="${project}" />
<param name="sub" value="/common" />
</antcall>
<antcall target="contributeclientsource" />
</target>
<target name="init" description="Initialize build environment" depends="prepare">
<echo append="false" file="${temp.dir}/build.cfg" message="[OUTPUT]
SrcClient = build/src" />
<echo level="info" message="Cleaning old stage and dist, MCP reobf directories" />
<delete dir="${stage.dir}" />
<echo level="info" message="Creating stage and dist dirs" />
<mkdir dir="${stage.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${md5.dir}" />
</target>
<target name="recompile" description="MCP recompile">
<echo level="info" message="Compiling projects" />
<exec executable="${python_windows}" dir="${mcp.dir}" osfamily="windows">
<arg value="runtime/recompile.py" />
<arg value="--client" />
<arg value="--config" />
<arg value="${temp.dir}/build.cfg" />
<arg value="%*" />
</exec>
<exec executable="${python_linux}" dir="${mcp.dir}" osfamily="unix">
<arg value="runtime/recompile.py" />
<arg value="--client" />
<arg value="--config" />
<arg value="${temp.dir}/build.cfg" />
<arg value="%*" />
</exec>
</target>
<target name="reobfuscate" description="MCP reobfuscate">
<echo level="info" message="Obfuscating classes" />
<exec executable="${python_windows}" dir="${mcp.dir}" osfamily="windows">
<arg value="runtime/reobfuscate.py" />
<arg value="--client" />
<arg value="%*" />
</exec>
<exec executable="${python_linux}" dir="${mcp.dir}" osfamily="unix">
<arg value="runtime/reobfuscate.py" />
<arg value="--client" />
<arg value="%*" />
</exec>
</target>
<target name="savemd5" description="Put post-obfuscation MD5 to stored md5 set" if="outmd5set">
<echo level="info" message="Storing obfuscated MD5s" />
<copy file="${temp.dir}/client_reobf.md5" tofile="${md5.outfile}" overwrite="true" verbose="true" />
</target>
<target name="stage" description="Stage resources into staging directory">
<echo level="info" message="Staging resources" />
<copy todir="${stage.dir}" overwrite="true">
<fileset dir="${mcp.dir}/reobf/minecraft" excludes=".svn/**, *.txt">
<exclude name="?.class" />
<exclude name="??.class" />
<exclude name="???.class" />
<exclude name="/net/minecraft/**" />
</fileset>
</copy>
<foreach list="${upstream}" param="lib" target="contributeresources" />
<antcall target="contributeresources">
<param name="lib" value="${project}" />
</antcall>
<antcall target="stamp">
</antcall>
</target>
<target name="stamp" description="Stamp build information into staged resources" if="jenkins">
<echo level="info" message="Writing branding information into artefact staging area" />
<echo level="info" message="Brand: ${brand}" />
<replaceregexp file="${stage.dir}/liteloader.properties" byline="true" match="^brand=.*$" replace="brand=${brand}" />
</target>
<target name="jar" description="Build the client jar">
<echo level="info" message="Building final output" />
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/${artefact.name}.${filetype}" duplicate="preserve" index="true" manifestencoding="UTF-8">
<manifest>
<attribute name="Built-By" value="MCP (http://mcp.ocean-labs.de)" />
<attribute name="Implementation-Vendor" value="${author}" />
<attribute name="Implementation-Title" value="${ant.project.name}" />
<attribute name="Implementation-Version" value="${meta.version}" />
<attribute name="TweakClass" value="${tweakclass}" />
<attribute name="TweakName" value="LiteLoader" />
<attribute name="TweakVersion" value="${version}" />
<attribute name="TweakAuthor" value="${author}" />
</manifest>
<fileset dir="${stage.dir}" />
</jar>
</target>
<target name="mcpjar" description="Build the MCP-names jar">
<echo level="info" message="Building mcpnamesjars" />
<mkdir dir="${dist.dir}" />
<delete file="${dist.dir}/${artefact.name}-mcpnames.${filetype}" />
<delete file="${dist.dir}/${artefact.name}-mcpnames-sources.${filetype}" />
<jar destfile="${dist.dir}/${artefact.name}-mcpnames.${filetype}" duplicate="preserve" index="true" manifestencoding="UTF-8">
<manifest>
<attribute name="Built-By" value="MCP (http://mcp.ocean-labs.de)" />
<attribute name="Implementation-Vendor" value="${author}" />
<attribute name="Implementation-Title" value="${ant.project.name}" />
<attribute name="Implementation-Version" value="${meta.version}" />
<attribute name="TweakClass" value="${tweakclass}" />
<attribute name="TweakName" value="LiteLoader" />
<attribute name="TweakVersion" value="${version}" />
<attribute name="TweakAuthor" value="${author}" />
</manifest>
<fileset dir="${mcp.dir}/bin/minecraft">
<include name="com/mumfrey/**" />
<include name="net/eq2online/**" />
</fileset>
</jar>
<jar destfile="${dist.dir}/${artefact.name}-mcpnames-sources.${filetype}" duplicate="preserve" index="false" filesetmanifest="skip">
<fileset dir="${eclipse.dir}/LiteLoader/java/common" />
<fileset dir="${eclipse.dir}/LiteLoader/java/client" />
<fileset dir="${eclipse.dir}/LiteLoader/debug" />
<fileset dir="${eclipse.dir}/LiteLoader/resources" />
</jar>
</target>
<target name="javadoc" description="Create the javadoc jar">
<echo level="info" message="Generating javadoc" />
<javadoc destdir="${stage.dir}/${javadocpath}" useexternalfile="true">
<fileset dir="${eclipse.dir}/${project}/java">
<exclude name="**/debug" />
<exclude name="**/debug/*.java" />
</fileset>
<classpath>
<fileset dir="${mc.libs.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${libs.dir}">
<include name="*.jar" />
</fileset>
<pathelement location="${mc.bin.dir}"/>
</classpath>
<arg value="-XDignore.symbol.file" />
</javadoc>
<jar destfile="${dist.dir}/${artefact.name}-javadoc.${filetype}" duplicate="preserve" index="true" manifestencoding="UTF-8">
<manifest>
<attribute name="Built-By" value="MCP (http://mcp.ocean-labs.de)" />
<attribute name="Implementation-Vendor" value="${author}" />
<attribute name="Implementation-Title" value="${ant.project.name}" />
<attribute name="Implementation-Version" value="${version}" />
</manifest>
<fileset dir="${stage.dir}/${javadocpath}" />
</jar>
</target>
<target name="deploy" depends="production" description="Deploy artifact to local minecraft installation in APPDATA">
<mkdir dir="${env.APPDATA}/.minecraft/libraries/com/mumfrey/liteloader/${mcversion}"/>
<copy todir="${env.APPDATA}/.minecraft/libraries/com/mumfrey/liteloader/${mcversion}" file="${dist.dir}/${artefact.name}.${filetype}" failonerror="false" overwrite="true" />
<copy todir="${eclipse.dir}/LiteLoaderInstaller/src/main/resources" file="${dist.dir}/${artefact.name}.${filetype}" failonerror="false" overwrite="true" />
</target>
</project>