forked from MrTJP/ProjectRed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
252 lines (215 loc) · 9.07 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
<?xml version="1.0" ?>
<project name="Project: Red" basedir="../" default="">
<!-- Directories -->
<property name="src.dir" value="ProjectRed" />
<property name="build.dir" value="build" />
<property name="download.dir" value="download" />
<property name="forge.dir" value="${build.dir}/forge" />
<property name="mcp.dir" value="${forge.dir}/mcp" />
<property name="mc.src.dir" value="${mcp.dir}/src/minecraft" />
<property name="jar.dir" value="${build.dir}/dist" />
<property name="chickencore.dir" value="${build.dir}/unpack/chickencore" />
<property name="nei.dir" value="${build.dir}/unpack/nei" />
<property name="teapi.dir" value="${build.dir}/unpack/teapi" />
<property name="ccapi.dir" value="${build.dir}/unpack/ccapi" />
<!-- Versioning -->
<property file="${src.dir}/buildspecs.properties" prefix="buildspecs" />
<property name="mc.version" value="1.6.2" />
<property name="mod.version" value="4.0.0pre" />
<property name="mod.build" value="${buildspecs.build_number}" />
<property name="mod.version.full" value="${mod.version}.${mod.build}" />
<property name="version.mcp" value="805" />
<property name="version.forge" value="9.10.0.819" />
<property name="version.chickencore" value="0.9.0.0" />
<property name="version.nei" value="1.6.0.3" />
<property name="version.teapi" value="2.4.6.0" />
<property name="version.ccapi" value="1.53" />
<!-- Servers -->
<property name="download.root" value="http://dl.dropboxusercontent.com/u/46144650" />
<property name="download.mcp" value="mcp-${version.mcp}.zip" />
<property name="download.forge" value="forge-${version.forge}.zip" />
<property name="download.chickencore" value="chickencore-${version.chickencore}.zip" />
<property name="download.nei" value="nei-${version.nei}.zip" />
<property name="download.teapi" value="teapi-${version.teapi}.zip" />
<property name="download.ccapi" value="ccapi-${version.ccapi}.zip" />
<target name="cleanoldworkspace">
<delete dir="${mc.src.dir}\mrtjp" />
<delete dir="${mc.src.dir}\dan200" />
<delete dir="${mcp.dir}\reobf\minecraft" />
<delete dir="${mcp.dir}\reobf\resources" />
</target>
<target name="increment_build_number">
<propertyfile file="${src.dir}/buildspecs.properties">
<entry key="build_number" type="int" operation="+" default="1" />
</propertyfile>
</target>
<target name="fullfilesetup">
<!-- Download files -->
<mkdir dir="${download.dir}" />
<get src="${download.root}/${download.mcp}" dest="${download.dir}" usetimestamp="True" />
<get src="${download.root}/${download.forge}" dest="${download.dir}" usetimestamp="True" />
<get src="${download.root}/${download.chickencore}" dest="${download.dir}" usetimestamp="True" />
<get src="${download.root}/${download.nei}" dest="${download.dir}" usetimestamp="True" />
<get src="${download.root}/${download.teapi}" dest="${download.dir}" usetimestamp="True" />
<get src="${download.root}/${download.ccapi}" dest="${download.dir}" usetimestamp="True" />
<echo message="Download finished" />
<!-- Unzip files -->
<!-- mcp -->
<!--
<unzip dest="${mcp.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="${download.mcp}" />
</fileset>
</unzip>
-->
<!-- forge -->
<unzip dest="${forge.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="${download.forge}" />
</fileset>
</unzip>
<!-- chickencore -->
<unzip dest="${chickencore.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="${download.chickencore}" />
</fileset>
</unzip>
<!-- nei -->
<unzip dest="${nei.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="${download.nei}" />
</fileset>
</unzip>
<!-- Computer Craft api -->
<unzip dest="${ccapi.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="${download.ccapi}" />
</fileset>
</unzip>
<!-- Thermal Expansion api -->
<unzip dest="${teapi.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="${download.teapi}" />
</fileset>
</unzip>
<echo message="All Files Unpacked" />
<!-- Grant permissions -->
<chmod file="${forge.dir}/install.sh" perm="+x" />
<echo message="Permissions set" />
<!-- 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="Initial Forge Setup complete" />
<!-- MCP OSX perms -->
<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="${mcp.dir}/runtime/bin/astyle-osx" perm="+x" />
<chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x" />
<!-- Copy files that will be hashed with MD5 -->
<copy todir="${mc.src.dir}">
<fileset dir="${src.dir}/dummy" />
</copy>
<echo message="All apis and sources copied" />
<!-- 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="copymodsrc">
<!-- Delete PR source in build space -->
<delete dir="${mc.src.dir}/mrtjp" />
<!-- Copy PR source -->
<copy todir="${mc.src.dir}">
<fileset dir="${src.dir}/common" />
</copy>
<copy todir="${mcp.dir}\reobf\resources">
<fileset dir="${src.dir}/resources" />
</copy>
</target>
<target name="injectdata">
<!-- Replace Tokens-->
<replace dir="${mc.src.dir}/mrtjp/projectred" token="@VERSION@" value="${mod.version}" />
<replace dir="${mc.src.dir}/mrtjp/projectred" token="@BUILD_NUMBER@" value="${mod.build}" />
<replace dir="${mc.src.dir}/mrtjp/projectred" token="@MC_VERSION@" value="${mc.version}" />
<replace dir="${mcp.dir}\reobf\resources" token="@VERSION@" value="${mod.version}" />
<replace dir="${mcp.dir}\reobf\resources" token="@BUILD_NUMBER@" value="${mod.build}" />
<replace dir="${mcp.dir}\reobf\resources" token="@MC_VERSION@" value="${mc.version}" />
<replace dir="${mcp.dir}\reobf\resources" token="@FORGE_VERSION@" value="${version.forge}" />
<replace dir="${mcp.dir}\reobf\resources" token="@TEST_MSG@" value="..." />
</target>
<target name="injecttestdata">
<!-- Replace Tokens-->
<replace dir="${mc.src.dir}/mrtjp/projectred" token="@VERSION@" value="${mod.version}" />
<replace dir="${mc.src.dir}/mrtjp/projectred" token="@BUILD_NUMBER@" value="${mod.build}.NIGHTLY" />
<replace dir="${mc.src.dir}/mrtjp/projectred" token="@MC_VERSION@" value="${mc.version}" />
<replace dir="${mcp.dir}\reobf\resources" token="@VERSION@" value="${mod.version}" />
<replace dir="${mcp.dir}\reobf\resources" token="@BUILD_NUMBER@" value="${mod.build}.NIGHTLY" />
<replace dir="${mcp.dir}\reobf\resources" token="@MC_VERSION@" value="${mc.version}" />
<replace dir="${mcp.dir}\reobf\resources" token="@FORGE_VERSION@" value="${version.forge}" />
<replace dir="${mcp.dir}\reobf\resources" token="@TEST_MSG@" value="WARNING: This is an unstable test build" />
</target>
<target name="recompile">
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
<arg line="/c recompile.bat" />
</exec>
<exec dir="${mcp.dir}" executable="bash" osfamily="unix">
<arg line="recompile.sh" />
</exec>
</target>
<target name="reobfuscate">
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
<arg line="/c reobfuscate_srg.bat" />
</exec>
<exec dir="${mcp.dir}" executable="bash" osfamily="unix">
<arg line="reobfuscate_srg.sh" />
</exec>
</target>
<target name="packjar">
<!-- Build the jar -->
<mkdir dir="${jar.dir}" />
<jar destfile="${jar.dir}/ProjectRed-${mc.version}-${mod.version.full}.jar">
<fileset dir="${mcp.dir}\reobf\minecraft" />
<fileset dir="${mcp.dir}\reobf\resources" />
</jar>
</target>
<target name="packtestjar">
<!-- Build the test jar -->
<mkdir dir="${jar.dir}" />
<jar destfile="${jar.dir}/ProjectRed-${mc.version}-${mod.version.full}.NIGHTLY.jar">
<fileset dir="${mcp.dir}\reobf\minecraft" />
<fileset dir="${mcp.dir}\reobf\resources" />
</jar>
</target>
<target name="initialsetup">
<antcall target="fullfilesetup" />
</target>
<target name="quickbuild">
<antcall target="cleanoldworkspace" />
<antcall target="increment_build_number" />
<antcall target="copymodsrc" />
<antcall target="injectdata" />
<antcall target="recompile" />
<antcall target="reobfuscate" />
<antcall target="packjar" />
<antcall target="cleanoldworkspace" />
</target>
<target name="testbuild">
<antcall target="cleanoldworkspace" />
<antcall target="copymodsrc" />
<antcall target="injecttestdata" />
<antcall target="recompile" />
<antcall target="reobfuscate" />
<antcall target="packtestjar" />
<antcall target="cleanoldworkspace" />
</target>
</project>