-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
120 lines (106 loc) · 5.2 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="YADIC" basedir="." default="build">
<tstamp>
<format property="date.version" pattern="yyMMdd" locale="en,GB" />
</tstamp>
<property name="major.version" value="5" />
<property name="minor.version" value="0" />
<property name="spec.version" value="${major.version}.${minor.version}" />
<property name="jar.version" value="${major.version}.${minor.version}.${date.version}" />
<property name="vendor" value="Rafał Kaleta" />
<property name="main.package" value="yadic" />
<property name="src.dir" value="src/main/java" />
<property name="resources.dir" value="src/main/resources" />
<property name="test.dir" value="src/test/java" />
<property name="test.resources.dir" value="src/test/resources" />
<property name="ant.output.dir" value="antBuild" />
<property name="build.dir" value="${ant.output.dir}/bin" />
<property name="dist.dir" value="${ant.output.dir}/dist" />
<property name="junit.output.dir" value="${ant.output.dir}/junit" />
<property name="junit.result.dir" value="${junit.output.dir}/result" />
<property name="junit.report.dir" value="${junit.output.dir}/report" />
<property name="javadoc.output.dir" value="${ant.output.dir}/docs" />
<property name="jar.file" value="${main.package}-${jar.version}.jar" />
<property name="ivy.lib.dir" value="ivyLib" />
<property name="ivy.install.version" value="2.5.2" />
<path id="project.classpath">
<fileset dir="${basedir}/${ivy.lib.dir}" includes="*.jar" />
<pathelement location="${basedir}/${build.dir}" />
</path>
<target name="download-ivy" unless="offline">
<delete dir="${ivy.lib.dir}" />
<mkdir dir="${ivy.lib.dir}" />
<get
src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.lib.dir}/ivy-${ivy.install.version}.jar" usetimestamp="true" />
</target>
<target name="resolve" depends="download-ivy" description="Resolve dependencies">
<path id="ivy.lib.path">
<fileset dir="${ivy.lib.dir}" includes="*.jar" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant"
classpathref="ivy.lib.path" />
<ivy:retrieve />
</target>
<target name="clean" description="Remove additional build files">
<delete dir="${ant.output.dir}" />
</target>
<target name="init">
<mkdir dir="${build.dir}" />
<copy includeemptydirs="false" todir="${build.dir}">
<fileset dir="${resources.dir}" erroronmissingdir="false" />
<fileset dir="${test.resources.dir}" erroronmissingdir="false" />
</copy>
</target>
<target name="compile" depends="init">
<echo level="info" message="Java version is ${ant.java.version}" />
<javac destdir="${build.dir}" includeantruntime="false">
<src path="${src.dir}" />
<src path="${test.dir}" />
<compilerarg line="-Xlint" />
<classpath refid="project.classpath" />
</javac>
</target>
<target name="jar" depends="compile" description="Compile source files & Create jar">
<jar destfile="${dist.dir}/${jar.file}" basedir="${build.dir}" excludes="**/*Test.class">
<zipgroupfileset dir="${ivy.lib.dir}" includes="*.jar" />
<manifest>
<attribute name="Built-By" value="${vendor}" />
<attribute name="Specification-Title" value="Yet Another Dependency Injection Container" />
<attribute name="Specification-Version" value="${spec.version}" />
<attribute name="Specification-Vendor" value="${vendor}" />
<attribute name="Implementation-Title" value="${main.package}" />
<attribute name="Implementation-Version" value="${jar.version}" />
<attribute name="Implementation-Vendor" value="${vendor}" />
</manifest>
</jar>
</target>
<target name="test" description="Run all tests">
<mkdir dir="${junit.result.dir}" />
<junitlauncher printsummary="true" failureproperty="junit.failure">
<classpath refid="project.classpath" />
<testclasses outputdir="${junit.result.dir}">
<fileset dir="${build.dir}" includes="**/*Test.class" />
<listener type="legacy-xml" sendSysErr="true" sendSysOut="true" />
</testclasses>
</junitlauncher>
<mkdir dir="${junit.report.dir}" />
<junitreport todir="${junit.report.dir}">
<fileset dir="${junit.result.dir}" includes="TEST-*.xml" />
<report format="frames" todir="${junit.report.dir}" />
</junitreport>
<fail if="junit.failure" message="JUnit test(s) failed" />
</target>
<target name="docs" description="Generate Javadoc">
<mkdir dir="${javadoc.output.dir}" />
<javadoc sourcepath="${src.dir}" destdir="${javadoc.output.dir}" access="public"
classpathref="project.classpath">
<package name="${main.package}.*" />
<arg value="-Xdoclint:none" />
</javadoc>
</target>
<target name="build" depends="resolve, jar, test"
description="Resolve dependencies & Compile source files & Create jar & Run all tests" />
<target name="rebuild" depends="clean, build"
description="Remove additional build files & Resolve dependencies & Compile source files & Create jar & Run all tests" />
</project>