forked from AdlyTempleton/Aura-Cascade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml~
executable file
·306 lines (302 loc) · 13.5 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
<project name="AuraCascade" default="install" basedir=".">
<!-- Buildscript thanks to CoFH -->
<property environment="env"/>
<!-- Basic directories -->
<property name="src.dir" value="src/main/java"/>
<property name="api.dir" value="src/api/java"/>
<property name="library.dir" value="libs"/>
<property name="library.download.dir" value="${library.dir}/downloads"/>
<property name="resources.dir" value="src/main/resources"/>
<property name="build.dir" value="build"/>
<property name="download.dir" value="${build.dir}/downloads"/>
<!-- Project information -->
<property name="build.name" value="${ant.project.name}"/>
<property name="class.pckg" value="pixlepix/auracascade"/>
<!-- Version file -->
<property name="verclass.dir" value="src/main/java/creaturecollapse/auracascade/lib"/>
<property name="verclass.name" value="LibMisc.java"/>
<!-- Forge version -->
<property name="mc.version" value="1.7.10"/>
<property name="forge.major" value="10"/>
<property name="forge.minor" value="13"/>
<property name="forge.patch" value="0"/>
<property name="forge.build" value="1199"/>
<!-- 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="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="forge.jar" value="${forge.stsh}/forgeSrc-${forge.version}.jar"/>
<property name="reobf.cmd" value="${download.dir}/bon.jar"/>
<property name="forge.url"
value="http://files.minecraftforge.net/maven/net/minecraftforge/forge/${forge.version}/forge-${forge.version}-src.zip"/>
<!-- Classpaths -->
<path id="lib.classpath">
<pathelement location="${forge.jar}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
<include name="**/*.jar"/>
<exclude name="${reobf.jar}"/>
</fileset>
<fileset dir="libs">
<include name="*.jar"/>
<include name="**/*.jar"/>
</fileset>
<!--fileset dir="${build.dir}/.gradle/caches">
<include name="modules*/files*/**/*.jar"/>
<exclude name="commons-io-1.4.jar"/>
<exclude name="commons-lang3-3.1.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"/>
</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="forge.exists" file="${download.dir}/forge-${forge.version}-src.zip"/>
<available property="bon.exists" file="${reobf.cmd}"/>
<condition property="forge.already.installed">
<available file="${forge.jar}" type="file"/>
</condition>
<condition property="have.libs">
<and>
<istrue value="${
}"/>
</and>
</condition>
</target>
<!-- Dependency downloading -->
<target name="download-core" depends="properties">
</target>
<target name="get-dependencies" depends="get-version" unless="have.libs">
<delete dir="${library.download.dir}/"/>
<mkdir dir="${library.download.dir}/"/>
<echo message="Downloading libs"/>
<get src="http://files.minecraftforge.net/maven/codechicken/ForgeMultipart/1.7.2-1.1.0.268/ForgeMultipart-1.7.2-1.1.0.268-dev.jar"
dest="${library.download.dir}/FMP.jar"/>
<get src="http://dvs1.progwml6.com/files/maven/tconstruct/TConstruct/1.7.2-1.6.0.jenkins494/TConstruct-1.7.2-1.6.0.jenkins494-deobf.jar"
dest="${library.download.dir}/TCONSTRUCT.jar"/>
<get src="http://dvs1.progwml6.com/files/maven/mantle/Mantle/1.7.2-145.3a637c2/Mantle-1.7.2-145.3a637c2-deobf.jar"
dest="${library.download.dir}/MANTLE.jar"/>
<!-- Begin hack -->
<delete dir="${compile.dir}" failonerror="false"/>
<!-- End hack -->
</target>
<!-- Building process -->
<target name="install" depends="build">
<!-- 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}dev-${build.number}.jar"/>
<exclude name="${build.name}-API${build.full}${build.number}.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="**/*.class"/>
</fileset>
<fileset dir="${resources.dir}"/>
</copy>
<update-languages/>
<manifest file="${classes.dir}/MANIFEST.MF">
<attribute name="FMLCorePlugin" value="cofh.asm.LoadingPlugin"/>
<attribute name="FMLCorePluginContainsFMLMod" value="true"/>
</manifest>
<jar destfile="${dist.dir}/${build.name}${build.full}@{build}.jar"
compress="true" level="9" basedir="${classes.dir}"
manifest="${classes.dir}/MANIFEST.MF">
<exclude name="MANIFEST.MF"/>
</jar>
</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>
<!--Print out detailed classpath-->
<pathconvert pathsep="${line.separator}| |-- "
property="echo.path.compile"
refid="lib.classpath">
</pathconvert>
<echo message="|-- compile classpath"/>
<echo message="| |"/>
<echo message="| |-- ${echo.path.compile}"/>
<javac srcdir="${sources.dir}" destdir="${compile.dir}" target="1.6" source="1.6"
classpathref="lib.classpath" debug="true" debuglevel="lines,source" includeAntRuntime="false">
<include name="**/*.java"/>
</javac>
<!-- Dev jar -->
<echo message="Building jar..."/>
<local name="build"/>
<property name="build" value="dev-${build.number}"/>
<install-lite build="${build}"/>
<!-- Reobf -->
<echo message="Reobfuscating..."/>
<java classpath="${reobf.cmd}" classname="immibis.bon.cui.MCPRemap">
<arg line="-q -m"/>
<arg value="-to SRG"/>
<arg value="-from MCP"/>
<arg value="-mcp ${forge.stsh}/unpacked"/>
<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}"/>
<fileset dir="${api.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}-API${build.full}${build.number}.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"/>
<delete dir="${build.dir}/.gradle/caches/minecraft/net/minecraftforge/forge/${forge.version}/srgs"
failonerror="false"/>
<!-- Change executables' permissions -->
<chmod file="${forge.dir}/gradlew" perm="+x"/>
<copy file="${resources.dir}/aura_at.cfg" tofile="${transformers.dir}/aura_at.cfg"/>
<!-- Install forge -->
<exec executable="./gradlew" failonerror="true" dir="${forge.dir}/" vmlauncher="false">
<arg line="-g ../.gradle"/>
<arg line="extractMinecraftSrc"/>
<arg line="eclipseClasspath"/>
</exec>
<mkdir dir="${compile.dir}"/>
<mkdir dir="${lib.dir}"/>
<javac srcdir="${forgebuild.dir}/tmp/recompSrc" destdir="${compile.dir}" target="1.6" source="1.6"
classpathref="lib.classpath" debug="true" debuglevel="lines,source" includeAntRuntime="false"/>
<jar destfile="${forge.jar}" compress="true" level="9" basedir="${compile.dir}"/>
<copy file="${forge.jar}" todir="${forgebuild.dir}/dirtyArtifacts/"/>
<delete dir="${compile.dir}"/>
</target>
<target name="download-forge" depends="setup-bon,download-core">
<echo message="Downloading forge... "/>
<get src="${forge.url}" dest="${download.dir}/forge-${forge.version}-src.zip"/>
</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/1.1/BON.jar" dest="${reobf.cmd}"/>
</target>
<macrodef name="update-languages">
<sequential>
<script language="javascript"><![CDATA[
importPackage(java.io);
var path = "/assets/cofh/language/";
var languages = new File(project.getProperty("resources.dir") + path);
if (languages.exists() && languages.isDirectory()) {
var out = "";
for each(var i in languages.list()) {
if (i != null && i.length() > 5 && i.indexOf(".lang") == i.length() - 5) {
out += i.substring(0, i.length() - 5) + ", ";
}
}
if (out.length > 0) {
var os = new PrintWriter(project.getProperty("classes.dir") + path + ".languages");
os.write("["+out.substring(0, out.length - 2)+"]");
os.flush();
os.close();
}
}
]]></script>
</sequential>
</macrodef>
<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"/>
<local name="mcv"/>
<!-- Read version out of file -->
<property name="version" value="2.4"/>
<!-- Split mod&mc version, update mcmod -->
<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>