This repository has been archived by the owner on May 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
231 lines (173 loc) · 8.77 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
<project name="NEM-VersionChecker" basedir="../" default="main">
<property environment="env"/>
<!-- Properties -->
<property name="build.dir" value="build"/>
<property name="src.dir" value="src"/>
<property name="test.dir" value="test"/>
<property name="sign.dir" value="/home/jenkins/.sign"/>
<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="lib.dir" value="${build.dir}/lib"/>
<property name="forge.dir" value="${build.dir}/forge"/>
<property name="mcp.dir" value="${forge.dir}/mcp"/>
<property name="clientsrc.dir" value="${mcp.dir}/src/minecraft"/>
<property name="commonsrc.dir" value="${clientsrc.dir}"/>
<property name="minecraftsrc.dir" value="${mcp.dir}/src/minecraft"/>
<property file="${minecraftsrc.dir}/fmlversion.properties" />
<property name="downloadserver" value="http://rs485.theZorro266.com"/>
<property name="downloadserver.dir" value="external/"/>
<property name="downloadserver.full" value="${downloadserver}/${downloadserver.dir}"/>
<property name="antcont.version" value="1.0b3"/>
<property name="mc.version" value="1.6.2"/>
<property name="forge.version" value="9.10.0.837"/>
<property name="lombok.version" value="0.11.8"/>
<property name="jarjar.version" value="1.4"/>
<property name="gson.version" value="2.2.4"/>
<property name="nem-vc.version" value="0.2.0"/>
<property name="nem-vc.version.full" value="${nem-vc.version}.${BUILD_NUMBER}"/>
<!-- Targets -->
<target name="init-msg">
<echo message="Starting build for ${nem-vc.version.full} for MC ${mc.version}"/>
</target>
<target name="download">
<mkdir dir="${download.dir}"/>
<get src="http://files.minecraftforge.net/minecraftforge/minecraftforge-src-${mc.version}-${forge.version}.zip" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}ant-contrib-${antcont.version}-bin.zip" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}jarjar-${jarjar.version}.jar" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}gson-${gson.version}.jar" dest="${download.dir}" usetimestamp="True"/>
<get src="${downloadserver.full}lombok-${lombok.version}.jar" dest="${download.dir}" usetimestamp="True"/>
<echo message="Download finished"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
<echo message="Cleaned."/>
</target>
<target name="check-setup-forge" depends="download, clean">
<available file="${download.dir}/minecraftforge-setup-${mc.version}-${forge.version}.zip" property="setup.forge.present"/>
</target>
<target name="setup-forge" depends="check-setup-forge" unless="setup.forge.present">
<unzip dest="${build.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="minecraftforge-src-${mc.version}-${forge.version}.zip"/>
</fileset>
</unzip>
<!-- Set executable permission on forge's *.sh -->
<chmod dir="${forge.dir}" perm="a+rx" includes="**.sh"/>
<!-- Install forge -->
<echo message="Starting forge install process"/>
<exec dir="${forge.dir}" executable="cmd" osfamily="windows" failonerror="true">
<arg value="/c"/>
<arg value="install.cmd"/>
</exec>
<exec dir="${forge.dir}" executable="sh" osfamily="unix" failonerror="true">
<arg value="install.sh"/>
</exec>
<echo message="Forge installation finished"/>
<zip destfile="${download.dir}/minecraftforge-setup-${mc.version}-${forge.version}.zip" basedir="${build.dir}"/>
<echo message="Zipped Forge for faster access next builds"/>
</target>
<target name="unzip-forge" depends="check-setup-forge" if="setup.forge.present">
<unzip dest="${build.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="minecraftforge-setup-${mc.version}-${forge.version}.zip"/>
</fileset>
</unzip>
<echo message="Unzipped Forge. \o/"/>
</target>
<target name="setup" depends="unzip-forge, setup-forge">
<copy file="${download.dir}/lombok-${lombok.version}.jar" todir="${mcp.dir}/lib"/>
<copy file="${download.dir}/gson-${gson.version}.jar" todir="${mcp.dir}/lib"/>
<echo message="Setup finished"/>
</target>
<target name="copySRC" >
<unzip dest="${lib.dir}" failOnEmptyArchive="true">
<fileset dir="${download.dir}">
<include name="ant-contrib-${antcont.version}-bin.zip"/>
</fileset>
</unzip>
<!-- Pull in ant-contrib for if task -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${lib.dir}/ant-contrib/ant-contrib-${antcont.version}.jar"/>
</classpath>
</taskdef>
<echo message="Loaded ant-contrib"/>
<!-- Delete nem-vc source in build space -->
<delete dir="${minecraftsrc.dir}/rs485/nem/versionchecker"/>
<!-- Copy nem-vc source -->
<copy todir="${minecraftsrc.dir}">
<fileset dir="${src.dir}/common"/>
</copy>
<replace file="${minecraftsrc.dir}/rs485/nem/versionchecker/NEMVersionChecker.java" token="%VERSION%" value="${nem-vc.version.full}"/>
<replace file="${minecraftsrc.dir}/rs485/nem/versionchecker/NEMVersionChecker.java" token="%MCVERSION%" value="${mc.version}"/>
<echo message="Loading FingerPrint"/>
<if>
<available file="${sign.dir}/.fingerprint"/>
<then>
<loadfile property="fingerprint" srcFile="${sign.dir}/.fingerprint"/>
<replace file="${minecraftsrc.dir}/rs485/nem/versionchecker/NEMVersionChecker.java" token="%------------CERTIFICATE-SUM-----------%" value='*/ certificateFingerprint="${fingerprint}", /*'/>
</then>
</if>
</target>
<target name="compile" depends="copySRC">
<echo message="Compiling version ${nem-vc.version.full}"/>
<!-- Recompile -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
<arg line="/c recompile.bat --client"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix" failonerror="true">
<arg line="recompile.sh --client"/>
</exec>
<!-- Reobf -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
<arg line="/c reobfuscate_srg.bat --client"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix" failonerror="true">
<arg line="reobfuscate_srg.sh --client"/>
</exec>
<!-- Copy LP classes -->
<copy todir="${classes.dir}/client">
<fileset dir="${mcp.dir}/reobf/minecraft"/>
</copy>
<!-- Copy mcmod.info -->
<copy todir="${classes.dir}/client">
<fileset dir="${src.dir}/resources"></fileset>
</copy>
<replace file="${classes.dir}/client/mcmod.info" token="%VERSION%" value="${nem-vc.version.full}"/>
<replace file="${classes.dir}/client/mcmod.info" token="%MCVERSION%" value="${mc.version}"/>
<echo message="Compiling finished"/>
</target>
<target name="package-simple" depends="compile">
<echo message="Packing version ${nem-vc.version.full}"/>
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="${download.dir}/jarjar-${jarjar.version}.jar"/>
<jarjar destfile="${jar.dir}/NEM-VersionChecker-MC${mc.version}-${nem-vc.version.full}.jar" basedir="${classes.dir}/client">
<zipfileset src="${download.dir}/gson-${gson.version}.jar"/>
<rule pattern="com.google.gson.**" result="rs485.nem.versionchecker.com.google.gson.@1"/>
</jarjar>
<echo message="Packing finished"/>
</target>
<target name="package-sign" depends="compile">
<echo message="Loading SignSettings"/>
<loadfile property="key" srcFile="${sign.dir}/.key"/>
<echo message="Packing version ${nem-vc.version.full}"/>
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="${download.dir}/jarjar-${jarjar.version}.jar"/>
<jarjar destfile="${jar.dir}/NEM-VersionChecker-MC${mc.version}-${nem-vc.version.full}.jar" basedir="${classes.dir}/client">
<zipfileset src="${download.dir}/gson-${gson.version}.jar"/>
<rule pattern="com.google.gson.**" result="rs485.nem.versionchecker.com.google.gson.@1"/>
<manifest>
<attribute name="Built-By" value="RS485-Jenkins"/>
<attribute name="Implementation-Vendor" value="RS485"/>
<attribute name="Implementation-Title" value="NEM-VersionChecker"/>
<attribute name="Implementation-Version" value="${nem-vc.version.full}"/>
</manifest>
</jarjar>
<signjar jar="${jar.dir}/NEM-VersionChecker-MC${mc.version}-${nem-vc.version.full}.jar" alias="RS485" keystore="${sign.dir}/.keystore" storepass="${key}"/>
<echo message="Packing finished"/>
</target>
<target name="main" depends="init-msg, setup, package-simple"/>
<target name="ci" depends="init-msg, setup, package-sign"/>
</project>