-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
148 lines (133 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?xml version="1.0"?>
<project name="JNDIDriver" default="all" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Load user property definition overrides -->
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>
<property environment="env" />
<property name="target.version" value="1.8"/>
<property name="debug.setting" value="on"/>
<property name="app.name" value="JNDIDriver-JDBC" />
<property name="build.dir" value="${basedir}/build"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="deps.dir" value="${basedir}/deps/test/"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="ivy.version" value="2.2.0"/>
<path id="ivy.path" location="${basedir}/ivylib/ivy-${ivy.version}.jar" />
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant">
<classpath>
<path refid="ivy.path" />
<fileset dir="${basedir}" includes="ivylib/*.jar" />
</classpath>
</taskdef>
<target name="all" depends="clean-dist" />
<target name="clean-dist" depends="clean,dist" />
<target name="clean"
description="Removes all temporary files and directories." >
<mkdir dir="${dist.dir}" />
<delete dir="${build.dir}"/>
<delete dir="${deps.dir}"/>
<delete>
<fileset dir="${dist.dir}">
<include name="*.jar" />
</fileset>
</delete>
</target>
<target name="resolve" description="Resolve all dependencies with ivy and save">
<mkdir dir="${deps.dir}" />
<ivy:resolve file="${basedir}/ivy.xml" conf="*" />
<ivy:retrieve sync="yes" pattern="${deps.dir}/[conf]/[artifact].[ext]" conf="runtime,compile,test" symlink="${ivy.symlink}" />
<ivy:report outputpattern="deps/[organisation]-[module]-[conf].[ext]" graph="false" />
<move todir="deps/" file="ivy-report.css" />
<ivy:artifactproperty name="ivydeps.[artifact].[conf].version" value="[revision]" />
<ivy:artifactproperty name="ivydeps.[artifact].[conf].jar" value="[artifact].[ext]" />
<ivy:artifactproperty name="ivydeps.[artifact].[conf].path" value="${deps.dir}/[conf]/[artifact].[ext]" />
<echoproperties destfile="${deps.dir}/ivydeps.properties" prefix="ivydeps." />
</target>
<target name="version">
<exec executable="perl">
<arg value="make_version_properties.pl" />
</exec>
<property file="version.properties" />
<fail unless="app.fullVersion" message="Cannot determine version of code" />
<echo message="Code version ${app.fullVersion}" />
</target>
<target name="dist" depends="tests" />
<target name="prepare" description="Prepares the build target." depends="version,resolve">
<tstamp>
<format property="DATE" pattern="yyyy-MM-dd" />
</tstamp>
<mkdir dir="${dist.dir}" />
<mkdir dir="${build.dir}" />
</target>
<target name="compile" depends="prepare" description="Compiles the sources." >
<mkdir dir="${build.dir}/classes" />
<javac srcdir="src" destdir="${build.dir}/classes" debug="${debug.setting}"
source="${target.version}">
</javac>
</target>
<target name="jar" depends="compile" description="Creates the jar." >
<copy todir="${build.dir}/classes">
<fileset dir="src">
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*.xsd"/>
<include name="**/java.sql.Driver"/>
</fileset>
</copy>
<jar destfile="${dist.dir}/${app.name}.jar">
<fileset dir="${build.dir}/classes" />
<manifest>
<attribute name="Build-Date" value="${DATE}" />
<attribute name="Export-Package" value="org.goochfriend.jndidriver" />
<attribute name="Bundle-Name" value="${app.name}" />
<attribute name="Bundle-SymbolicName" value="${app.name}" />
<attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Version" value="${app.fullVersion}" />
<attribute name="Project-Home" value="https://github.com/goochjj/JNDIDriver" />
</manifest>
</jar>
<copy tofile="${dist.dir}/${app.name}-${app.fullVersion}.jar" file="${dist.dir}/${app.name}.jar"/>
</target>
<target name="tests" depends="jar" description="Compile and run the tests." >
<mkdir dir="${build.dir}/test-classes" />
<javac destdir="${build.dir}/test-classes" debug="${debug.setting}"
source="${target.version}">
<src path="tests"/>
<classpath>
<pathelement location="${dist.dir}/${app.name}.jar"/>
<fileset dir="${deps.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<copy todir="${build.dir}/test-classes">
<fileset dir="tests">
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*.xsd"/>
</fileset>
</copy>
<mkdir dir="${build.dir}/test-reports" />
<junit haltonfailure="yes">
<classpath>
<pathelement location="${dist.dir}/${app.name}.jar"/>
<pathelement location="${build.dir}/test-classes"/>
<fileset dir="${deps.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="plain"/>
<batchtest todir="${build.dir}/test-reports">
<fileset dir="${build.dir}/test-classes">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
</project>