-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
92 lines (78 loc) · 3.82 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="optipng-ant-task" default="all">
<target name="-init" description="Common initialization">
<property name="sourcedir" value="src" />
<property name="outputdir" value="build" />
<property name="javac.deprecation" value="true" />
<property name="javac.compilerargs" value="-Xlint" />
<property name="javac.listfiles" value="true" />
<property name="javac.encoding" value="utf-8" />
<property name="javac.targetvm" value="1.5" />
<property name="javac.debug" value="true" />
<property name="javac.optimize" value="false" />
<property name="javac.sourcedir" value="${sourcedir}" />
<property name="javac.outputdir" value="${outputdir}/classes" />
<property name="javac.includes" value="**/*.java" />
<property name="jar.filename" value="${outputdir}/${ant.project.name}.jar" />
<property name="project.description" value="OptiPNG Ant task" />
<property name="project.vendor" value="PensioenPage B.V." />
<loadfile property="project.version" srcfile="VERSION">
<filterchain>
<striplinebreaks/>
</filterchain>
</loadfile>
<property name="unittests.sourcedir" value="${sourcedir}/unittests/input" />
<property name="unittests.expecteddir" value="${sourcedir}/unittests/expected" />
<property name="unittests.outputdir" value="${outputdir}/unittests" />
<echo level="verbose" message="Project: ${ant.project.name} ("${project.description}") version ${project.version}" />
</target>
<target name="compile" depends="-init">
<mkdir dir="${javac.outputdir}" />
<javac encoding="${javac.encoding}"
destdir="${javac.outputdir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
optimize="${javac.optimize}"
target="${javac.targetvm}"
includes="${javac.includes}"
listfiles="${javac.listfiles}">
<compilerarg value="${javac.compilerargs}" />
<src path="src" />
</javac>
</target>
<target name="unittests" depends="compile" description="Runs all available unit tests">
<taskdef name="optipng" classname="com.pensioenpage.jynx.optipng.OptiPNGTask" classpath="${javac.outputdir}" />
<mkdir dir="${unittests.outputdir}" />
<macrodef name="unittest">
<attribute name="testnum" />
<attribute name="process" />
<attribute name="expected" default="${unittests.expecteddir}/@{testnum}.png" />
<attribute name="actual" default="${unittests.outputdir}/@{testnum}.png" />
<sequential>
<optipng dir="${unittests.sourcedir}" includes="@{testnum}.png" todir="${unittests.outputdir}" process="@{process}" />
<condition property="test@{testnum}.success">
<filesmatch file1="@{expected}" file2="@{actual}" />
</condition>
<fail unless="test@{testnum}.success">Output file "@{actual}" differs from what was expected: "@{expected}".</fail>
</sequential>
</macrodef>
<unittest testnum="1" process="true" />
<unittest testnum="2" process="false" />
</target>
<target name="jar" depends="compile">
<jar jarfile="${jar.filename}" basedir="${javac.outputdir}">
<manifest>
<attribute name="Specification-Title" value="${project.description}"/>
<attribute name="Specification-Version" value="${project.version}"/>
<attribute name="Specification-Vendor" value="${project.vendor}"/>
<attribute name="Implementation-Title" value="${project.description}"/>
<attribute name="Implementation-Version" value="${project.version}"/>
<attribute name="Implementation-Vendor" value="${project.vendor}"/>
</manifest>
</jar>
</target>
<target name="all" depends="compile,unittests,jar" description="Compiles, runs all unit tests and builds the JAR" />
<target name="clean" depends="-init">
<delete dir="${outputdir}" />
</target>
</project>