forked from TPPIDev/TPPI-Tweaks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
129 lines (114 loc) · 5.42 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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project>
<project name="GenericForgeMod" default="build">
<description>Generic ForgeMod Builder</description>
<target name="init">
<!-- load properties from files -->
<property file="build.properties"/>
<property file="mod.properties"/>
<property name="version" value="${version.number}-${version.build}"/>
<!-- base dirs -->
<property name="dev.home" location="${dir.project}"/>
<property name="mcp.home" location="${dir.mcp}"/>
<property name="release.home" location="${dir.release}"/>
<property name="release.zip" value="${mod.id}_${version}.jar"/>
<!-- setup python -->
<property name="python.win" location="${mcp.home}/runtime/bin/python/python_mcp"/>
<condition property="python" value="${python.win}" else="python">
<os family="Windows"/>
</condition>
<!-- setup source dirs -->
<property name="dev.src" location="${dev.home}/src"/>
<property name="dev.resources" location="${dev.home}/resources"/>
<!-- check if the directories are present -->
<condition property="has.dev.src" value="true" else="false">
<available file="${dev.src}" type="dir"/>
</condition>
<condition property="has.dev.resources" value="true" else="false">
<available file="${dev.resources}" type="dir"/>
</condition>
<!-- setup MCP dirs -->
<property name="mcp.src" location="${mcp.home}/src"/>
<property name="mcp.src.minecraft" location="${mcp.src}/minecraft"/>
<property name="mcp.bin" location="${mcp.home}/reobf/minecraft"/>
</target>
<target name="clean">
<!-- clean minecraft sources -->
<delete includeemptydirs="true" verbose="true" failonerror="false">
<fileset dir="${mcp.src.minecraft}">
<present present="both" targetdir="${dev.src}"/>
</fileset>
</delete>
<!-- clean classes -->
<delete includeemptydirs="true" verbose="true" failonerror="false">
<fileset dir="${mcp.bin}"/>
</delete>
</target>
<target name="merge-source">
<!-- merge sources -->
<antcall target="merge-mod"/>
</target>
<target name="merge-mod" if="${has.dev.src}">
<!-- merge minecraft sources -->
<copy todir="${mcp.src.minecraft}" overwrite="true" verbose="true">
<fileset dir="${dev.src}" includes="**/*.java"/>
</copy>
</target>
<target name="recompile">
<!-- recompile -->
<exec executable="${python}" dir="${mcp.home}" failonerror="true">
<arg value="${mcp.home}/runtime/recompile.py"/>
</exec>
</target>
<target name="reobfuscate">
<!-- reobfuscate -->
<exec executable="${python}" dir="${mcp.home}" failonerror="true">
<arg value="${mcp.home}/runtime/reobfuscate.py"/>
<arg value="--srgnames"/>
</exec>
</target>
<target name="build-Forge-zip">
<!-- build the jar -->
<zip destfile="${release.home}/${release.zip}">
<fileset dir="${mcp.bin}" includes="tppitweaks/**/*.class"/>
<fileset dir="${dev.resources}">
<exclude name="mcmod.template"/>
</fileset>
<mappedresources>
<concat>
<fileset dir="${dev.resources}" includes="mcmod.template"/>
<filterchain>
<replacetokens>
<token key="AUTHORS" value="${mod.authors}"/>
<token key="CREDITS" value="${mod.credits}"/>
<token key="DEPENDANTS" value="${mod.dependants}"/>
<token key="DEPENDENCIES" value="${mod.Forge.dependencies}"/>
<token key="DESCRIPTION" value="${mod.description}"/>
<token key="LOGOFILE" value="${mod.logoFile}"/>
<token key="MCVERSION" value="${version.minecraft}"/>
<token key="MODID" value="${mod.id}"/>
<token key="MODNAME" value="${mod.name}"/>
<token key="PARENT" value="${mod.parent}"/>
<token key="REQUIREDMODS" value="${mod.Forge.requiredMods}"/>
<token key="SCREENSHOTS" value="${mod.screenshots}"/>
<token key="UPDATEURL" value="${mod.Forge.updateUrl}"/>
<token key="URL" value="${mod.url}"/>
<token key="USEDEPENDANCYINFORMATION" value="${mod.useDependencyInformation}"/>
<token key="VERSION" value="${version}"/>
</replacetokens>
</filterchain>
</concat>
<mergemapper to="mcmod.info"/>
</mappedresources>
</zip>
</target>
<target name="build" depends="init">
<!-- build the project and clean up MCP after -->
<antcall target="clean"/>
<antcall target="merge-source"/>
<antcall target="recompile"/>
<antcall target="reobfuscate"/>
<antcall target="build-Forge-zip"/>
<antcall target="clean"/>
</target>
</project>