forked from MinecraftForge/FML
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
216 lines (198 loc) · 8.87 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
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
30 Mar 2012 13:35:40
FML
The Forge Mod Loader
cpw
====================================================================== -->
<project name="FML" default="build">
<description>The Forge Mod Loader</description>
<macrodef name="side">
<attribute name="prop" />
<attribute name="src" />
<attribute name="side" />
<sequential>
<property name="@{prop}" value="${@{side}.@{src}}" />
<condition property="is.client">
<equals arg1="@{side}" arg2="client" />
</condition>
<condition property="is.server">
<equals arg1="@{side}" arg2="server" />
</condition>
</sequential>
</macrodef>
<target name="writeversion" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${basedir}" failonerror="true">
<arg value="${basedir}/getversion.py" />
</exec>
<propertyfile file="fmlversion.properties">
<entry key="fmlbuild.build.number" type="int" value="${version.build}"/>
</propertyfile>
</target>
<target name="buildenvsetup">
<tstamp>
<format pattern="yyMMddHHmmss" property="timestamp" />
</tstamp>
<property environment="env" />
<property file="fmlbuild.properties" />
<property name="modname" value="fml" />
<condition property="dev.home" value="${env.WORKSPACE}" else="${default.dev.home}">
<isset property="env.WORKSPACE" />
</condition>
<condition property="mcp.home" value="${env.WORKSPACE}/mcpworkspace" else="${default.mcp.home}">
<isset property="env.WORKSPACE" />
</condition>
<condition property="python.exe" value="${mcp.home}/runtime/bin/python/python_mcp" else="python">
<os family="Windows" />
</condition>
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
<property name="server.mcp.obfoutput" location="${mcp.obfoutput}/minecraft_server" />
<property name="mcp.srcdir" location="${mcp.home}/src" />
<property name="client.mcp.srcdir" location="${mcp.srcdir}/minecraft" />
<property name="server.mcp.srcdir" location="${mcp.srcdir}/minecraft_server" />
<property name="common.src.dir" location="${basedir}/common" />
<property name="client.src.dir" location="${basedir}/client" />
<property name="server.src.dir" location="${basedir}/server" />
<property name="patch.src.dir" location="${basedir}/patches" />
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
<isset property="env.BUILD_NUMBER" />
</condition>
</target>
<target name="init" depends="buildenvsetup">
<antcall target="writeversion" />
<property file="fmlversion.properties" />
<property name="build.number" value="${fmlbuild.major.number}.${fmlbuild.minor.number}.${fmlbuild.revision.number}" />
<property name="version.minecraft" value="${fmlbuild.mcversion}" />
<property name="version.major" value="${fmlbuild.major.number}" />
<property name="version.minor" value="${fmlbuild.minor.number}" />
<property name="version.rev" value="${fmlbuild.revision.number}" />
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
</target>
<target name="clean">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/cleanup.py" />
<arg value="-f" />
</exec>
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/decompile.py" />
<arg value="-d" />
<arg value="-n" />
</exec>
</target>
<target name="buildandreobfmcp" depends="init">
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
<arg value="${mcp.home}/runtime/recompile.py" />
</exec>
<fail message="Compilation failed">
<condition>
<not>
<and>
<available file="${mcp.home}/bin/minecraft/net/minecraft/client/Minecraft.class"/>
<available file="${mcp.home}/bin/minecraft_server/net/minecraft/server/MinecraftServer.class"/>
</and>
</not>
</condition>
</fail>
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/reobfuscate.py" />
</exec>
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${basedir}/generatechangedfilelist.py"/>
<arg value="${mcp.home}"/>
<arg value="${basedir}/difflist.txt"/>
</exec>
</target>
<target name="merge-client" depends="init,clean">
<antcall target="merge-source">
<param name="side" value="client" />
</antcall>
</target>
<target name="merge-server" depends="init,clean">
<antcall target="merge-source">
<param name="side" value="server" />
</antcall>
</target>
<target name="merge-source">
<side prop="merge-to" src="mcp.srcdir" side="${side}" />
<side prop="side-from" src="src.dir" side="${side}" />
<copy todir="${merge-to}" overwrite="true" verbose="true">
<fileset dir="${side-from}" includes="**/*.java" />
<fileset dir="${common.src.dir}" includes="**/*.java" />
</copy>
</target>
<target name="build-client" depends="init,merge-client,buildandreobfmcp">
<antcall target="extract-built-jar">
<param name="side" value="client" />
</antcall>
</target>
<target name="build-server" depends="init,clean,merge-server,buildandreobfmcp">
<antcall target="extract-built-jar">
<param name="side" value="server" />
</antcall>
</target>
<target name="extract-built-jar">
<side prop="output" src="mcp.obfoutput" side="${side}" />
<property name="jarname" value="${modname}-${side}-${version}" />
<mkdir dir="${basedir}/target" />
<zip destfile="${basedir}/target/${jarname}.zip">
<fileset dir="${output}" includes="**/*.class" />
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/>
<mappedresources>
<concat>
<fileset dir="${basedir}/install" includes="README.txt" />
<filterchain>
<replacetokens>
<token key="MAJOR" value="${version.major}" />
<token key="MINOR" value="${version.minor}" />
<token key="REV" value="${version.rev}" />
<token key="BUILD" value="${version.build}" />
<token key="MCVERSION" value="${version.minecraft}" />
</replacetokens>
</filterchain>
</concat>
<mergemapper to="README-fml.txt" />
</mappedresources>
</zip>
</target>
<target name="build-source-pack">
<property name="jarname" value="${modname}-src-${version}" />
<zip destfile="${basedir}/target/${jarname}.zip">
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt,difflist.txt" prefix="fml" />
<zipfileset dir="${common.src.dir}" includes="**/*.java" prefix="fml/src/minecraft_server" />
<zipfileset dir="${common.src.dir}" includes="**/*.java" prefix="fml/src/minecraft" />
<zipfileset dir="${client.src.dir}" includes="**/*.java" prefix="fml/src/minecraft" />
<zipfileset dir="${server.src.dir}" includes="**/*.java" prefix="fml/src/minecraft_server" />
<zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml/src/minecraft" />
<zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml/src/minecraft_server" />
<zipfileset dir="${patch.src.dir}" includes="**/*.patch" prefix="fml/patches" />
<mappedresources>
<concat>
<fileset dir="${basedir}/install" includes="README.txt" />
<filterchain>
<replacetokens>
<token key="MAJOR" value="${version.major}" />
<token key="MINOR" value="${version.minor}" />
<token key="REV" value="${version.rev}" />
<token key="BUILD" value="${version.build}" />
<token key="MCVERSION" value="${version.minecraft}" />
</replacetokens>
</filterchain>
</concat>
<mergemapper to="fml/README-fml.txt" />
</mappedresources>
<zipfileset dir="${basedir}/install" excludes="README.txt" prefix="fml" />
</zip>
</target>
<target name="build" depends="init,clean,merge-server,merge-client,patch,build-server,build-client,build-source-pack" />
<target name="patch" depends="init">
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/applypatches.py" />
<arg value="${patch.src.dir}" />
<arg value="${mcp.srcdir}" />
<arg value="${mcp.home}" />
</exec>
</target>
</project>