-
Notifications
You must be signed in to change notification settings - Fork 36
/
build.xml
139 lines (121 loc) · 4.12 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
<project name="rscplus" default="run">
<property name="main.src.dir" value="src" />
<property name="main.build.dir" value="build/main" />
<property name="test.src.dir" value="test" />
<property name="test.build.dir" value="build/test" />
<property name="dist.dir" value="dist" />
<property name="bin.dir" value="bin" />
<property name="assets.dir" value="assets" />
<property name="jinput-natives.dir" value="lib/jinput-natives" />
<property name="tools.dir" value="tools" />
<property name="doc.dir" value="doc" />
<property name="jar.main-class" value="Client.Launcher" />
<property name="jar.name" value="${ant.project.name}.jar" />
<property name="jar.file" value="${dist.dir}/${jar.name}" />
<tstamp>
<format property="calculatedVersion"
pattern="yyyyMMdd.HHmmss"
timezone="GMT" />
</tstamp>
<path id="classpath.main">
<fileset dir="${basedir}">
<include name="lib/*.jar" />
<exclude name="lib/junit-*.jar" />
<exclude name="lib/hamcrest-core-*.jar" />
</fileset>
</path>
<path id="classpath.test">
<fileset dir="${basedir}">
<include name="lib/junit-*.jar" />
<include name="lib/hamcrest-core-*.jar" />
</fileset>
<pathelement location="${main.build.dir}"/>
</path>
<pathconvert property="classpath.jar" pathsep=";">
<path refid="classpath.main"/>
<mapper>
<chainedmapper>
<flattenmapper />
<globmapper from="*.jar" to="lib/*.jar" />
</chainedmapper>
</mapper>
</pathconvert>
<target name="setversion">
<replaceregexp
file="${main.src.dir}/Client/Settings.java"
match="VERSION_NUMBER = (.*)"
replace="VERSION_NUMBER = ${calculatedVersion};"
byline="true"
/>
<echo message="Replaced version number in Settings.java with ${calculatedVersion}" />
<echo message="Run ant dist now to compile." />
</target>
<target name="compile">
<mkdir dir="${main.build.dir}" />
<javac srcdir="${main.src.dir}" destdir="${main.build.dir}" includeantruntime="false" encoding="UTF-8">
<classpath refid="classpath.main" />
</javac>
</target>
<target name="format-source">
<apply executable="java">
<arg line="-jar ${tools.dir}/google-java-format-1.6-all-deps.jar" />
<arg value="--replace" />
<srcfile />
<fileset dir="${main.src.dir}" includes="**/**.java" />
</apply>
</target>
<target name="test-compile" depends="compile">
<mkdir dir="${test.build.dir}"/>
<javac srcdir="${test.src.dir}" destdir="${test.build.dir}" includeantruntime="false">
<classpath refid="classpath.test"/>
</javac>
</target>
<target name="test" depends="test-compile">
<junit printsummary="on" haltonfailure="yes" fork="true">
<classpath>
<path refid="classpath.test"/>
<pathelement location="${test.build.dir}"/>
</classpath>
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${test.src.dir}" includes="**/*Test.java" />
</batchtest>
</junit>
</target>
<target name="dist" depends="compile">
<mkdir dir="${bin.dir}" />
<mkdir dir="${dist.dir}" />
<jar destfile="${jar.file}" basedir="${main.build.dir}">
<manifest>
<attribute name="Main-Class" value="${jar.main-class}"/>
</manifest>
<fileset dir=".">
<include name="${assets.dir}/**" />
<include name="${main.src.dir}/Client/FlatLaf/*.properties" />
<include name="${jinput-natives.dir}/**" />
<include name="LICENSE" />
</fileset>
<zipgroupfileset dir="lib" includes="*.jar" excludes="junit-*.jar,hamcrest-core-*.jar" />
</jar>
</target>
<target name="distrun" depends="dist">
<java jar="${jar.file}" dir="${bin.dir}" fork="true" />
</target>
<target name="run" depends="compile">
<java classname="Client.Launcher" fork="true">
<classpath>
<path refid="classpath.main"/>
<pathelement location="${main.build.dir}"/>
</classpath>
</java>
</target>
<target name="clean">
<delete dir="${main.build.dir}" />
<delete dir="${test.build.dir}" />
<delete dir="${bin.dir}" />
<delete dir="${doc.dir}" />
</target>
<target name="doc" description="Generate JavaDocs">
<javadoc access="private" classpath="${classpath.jar}" sourcepath="${main.src.dir}" destdir="${doc.dir}" source="1.8" use="true" />
</target>
</project>