-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
169 lines (134 loc) · 4.91 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
<project name="AestusCraft" default="main">
<property environment="env"/>
<!-- Properties -->
<dirname property="imported.basedir" file="${ant.file.AestusCraft}"/>
<property name="build.dir" value="build"/>
<property name="src.dir" value="${imported.basedir}"/>
<property name="resources.dir" value="${imported.basedir}/resources"/>
<property name="download.dir" value="download"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="bin"/>
<property name="forge.dir" value="../../forge"/>
<property name="mcp.dir" value="${forge.dir}/mcp"/>
<property name="mcpsrc.dir" value="${mcp.dir}/src"/>
<property name="mc.version" value="1.6.2"/>
<property name="aestuscraft.name" value="aestuscraft"/>
<available file="${src.dir}/.git" type="dir" property="git.present"/>
<!-- Targets -->
<!-- Clear build directory -->
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<!-- Set full version -->
<target name="initialize-version" depends="git.revision">
<property name="project.version.full" value="${project.version}"/>
</target>
<target name="git.revision">
<exec executable="git" dir="${src.dir}" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="describe"/>
<arg value="--tags"/>
</exec>
<loadresource property="git.clean.revision">
<propertyresource name="git.revision"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replaceregex pattern="-[a-z0-9]+$" replace=""/>
<replacestring from="-" to="."/>
</tokenfilter>
</filterchain>
</loadresource>
<condition property="project.version" value="${git.clean.revision}" else="0.0.0">
<and>
<isset property="git.clean.revision"/>
<length string="${git.clean.revision}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<condition property="project.complete.version" value="${git.revision}" else="0.0.0">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<echo>Building aestuscraft version ${project.complete.version} (${project.version})</echo>
</target>
<target name="clean-src">
<delete verbose="false" includeemptydirs="true">
<fileset dir="${mcpsrc.dir}/minecraft" >
<present present="both" targetdir="${src.dir}/aestuscraft_common" />
</fileset>
</delete>
</target>
<target name="copy-src" depends="clean-src,initialize-version">
<!-- Copy sources -->
<copy todir="${mcpsrc.dir}/minecraft" verbose="true">
<fileset dir="${src.dir}/aestuscraft_common"/>
<filterset>
<filter token="VERSION" value="${project.complete.version}" />
<filter token="BUILD_NUMBER" value="${build.number}" />
</filterset>
</copy>
</target>
<target name="compile" depends="initialize-version,copy-src">
<mkdir dir="${classes.dir}"/>
<delete includeemptydirs="true">
<fileset dir="${classes.dir}" includes="**/*"/>
</delete>
<!-- Recompile -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
<arg line="/c recompile.bat"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
<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>
</target>
<target name="reobf" depends="compile">
<!-- Reobfuscate -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
<arg line="/c reobfuscate_srg.bat"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
<arg value="reobfuscate_srg.sh"/>
</exec>
<!-- Copy classes -->
<copy todir="${classes.dir}" includeEmptyDirs="false">
<fileset dir="${mcp.dir}/reobf/minecraft">
<exclude name="cpw/mods/fml/**"/>
<exclude name="ibxm/**"/>
<exclude name="net/minecraft/**"/>
<exclude name="net/minecraftforge/**"/>
<exclude name="paulscode/**"/>
</fileset>
</copy>
<!-- Copy resources -->
<copy todir="${classes.dir}">
<fileset dir="${resources.dir}">
<exclude name="build.xml"/>
</fileset>
</copy>
<!-- Reset src dir to post-forge-install state -->
<antcall target="clean-src"/>
</target>
<!-- Package the compiled files -->
<target name="package" depends="reobf">
<mkdir dir="${jar.dir}"/>
<delete includeemptydirs="true">
<fileset dir="${jar.dir}" includes="**/*"/>
</delete>
<property name="jar.file.name" value="${jar.dir}/${aestuscraft.name}-${mc.version}-${project.version.full}.jar"/>
<jar destfile="${jar.file.name}" basedir="${classes.dir}"/>
<!--<copy todir="${jar.dir}/changelog">
<fileset dir="${resources.dir}/changelog">
<include name="*" />
</fileset>
</copy> --> <!-- FIXIT -->
</target>
<!-- Default target to run -->
<target name="main" depends="package"/>
</project>