forked from powercrystals/MineFactoryReloaded
-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathbuild.xml
545 lines (470 loc) · 21.7 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
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
<project name="MineFactoryReloaded" default="install" basedir=".">
<property environment="env"/>
<!-- Basic directories -->
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="resources.dir" value="resources"/>
<property name="download.dir" value="${build.dir}/downloads"/>
<!-- Project information -->
<property name="build.name" value="${ant.project.name}"/>
<property name="class.pckg" value="powercrystals/minefactoryreloaded"/>
<!-- Version file -->
<property name="verclass.dir" value="${src.dir}/${class.pckg}" />
<property name="verclass.name" value="MineFactoryReloadedCore.java"/>
<!-- BON version -->
<property name="bon.verison" value="1.6"/>
<!-- Forge version -->
<property name="mc.version" value="1.10.2"/>
<property name="forge.major" value="12"/>
<property name="forge.minor" value="18"/>
<property name="forge.patch" value="3"/>
<property name="forge.build" value="2185"/>
<property name="mcp.mapping" value="20161111"/>
<!-- Packaging -->
<property name="dist.dir" value="${build.dir}/dist"/>
<property name="classes.dir" value="${build.dir}/packaging"/>
<property name="apiclasses.dir" value="${build.dir}/api-packaging"/>
<!-- Forge paths -->
<property name="forge.version" value="${mc.version}-${forge.major}.${forge.minor}.${forge.patch}.${forge.build}"/>
<property name="forge.dir" value="${build.dir}/forge"/>
<property name="mcp.dir" value="${build.dir}/.gradle/caches/minecraft/de/oceanlabs/mcp"/>
<property name="forgebuild.dir" value="${forge.dir}/build"/>
<property name="compile.dir" value="${forgebuild.dir}/tmp/compile"/>
<property name="lib.dir" value="${forgebuild.dir}/libs"/>
<property name="sources.dir" value="${forgebuild.dir}/sources/minecraft"/>
<property name="transformers.dir" value="${forge.dir}/src/main/resources/"/>
<property name="forge.stsh" value="${build.dir}/.gradle/caches/minecraft/net/minecraftforge/forge/${forge.version}"/>
<property name="mcp.stsh" value="${mcp.dir}/mcp_snapshot/${mcp.mapping}"/>
<property name="forge.jar" value="${forge.stsh}/forgeSrc-${forge.version}.jar"/>
<property name="reobf.cmd" value="${download.dir}/bon${bon.verison}.jar"/>
<property name="forge.url" value="http://files.minecraftforge.net/maven/net/minecraftforge/forge/${forge.version}/forge-${forge.version}-mdk.zip"/>
<!-- Classpaths -->
<path id="compiledeps"/>
<path id="mcp.classpath">
<pathelement location="${forge.jar}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
<include name="**/*.jar"/>
</fileset>
<fileset dir="${build.dir}/.gradle/caches">
<include name="modules*/files*/**/*.jar"/>
<exclude name="modules*/files*/commons-codec/commons-codec/1.6/**/*.jar"/>
<exclude name="modules*/files*/commons-io/commons-io/1.4/**/*.jar"/>
<exclude name="modules*/files*/com.google.guava/guava/14*/**/*.jar"/>
<exclude name="modules*/files*/com.google.guava/guava/15*/**/*.jar"/>
<exclude name="modules*/files*/org.ow2.asm/asm-debug-all/4*/**/*.jar"/>
</fileset>
</path>
<path id="gson">
<fileset dir="${build.dir}/.gradle/caches">
<include name="modules*/files*/com.google.code.gson/**/*.jar"/>
</fileset>
</path>
<!-- Task skipping -->
<target name="properties">
<!-- Enforce some paths -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${download.dir}"/>
<!-- Set properties -->
<available property="has.api" file="${src.dir}/${class.pckg}/api"/>
<available property="bon.exists" file="${reobf.cmd}"/>
<available property="forge.exists" file="${download.dir}/forge-${forge.version}-src.zip"/>
<condition property="forge.already.installed">
<available file="${forge.jar}" type="file"/>
</condition>
<available property="maven.exists" file="${download.dir}/maven.jar"/>
</target>
<!-- Dependency downloading -->
<target name="download-core" depends="properties" unless="forge.exists">
<echo message="Downloading CoFHCore... "/>
<get src="https://github.com/CoFH/CoFHCore/archive/master.zip" dest="${download.dir}/CoFHCore.zip"/>
<delete dir="${download.dir}/CoFHCore-master" failonerror="false"/>
<unzip src="${download.dir}/CoFHCore.zip" dest="${download.dir}"/>
</target>
<target name="get-dependencies" depends="setup-forge,get-cf-token">
<dependencies pathId="compiledeps" filesetId="dependency.fileset">
<remoteRepository id="central" url="https://jcenter.bintray.com/"/>
<remoteRepository id="forge" url="http://files.minecraftforge.net/maven"/>
<remoteRepository id="sonatype" url="https://oss.sonatype.org/content/repositories/snapshots/"/>
<remoteRepository id="covers" url="http://maven.covers1624.net/"/>
<remoteRepository id="cc" url="http://chickenbones.net/maven/"/>
<remoteRepository id="prog" url="http://dvs1.progwml6.com/files/maven"/>
<remoteRepository id="ic2" url="http://maven.ic2.player.to/"/>
<!--<remoteRepository id="curseforge" url="https://minecraft.curseforge.com/api/maven/${curse.maven.token}/">
<releases checksumpolicy="ignore"/>
<snapshots checksumpolicy="ignore"/>
</remoteRepository>-->
<dependency groupId="cofh" artifactId="CoFHCore" version="${mc.version}-4.1.6.9" classifier="deobf"/>
<dependency groupId="codechicken" artifactId="CodeChickenLib" version="${mc.version}-2.5.7.241" classifier="deobf"/>
<!--
<dependency groupId="net.sengir.forestry" artifactId="forestry_${mc.version}" version="5.2.17.376" classifier=""/>
<dependency groupId="net.industrial-craft" artifactId="industrialcraft-2" version="2.6.149-ex110" classifier=""/>-->
</dependencies>
<delete dir="${lib.dir}" failonerror="false"/>
<mkdir dir="${lib.dir}"/>
<copy todir="${lib.dir}">
<fileset refid="dependency.fileset"/>
<mapper type="flatten"/>
</copy>
</target>
<macrodef name="move-transformers"><sequential>
<copy file="${download.dir}/CoFHCore-master/src/main/resources/cofh_at.cfg" tofile="${transformers.dir}/CoFH_at.cfg"/>
<copy file="${resources.dir}/META-INF/MFR_at.cfg" tofile="${transformers.dir}/MFR_at.cfg"/>
</sequential></macrodef>
<!-- Building process -->
<target name="install" depends="upload">
<!-- Cleanup -->
<delete dir="${apiclasses.dir}"/>
<delete dir="${classes.dir}"/>
<delete>
<fileset dir="${dist.dir}">
<exclude name="${build.name}${build.full}${build.number}.jar"/>
<exclude name="${build.name}${build.full}${build.number}-dev.jar"/>
<exclude name="${build.name}${build.full}${build.number}-API.zip"/>
</fileset>
</delete>
</target>
<macrodef name="install-lite">
<attribute name="build"/>
<attribute name="classes" default="${compile.dir}"/>
<sequential>
<copy todir="${classes.dir}" preservelastmodified="true">
<fileset dir="@{classes}">
<include name="powercrystals/**/*.class"/>
</fileset>
<fileset dir="${resources.dir}"/>
</copy>
<echo file="${classes.dir}/vers.prop">${build.full}${build.number}</echo>
<jar destfile="${dist.dir}/${build.name}${build.full}@{build}.jar"
compress="true" level="9" basedir="${classes.dir}"
manifest="${classes.dir}/META-INF/MANIFEST.MF"/>
</sequential>
</macrodef>
<target name="build" depends="get-dependencies,get-build-number,copy-sources">
<!-- Recompile -->
<echo message="Compiling..."/>
<mkdir dir="${compile.dir}"/>
<depend srcdir="${sources.dir}" destdir="${compile.dir}"
cache="${forgebuild.dir}/tmp/depcache" closure="true">
<include name="**/*.java"/>
</depend>
<javac srcdir="${sources.dir}" destdir="${compile.dir}" target="1.8" source="1.8"
debug="true" debuglevel="lines,source" includeAntRuntime="false">
<include name="**/*.java"/>
<exclude name="**/modhelpers/forestry/*.java"/>
<exclude name="**/modhelpers/ic2/*.java"/>
<classpath refid="mcp.classpath"/>
<classpath refid="compiledeps"/>
</javac>
<!-- Dev jar -->
<echo message="Building jar..."/>
<local name="build"/><property name="build" value="${build.number}-dev"/>
<install-lite build="${build}"/>
<!-- Reobf -->
<echo message="Reobfuscating..."/>
<java classpath="${reobf.cmd}" classname="immibis.bon.cui.MCPRemap"
fork="true" maxmemory="2048m">
<arg line="-q -m"/>
<arg value="-to SRG"/>
<arg value="-from MCP"/>
<arg value="-mcp ${mcp.stsh}"/>
<arg value="-in ${dist.dir}/${build.name}${build.full}${build}.jar"/>
<arg value="-out ${dist.dir}/${build.name}${build.full}${build.number}.jar"/>
<arg value="-ref ${forge.jar}"/>
<arg value="-jref ${lib.dir}"/>
</java>
</target>
<target name="copy-sources" depends="package-api">
<!-- Copy source -->
<mkdir dir="${sources.dir}"/>
<sync todir="${sources.dir}">
<fileset dir="${src.dir}"/>
</sync>
</target>
<target name="package-api" depends="get-version" if="has.api">
<!-- Copy & package API -->
<copy todir="${apiclasses.dir}/${class.pckg}/api">
<fileset dir="${src.dir}/${class.pckg}/api"/>
</copy>
<zip destfile="${dist.dir}/${build.name}${build.full}${build.number}-API.zip" basedir="${apiclasses.dir}"/>
</target>
<target name="setup-forge" depends="download-forge" unless="forge.already.installed">
<delete dir="${forge.dir}" failonerror="false"/>
<mkdir dir="${forge.dir}"/>
<unzip dest="${forge.dir}">
<fileset dir="${download.dir}">
<include name="forge-${forge.version}-src.zip"/>
</fileset>
</unzip>
<!-- Cleanup -->
<delete>
<fileset dir="${forge.dir}">
<include name="*.txt"/>
<include name="src/**/*.info"/>
</fileset>
</delete>
<delete dir="${forge.dir}/eclipse" failonerror="false"/>
<delete dir="${forge.dir}/src/main/java" failonerror="false"/>
<replaceregexp file="${forge.dir}/build.gradle" match="("snapshot_)\d+(")" replace="\1${mcp.mapping}\2"/>
<!-- Change executables' permissions -->
<chmod file="${forge.dir}/gradlew" perm="+x"/>
<!-- Install forge -->
<exec executable="./gradlew" failonerror="true" dir="${forge.dir}/" vmlauncher="false">
<arg line="-g ../.gradle"/>
<arg line="fixMcSources"/>
<arg line="remapMcSources"/>
</exec>
<mkdir dir="${mcp.stsh}/conf"/>
<copy todir="${mcp.stsh}/conf">
<fileset dir="${mcp.dir}/mcp/${mc.version}">
<include name="joined.*"/>
</fileset>
<fileset dir="${mcp.stsh}">
<include name="*.csv"/>
</fileset>
</copy>
<mkdir dir="${compile.dir}"/>
<mkdir dir="${lib.dir}"/>
<mkdir dir="${forgebuild.dir}/tmp/recompSrc"/>
<unzip dest="${forgebuild.dir}/tmp/recompSrc">
<fileset dir="${forge.stsh}/snapshot/${mcp.mapping}/">
<include name="forgeSrc-${forge.version}-sources.jar"/>
</fileset>
</unzip>
<javac srcdir="${forgebuild.dir}/tmp/recompSrc" destdir="${compile.dir}" target="1.7" source="1.7"
classpathref="mcp.classpath" debug="true" debuglevel="lines,source" includeAntRuntime="false"
fork="true" memoryinitialsize="512m" memorymaximumsize="2048m"/>
<jar destfile="${forge.jar}1" compress="true" level="9" basedir="${compile.dir}"/>
<echo message="Reobfuscating..."/>
<move-transformers/>
<java classpath="${reobf.cmd}" classname="immibis.bon.cui.MCPRemap"
fork="true" maxmemory="2048m">
<arg line="-q -m"/>
<arg value="-to SRG"/>
<arg value="-from MCP"/>
<arg value="-mcp ${mcp.stsh}"/>
<arg value="-in ${forge.jar}1"/>
<arg value="-out ${forge.jar}2"/>
<arg value="-jref ${lib.dir}"/>
</java>
<java classpath="${reobf.cmd}" classname="immibis.bon.cui.MCPRemap"
fork="true" maxmemory="2048m">
<arg line="-q -m"/>
<arg value="-to MCP"/>
<arg value="-from SRG"/>
<arg value="-mcp ${mcp.stsh}"/>
<arg value="-in ${forge.jar}2"/>
<arg value="-out ${forge.jar}"/>
<arg value="-jref ${lib.dir}"/>
<arg value="-at ${transformers.dir}"/>
</java>
<delete file="${forge.jar}1" failonerror="false"/>
<delete file="${forge.jar}2" failonerror="false"/>
<copy file="${forge.jar}" todir="${forgebuild.dir}/dirtyArtifacts/"/>
<delete dir="${compile.dir}"/>
</target>
<target name="download-forge" depends="setup-maven,setup-bon,download-core" unless="forge.exists">
<echo message="Downloading forge... "/>
<get src="${forge.url}" dest="${download.dir}/forge-${forge.version}-src.zip"/>
</target>
<target name="setup-maven" depends="download-maven">
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" classpath="${download.dir}/maven.jar" />
</target>
<target name="download-maven" depends="properties" unless="maven.exists">
<echo message="Downloading Maven Ant Tasks..."/>
<get src="http://central.maven.org/maven2/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar" dest="${download.dir}/maven.jar"/>
</target>
<target name="setup-bon" depends="properties" unless="bon.exists">
<echo message="Downloading BON..."/>
<get src="https://github.com/skyboy/bearded-octo-nemesis/releases/download/${bon.verison}/BON.jar" dest="${reobf.cmd}"/>
</target>
<target name="get-cf-token" depends="cf-token-there" unless="curse.maven.token">
<echo message="!!! No CurseForge Maven token !!!"/>
<property name="curse.maven.token" value=""/>
</target>
<target name="cf-token-there" if="env.CF_MAVEN_TOKEN" unless="curse.maven.token">
<property name="curse.maven.token" value="${env.CF_MAVEN_TOKEN}"/>
</target>
<target name="upload" depends="build" if="CF_API_TOKEN">
<echo message="Uploading to CurseForge..."/><local name="fileout"/>
<script language="javascript" classpathref="gson"><![CDATA[
var token = project.getProperty("CF_API_TOKEN");
var modid = project.getProperty("CF_MOD_ID");
var gameVersion = null;
var parser = new Packages.com.google.gson.JsonParser();
var path = project.getProperty("dist.dir");
var file = new Packages.java.lang.StringBuilder(path).append("/").append(project.getProperty("build.name"));
file.append(project.getProperty("build.full")).append(project.getProperty("build.number"));
var fileMain = new Packages.java.lang.StringBuilder(file).append(".jar");
var fileDev = new Packages.java.lang.StringBuilder(file).append("-dev.jar");
var fileApi = new Packages.java.lang.StringBuilder(file).append("-API.zip");
// version ids
var version = project.getProperty("mcv");
var t = new Packages.java.lang.StringBuilder("https://minecraft.curseforge.com/api/game/versions?token=");
t.append(token);
var con = new Packages.java.net.URL(t.toString()).openConnection();
con = new Packages.java.io.InputStreamReader(con.getInputStream());
var data = parser.parse(con).getAsJsonArray();
for (var i = 0, e = data.size(); i < e; ++i) {
var element = data.get(i).getAsJsonObject();
if (version.equals(element.get("name").getAsString())) {
gameVersion = element.get("id").getAsString();
break;
}
}
if (gameVersion == null) throw "Unable to find game version " + version + "!";
var httpConn;
function sendFile(requestURL, uploadFile, metadata) {
var LINE_FEED = "\r\n";
var boundary = "===" + Packages.java.lang.System.currentTimeMillis() + "===";
var url = new Packages.java.net.URL(requestURL);
httpConn = url.openConnection();
httpConn.setUseCaches(false);
httpConn.setDoOutput(true);
httpConn.setDoInput(true);
var t = new Packages.java.lang.StringBuilder("multipart/form-data; boundary=").append(boundary);
httpConn.setRequestProperty("Content-Type", t.toString());
httpConn.setRequestProperty("X-Api-Token", token);
var outputStream = httpConn.getOutputStream();
var writer = new Packages.java.io.PrintWriter(new Packages.java.io.OutputStreamWriter(outputStream, "UTF-8"), true);
writer.append("--").append(boundary).append(LINE_FEED);
writer.append("Content-Disposition: form-data; name=\"metadata\"").append(LINE_FEED);
writer.append("Content-Type: text/plain; charset=UTF-8").append(LINE_FEED);
writer.append(LINE_FEED);
writer.append(metadata).append(LINE_FEED);
writer.flush();
var fileName = uploadFile.getName();
writer.append("--").append(boundary).append(LINE_FEED);
writer.append("Content-Disposition: form-data; name=\"file\"; filename=\"").append(fileName).append("\"");
writer.append(LINE_FEED);
writer.append("Content-Type: application/octet-stream").append(LINE_FEED);
writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED);
writer.append(LINE_FEED);
writer.flush();
var inputStream = new Packages.java.io.FileInputStream(uploadFile);
var buffer = Packages.java.lang.reflect.Array.newInstance(Packages.java.lang.Byte.TYPE, 4096);
var bytesRead = -1;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
outputStream.flush();
inputStream.close();
writer.flush();
writer.append(LINE_FEED).flush();
writer.append("--").append(boundary).append("--").append(LINE_FEED);
writer.close();
return httpConn.getInputStream();
}
// main file
var t = new Packages.java.lang.StringBuilder("https://minecraft.curseforge.com/api/projects/");
path = t.append(modid).append("/upload-file").toString();
t = new Packages.java.lang.StringBuilder("{changelog:").append('"",');
t.append("releaseType:\"alpha\",").append("gameVersions:[");
t.append(gameVersion).append("]}");
try {
con = new Packages.java.io.InputStreamReader(sendFile(path, file = new Packages.java.io.File(fileMain), t.toString()));
var data = parser.parse(con).getAsJsonObject();
fileMain = data.get("id").getAsString();
t = new Packages.java.lang.StringBuilder("Uploaded to CurseForge! File ID: ");
t.append(fileMain);
project.setProperty("fileout", t.toString());
t = new Packages.java.lang.StringBuilder("{changelog:").append('"",');
t.append("releaseType:\"alpha\",").append("parentFileID:");
t.append(fileMain).append("}");
sendFile(path, file = new Packages.java.io.File(fileDev), t.toString());
file = new Packages.java.io.File(fileApi);
if (file.exists()) sendFile(path, file, t.toString());
} catch(_) {
t = new Packages.java.lang.StringBuilder("Error uploading ").append(file.getName());
t.append(" to CurseForge! ").append(httpConn.getResponseCode()).append(": ");
t.append(httpConn.getResponseMessage());
if (fileMain == null) {
project.setProperty("fileout", t.toString());
} else {
Packages.java.lang.System.err.println(t.toString());
Packages.java.lang.System.err.println(_.toString());
}
}
]]></script>
<echo message="${fileout}"/>
</target>
<target name="verify-version">
<script language="javascript"><![CDATA[
var name = project.getProperty("build.full");
if (name == null || name == "") {
name = project.getProperty("verclass.name");
if (name == null || name == "") {
project.setProperty("build.full", "-");
}
}
]]></script>
</target>
<target name="get-version" depends="verify-version,setup-forge" unless="build.full">
<local name="grep.out"/><local name="mfrv"/>
<!-- Read version out of file -->
<script language="javascript"><![CDATA[
var mainClass = new Packages.java.io.File(project.getProperty("verclass.dir"), project.getProperty("verclass.name"));
mainClass = new Packages.java.util.Scanner(mainClass, "UTF-8").useDelimiter("\\Z");
var text = mainClass.next();
mainClass.close();
var matches = /version\s+=\s+"([0-9.]+((RC|B)[0-9]+)?)";/.exec(text);
project.setProperty("grep.out", matches[1]);
]]></script>
<!-- Split mod&mc version, update mcmod -->
<script language="javascript" classpathref="gson"><![CDATA[
versionlist = project.getProperty("grep.out");
mcversion = project.getProperty("mc.version");
mfrversion = versionlist;
project.setProperty("mfrv", mfrversion);
project.setProperty("mcv", mcversion);
var c = project.getProperty("build.channel");
if (c == null || c == "")
project.setProperty("build.channel", mfrversion.indexOf("B") > 0 ? "alpha" : (
mfrversion.indexOf("RC") > 0 ? "beta" : "release"));
// open file and parse JSON structure
var file = new Packages.java.io.File(project.getProperty("resources.dir") + "/mcmod.info");
if (file.exists())
{
var mcmod = new Packages.java.util.Scanner(file, "UTF-8").useDelimiter("\\Z");
var data = new Packages.com.google.gson.JsonParser().parse(mcmod.next()).getAsJsonArray();
mcmod.close();
// update all version elements
for (var i = 0, e = data.size(); i < e; ++i) {
var element = data.get(i).getAsJsonObject();
element.addProperty("version", mfrversion);
element.addProperty("mcversion", mcversion);
}
// write file back, pretty-printed
var output = new Packages.com.google.gson.stream.JsonWriter(new java.io.FileWriter(file));
output.setIndent(" ");
new Packages.com.google.gson.Gson().toJson(data, output);
output.close();
}
]]></script>
<echo message="Version: ${mfrv} Channel: ${build.channel}"/>
<property name="build.full" value="-[${mcv}]${mfrv}-"/>
</target>
<target name="get-build-number" depends="build-number-there" unless="build.number">
<echo message="!! No build number set !!"/>
<property name="build.number" value="CUSTOM_BUILD"/>
</target>
<target name="build-number-there" depends="get-version" if="env.BUILD_NUMBER" unless="build.number">
<echo message="Using build number ${env.BUILD_NUMBER}..."/>
<property name="build.number" value="${env.BUILD_NUMBER}"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="rebuild">
<delete file="${forge.jar}" failonerror="false"/>
<delete dir="${forge.dir}"/>
<delete dir="${download.dir}"/>
<antcall target="install"/>
</target>
<target name="refresh-deps">
<delete dir="${lib.dir}"/>
<delete dir="${download.dir}"/>
<antcall target="install"/>
</target>
<target name="jar" depends="install"/>
</project>