forked from jarofdoom/LogisticsPipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
346 lines (266 loc) · 12 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
<project name="LogisticsPipes" basedir="../" default="main">
<property environment="env"/>
<!-- Properties -->
<property name="build.dir" value="build"/>
<property name="src.dir" value="src"/>
<property name="sign.dir" value="/home/jenkins/.sign"/>
<property name="download.dir" value="download"/>
<property name="files.minecraft.dir" value="jars"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/dist"/>
<property name="lib.dir" value="${build.dir}/lib"/>
<property name="mcp.dir" value="${build.dir}/mcp"/>
<property name="forge.dir" value="${mcp.dir}/forge"/>
<property name="buildcraft.dir" value="${mcp.dir}/unpack/buildcraft"/>
<property name="forestry.dir" value="${mcp.dir}/unpack/forestry"/>
<property name="ic2.dir" value="${mcp.dir}/unpack/ic2"/>
<property name="cc.dir" value="${mcp.dir}/unpack/cc"/>
<property name="thaumcraft.dir" value="${mcp.dir}/unpack/thaumcraft"/>
<property name="te.dir" value="${mcp.dir}/unpack/te"/>
<property name="clientsrc.dir" value="${mcp.dir}/src/minecraft"/>
<property name="commonsrc.dir" value="${clientsrc.dir}"/>
<property file="${clientsrc.dir}/fmlversion.properties" />
<property name="downloadserver" value="http://www.theZorro266.com"/>
<property name="downloadserver.dir" value="rs485/"/>
<property name="downloadserver.full" value="${downloadserver}/${downloadserver.dir}"/>
<property name="antcont.version" value="1.0b3"/>
<property name="mcp.version" value="751"/>
<property name="mc.version" value="1.5.2"/>
<property name="forge.version" value="7.8.0.685"/>
<property name="bc.version" value="3.5.3"/>
<property name="forestry.version" value="2.2.4.3"/>
<property name="ic2.version" value="1.115.304-lf"/>
<property name="cc.version" value="1.52"/>
<property name="thaumcraft.version.api" value="0.0.5"/>
<property name="thaumcraft.version.mod" value="3.0.4b"/>
<property name="te.version" value="2.3.0"/>
<property name="lp.version" value="0.7.3"/>
<!-- Targets -->
<target name="init-msg">
<echo message="Starting build for ${lp.version.full} for MC ${mc.version} for BC ${bc.version}"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="setup">
<mkdir dir="${download.dir}"/>
<get src="${downloadserver.full}mcp${mcp.version}.zip" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}minecraftforge-src-${mc.version}-${forge.version}.zip" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}buildcraft-src-${bc.version}.zip" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}forestry-api-${forestry.version}.zip" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}industrialcraft-2-api_${ic2.version}.zip" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}ComputerCraftAPI${cc.version}.zip" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}ThaumcraftApi-${thaumcraft.version.api}-for-${thaumcraft.version.mod}.zip" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}ThermalExpansion-API-${te.version}.zip" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}ant-contrib-${antcont.version}-bin.zip" dest="${download.dir}" usetimestamp="True"/>
<echo message="Download finished"/>
<unzip dest="${lib.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="ant-contrib-${antcont.version}-bin.zip"/>
</fileset>
</unzip>
<!-- Pull in ant-contrib for if task -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${lib.dir}/ant-contrib/ant-contrib-${antcont.version}.jar"/>
</classpath>
</taskdef>
<unzip dest="${mcp.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="mcp${mcp.version}.zip"/>
</fileset>
</unzip>
<unzip dest="${mcp.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="minecraftforge-src-${mc.version}-${forge.version}.zip"/>
</fileset>
</unzip>
<unzip dest="${buildcraft.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="buildcraft-src-${bc.version}.zip"/>
</fileset>
</unzip>
<unzip dest="${forestry.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="forestry-api-${forestry.version}.zip"/>
</fileset>
</unzip>
<unzip dest="${ic2.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="industrialcraft-2-api_${ic2.version}.zip"/>
</fileset>
</unzip>
<unzip dest="${cc.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="ComputerCraftAPI${cc.version}.zip"/>
</fileset>
</unzip>
<unzip dest="${thaumcraft.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="ThaumcraftApi-${thaumcraft.version.api}-for-${thaumcraft.version.mod}.zip"/>
</fileset>
</unzip>
<unzip dest="${te.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="ThermalExpansion-API-${te.version}.zip"/>
</fileset>
</unzip>
<echo message="Unpacking finished"/>
<chmod file="${mcp.dir}/updatemd5.sh" perm="+x"/>
<chmod file="${mcp.dir}/updatemcp.sh" perm="+x"/>
<chmod file="${mcp.dir}/recompile.sh" perm="+x"/>
<chmod file="${mcp.dir}/reobfuscate_srg.sh" perm="+x"/>
<chmod file="${forge.dir}/install.sh" perm="+x"/>
<!-- if your building on OSX these 2 should be executable -->
<chmod file="${mcp.dir}/runtime/bin/astyle-osx" perm="+x"/>
<chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x"/>
<!-- Install forge -->
<exec dir="${forge.dir}" executable="cmd" osfamily="windows" failonerror="true">
<arg line="/c install.cmd"/>
</exec>
<exec dir="${forge.dir}" executable="sh" osfamily="unix" failonerror="true">
<arg value="install.sh"/>
</exec>
<echo message="Decompile finished"/>
<!-- Copy BC source -->
<copy todir="${commonsrc.dir}">
<fileset dir="${buildcraft.dir}/common">
<exclude name="**/buildcraft/devel"/>
</fileset>
</copy>
<copy todir="${commonsrc.dir}">
<fileset dir="${buildcraft.dir}/buildcraft_resources">
</fileset>
</copy>
<echo message="Copied BC files"/>
<!-- Copy Forestry API source -->
<copy todir="${commonsrc.dir}">
<fileset dir="${forestry.dir}"/>
</copy>
<echo message="Copied Forestry API"/>
<!-- Copy IC2 API source -->
<copy todir="${commonsrc.dir}">
<fileset dir="${ic2.dir}"/>
</copy>
<echo message="Copied IC2 API"/>
<!-- Copy CC API source -->
<copy todir="${commonsrc.dir}">
<fileset dir="${cc.dir}"/>
</copy>
<echo message="Copied CC API"/>
<!-- Copy ThaumCraft API source -->
<copy todir="${commonsrc.dir}">
<fileset dir="${thaumcraft.dir}"/>
</copy>
<echo message="Copied ThaumCraft API"/>
<!-- Copy TE API source -->
<copy todir="${commonsrc.dir}">
<fileset dir="${te.dir}"/>
</copy>
<echo message="Copied TE API"/>
<!-- Copy Dummy classes source -->
<copy todir="${commonsrc.dir}">
<fileset dir="${src.dir}/dummy"/>
</copy>
<echo message="Copied dummy files"/>
<!-- Refresh MD5 -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
<arg line="/c updatemd5.bat -f --client"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix" failonerror="true">
<arg line="updatemd5.sh -f --client"/>
</exec>
<echo message="Regenerated MD5s"/>
</target>
<target name="copySRC" >
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${lib.dir}/ant-contrib/ant-contrib-${antcont.version}.jar"/>
</classpath>
</taskdef>
<echo message="Loaded ant-contrib"/>
<!-- Delete LP source in build space -->
<delete dir="${commonsrc.dir}/logisticspipes"/>
<!-- Copy LP source -->
<copy todir="${commonsrc.dir}">
<fileset dir="${src.dir}/common"/>
</copy>
<replace file="${commonsrc.dir}/logisticspipes/LogisticsPipes.java" token="%VERSION%" value="${lp.version.full}"/>
<replace file="${commonsrc.dir}/logisticspipes/LogisticsPipes.java" token="%MCVERSION%" value="${mc.version}"/>
<replace file="${commonsrc.dir}/logisticspipes/LogisticsPipes.java" token="%DEBUG%" value="${DEBUG}"/>
<echo message="Loading FingerPrint"/>
<if>
<available file="${sign.dir}/.fingerprint"/>
<then>
<loadfile property="fingerprint" srcFile="${sign.dir}/.fingerprint"/>
<replace file="${commonsrc.dir}/logisticspipes/LogisticsPipes.java" token="%------------CERTIFICATE-SUM-----------%" value='*/ certificateFingerprint="${fingerprint}", /*'/>
</then>
</if>
</target>
<target name="compile" depends="copySRC">
<echo message="Compiling version ${lp.version.full}"/>
<!-- Recompile -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
<arg line="/c recompile.bat --client"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix" failonerror="true">
<arg value="recompile.sh"/>
</exec>
<!-- Reobf -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
<arg line="/c reobfuscate_srg.bat --client"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix" failonerror="true">
<arg value="reobfuscate_srg.sh"/>
</exec>
<!-- Copy LP classes -->
<copy todir="${classes.dir}/client">
<fileset dir="${mcp.dir}/reobf/minecraft"/>
</copy>
<!-- Copy resoucres -->
<copy todir="${classes.dir}/client">
<fileset dir="${src.dir}/resources"></fileset>
</copy>
<replace file="${classes.dir}/client/mcmod.info" token="%VERSION%" value="${lp.version.full}"/>
<echo message="Compiling finished"/>
<!-- Create resources zip for MC in mcp -->
<zip destfile="${mcp.dir}/jars/mods/LogisticsPipes_resources.zip" basedir="${src.dir}/resources" excludes="mcmod.info"/>
</target>
<target name="package-simple" depends="compile">
<echo message="Packing version ${lp.version.full}"/>
<jar destfile="${jar.dir}/LogisticsPipes-MC${mc.version}-${lp.version.full}.jar" basedir="${classes.dir}/client"/>
<echo message="Packing finished"/>
</target>
<target name="package-sign" depends="compile">
<echo message="Loading SignSettings"/>
<loadfile property="key" srcFile="${sign.dir}/.key"/>
<echo message="Packing version ${lp.version.full}"/>
<jar destfile="${jar.dir}/LogisticsPipes-MC${mc.version}-${lp.version.full}.jar" basedir="${classes.dir}/client">
<manifest>
<attribute name="Built-By" value="RS485-Jenkins"/>
<attribute name="Implementation-Vendor" value="RS485"/>
<attribute name="Implementation-Title" value="LogisticsPipes"/>
<attribute name="Implementation-Version" value="${lp.version.full}"/>
</manifest>
</jar>
<signjar jar="${jar.dir}/LogisticsPipes-MC${mc.version}-${lp.version.full}.jar" alias="RS485" keystore="${sign.dir}/.keystore" storepass="${key}"/>
<echo message="Packing finished"/>
</target>
<target name="vars">
<property name="lp.version.full" value="${lp.version}.${BUILD_NUMBER}"/>
</target>
<target name="vars-dev">
<property name="lp.version.full" value="${lp.version}.dev.${BUILD_NUMBER}"/>
</target>
<target name="vars-test">
<property name="lp.version.full" value="0.0.0.0"/>
<property name="DEBUG" value="true"/>
</target>
<target name="dev">
<property name="src.dir" value="src_dev"/>
</target>
<target name="main" depends="vars, init-msg, clean, setup, package-simple"/>
<target name="ci-dev" depends="vars-dev, init-msg, clean, setup, package-sign"/>
<target name="ci" depends="vars, init-msg, clean, setup, package-sign"/>
<target name="test" depends="vars-test, init-msg, clean, setup, compile"/>
</project>