forked from VazkiiMods/Botania
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
107 lines (87 loc) · 4.05 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
<?xml version="1.0" ?>
<project name="Botania" default="build">
<property file="build.properties" prefix="build"/>
<property file="ftp.properties" prefix="ftp"/>
<target name="clean">
<delete dir="${build.dir.gradle}\build\classes\main" />
<delete dir="${build.dir.gradle}\src\main\java\vazkii" />
<delete file="${build.dir.gradle}\src\main\java\mcmod.info" />
<delete dir="${build.dir.gradle}\src\api\java\thaumcraft" />
<delete dir ="${build.dir.temp}" />
</target>
<target name="increment_build_number">
<propertyfile file="build.properties">
<entry key="build_number" type="int" operation="+" default="1"/>
</propertyfile>
<concat destfile="${build.dir.repo}\web\versions.ini" append="true" fixlastline="true">${line.separator}${build.version}-${build.build_number}=${build.mc_version}</concat>
<echo file="${build.dir.repo}\version\${build.mc_version}.txt">${build.version}-${build.build_number}</echo>
</target>
<target name="prep">
<mkdir dir="${build.dir.temp}" />
<copy todir="${build.dir.temp}">
<fileset dir="${build.dir.repo}\resources\" />
</copy>
<copy todir="${build.dir.gradle}\src\main\java">
<fileset dir="${build.dir.repo}\MODSRC\" />
</copy>
<copy todir="${build.dir.gradle}\src\api\java">
<fileset dir="${build.dir.repo}\apis\" />
</copy>
</target>
<target name="replace_tokens">
<replace dir="${build.dir.temp}" token="ANT:VERSION" value="${build.version}" />
<replace dir="${build.dir.temp}" token="ANT:BUILD" value="${build.build_number}" />
<replace dir="${build.dir.gradle}\src\main\java" token="ANT:VERSION" value="${build.version}" />
<replace dir="${build.dir.gradle}\src\main\java" token="ANT:BUILD" value="${build.build_number}" />
</target>
<target name="gradle_build">
<copy todir="${build.dir.gradle}" overwrite="true">
<fileset file="${build.dir.repo}\build.gradle"/>
</copy>
<exec dir="${build.dir.gradle}" executable="cmd" osfamily="windows">
<arg line="/c gradle build" />
</exec>
<exec dir="${build.dir.gradle}" executable="gradle" osfamily="unix">
<arg value="build" />
</exec>
<move file="${build.dir.gradle}\build\libs\modid-1.0.jar" tofile="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar" />
</target>
<target name="inject_assets">
<jar update="true" destfile="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar">
<fileset dir="${build.dir.temp}" excludes="**/psd/**" />
</jar>
<delete dir ="${build.dir.temp}" />
</target>
<target name="forgecraft">
<delete>
<fileset dir="${build.dir.forgecraft}" includes="**/${build.mod_name}*" />
</delete>
<copy file="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar" todir="${build.dir.forgecraft}" />
</target>
<target name="upload">
<ftp action="mkdir" server="${ftp.host}" remotedir="/files" userid="${ftp.user}" password="${ftp.pass}" verbose="yes" depends="yes" />
<ftp action="send" server="${ftp.host}" remotedir="/files" userid="${ftp.user}" password="${ftp.pass}" verbose="yes" depends="yes">
<fileset file="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar" />
</ftp>
<ftp action="send" server="${ftp.host}" remotedir="." userid="${ftp.user}" password="${ftp.pass}" verbose="yes" depends="yes">
<fileset file="${build.dir.repo}web/changelog.txt" />
<fileset file="${build.dir.repo}web/versions.ini" />
</ftp>
</target>
<target name="deploy_website">
<ftp action="send" server="${ftp.host}" remotedir="." userid="${ftp.user}" password="${ftp.pass}" verbose="yes" depends="yes">
<fileset dir="${build.dir.repo}web" />
</ftp>
</target>
<target name="build">
<antcall target="clean" />
<antcall target="prep" />
<antcall target="replace_tokens" />
<antcall target="gradle_build" />
<antcall target="inject_assets" />
<antcall target="increment_build_number" />
<antcall target="clean" />
<antcall target="forgecraft" />
<antcall target="upload" />
</target>
</project>