-
Notifications
You must be signed in to change notification settings - Fork 56
/
build.xml
252 lines (224 loc) · 9.09 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?xml version="1.0"?>
<project name="CRG ScoreBoard" default="test">
<property name="ant.build.javac.source" value="1.8"/>
<property name="ant.build.javac.target" value="1.8"/>
<property name="src.dir" value="src"/>
<property name="dest.dir" value="bin"/>
<property name="test.run" value="*" />
<property name="test.src.dir" value="tests" />
<property name="test.build.dir" value="test-bin" />
<property name="jdoc.dir" value="jdoc"/>
<property name="version.dest.dir" value="${dest.dir}/com/carolinarollergirls/scoreboard/version"/>
<property name="version.release.file" value="release.properties"/>
<property name="compile.deprecation" value="true"/>
<property name="compile.debug" value="true"/>
<property name="compile.nowarn" value="false"/>
<property name="compile.verbose" value="false"/>
<property name="jar.dir" value="lib"/>
<property name="jar.file" value="crg-scoreboard.jar"/>
<property name="manifest.file" value="crg-scoreboard.mf"/>
<available property="manifest.exists" file="${jar.dir}/${manifest.file}" />
<property name="launch4j.dir" value="launch4j"/>
<property name="launch4j.outfile" value="scoreboard-Windows.exe"/>
<property name="release.dir" value="release" />
<property name="android.dir" value="android" />
<property name="clean.verbose" value="false"/>
<property name="clean.quiet" value="false"/>
<property name="one-jar.dist.dir" value="one-jar"/>
<import file="${one-jar.dist.dir}/one-jar-ant-task.xml" optional="true" />
<path id="classpath.test">
<pathelement location="test-libs/junit-4.13.2.jar"/>
<pathelement location="test-libs/hamcrest-2.2.jar"/>
<pathelement location="test-libs/mockito-core-4.2.0.jar"/>
<pathelement location="test-libs/byte-buddy-1.12.6.jar"/>
<pathelement location="test-libs/byte-buddy-agent-1.12.6.jar"/>
<pathelement location="test-libs/objenesis-3.2.jar"/>
<fileset dir="${jar.dir}" includes="deps/*.jar" />
<pathelement location="${dest.dir}"/>
</path>
<!-- Show help (the different options for this build.xml) -->
<target name="help">
<echo message="Buildfile for CRG ScoreBoard"/>
<echo message=""/>
<echo message="Targets:"/>
<echo message=""/>
<echo message=" all clean compile"/>
<echo message=" clean Clean everything"/>
<echo message=" compile Compile all classes and create jarfile"/>
<echo message=" test Compile all classes and run unit tests (default)"/>
<echo message=" launcher Create Windows scoreboard.exe"/>
<echo message=" manifest (Re)create the manifest file"/>
<echo message=" help Show this help"/>
<echo message=" jdoc Create JavaDOC"/>
<echo message=" release Create release zip file based on a git tag"/>
<echo message=" zip Create non-release zip file"/>
<echo message=""/>
</target>
<!-- Determine version -->
<target name="-version">
<exec executable="git" outputproperty="version.git">
<arg line="describe --tags --always --dirty"/>
</exec>
<exec executable="git" outputproperty="version.commit">
<arg line="describe --exclude * --always --abbrev=100"/>
</exec>
<tstamp>
<format property="version.time" pattern="yyyyMMddHHmmss" />
</tstamp>
<hostinfo prefix="host"/>
<condition property="version" value="${version.git}-${version.time}" else="${version.git}">
<isfalse value="${isRelease}"/>
</condition>
<mkdir dir="${version.dest.dir}"/>
<propertyfile file="${version.dest.dir}/${version.release.file}">
<entry key="release" value="${version}"/>
<entry key="release.commit" value="${version.commit}"/>
<entry key="release.user" value="${user.name}"/>
<entry key="release.time" value="${version.time}"/>
<entry key="release.host" value="${host.NAME}"/>
</propertyfile>
</target>
<!-- Compile source files -->
<target name="compile" depends="-version,-manifest" >
<mkdir dir="${dest.dir}"/>
<mkdir dir="html/images/teamlogo" />
<mkdir dir="html/images/sponsor_banner" />
<javac srcdir="."
destdir="${dest.dir}"
deprecation="${compile.deprecation}"
debug="${compile.debug}"
verbose="${compile.verbose}"
nowarn="${compile.nowarn}"
includeAntRuntime="false"
includes="${src.dir}/com/carolinarollergirls/scoreboard/**" >
<compilerarg value="-Xlint:all"/>
<compilerarg value="-Xlint:-serial"/>
<compilerarg value="-Xlint:-options"/>
<classpath>
<fileset dir="${jar.dir}" includes="deps/*.jar" />
</classpath>
</javac>
<copy todir="${dest.dir}">
<fileset dir="${src.dir}" includes="**/*.properties"/>
</copy>
<mkdir dir="${jar.dir}"/>
<one-jar destfile="${jar.dir}/${jar.file}" manifest="${jar.dir}/one-jar.mf" mainmanifest="${jar.dir}/${manifest.file}">
<main>
<!-- Construct main.jar from classes and source code -->
<fileset dir="${dest.dir}" excludes="**/*.java" />
</main>
<lib>
<fileset dir="${jar.dir}" includes="deps/*.jar" />
</lib>
</one-jar>
</target>
<target name="test-compile" depends="compile">
<mkdir dir="${test.build.dir}"/>
<javac srcdir="${test.src.dir}"
destdir="${test.build.dir}"
debug="true"
includeantruntime="true">
<compilerarg value="-Xlint:all"/>
<compilerarg value="-Xlint:-serial"/>
<compilerarg value="-Xlint:-options"/>
<classpath refid="classpath.test"/>
</javac>
</target>
<target name="test" depends="test-compile">
<junit printsummary="on" haltonfailure="yes" fork="true" showoutput="yes" maxmemory="192m">
<classpath>
<path refid="classpath.test"/>
<pathelement location="${test.build.dir}"/>
</classpath>
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${test.src.dir}" includes="**/${test.run}Tests.java" />
</batchtest>
</junit>
</target>
<!-- Create Manifest only if file doesn't exist -->
<target name="-manifest" unless="manifest.exists" >
<echo message="${jar.dir}/${manifest.file} does not exist, creating..." />
<antcall target="manifest" />
</target>
<!-- Create Manifest -->
<target name="manifest">
<manifest file="${jar.dir}/${manifest.file}" >
<attribute name="Main-Class" value="com.carolinarollergirls.scoreboard.Main" />
<attribute name="Class-Path" value="." />
</manifest>
<echo message="Created ${jar.dir}/${manifest.file}" />
</target>
<!-- Create JavaDOC -->
<target name="jdoc">
<mkdir dir="${jdoc.dir}"/>
<javadoc
packagenames="com.carolinarollergirls.scoreboard.*"
sourcepath="${src.dir}"
destdir="${jdoc.dir}"
/>
<echo message="Java Documentation placed in ${jdoc.dir}"/>
</target>
<!-- Do everything -->
<target name="all" depends="clean,test"/>
<!-- Create Windows scoreboard-Windows.exe -->
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
<target name="launcher" >
<launch4j>
<config outfile="${launch4j.outfile}" dontWrapJar="true" jarPath="${jar.dir}/${jar.file}" stayAlive="true" headerType="gui" chdir="." errTitle="CRG ScoreBoard" cmdLine="--gui" >
<jre minVersion="1.8.0" jdkPreference="preferJre" maxHeapSize="512" />
<messages jreVersionErr="You do not have Java installed. Press OK to open the Java download website. Restart the scoreboard after installing Java.\nError: The scoreboard requires Java JRE minimum version" />
</config>
</launch4j>
</target>
<!-- Create zip file -->
<target name="zip" depends="clean,-version,compile,test" >
<mkdir dir="${release.dir}" />
<property name="zip.prefix" value="crg-scoreboard_${version}"/>
<zip destfile="${release.dir}/${zip.prefix}.zip" >
<zipfileset dir="." prefix="${zip.prefix}" filemode="755" >
<include name="README.md" />
<include name="COPYING" />
<include name="COPYING-GPL" />
<include name="COPYING-AL" />
<include name="LICENSES" />
<include name="NOTICE" />
<include name="scoreboard-Windows.exe" />
<include name="scoreboard-mac.command" />
<include name="scoreboard.sh" />
<include name="start.html" />
<include name="html/**" />
<exclude name="html/stream/*" />
<exclude name="html/images/teamlogo/*" />
<exclude name="html/images/sponsor_banner/*" />
<include name="html/images/teamlogo" />
<include name="html/images/sponsor_banner" />
<exclude name="html/themes/custom/*" />
<exclude name="html/game-data/json/*" />
<exclude name="html/game-data/xlsx/*" />
<include name="lib/crg-scoreboard.jar" />
<include name="config/crg.scoreboard.properties" />
<include name="config/penalties/**" />
<include name="config/default.json" />
</zipfileset>
<zipfileset dir="${version.dest.dir}" prefix="${zip.prefix}/html/" filemode="755" >
<include name="${version.release.file}" />
</zipfileset>
</zip>
</target>
<!-- Create official release zip file -->
<target name="release" >
<antcall target="zip">
<param name="isRelease" value="true"/>
</antcall>
</target>
<!-- Clean all classfiles -->
<target name="clean">
<delete verbose="${clean.verbose}" quiet="${clean.quiet}" includeemptydirs="true" failonerror="false">
<fileset dir="${dest.dir}"/>
<fileset dir="${jar.dir}" includes="${jar.file}"/>
<fileset dir="${jdoc.dir}"/>
<fileset dir="${test.build.dir}"/>
</delete>
</target>
</project>