-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
86 lines (76 loc) · 3.04 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="XtrkCadReader" default="jar" basedir=".">
<property name="src" location="src"/>
<property name="bin" location="bin"/>
<property name="lib" location="lib"/>
<property name="dist" location="dist"/>
<property name="jarfile" location="${dist}/${ant.project.name}.jar"/>
<property name="compile.debug" value="true"/>
<fileset id="lib.jars" dir="${lib}">
<include name="**/*.jar"/>
</fileset>
<path id="lib.path">
<fileset refid="lib.jars"/>
</path>
<!-- Stub install target. Install should depend on the 'jar' target,
and copy the built objects to the 'dist' directory. -->
<target name="install" description="Install jar" depends="jar">
</target>
<target name="compile" description="Compile code">
<mkdir dir="${bin}"/>
<mkdir dir="${lib}"/>
<javac srcdir="${src}" destdir="${bin}"
source="1.5" target="1.5"
includeAntRuntime="no"
classpathref="lib.path" debug="${compile.debug}">
</javac>
</target>
<target name="jar" depends="compile" description="Build jar">
<mkdir dir="${dist}"/>
<jar jarfile="${jarfile}" basedir="${bin}" manifest="Manifest">
<!-- Merge library jars into final jar file -->
<zipgroupfileset refid="lib.jars"/>
</jar>
</target>
<target name="run" depends="jar" description="Run jar file">
<java jar="${jarfile}" fork="yes" failonerror="true">
<!-- pass the '-h' option to display help -->
<arg value="-h"/>
</java>
</target>
<target name="clean" description="Remove build and dist directories">
<delete dir="${bin}"/>
<delete dir="${dist}"/>
</target>
<target name="dist"
description="Create a release package as a Zip file"
depends="clean, get-version-string, jar">
<zip destfile="${dist}/XtrkCadReader${release.version-string}.zip">
<fileset dir="${dist}"
includes="*.jar"/>
<fileset dir="."
includes="LICENSE.txt,docs/,examples/"/>
</zip>
</target>
<target name="get-version-string" depends="compile"><!-- compute the version string, not for user use -->
<java classname="XtrkCadReader"
dir="${basedir}"
fork="yes"
resultproperty="version-string.returncode"
outputproperty="release.version-string"
errorproperty="release.version-string-error">
<classpath>
<pathelement path="${bin}"/>
</classpath>
<arg value="-v"/>
</java>
<echo message="release version string is ${release.version-string}"/>
<fail message="error getting version string: ${version-string.returncode}">
<condition>
<not>
<equals arg1="${version-string.returncode}" arg2="0"/>
</not>
</condition>
</fail>
</target>
</project>