forked from zerotheliger/PowerConverters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
273 lines (212 loc) · 11 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
<project name="PowerConverters" default="install" basedir=".">
<property environment="env" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/packaging" />
<property name="src.dir" value="src" />
<property name="forge.buildnum" value="733" />
<property name="forge.version" value="1.5.2-7.8.0.${forge.buildnum}" />
<property name="forge.url" value="http://files.minecraftforge.net/minecraftforge/minecraftforge-src-${forge.version}.zip" />
<property name="forge.dir" value="${build.dir}/forge" />
<property name="mcp.dir" value="${forge.dir}/mcp" />
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft" />
<property name="resources.dir" value="resources" />
<property name="package.meta-inf" value="META-INF" />
<property name="build.ver" value="1.4.7" />
<!--<property name="files.minecraft.dir" value="jars" />-->
<property name="dist.dir" value="${build.dir}/dist" />
<property name="download.dir" value="downloads" />
<property name="lib.dir" value="${mcp.dir}/lib" />
<property file="${forge.dir}/forgeversion.properties" />
<condition property="forge.already.installed">
<equals arg1="${forge.build.number}" arg2="${forge.buildnum}" />
</condition>
<property name="verclass.dir" value="${mcpsrc.dir}/powercrystals/powerconverters" />
<property name="verclass.name" value="PowerConverterCore.java"/>
<condition property="have-apis">
<and>
<available file="${mcpsrc.dir}/powercrystals/core" type="dir"/>
<available file="${mcpsrc.dir}/buildcraft" type="dir"/>
<available file="${mcpsrc.dir}/thermalexpansion" type="dir"/>
<available file="${mcpsrc.dir}/ic2" type="dir"/>
<available file="${mcpsrc.dir}/universalelectricity" type="dir"/>
<available file="${lib.dir}/fz-deobf-1.5.1.jar"/>
</and>
</condition>
<target name="get-dependencies" depends="get-version" unless="${have-apis}">
<echo message="Downloading Thermal Expansion API... " />
<get src="https://dl.dropboxusercontent.com/u/57416963/Minecraft/Mods/ThermalExpansion/api/ThermalExpansion-API-2.3.0.zip" dest="${download.dir}/thermalexpansion.zip" />
<echo message="Downloading IC2 API... " />
<get src="http://www.powercrystalsmods.com/build/ic2-api.zip" dest="${download.dir}/industrialcraft-2-api.zip" />
<echo message="Downloading BuildCraft API..." />
<get src="http://www.powercrystalsmods.com/build/buildcraft-api.zip" dest="${download.dir}/BuildCraft-master.zip"/>
<echo message="Downloading PowerCrystalsCore... " />
<get src="https://github.com/powercrystals/PowerCrystalsCore/archive/master.zip" dest="${download.dir}/PowerCrystalsCore-master.zip"/>
<echo message="Downloading Factorization... " />
<get src="http://www.powercrystalsmods.com/build/fz-deobf-1.5.1.jar" dest="${lib.dir}/fz-deobf-1.5.1.jar" />
<echo message="Downloading UniversalElectricity API... " />
<get src="http://www.powercrystalsmods.com/build/UniversalElectricity_v1.3.2.74.zip" dest="${download.dir}/ue-api.zip" />
</target>
<target name="extract-dependencies" depends="setup-forge,get-dependencies">
<echo message="Extracting PowerCrystalsCore... " />
<unzip src="${download.dir}/PowerCrystalsCore-master.zip" dest="${download.dir}"/>
<move file="${download.dir}/PowerCrystalsCore-master/src/powercrystals/core" todir="${mcpsrc.dir}/powercrystals/"/>
<echo message="Extracting BuildCraft API..." />
<unzip src="${download.dir}/BuildCraft-master.zip" dest="${download.dir}"/>
<mkdir dir="${mcpsrc.dir}/buildcraft/" />
<move file="${download.dir}/BuildCraft-master/common/buildcraft/api" todir="${mcpsrc.dir}/buildcraft/"/>
<echo message="Extracting Thermal Expansion API... " />
<unzip src="${download.dir}/thermalexpansion.zip" dest="${download.dir}" />
<move file="${download.dir}/thermalexpansion" todir="${mcpsrc.dir}" />
<echo message="Extracting IC2 API... " />
<unzip src="${download.dir}/industrialcraft-2-api.zip" dest="${download.dir}" />
<move file="${download.dir}/ic2" todir="${mcpsrc.dir}" />
<echo message="Extracting UniversalElectricity API... " />
<unzip src="${download.dir}/ue-api.zip" dest="${download.dir}/universalelectricity/" />
<move file="${download.dir}/universalelectricity/universalelectricity" todir="${mcpsrc.dir}" />
<echo message="Deleting stuff from the UE API that isn't actually the API... " />
<delete dir="${mcpsrc.dir}/universalelectricity/components"/>
<delete dir="${mcpsrc.dir}/universalelectricity/prefab"/>
</target>
<mkdir dir="${download.dir}"/>
<mkdir dir="${build.dir}" />
<target name="get-version" depends="setup-forge">
<!-- Copy source -->
<mkdir dir="${mcpsrc.dir}/powercrystals" />
<copy todir="${mcpsrc.dir}/powercrystals" overwrite="true">
<fileset dir="${src.dir}/powercrystals"/>
</copy>
<copy todir="${mcpsrc.dir}" file="mcmod.info" overwrite="true"/>
<exec dir="${verclass.dir}" executable="sh" osfamily="unix" outputproperty="grep.out">
<arg value="-c"/>
<arg value="grep -o -P '[0-9.]+R[0-9.]+(RC[0-9]+)?(B[0-9]+)?' ${verclass.name}"/>
</exec>
<exec executable="python" osfamily="unix" outputproperty="python.out">
<arg value="versionscript.py" />
<arg value="${grep.out}" />
</exec>
<echo message="Grepped version: ${grep.out}"/>
<echo message="versionscript.py returned: ${python.out}"/>
</target>
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip" />
<available property="already-compiled" file="${classes.dir}/powercrystals" />
<condition property="should-download-ant-contrib">
<or>
<available file="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
<available file="${download.dir}/minecraftforge-src-${forge.version}.zip"/>
</or>
</condition>
<target name="install" depends="build">
<jar destfile="${dist.dir}/PowerConverters-${python.out}-${build.number}.jar" basedir="${classes.dir}"/>
<delete dir="${classes.dir}" />
<delete dir="${mcp.dir}/reobf"/>
<delete dir="${mcpsrc.dir}/powercrystals/powerconverters" />
</target>
<target name="build" depends="extract-dependencies" unless="already-compiled">
<!-- Recompile -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
<arg line="/c recompile.bat"/>
</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">
<arg line="/c reobfuscate.bat --srgnames"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
<arg value="reobfuscate.sh" />
<arg value="--srgnames" />
</exec>
<delete dir="${mcp.dir}/reobf/minecraft/buildcraft"/>
<delete dir="${mcp.dir}/reobf/minecraft/ic2"/>
<delete dir="${mcp.dir}/reobf/minecraft/thermalexpansion"/>
<delete dir="${mcp.dir}/reobf/minecraft/universalelectricity"/>
<delete dir="${mcp.dir}/reobf/minecraft/powercrystals/core"/>
<copy todir="${classes.dir}">
<fileset dir="${mcp.dir}/reobf/minecraft"/>
</copy>
<copy todir="${classes.dir}" file="${mcpsrc.dir}/mcmod.info"/>
<copy todir="${classes.dir}/textures/blocks/powercrystals/powerconverters">
<fileset dir="${mcpsrc.dir}/powercrystals/powerconverters/textures/blocks/" />
</copy>
<copy todir="${classes.dir}/powercrystals/powerconverters/textures/gui">
<fileset dir="${mcpsrc.dir}/powercrystals/powerconverters/textures/gui">
<include name="*.png" />
</fileset>
</copy>
</target>
<target name="build-number-there" if="env.BUILD_NUMBER" >
<echo message="Using build number ${env.BUILD_NUMBER}..." />
<property name="build.number" value="${env.BUILD_NUMBER}" />
</target>
<target name="build-number-not-there" unless="env.BUILD_NUMBER" >
<echo message="!! No build number set !!" />
<property name="build.number" value="CUSTOM_BUILD" />
</target>
<target name="setup-forge" depends="download-core,download-forge,build-number-there,build-number-not-there" unless="forge.already.installed">
<property name="build.full" value="${build.number}" />
<unzip dest="${build.dir}">
<fileset dir="${download.dir}">
<include name="minecraftforge-src-${forge.version}.zip"/>
</fileset>
</unzip>
<!-- Change executables' permitions -->
<chmod file="${forge.dir}/install.sh" perm="+x"/>
<copy file="${download.dir}/PowerCrystalsCore-master/pcc_at.cfg" todir="${forge.dir}/accesstransformers/"/>
<!-- Install forge -->
<delete dir="${mcp.dir}" failonerror="no"/>
<exec dir="${forge.dir}" executable="cmd" osfamily="windows" inputstring="Yes\n">
<arg line="/c install.cmd"/>
</exec>
<exec dir="${forge.dir}" executable="sh" osfamily="unix" inputstring="Yes\n">
<arg value="install.sh" />
</exec>
<chmod file="${mcp.dir}/updatemd5.sh" perm="+x"/>
<chmod file="${mcp.dir}/recompile.sh" perm="+x"/>
<chmod file="${mcp.dir}/reobfuscate.sh" perm="+x"/>
<chmod file="${mcp.dir}/runtime/bin/astyle-osx" perm="+x" />
<chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x" />
<!-- Copy source -->
<mkdir dir="${mcpsrc.dir}/powercrystals" />
<copy todir="${mcpsrc.dir}/powercrystals" overwrite="true">
<fileset dir="${src.dir}/powercrystals"/>
</copy>
<copy todir="${mcpsrc.dir}" file="mcmod.info" overwrite="true"/>
</target>
<target name="download-core" unless="forge-exists">
<echo message="Downloading PowerCrystalsCore... " />
<get src="https://github.com/powercrystals/PowerCrystalsCore/archive/master.zip" dest="${download.dir}/PowerCrystalsCore-master.zip"/>
<echo message="Extracting PowerCrystalsCore... " />
<unzip src="${download.dir}/PowerCrystalsCore-master.zip" dest="${download.dir}"/>
</target>
<target name="download-forge" depends="download-ant-contrib" unless="forge-exists">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
<fileset dir="${download.dir}/ant-contrib/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
<echo message="Downloading forge... " />
<get src="${forge.url}" dest="${download.dir}/minecraftforge-src-${forge.version}.zip" />
</target>
<target name="download-ant-contrib" unless="should-download-ant-contrib">
<echo message="Getting: ant-contrib"/>
<mkdir dir="${download.dir}/tmp"/>
<mkdir dir="${download.dir}/ant-contrib/lib" />
<get src="http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ant-contrib-1.0b3-bin.zip/download" dest="${download.dir}/tmp/ant-contrib-1.0b3-bin.zip"/>
<get src="http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.6-bin.zip" dest="${download.dir}/tmp/commons-codec-1.6-bin.zip"/>
<unzip src="${download.dir}/tmp/ant-contrib-1.0b3-bin.zip" dest="${download.dir}"/>
<unzip src="${download.dir}/tmp/commons-codec-1.6-bin.zip" dest="${download.dir}/tmp"/>
<move todir="${download.dir}/ant-contrib/lib">
<fileset file="${download.dir}/tmp/commons-codec-1.6/commons-codec-1.6.jar"/>
</move>
<!-- Delete useless files -->
<delete dir="${download.dir}/ant-contrib/docs"/>
<delete dir="${download.dir}/tmp"/>
</target>
<target name="clean" >
<delete dir="${build.dir}" />
</target>
</project>