forked from zaboople/klonk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
201 lines (162 loc) · 6.73 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
<?xml version="1.0"?>
<project name="klonk" basedir="." default="help">
<!--**********-->
<!--PROPERTIES-->
<!--**********-->
<!--Properties: arbitrary environment prefix:-->
<property environment="env"/>
<!--Properties: directories:-->
<property file="build.properties"/>
<property name="java.dir" value="java"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<property name="lib.dir" value="lib"/>
<property name="appname" value="klonk"/>
<property name="jar.dir" value="${lib.dir}/jar"/>
<property name="icon.ico" value="${lib.dir}/app.ico"/>
<property name="icon.png" value="${build.dir}/org/tmotte/klonk/windows/app.png"/>
<property name="iconFR.png" value="${build.dir}/org/tmotte/klonk/windows/app-find-replace.png"/>
<property name="version" value="${VERSION.KLONK}"/>
<property name="appname.version" value="${appname}.${version}"/>
<path id="classpath">
<fileset dir="${jar.dir}" includes="*.jar"/>
</path>
<!--**************-->
<!--TARGETS: HELP -->
<!--**************-->
<target name="help">
<echo>
clean:
Deletes all generated classes etc.
config.prod,config.test:
One of these two targets must be run first when building from scratch.
These copy either of two .png files into the build directory; the application will use the file
as its window icon. This way it's easier to tell whether it's a test or production build, especially
when I am using the application in one window and testing changes in another.
compile:
Compile all Java files to ./build. Also does a few things with text file resources concerned with
help screens.
jar:
Compiles and creates dist/${appname}.jar file from contents of ./build. This is an executable
jar, so double-clicking it should start the application if your java environment is properly
configured.
dist:
Creates source zip & binaries zip in dist directory. This does not include native
executables, however, unless you first run the commands below.
exe:
Generates a windows executable using jsmoothgen. To use this target, you will need to download
jsmoothgen, then set a JSMOOTH_HOME environment variable to point to the correct
directory of your jsmooth install. The actual build is controlled by build.exe.xml.
Note that the windows executable will *still* require a Java installation; it only makes
application startup a little more straightforward (especially mapping file types to the
executable). Also consider using the jar target, however.
Creating OSX/MacOS executables:
To make a macintosh distribution file, run the "jar" task and then lib/makedmg. This
only works on Java 8 and above. You can also use lib/makewin.bat to make a windows installer,
although this is not as clean as jsmooth.
</echo>
</target>
<!--****************-->
<!--TARGETS: CLEAN -->
<!--****************-->
<target name="clean" description="Clean output directories">
<delete dir="javadoc"/>
<delete dir ="${build.dir}"/>
<delete dir ="${dist.dir}"/>
</target>
<!--****************-->
<!--TARGETS: CONFIG -->
<!--****************-->
<target name="config.test">
<copy file="${lib.dir}/apptest.png" tofile="${icon.png}" overwrite="true"/>
<copy file="${lib.dir}/apptest-find-replace.png" tofile="${iconFR.png}" overwrite="true"/>
</target>
<target name="config.prod">
<copy file="${lib.dir}/app.png" tofile="${icon.png}" overwrite="true"/>
<copy file="${lib.dir}/app-find-replace.png" tofile="${iconFR.png}" overwrite="true"/>
</target>
<!--****************-->
<!--TARGETS: BUILD -->
<!--****************-->
<target name="compile" description="Compile main source tree java files">
<!--Need to select & copy icon file:-->
<available file="${icon.png}" property="haspng"/>
<fail unless="haspng"
message="Need to run config.prod or config.test target first before compile"/>
<!--Compile:-->
<javac destdir="${build.dir}"
debug="true"
failonerror="true"
deprecation="on"
srcdir="${java.dir}"
includeantruntime="false">
<!--compilerarg value="-Xlint"/-->
<classpath refid="classpath"/>
</javac>
<!--Copies the help.txt & about.txt file:-->
<copy todir="${build.dir}">
<fileset dir="${java.dir}" includes="**/*.txt,**/*.html"/>
</copy>
<!--Version number & license for about screen-->
<copy tofile="${build.dir}/org/tmotte/klonk/windows/popup/About-Version-Number.txt"
file="build.properties"/>
<copy tofile="${build.dir}/org/tmotte/klonk/windows/popup/About-License.html"
file="license.html"/>
</target>
<target name="javadoc" description="JavaDoc">
<mkdir dir="javadoc"/>
<javadoc sourcepath="java" access="public" destdir="javadoc" packagenames="org.**,com.**">
<classpath refid="classpath"/>
<fileset dir="java">
<include name="**/*.java"/>
</fileset>
</javadoc>
</target>
<target name="jar" depends="compile">
<mkdir dir ="${dist.dir}"/>
<jar basedir="./build" destfile="dist/${appname}.jar">
<!--Unzip all the jars and zip them into our own jar:-->
<zipgroupfileset dir="${jar.dir}" includes="*.jar" />
<manifest>
<attribute name="Built-By" value="Mr Motte" />
<attribute name="Main-Class" value="org.tmotte.klonk.config.Klonk" />
</manifest>
</jar>
</target>
<target name="exe" depends="jar">
<mkdir dir ="${dist.dir}/bin"/>
<subant target="exe">
<fileset dir="." includes="build.exe.xml"/>
</subant>
</target>
<!-- ********************* -->
<!-- TARGETS: DISTRIBUTION -->
<!-- ********************* -->
<target name="dist" depends="_dist.site"/>
<target name="_dist.site" depends="_dist.bin">
<mkdir dir ="${dist.dir}/site"/>
<copy todir="${dist.dir}/site">
<fileset dir="${dist.dir}">
<include name="*.zip"/>
</fileset>
</copy>
<copy file="license.html" todir="${dist.dir}/site"/>
<copy file="build.properties" todir="${dist.dir}/site"/>
</target>
<target name="_dist.bin" depends="config.prod,jar">
<mkdir dir ="${dist.dir}/bin"/>
<copy file="dist/${appname}.jar" tofile="${dist.dir}/bin/${appname.version}.jar"/>
<zip destfile="${dist.dir}/${appname.version}.zip">
<zipfileset dir="${dist.dir}/bin" prefix="${appname.version}"/>
</zip>
<!--Cleanup:-->
<delete file="dist/klonk.jar"/>
</target>
<target name="_dist.src" depends="clean">
<mkdir dir ="${dist.dir}"/>
<zip destfile="dist/${appname.version}.src.zip">
<zipfileset dir="." prefix="${appname.version}.src"
excludes=".git/**/*,.git"/>
</zip>
</target>
</project>