forked from Cloudhunter/OpenCCSensors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
149 lines (111 loc) · 4.17 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
<!-- nallar's BuildCraft ant build script edited for OpenCCSensors -->
<project name="OpenCCSensors" default="main">
<property environment="env"/>
<!-- Properties -->
<property name="build.dir" value="build"/>
<property name="src.dir" value="src"/>
<property name="download.dir" value="download"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/dist"/>
<property name="forge.dir" value="${build.dir}/forge"/>
<property name="mcp.dir" value="${forge.dir}/mcp"/>
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft"/>
<property name="mc.version" value="1.6.4"/>
<property name="forge.version" value="9.11.1.953"/>
<property name="mod.version" value="1.6.4.1"/>
<property name="mod.name" value="OpenCCSensors"/>
<property name="forge.name" value="minecraftforge-src-${mc.version}-${forge.version}.zip"/>
<available property="forge-exists" file="${download.dir}/${forge.name}"/>
<condition property="out-of-date">
<not>
<and>
<available file="${download.dir}/${forge.name}"/>
<available file="${mcpsrc.dir}"/>
</and>
</not>
</condition>
<mkdir dir="${download.dir}"/>
<!-- Targets -->
<!-- Clear build directory -->
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<!-- Set full version -->
<target name="initialize-version">
<echo message="Starting build for ${mod.name} v${mod.version}"/>
</target>
<!-- Download necessary files -->
<target name="download-files" depends="download-forge"/>
<!-- Download forge (if it doesn't exist) -->
<target name="download-forge" unless="forge-exists" >
<get src="http://files.minecraftforge.net/${forge.name}" dest="${download.dir}" usetimestamp="True"/>
</target>
<!-- Setup mcp and forge -->
<target name="setup" depends="download-files" if="out-of-date">
<delete dir="${mcp.dir}"/>
<delete dir="${forge.dir}"/>
<!-- Unzip them -->
<unzip dest="${build.dir}" src="${download.dir}/${forge.name}"/>
<!-- Install forge -->
<exec dir="${forge.dir}" executable="cmd" osfamily="windows">
<arg line="/c install.cmd"/>
</exec>
<exec dir="${forge.dir}" executable="sh" osfamily="unix">
<arg value="install.sh"/>
</exec>
</target>
<target name="compile" depends="initialize-version,setup">
<delete dir="${classes.dir}"/>
<mkdir dir="${classes.dir}"/>
<copy todir="${mcpsrc.dir}">
<fileset dir="${src.dir}"/>
<filterset>
<filter token="VERSION" value="${mod.version}"/>
</filterset>
</copy>
<!-- 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>
<!-- 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}/openccsensors">
<fileset dir="${mcp.dir}/reobf/minecraft/openccsensors" />
</copy>
<!-- Copy resources -->
<copy todir="${classes.dir}/assets/openccsensors">
<fileset dir="assets/openccsensors" />
</copy>
<!-- Copy resources -->
<copy todir="${classes.dir}">
<fileset dir="." includes="mcmod.info" />
</copy>
<!-- Reset src dir to post-forge-install state -->
<delete dir="${mcpsrc.dir}/am2"/>
<delete dir="${mcpsrc.dir}/appeng"/>
<delete dir="${mcpsrc.dir}/buildcraft"/>
<delete dir="${mcpsrc.dir}/dan200"/>
<delete dir="${mcpsrc.dir}/forestry"/>
<delete dir="${mcpsrc.dir}/ic2"/>
<delete dir="${mcpsrc.dir}/openccsensors"/>
<delete dir="${mcpsrc.dir}/thaumcraft"/>
<delete dir="${mcpsrc.dir}/universalelectricity"/>
</target>
<!-- Package the compiled files -->
<target name="package" depends="compile">
<delete dir="${jar.dir}"/>
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${mod.name}-${mod.version}.jar" basedir="${classes.dir}"/>
</target>
<!-- Default target to run -->
<target name="main" depends="package"/>
</project>