This repository has been archived by the owner on Apr 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
178 lines (146 loc) · 6.75 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
<project name="World Core" basedir="./" default="build">
<property environment="env" />
<property file="buildspecs.properties" prefix="buildspecs" />
<property name="mod.minecraftversion" value="1" />
<property name="mod.majorversion" value="1" />
<property name="mod.tweakversion" value="0" />
<property name="mod.version" value="${mod.minecraftversion}.${mod.majorversion}.${mod.tweakversion}" />
<condition property="mod.build" value="${env.BUILD_NUMBER}" else="0">
<isset property="env.BUILD_NUMBER" />
</condition>
<property name="mc.version" value="1.6.4" />
<property name="forge.version" value="9.11.1.952" />
<property name="src.dir" value="" />
<property name="build.dir" value="build" />
<property name="download.dir" value="download" />
<property name="dist.dir" value="dist" />
<property name="forge.dir" value="${build.dir}/forge" />
<property name="mcp.dir" value="${forge.dir}/mcp" />
<property name="mod.name" value="ZZZZ_WorldCore-universal-${mc.version}-${mod.version}.${mod.build}.jar" />
<property name="dev.name" value="WorldCore-dev-${mc.version}-${mod.version}.${mod.build}.jar" />
<property name="changelog.name" value="WorldCore-changelog-${mc.version}-${mod.version}.${mod.build}.txt" />
<property name="forge.name" value="minecraftforge-src-${mc.version}-${forge.version}.zip" />
<!-- Check downloaded dependencies -->
<available property="forge-downloaded" file="${download.dir}/${forge.name}" />
<!-- Check installed dependencies -->
<property name="build.dependencies.file" value="${build.dir}/dependencies.properties" />
<property prefix="build.dependencies" file="${build.dependencies.file}" />
<condition property="forge-installed">
<equals arg1="${build.dependencies.forge}" arg2="${forge.version}" />
</condition>
<!-- Make directories -->
<mkdir dir="${build.dir}" />
<mkdir dir="${download.dir}" />
<mkdir dir="${dist.dir}" />
<!-- Targets for downloading dependencies -->
<target name="download-forge" unless="forge-downloaded">
<get src="http://files.minecraftforge.net/${forge.name}" dest="${download.dir}" usetimestamp="true" />
</target>
<!-- Targets for installing dependencies -->
<target name="install-forge" depends="download-forge" unless="forge-installed">
<echo message="Deleting old Forge" />
<delete dir="${forge.dir}" />
<condition property="installargs" value=" --no-assets" else="">
<or>
<isset property="env.BUILD_ID" />
</or>
</condition>
<echo message="Installing Forge with args '${installargs}'." />
<unzip src="${download.dir}/${forge.name}" dest="${forge.dir}/.." />
<property name="fml.python.exe" location="${forge.dir}/fml/python/python_fml.exe" />
<exec dir="${forge.dir}" executable="${fml.python.exe}" osfamily="windows" failonerror="true">
<arg line="install.py${installargs}" />
</exec>
<exec dir="${forge.dir}" executable="python" osfamily="unix" failonerror="true">
<arg line="install.py${installargs}" />
</exec>
<echo message="Updating build.dependencies" />
<delete file="${build.dependencies.file}" />
<propertyfile file="${build.dependencies.file}">
<entry key="forge" value="${forge.version}" />
</propertyfile>
</target>
<target name="install-dependencies" depends="install-forge" />
<!-- Targets for building -->
<target name="recompile">
<!-- Copy source -->
<echo message="Copying source" />
<copy todir="${mcp.dir}/src/minecraft">
<fileset dir="common" />
</copy>
<copy todir="${mcp.dir}/reobf/resources">
<fileset dir="resources" />
</copy>
<!-- Replace Tokens-->
<replace dir="${mcp.dir}/src/minecraft/worldcore" token="@VERSION@" value="${mod.version}" />
<replace dir="${mcp.dir}/src/minecraft/worldcore" token="@BUILD_NUMBER@" value="${mod.build}" />
<replace dir="${mcp.dir}/src/minecraft/worldcore" token="@MC_VERSION@" value="${mc.version}" />
<replace dir="${mcp.dir}/src/minecraft/worldcore" token="1.42.666.42.1" value="9.10.1.871" />
<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="${forge.version}" />
<replace dir="" token="@BUILD_NUMBER@" value="${mod.build}" />
<echo message="Recompiling" />
<property name="mcp.python.exe" location="${mcp.dir}/runtime/bin/python/python_mcp.exe" />
<exec dir="${mcp.dir}" executable="${mcp.python.exe}" osfamily="windows" resultproperty="recompile.code">
<arg line="runtime/recompile.py" />
</exec>
<exec dir="${mcp.dir}" executable="python" osfamily="unix" resultproperty="recompile.code">
<arg line="runtime/recompile.py" />
</exec>
<echo message="Removing source" />
<delete includeemptydirs="true">
<fileset dir="${mcp.dir}/src/minecraft">
<present present="both" targetdir="common" />
<present present="both" targetdir="apis" />
</fileset>
</delete>
<fail message="Failed to recompile">
<condition>
<isfailure code="${recompile.code}" />
</condition>
</fail>
</target>
<target name="reobfuscate">
<echo message="Reobfuscating" />
<property name="mcp.python.exe" location="${mcp.dir}/runtime/bin/python/python_mcp.exe" />
<exec dir="${mcp.dir}" executable="${mcp.python.exe}" osfamily="windows" resultproperty="reobfuscate.code">
<arg line="runtime/reobfuscate.py --srgnames" />
</exec>
<exec dir="${mcp.dir}" executable="python" osfamily="unix" resultproperty="reobfuscate.code">
<arg line="runtime/reobfuscate.py --srgnames" />
</exec>
<fail message="Failed to reobfuscate">
<condition>
<isfailure code="${reobfuscate.code}" />
</condition>
</fail>
</target>
<target name="package">
<echo message="Building Jar" />
<mkdir dir="${dist.dir}" />
<echo message="Packaging WorldCore Universal" />
<jar destfile="${dist.dir}/${mod.name}" manifest="${mcp.dir}/reobf/resources/MANIFEST.MF">
<fileset dir="${mcp.dir}/reobf/minecraft" includes="**/worldcore/**" />
<fileset dir="${mcp.dir}/reobf/resources" excludes="MANIFEST.MF">
</fileset>
</jar>
<copy todir="tmp/src">
<fileset dir="${mcp.dir}/src/minecraft" includes="**/worldcore/**"/>
</copy>
<echo message="Packaging WorldCore Dev" />
<jar destfile="${dist.dir}/${dev.name}" manifest="${mcp.dir}/reobf/resources/MANIFEST.MF">
<fileset dir="tmp" includes="**/src/**" />
<fileset dir="${mcp.dir}/bin/minecraft" includes="**/worldcore/**" />
<fileset dir="${mcp.dir}/reobf/resources" excludes="MANIFEST.MF">
</fileset>
</jar>
</target>
<target name="build">
<antcall target="install-dependencies" />
<antcall target="recompile" />
<antcall target="reobfuscate" />
<antcall target="package" />
</target>
</project>