-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
114 lines (91 loc) · 4.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
<?xml version="1.0" encoding="utf-8" ?>
<project name="CDDATSELite" default="dispatch" basedir="." >
<!-- This is kind of like a Makefile, but for Java programs. -->
<!-- Chase's Ye Olde Ant Build Script. If anyone wants to convert this
project to Maven and explain to me in detail how Maven works,
I would be all for it. Until then, Ye Olde Ant Build Script. -->
<!-- Your settings, all you need to change is here -->
<description>Ant Build Script</description>
<property name="build.version" value="8" />
<property file="version.number" />
<property name="version.file" value="src/org/csdgn/cddatse/Version.java" />
<property name="app.name" value="cddatse" />
<property name="app.build" value="${version.major}.${version.minor}${version.status}" />
<property name="launch.bat" value="cddatse.bat" />
<property name="launch.sh" value="cddatse.sh" />
<property name="release.dir" value="dispatch" />
<property name="resource.dir" value="resource" />
<property name="lib.dir" value="lib" />
<property name="src.dir" value="src" />
<property name="bin.dir" value="bin" />
<property name="jar.mainclass" value="org.csdgn.cddatse.Main" />
<path id="project.class.path">
<pathelement location="${lib.dir}/gson-2.8.5.jar" />
</path>
<!-- Nothing to see past here folks, move along. -->
<!-- Compile the source java to class files -->
<target name="compile">
<!-- Update our VERSION java file -->
<replaceregexp file="${version.file}" match="int MAJOR = [0-9]*;" replace="int MAJOR = ${version.major};" />
<replaceregexp file="${version.file}" match="int MINOR = [0-9]*;" replace="int MINOR = ${version.minor};" />
<replaceregexp file="${version.file}" match='String STATUS = ".*?";' replace='String STATUS = "${version.status}";' />
<!-- Delete all the current files so we can recompile with our compiler. -->
<mkdir dir="${bin.dir}"/>
<delete>
<fileset dir="${bin.dir}" includes="**/*.class"/>
</delete>
<!-- Compile with no debugging info -->
<javac srcdir="${src.dir}" destdir="${bin.dir}" includeAntRuntime="no" encoding="UTF-8"
target="${build.version}" source="${build.version}" debug="on">
<exclude name="demo/*.java"/>
<exclude name="test/*.java"/>
<classpath refid="project.class.path" />
</javac>
</target>
<!-- This just builds our manifest file -->
<target name="manifest">
<!-- The actual jar name here is unimportant but the path is. -->
<manifestclasspath property="jar.classpath" jarfile="${lib.dir}/placeholder.jar">
<classpath refid="project.class.path" />
</manifestclasspath>
<manifest file="MANIFEST.MF">
<attribute name="Class-Path" value="${jar.classpath}" />
<attribute name="Main-Class" value="${jar.mainclass}" />
</manifest>
</target>
<!-- This builds the dispatch directory and everything that goes in it. -->
<target name="dispatch" depends="compile,manifest">
<!-- Cleanup any crap that got in there -->
<delete dir="${release.dir}" />
<mkdir dir="${release.dir}" />
<!-- Copy our libraries into the dispatch library folder. -->
<copy todir="${release.dir}/${lib.dir}" >
<fileset dir="${lib.dir}" includes="**"/>
</copy>
<!-- Create our main jar file. Again in the library folder. -->
<property name="release.file" location="${release.dir}/${lib.dir}/${app.name}.jar" />
<jar duplicate="add" basedir="${bin.dir}" destfile="${release.file}" update="true" compress="true" manifest="MANIFEST.MF">
<include name="**/*.class" />
</jar>
<!-- This copies the resources from our resource directory into our jar. -->
<jar duplicate="add" basedir="${resource.dir}" destfile="${release.file}" update="true" compress="true">
<include name="*.png" />
</jar>
<!-- Copy the launcher files to our dispatch directory. -->
<copy file="${resource.dir}/${launch.bat}" todir="${release.dir}" />
<copy file="${resource.dir}/${launch.sh}" todir="${release.dir}" />
<chmod file="${release.dir}/${launch.sh}" perm="ugo+x" />
<!-- Copy readme/license -->
<copy file="LICENSE" todir="${release.dir}" />
<copy file="IMAGE_LICENSE" todir="${release.dir}" />
<copy file="README.md" todir="${release.dir}" />
<!-- Delete the manifest, we already made use of it -->
<delete file="MANIFEST.MF" />
<zip destfile="${release.dir}/${app.name}_${app.build}.zip" basedir="${release.dir}" level="9" update="true" />
</target>
<!-- Clean -->
<target name="clean">
<delete dir="${release.dir}" />
<delete dir="${bin.dir}" />
</target>
</project>