-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.xml
87 lines (74 loc) · 2.97 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Ant build file for SliderDemo project.
-->
<project name="SliderDemo" basedir="." default="run">
<!-- Define build locations -->
<property name="build.dir" location="build" />
<property name="src.dir" location="src" />
<!-- Define build properties -->
<property name="project.jar" value="${ant.project.name}.jar" />
<property name="project.zip" value="${ant.project.name}.zip" />
<property name="main.class" value="slider.RangeSliderDemo" />
<!-- Define classpath for compile -->
<path id="compile.classpath">
<pathelement path="${build.dir}" />
</path>
<target name="init" description="Initializes build">
<mkdir dir="${build.dir}" />
</target>
<target name="clean" depends="init" description="Deletes build products">
<!-- Delete compiled classes -->
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${build.dir}" includes="**/*" />
</delete>
<!-- Delete distribution files -->
<delete failonerror="false">
<fileset dir="${basedir}">
<include name="${project.jar}" />
<include name="${project.zip}" />
</fileset>
</delete>
</target>
<target name="compile" depends="init" description="Compiles all classes">
<!-- Compile all java classes -->
<javac destdir="${build.dir}"
srcdir="${src.dir}"
debug="true"
deprecation="true" >
<classpath refid="compile.classpath" />
</javac>
</target>
<target name="jar" depends="compile" description="Creates executable jar">
<!-- Define manifest attributes -->
<property name="manifest.mainclass" value="${main.class}" />
<property name="manifest.classpath" value="${project.jar}" />
<!-- Create executable jar file -->
<jar jarfile="${project.jar}"
basedir="${build.dir}"
compress="true" >
<manifest>
<attribute name="Main-Class" value="${manifest.mainclass}" />
<attribute name="Class-Path" value="${manifest.classpath}" />
</manifest>
</jar>
</target>
<target name="run" depends="compile" description="Runs demo application">
<!-- Execute application -->
<java classname="${main.class}"
fork="true"
spawn="true">
<classpath refid="compile.classpath" />
</java>
</target>
<target name="dist" depends="jar" description="Creates project archive">
<!-- Create zip file containing source and build files -->
<zip destfile="${project.zip}" compress="true">
<zipfileset dir="${src.dir}" prefix="src"
includes="**/*.java" />
<fileset file="${project.jar}" />
<fileset file="build.xml" />
<fileset file="LICENSE.txt" />
</zip>
</target>
</project>