forked from BuildCraft/BuildCraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
212 lines (158 loc) · 6.57 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
<project name="Buildcraft" basedir="../" default="main">
<property environment="env" />
<!-- Properties -->
<property name="build.dir" value="build"/>
<property name="src.dir" value="BuildCraft"/>
<property name="lang.dir" value="BuildCraft-Localization"/>
<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="mcp.dir" value="${build.dir}/mcp"/>
<property name="forge.dir" value="${mcp.dir}/forge"/>
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft"/>
<property name="mcp.version" value="723"/>
<property name="forge.version" value="1.4.5-6.4.1.408"/>
<property name="bc.version" value="3.1.8"/>
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip"/>
<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>
<mkdir dir="${download.dir}"/>
<!-- Targets -->
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<!-- Set build number -->
<target name="initialize-version" depends="version-provided,version-not-provided">
<property name="bc.version.full" value="${bc.version}.${build.number}"/>
<echo message="Starting build for ${bc.version.full}"/>
</target>
<target name="version-not-provided" unless="env.BUILD_NUMBER">
<buildnumber/>
</target>
<target name="version-provided" if="env.BUILD_NUMBER">
<property name="build.number" value="${env.BUILD_NUMBER}"/>
</target>
<!-- Download necessary files -->
<target name="download-files" depends="download-mcp,download-forge"/>
<!-- Download ant-contrib, necessary to be able to download forge (only if neither forge zip nor ant-contrib exist) -->
<target name="download-ant-contrib" unless="should-download-ant-contrib">
<echo message="Getting: ant-contrib"/>
<mkdir dir="${download.dir}/tmp"/>
<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>
<!-- Download mcp -->
<target name="download-mcp">
<get src="http://mcp.ocean-labs.de/files/mcp${mcp.version}.zip" dest="${download.dir}" usetimestamp="True"/>
</target>
<!-- Download forge (if it doesn't exist) -->
<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>
<getMethod url="http://files.minecraftforge.net/minecraftforge-src-${forge.version}.zip"
responseDataFile="${download.dir}/minecraftforge-src-${forge.version}.zip">
<header name="User-Agent" value="Ant-${ant.version}/${ant.java.version}"/>
</getMethod>
</target>
<!-- Setup mcp and forge -->
<target name="setup" depends="initialize-version">
<!-- Unzip them -->
<unzip dest="${mcp.dir}">
<fileset dir="${download.dir}">
<include name="mcp${mcp.version}.zip"/>
</fileset>
</unzip>
<unzip dest="${mcp.dir}">
<fileset dir="${download.dir}">
<include name="minecraftforge-src-${forge.version}.zip"/>
</fileset>
</unzip>
<!-- Copy the necessary jars -->
<copy todir="${mcp.dir}/jars">
<fileset dir="${files.minecraft.dir}"/>
</copy>
<!-- Change executables' permitions -->
<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="${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">
<arg line="/c install.cmd"/>
</exec>
<exec dir="${forge.dir}" executable="sh" osfamily="unix">
<arg value="install.sh" />
</exec>
<!-- Copy BC source -->
<copy todir="${mcpsrc.dir}">
<fileset dir="${src.dir}/common">
<exclude name="**/buildcraft/devel"/>
</fileset>
<filterset>
<filter token="VERSION" value="${bc.version}" />
<filter token="BUILD_NUMBER" value="${build.number}" />
</filterset>
</copy>
</target>
<target name="compile" depends="setup">
<!-- 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"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
<arg value="reobfuscate.sh" />
</exec>
<!-- Copy BC classes -->
<copy todir="${classes.dir}">
<fileset dir="${mcp.dir}/reobf/minecraft"/>
</copy>
<!-- Copy resources -->
<copy todir="${classes.dir}">
<fileset dir="${src.dir}/buildcraft_resources">
<exclude name="build.xml"/>
<exclude name="build.number"/>
</fileset>
</copy>
<!-- Copy localizations -->
<copy todir="${classes.dir}" failonerror="false">
<fileset dir="${lang.dir}">
<exclude name="README.md"/>
</fileset>
</copy>
</target>
<!-- Zip the compiled files -->
<target name="package" depends="compile">
<jar destfile="${jar.dir}/buildcraft-A-${bc.version.full}.jar" basedir="${classes.dir}"/>
</target>
<!-- Default target to run -->
<target name="main" depends="initialize-version,download-files,clean,package"/>
</project>