-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
196 lines (164 loc) · 7.05 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns:eclipse="antlib:com.unicorntoast.ant.ivy.eclipse"
xmlns:static="antlib:com.unicorntoast.ant.ivy.static_classpath"
xmlns:export="antlib:com.unicorntoast.ant.ivy.export"
xmlns:ivy="antlib:org.apache.ivy.ant"
default="help"
>
<property name="build.dir" value="build" />
<property name="src.dir" value="src" />
<!-- jars that are not from ivy dependency management -->
<property name="ivy.lib.dir" value="libs"/>
<!-- deifne the ivy task -->
<property name="ivy.jar.dir" value="${basedir}/contrib" />
<path id="ivy.lib.path"><fileset dir="${ivy.jar.dir}" includes="*.jar"/></path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<!-- using http://code.google.com/p/ant-ivy-tools/ -->
<property name="ant_ivy_tools_classpath" value="contrib/ivy.jar:contrib/ant-ivy-tools.jar" />
<taskdef uri="antlib:com.unicorntoast.ant.ivy.eclipse" classpath="${ant_ivy_tools_classpath}" />
<taskdef uri="antlib:com.unicorntoast.ant.ivy.static_classpath" classpath="${ant_ivy_tools_classpath}" />
<taskdef uri="antlib:com.unicorntoast.ant.ivy.export" classpath="${ant_ivy_tools_classpath}" />
<!-- jar files in checked in lib dir -->
<property name="checkedin.dir" value="lib"/>
<path id="checkedin.classpath">
<fileset dir="${checkedin.dir}" includes="*.jar" />
</path>
<property name="classes.dir" value="bin"/>
<property name="config.dir" location="config" />
<!-- =================================
target: help
================================= -->
<target name="help">
<echo>important: before first compile, execute "ant update-deps"</echo>
<echo />
<echo>update-deps - fetch dependencies (ivy) and create necessary files ( .classpath, project.classpath )</echo>
<echo>compile</echo>
<echo>clean</echo>
<echo>clean-cache</echo>
<echo />
</target>
<!-- =================================
target: update-deps
================================= -->
<target name="update-deps" description="--> update ivy dependencies">
<!-- Some setups require a libs directory containing all
dependencies. This can be accomplished by the export task, which
will copy all jars into the output directory and will optionally
generate a corresponding classpath file.
Note: the generated classpath file will contain the filenames
without any path information, this is where the pathprefix
argument comes into play. The classpath option of this task may
replace the previously mentioned static:store. -->
<export:export settings="ivysettings.xml" input="ivy.xml"
classpath="project.classpath" output="libs" pathprefix="libs/" />
<!-- The following element will create an eclipse .classpath file which will include the
jars, sources and javadoc. Note: The generated .classpath and project.classpath files will
point to the jar files in your ivy cache. -->
<eclipse:classpath >
<entry kind="src" path="src" output="bin" />
<entry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" />
<ivy settings="ivysettings.xml" input="ivy.xml" />
</eclipse:classpath>
</target>
<!-- =================================
target: Compile
================================= -->
<target name="compile" description="--> compile java classes">
<mkdir dir="${classes.dir}" />
<static:load input="project.classpath" refid="ivy.classpath" />
<path id="compile.classpath" >
<path refid="checkedin.classpath"/>
<path refid="ivy.classpath" />
</path>
<javac srcdir="src" destdir="${classes.dir}"
classpathref="compile.classpath" includeantruntime="false"
compiler="javac1.7"/>
</target>
<!-- ====================
Target: compileTests
==================== -->
<target name="compileTests" depends="compile" >
<static:load input="project.classpath" refid="ivy.classpath" />
<path id="compile.classpath" >
<path refid="checkedin.classpath"/>
<path refid="ivy.classpath" />
</path>
<javac srcdir="test" destdir="${classes.dir}" classpathref="compile.classpath" includeantruntime="false"/>
</target>
<!-- =================================
target: fatjar
================================= -->
<target name="fatjar" description="--> make jar with classes and dependencies">
<static:load input="project.classpath" refid="ivy.classpath" />
<jar destfile="${build.dir}/vivo-multisite.jar">
<zipgroupfileset dir="${ivy.lib.dir}">
<include name="*.jar"/>
</zipgroupfileset>
<zipgroupfileset dir="${checkedin.dir}">
<include name="*.jar"/>
</zipgroupfileset>
<fileset dir="${classes.dir}"/>
</jar>
</target>
<!-- =================================
target: nestedjar
================================= -->
<target name="nestedjar" depends="unitTests" description="--> make jar with 3rd-party jars in /lib">
<static:load input="project.classpath" refid="ivy.classpath" />
<jar destfile="${build.dir}/nested-multisite.jar">
<zipfileset dir="${ivy.lib.dir}" prefix="lib/">
<include name="*.jar"/>
</zipfileset>
<zipfileset dir="${checkedin.dir}" prefix="lib/">
<include name="*.jar"/>
</zipfileset>
<fileset dir="${classes.dir}"/>
<fileset dir="${config.dir}"/>
</jar>
</target>
<!-- ========================
Target: test
======================== -->
<target name="unitTests" depends="compileTests" description="--> run unit tests">
<path id="test.classpath">
<pathelement location="test"/>
<pathelement location="bin"/>
</path>
<junit printsummary="yes" haltonfailure="no" fork="yes">
<formatter type="plain"/>
<classpath>
<path refid="checkedin.classpath"/>
<path refid="ivy.classpath" />
<path refid="test.classpath"/>
</classpath>
<batchtest fork="yes" >
<fileset dir="test">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- =================================
target: clean
================================= -->
<target name="clean" description="--> remove compiled classes">
<delete dir="${classes.dir}" />
</target>
<!-- =================================
target: clean-cache
================================= -->
<target name="clean-cache"
description="--> clean the ivy cache">
<ivy:cleancache />
</target>
<!-- =================================
target: ivy dependency report
================================= -->
<target name="report-deps"
description="--> report of ivy dependencies">
<mkdir dir="report" />
<ivy:resolve type="${ivy.resolve.types}"/>
<ivy:report todir="report" />
</target>
</project>