-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.xml
197 lines (165 loc) · 6.18 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
<project name="Additional-Buildcraft-Objects" basedir="../" default="main">
<property environment="env" />
<property name="abo.version" value="1.0.7"/>
<property name="abo.dir" value="Additional-Buildcraft-Objects"/>
<import file="../BuildCraft/build.xml" as="BuildCraft"/>
<!-- Set full version -->
<target name="initialize-version" depends="BuildCraft.initialize-version,version-provided,version-not-provided">
<property name="abo.version.full" value="${abo.version}.${build.number}"/>
<echo message="Building ${ant.project.name} ${abo.version.full} with Forge ${forge.version} and BuildCraft ${bc.version}"/>
<delete file="jenkins.properties" failonerror="false" />
<propertyfile file="jenkins.properties">
<entry key="ABO_VERSION_FULL" value="${abo.version.full}" />
<entry key="MC_VERSION" value="${mc.version}" />
<entry key="MCP_VERSION" value="${mcp.version}" />
<entry key="BC_VERSION" value="${bc.version}" />
<entry key="FORGE_VERSION" value="${forge.version}" />
</propertyfile>
</target>
<!-- Set unknown build number -->
<target name="version-not-provided" unless="env.BUILD_NUMBER">
<property name="build.number" value="custom"/>
</target>
<!-- Set build number from environment -->
<target name="version-provided" if="env.BUILD_NUMBER">
<property name="build.number" value="${env.BUILD_NUMBER}"/>
</target>
<!-- Clean -->
<target name="clean"> <!-- depends="BuildCraft.clean" -->
<delete file="jenkins.properties" failonerror="false" />
</target>
<!-- Setup -->
<target name="setup" depends="initialize-version,BuildCraft.setup,BuildCraft.copy-src">
<!-- Update MD5 otherwise we get all the buildcraft classes too :/ -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
<arg line="/c"/>
<arg line="updatemd5.bat"/>
<arg line="--force"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix" failonerror="true">
<arg line="updatemd5.sh"/>
<arg line="--force"/>
</exec>
</target>
<!-- Copy source for use in eclipse to debug -->
<target name="copy-src-eclipse" depends="BuildCraft.copy-src">
<echo message="Installing ABO source for Eclipse"/>
<!-- Copy ABO source -->
<copy todir="${mcpsrc.dir}/minecraft">
<fileset dir="${abo.dir}/common">
<exclude name="**/*.bak"/>
</fileset>
</copy>
<!-- Copy buildcraft resources to debug it -->
<copy todir="${mcpsrc.dir}/minecraft">
<fileset dir="${resources.dir}">
<exclude name="changelog"/>
<exclude name="build.xml"/>
<exclude name="build.number"/>
<exclude name="LICENSE.txt"/>
<exclude name="mcmod.info"/>
<exclude name="pack.mcmeta"/>
</fileset>
</copy>
<!-- Copy buildcraft localizations to debug it -->
<copy todir="${mcpsrc.dir}/minecraft">
<fileset dir="${lang.dir}">
<exclude name="README.md"/>
</fileset>
</copy>
<!-- Copy abo resources to debug it -->
<copy todir="${mcpsrc.dir}/minecraft">
<fileset dir="${abo.dir}/resources">
<exclude name="**/*.psd"/>
<exclude name="build.xml"/>
<exclude name="build.number"/>
<exclude name="mcmod.info"/>
<exclude name="pack.mcmeta"/>
</fileset>
</copy>
</target>
<!-- Copy source for packaging -->
<target name="copy-src">
<echo message="Installing ABO source"/>
<!-- Copy ABO source -->
<copy todir="${mcpsrc.dir}/minecraft">
<fileset dir="${abo.dir}/common">
<exclude name="**/*.bak"/>
</fileset>
<filterset>
<filter token="ABO_VERSION" value="${abo.version.full}" />
<filter token="BUILD_NUMBER" value="${build.number}" />
<filter token="MINECRAFT_VERSION" value="${mc.version}" />
<filter token="BUILDCRAFT_VERSION" value="${bc.version}" />
<filter token="FORGE_VERSION" value="${forge.version}" />
</filterset>
</copy>
</target>
<!-- compile abo -->
<target name="compile">
<echo message="Compiling ABO"/>
<!-- Recompile -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
<arg line="/c"/>
<arg line="recompile.bat"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix" failonerror="true">
<arg value="recompile.sh" />
</exec>
<!-- Check for failure -->
<fail message="MCP failed to build">
<condition>
<resourcecontains resource="${mcp.dir}/logs/client_compile.log" substring="error:"/>
</condition>
</fail>
<!-- Reobf -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
<arg line="/c"/>
<arg line="reobfuscate_srg.bat"/>
</exec>
<!-- remove empty server.md5 or simply every empty file in temp! -->
<exec dir="${mcp.dir}" executable="find" osfamily="unix" failonerror="false">
<arg value="temp" />
<arg value="-empty" />
<arg value="-exec" />
<arg value="rm" />
<arg value="{}" />
<arg value=";" />
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix" failonerror="true">
<arg value="reobfuscate_srg.sh" />
</exec>
</target>
<!-- copy build results -->
<target name="copy">
<echo message="Copying build results"/>
<!-- Copy ABO classes -->
<copy todir="${classes.dir}">
<fileset dir="${mcp.dir}/reobf/minecraft"/>
</copy>
<!-- Copy resources -->
<copy todir="${classes.dir}">
<fileset dir="${abo.dir}/resources">
<exclude name="**/*.psd"/>
<exclude name="build.xml"/>
<exclude name="build.number"/>
</fileset>
</copy>
</target>
<!-- create abo package -->
<target name="package">
<echo message="Creating JAR"/>
<jar destfile="${jar.dir}/buildcraft-Z-additional-buildcraft-objects-${mc.version}-${bc.version}-${abo.version.full}.jar" basedir="${classes.dir}"/>
<!-- Reset src dir to post-forge-install state -->
<delete dir="${mcpsrc.dir}/minecraft/assets/additional-buildcraft-objects"/>
<delete dir="${mcpsrc.dir}/minecraft/assets/buildcraft"/>
<delete dir="${mcpsrc.dir}/minecraft/abo"/>
<delete dir="${mcpsrc.dir}/minecraft/buildcraft"/>
<delete dir="${mcpsrc.dir}/minecraft/lang/abo"/>
<delete dir="${mcpsrc.dir}/minecraft/lang/buildcraft"/>
<delete dir="${mcpsrc.dir}/minecraft/changelog"/>
</target>
<target name="main" depends="clean,setup,copy-src,compile,copy,package">
<echo message="Finished building ABO"/>
</target>
</project>