-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
158 lines (122 loc) · 5.1 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
<project name="dyna-core" default="jar">
<property name="tmp.path" location="tmp" />
<property name="build.path" location="${tmp.path}/classes-core" />
<property name="dist.path" location="${tmp.path}/dist" />
<property name="website.path" location="${tmp.path}/webstart" />
<property name="obfuscated.dir" location="${tmp.path}/obfuscated" />
<property file="VERSION" />
<tstamp>
<format property="build.tstamp" pattern="MMM dd, yyyy, HH:mmZ" locale="en_US" />
</tstamp>
<filterset id="replacements">
<filter token="VERSION" value="${version}" />
<filter token="BUILD.TSTAMP" value="${build.tstamp}" />
</filterset>
<property name="debug" value="on" />
<property name="optimize" value="off" />
<property name="src.java" location="src/java" />
<!-- Paths and filesets. -->
<fileset dir="lib" includes="runtime*/*.jar" id="classpath.runtime" />
<path id="classpath.compile">
<fileset refid="classpath.runtime" />
</path>
<target name="clean" description="Clean generated files.">
<delete includeemptydirs="true">
<fileset dir="${tmp.path}">
<exclude name="eclipse/**" />
</fileset>
</delete>
</target>
<target name="compile" description="Compile source code.">
<mkdir dir="${build.path}" />
<javac destdir="${build.path}" debug="${debug}" optimize="${optimize}" deprecation="on" includeAntRuntime="no" includeJavaRuntime="no"
encoding="UTF-8">
<src location="${src.java}" />
<classpath refid="classpath.compile" />
</javac>
<copy todir="${build.path}">
<fileset dir="${src.java}">
<exclude name="**/*.java" />
<exclude name="**/about.txt" />
</fileset>
<fileset dir="src/boards" />
<fileset dir="src/graphics" />
<fileset dir="src/audio" />
</copy>
<copy todir="${build.path}" encoding="UTF-8" filtering="true" overwrite="true">
<fileset dir="${src.java}">
<include name="**/about.txt" />
</fileset>
<filterset refid="replacements" />
</copy>
</target>
<target name="jar" depends="compile" description="Compile the core JAR.">
<mkdir dir="${dist.path}" />
<jar jarfile="${dist.path}/jdyna-core.jar" basedir="${build.path}" />
<copy todir="${dist.path}" flatten="true">
<fileset refid="classpath.runtime" />
</copy>
</target>
<target name="webstart" depends="obfuscate">
<mkdir dir="${website.path}" />
<copy todir="${website.path}">
<fileset dir="src/website" />
</copy>
<copy todir="${website.path}" encoding="UTF-8" filtering="true" overwrite="true">
<fileset dir="src/website">
<include name="**/*.html" />
</fileset>
<filterset refid="replacements" />
</copy>
<copy todir="${website.path}/play">
<fileset dir="${obfuscated.dir}" includes="*.jar" />
<fileset dir="src/webstart">
<exclude name="**/*.keystore" />
</fileset>
</copy>
<mkdir dir="${website.path}/play/native/win32" />
<jar destfile="${website.path}/play/native/win32/lwjgl.jar">
<fileset dir="lib/native/win32" />
</jar>
<mkdir dir="${website.path}/play/native/macosx" />
<jar destfile="${website.path}/play/native/macosx/lwjgl.jar">
<fileset dir="lib/native/macosx" />
</jar>
<mkdir dir="${website.path}/play/native/linux" />
<jar destfile="${website.path}/play/native/linux/lwjgl.jar">
<fileset dir="lib/native/linux" />
</jar>
<property name="keystore.alias" value="jdyna.com" />
<property name="keystore.password" value="jdyna rocks" />
<property name="keystore" value="src/webstart/jdyna.com.keystore" />
<signjar alias="${keystore.alias}" storepass="${keystore.password}" keystore="${keystore}">
<fileset dir="${website.path}">
<include name="**/*.jar" />
</fileset>
</signjar>
</target>
<target name="obfuscate" depends="jar">
<available file="${java.home}/lib/rt.jar" property="rt.libs.available" type="file" value="true" />
<fail unless="rt.libs.available">Runtime Java libraries are needed for obfuscation. They are not found in the default path: ${java.home}/lib</fail>
<mkdir dir="${obfuscated.dir}" />
<pathconvert property="include.jars">
<path refid="classpath.compile" />
</pathconvert>
<pathconvert property="library.jars">
<path location="${java.home}/lib/rt.jar" />
</pathconvert>
<echo file="${obfuscated.dir}/jdyna.pro"><![CDATA[
-printmapping ${obfuscated.dir}/obfuscation-mapping.txt
-printseeds ${obfuscated.dir}/obfuscation-seeds.txt
-injar ${dist.path}/jdyna-core.jar
-injar ${include.jars}
-libraryjar ${library.jars}
-outjar ${obfuscated.dir}/jdyna.jar
@${basedir}/etc/obfuscation.pro
]]>
</echo>
<java jar="lib/proguard.jar" fork="true" maxmemory="256m">
<arg value="@${obfuscated.dir}/jdyna.pro" />
</java>
</target>
</project>