-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.xml
More file actions
114 lines (95 loc) · 3.44 KB
/
build.xml
File metadata and controls
114 lines (95 loc) · 3.44 KB
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" standalone="no"?>
<project default="create_jar" name="Create Runnable Jar for Project vpl-junit">
<property name="project-name" value="vpl-junit"/>
<property name="project-version" value="0.8"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.8"/>
<property name="source" value="1.8"/>
<property name="src.dir" value="src"/>
<property name="bin.dir" value="bin"/> <!-- Compile directory -->
<property name="lib.dir" value="vendor"/>
<property name="jar.dir" value="release"/>
<property name="example.dir" value="examples"/>
<property name="checkstyle.dir" value="checkstyle"/>
<property name="jar.file" value="${project-name}-${project-version}.jar"/>
<path id="project.classpath">
<pathelement location="${bin.dir}"/>
<pathelement location="${lib.dir}/junit.jar"/>
<pathelement location="${lib.dir}/org.hamcrest.core_1.3.0.v201303031735.jar"/>
</path>
<!-- Deletes all the garbage -->
<target name="clean">
<delete dir="${bin.dir}"/>
<delete dir="${jar.dir}"/>
</target>
<!-- Initialize the build environment-->
<target name="init">
<!-- create the build directory -->
<mkdir dir="${bin.dir}"/>
<mkdir dir="${jar.dir}"/>
</target>
<!-- builds the project (without the tests) -->
<target name="build" depends="init">
<javac debug="true" debuglevel="${debuglevel}" destdir="${bin.dir}" source="${source}" target="${target}" includeantruntime="false">
<src path="${src.dir}"/>
<classpath refid="project.classpath"/>
</javac>
</target>
<!-- creates the needed jar file -->
<target name="create_jar" depends="build">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${jar.file}">
<!-- package compiled classes into jar -->
<fileset dir="${bin.dir}"/>
<!-- package libraries into jar -->
<restrict>
<name name="**/*.class"/>
<archives>
<zips>
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</zips>
</archives>
</restrict>
<!-- Define main class -->
<manifest>
<attribute name="Main-Class" value="VplJUnitTester"/>
<attribute name="Class-Path" value="."/>
</manifest>
</jar>
</target>
<!-- Runs the testcases with the newly generated library -->
<target name="run" depends="create_jar">
<!-- wipe old bin and copy the current jar to it -->
<delete dir="${bin.dir}"/>
<mkdir dir="${bin.dir}"/>
<copy file="${jar.dir}/${jar.file}" todir="${bin.dir}"/>
<!-- compile the testcases into the bin directory-->
<javac debug="true" debuglevel="${debuglevel}" destdir="${bin.dir}" source="${source}" target="${target}" includeantruntime="false">
<src path="examples"/>
<classpath>
<pathelement location="${jar.dir}/${jar.file}"/>
</classpath>
</javac>
<!-- copy the checkstyle definitions into the bin dir-->
<copy todir="${bin.dir}">
<fileset dir="${checkstyle.dir}">
<include name="**/checkstyle_*.xml"/>
</fileset>
</copy>
<!-- copy the examples from the example dir to the bin dir -->
<copy todir="${bin.dir}">
<fileset dir="${example.dir}">
<include name="**/*.java"/>
</fileset>
</copy>
<!-- copy the sources from the example dir to the bin dir -->
<copy todir="${bin.dir}">
<fileset dir="${src.dir}">
<include name="**/*.java"/>
</fileset>
</copy>
<!-- and run them -->
<java jar="${bin.dir}/${jar.file}" dir="${bin.dir}" fork="true" >
</java>
</target>
</project>