forked from johndeverall/opengraph-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
84 lines (82 loc) · 3.03 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
<?xml version="1.0"?>
<project basedir="." default="main" name="OpenGraph">
<!-- Sets variables which can later be used. -->
<!-- The value of a property is accessed via ${} -->
<property location="src" name="src.dir"/>
<property location="libs" name="lib.dir"/>
<property location="bin" name="build.dir"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="javadoc.dir" value="${build.dir}/docs"/>
<path id="build.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- Variables used for JUnit testing -->
<property location="src" name="test.dir"/>
<property location="testreport" name="test.report.dir"/>
<!-- Define the classpath which includes the junit.jar and the classes after compiling-->
<path id="junit.class.path">
<pathelement location="libs/junit.jar"/>
<pathelement location="libs/hamcrest-core.jar"/>
<pathelement location="libs/htmlcleaner-2.8.jar"/>
<pathelement location="${classes.dir}"/>
</path>
<!-- Deletes the existing build, docs and dist directory-->
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${test.report.dir}"/>
</target>
<!-- Creates the build, docs and dist directory-->
<target name="makedir">
<mkdir dir="${build.dir}"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${jar.dir}"/>
<mkdir dir="${test.report.dir}"/>
</target>
<!-- Compiles the java code (including the usage of library for JUnit -->
<target depends="clean, makedir" name="compile">
<javac destdir="${classes.dir}" srcdir="${src.dir}" debug="on">
<classpath refid="junit.class.path"/>
<classpath refid="build.classpath"/>
</javac>
</target>
<target depends="compile" name="jar">
<mkdir dir="${jar.dir}"/>
<mkdir dir="${jar.dir}/lib"/>
<copy todir="${jar.dir}/lib">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
<path id="classpath_dist">
<fileset dir="${jar.dir}/lib" includes="*.jar"/>
</path>
<manifestclasspath jarfile="${jar.dir}/${ant.project.name}.jar" property="lib.list">
<classpath refid="classpath_dist"/>
</manifestclasspath>
<jar basedir="${classes.dir}" destfile="${jar.dir}/${ant.project.name}.jar">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Class-Path" value="${lib.list}"/>
</manifest>
</jar>
</target>
<!-- Run the JUnit Tests -->
<!-- Output is XML, could also be plain-->
<target depends="compile" name="junit">
<junit fork="true" haltonfailure="yes" printsummary="on">
<classpath refid="junit.class.path"/>
<formatter type="plain"/>
<batchtest todir="${test.report.dir}">
<fileset dir="${src.dir}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target depends="compile, jar, junit" name="main">
<description>Main target</description>
</target>
</project>