-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
166 lines (142 loc) · 5.52 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!--
Copyright 2014 Jesse Shaffer
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="CFArangoCache" default="build-lib" xmlns:ivy="antlib:org.apache.ivy.ant">
<!--
================
Build properties
================
-->
<property file="build.properties" />
<property name="src.dir" location="src/main/java"/>
<property name="src.driver.dir" location="src/main/cfml"/>
<property name="src.ext.dir" location="${src.driver.dir}/extension"/>
<property name="resources.dir" location="src/main/resources"/>
<property name="test.src.dir" location="src/test/java"/>
<property name="build.dir" location="build"/>
<property name="classes.dir" location="${build.dir}/classes"/>
<property name="test.classes.dir" location="${build.dir}/test-classes"/>
<property name="ivy.reports.dir" location="${build.dir}/ivy-reports"/>
<property name="test.reports.dir" location="${build.dir}/test-reports"/>
<property name="dist.dir" location="${build.dir}/dist"/>
<!-- <property name="jar.main.class" value="org.demo.App"/> -->
<property name="jar.file" value="${dist.dir}/${ant.project.name}.jar"/>
<property name="ext.file" value="${dist.dir}/${ant.project.name}.zip"/>
<tstamp prefix="stamp">
</tstamp>
<tstamp prefix="created">
<format property="TODAY" pattern="MM/dd/yyyy" locale="en,US"/>
<format property="TSTAMP" pattern="HH:mm" locale="en,US"/>
</tstamp>
<!--
===========
Build setup
===========
-->
<target name="bootstrap" description="Install ivy">
<mkdir dir="${user.home}/.ant/lib"/>
<get dest="${user.home}/.ant/lib/ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>
</target>
<target name="resolve" description="Use ivy to resolve classpaths">
<ivy:resolve/>
<ivy:report todir='${ivy.reports.dir}' graph='false' xml='false'/>
<ivy:cachepath pathid="compile.path" conf="compile"/>
<ivy:cachepath pathid="test.path" conf="test"/>
</target>
<!--
===============
Compile targets
===============
-->
<target name="resources" description="Copy resources into classpath">
<copy todir="${classes.dir}">
<fileset dir="${resources.dir}"/>
</copy>
</target>
<target name="compile" depends="resolve,resources" description="Compile code">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false" debug="true" classpathref="compile.path"/>
</target>
<target name="compile-tests" depends="compile" description="Compile tests">
<mkdir dir="${test.classes.dir}"/>
<javac srcdir="${test.src.dir}" destdir="${test.classes.dir}" includeantruntime="false" debug="true">
<classpath>
<path refid="test.path"/>
<pathelement path="${classes.dir}"/>
</classpath>
</javac>
</target>
<!--
============
Test targets
============
-->
<target name="test" depends="compile-tests" description="Run unit tests">
<mkdir dir="${test.reports.dir}"/>
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<path refid="test.path"/>
<pathelement path="${classes.dir}"/>
<pathelement path="${test.classes.dir}"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.reports.dir}">
<fileset dir="${test.src.dir}">
<include name="**/*Test*.java"/>
<exclude name="**/AllTests.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!--
=====================
Build and run targets
=====================
--><!-- depends="test" -->
<target name="build-lib" depends="compile" description="Create library jar archive">
<ivy:retrieve pattern="${dist.dir}/lib/[artifact].[ext]" conf="runtime"/><!-- -[revision](-[classifier]) -->
<manifestclasspath property="jar.classpath" jarfile="${jar.file}">
<classpath>
<fileset dir="${dist.dir}/lib" includes="*.jar"/>
</classpath>
</manifestclasspath>
<jar destfile="${jar.file}" basedir="${classes.dir}">
<manifest>
<!-- <attribute name="Main-Class" value="${jar.main.class}" /> -->
<attribute name="Class-Path" value="${jar.classpath}" />
</manifest>
</jar>
</target>
<target name="build-ext" description="Create extension archive">
<copy file="${src.ext.dir}/config.tpl.xml" tofile="${src.ext.dir}/config.xml" overwrite="true" />
<replace file="${src.ext.dir}/config.xml" token="{version}" value="${version}.${stamp.DSTAMP}${stamp.TSTAMP}" />
<replace file="${src.ext.dir}/config.xml" token="{created}" value="${created.TODAY} ${created.TSTAMP}" />
<zip destfile="${ext.file}">
<zipfileset includes="context/**" dir="${src.driver.dir}" />
<zipfileset includes="**" excludes="**/config.tpl.xml" dir="${src.ext.dir}" />
<zipfileset includes="*.jar" dir="${dist.dir}" prefix="lib" />
<zipfileset includes="*.jar" dir="${dist.dir}/lib" prefix="lib" />
</zip>
<delete file="${src.ext.dir}/config.xml" />
</target>
<!--
=============
Clean targets
=============
-->
<target name="clean" description="Cleanup build files">
<delete dir="${build.dir}"/>
</target>
<target name="clean-all" depends="clean" description="Additionally purge ivy cache">
<ivy:cleancache/>
</target>
</project>