This repository has been archived by the owner on Jun 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
174 lines (143 loc) · 6.95 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
<!--
Copyright 2008 Last.fm
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="ivysvnresolver" default="build">
<property name="lib.dir" value="${basedir}/lib" />
<property name="src.dir" value="${basedir}/src" />
<property name="java.src.dir" value="${src.dir}/java" />
<property name="test.dir" location="test" />
<property name="test.conf.dir" location="${test.dir}/conf" />
<property name="test.data.dir" location="${test.dir}/data" />
<property name="test.java.dir" location="${test.dir}/java" />
<property name="build.dir" value="${basedir}/build" />
<property name="dist.dir" value="${build.dir}/dist" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="junit.report.dir" location="${build.dir}/junit" />
<property name="ivysettings.dir" value="${basedir}" />
<property file="build.properties" />
<!-- override this if you intend to publish a new version -->
<property name="version" value="0" />
<fileset dir="${lib.dir}" id="dependencies">
<include name="ivy*.jar" />
<include name="svnkit.jar" />
<include name="trilead.jar" />
</fileset>
<!-- paths used for compilation -->
<path id="lib.path.id">
<fileset refid="dependencies" />
</path>
<!-- classpath used when compiling and running tests -->
<path id="test-classpath">
<pathelement location="${test.conf.dir}" />
<pathelement location="${classes.dir}" />
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<import file="ivy-common-targets.xml" />
<target name="install" depends="clean, build-jar" description="Installs files required for ivysvnresolver to work into ant lib">
<property name="ivy.skip.retrieve" value="true" />
<copy todir="${ant.home}/lib" overwrite="true" verbose="true">
<fileset refid="dependencies" />
</copy>
<!-- copy XML files to ANT_HOME/lib -->
<copy todir="${ant.home}/lib" overwrite="true" verbose="true">
<fileset dir="${ivysettings.dir}">
<include name="ivysettings.xml" />
<include name="ivy-common-targets.xml" />
</fileset>
</copy>
<antcall target="jar" />
<copy todir="${ant.home}/lib" overwrite="true" verbose="true">
<fileset dir="${dist.dir}">
<include name="${ant.project.name}.jar" />
</fileset>
</copy>
</target>
<target name="clean" description="">
<delete dir="${build.dir}" />
</target>
<target name="compile" depends="compile-source, compile-test" />
<target name="compile-source">
<mkdir dir="${classes.dir}" />
<javac srcdir="${java.src.dir}" destdir="${classes.dir}" classpathref="lib.path.id" debug="true" source="1.5" target="1.5" />
</target>
<target name="compile-test" depends="compile-source">
<mkdir dir="${classes.dir}" />
<javac srcdir="${test.java.dir}" destdir="${classes.dir}" debug="true">
<classpath>
<path refid="test-classpath" />
</classpath>
</javac>
</target>
<target name="test" depends="compile" description="Run the unit tests">
<delete dir="${junit.report.dir}" />
<mkdir dir="${junit.report.dir}" />
<property name="junit.includes" value="**/*Test.java" />
<property name="junit.excludes" value="nothing.by.default" />
<junit printsummary="yes" failureproperty="testfailed" showoutput="true" fork="true">
<classpath refid="test-classpath" />
<formatter type="xml" usefile="true" />
<batchtest todir="${junit.report.dir}">
<fileset dir="${test.java.dir}" includes="${junit.includes}" excludes="${junit.excludes}" />
</batchtest>
</junit>
<junitreport todir="${junit.report.dir}">
<fileset dir="${junit.report.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="noframes" todir="${junit.report.dir}" />
</junitreport>
<fail if="testfailed" message="Some test(s) failed. See '${junit.report.dir}' for details." />
</target>
<target name="jar" depends="compile" description="Build a jar file for this project">
<tstamp>
<format property="BUILD-DATETIME" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<mkdir dir="${dist.dir}" />
<echo message="Generating ${dist.dir}/${ant.project.name}.jar with version ${version}" />
<jar destfile="${dist.dir}/${ant.project.name}.jar" update="true">
<fileset dir="${classes.dir}">
<exclude name="**/*Test*" />
<exclude name="**/test*" />
</fileset>
<manifest>
<attribute name="Build-Version" value="${version}" />
<attribute name="Build-DateTime" value="${BUILD-DATETIME}" />
</manifest>
</jar>
</target>
<target name="build-jar" depends="jar" />
<target name="build" depends="build-jar" />
<target name="build-dist" depends="build-bin, build-src" />
<!-- builds the binary zip file -->
<target name="build-bin" depends="build-jar">
<tar destfile="${dist.dir}/${ant.project.name}-${version}-bin.tgz" compression="gzip">
<zipfileset dir="${dist.dir}" includes="${ant.project.name}.jar" prefix="${ant.project.name}-${version}" />
<zipfileset dir="${basedir}" includes="*.txt" excludes="TODO.txt" prefix="${ant.project.name}-${version}" />
<tarfileset refid="dependencies" prefix="${ant.project.name}-${version}/lib" />
</tar>
</target>
<!-- builds the source zip file -->
<target name="build-src" depends="build-jar">
<tar destfile="${dist.dir}/${ant.project.name}-${version}-src.tgz" compression="gzip">
<zipfileset dir="${basedir}" excludes="build/**/*, build, .*, build.properties, ivysettings.xml, .settings/**/*, deb.xml, test/conf/test.properties" prefix="${ant.project.name}-${version}" />
</tar>
</target>
<target name="upload" depends="build-dist">
<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask" classpath="${lib.dir}/ant-googlecode.jar" name="gcupload" />
<!-- first upload the src version -->
<gcupload username="${google.username}" password="${google.password}" projectname="ivysvn" filename="${dist.dir}/${ant.project.name}-${version}-src.tgz" targetfilename="${ant.project.name}-${version}-src.tgz" summary="${version} Source Release" labels="Featured, Type-Source, OpSys-All" />
<!-- now upload the bin version -->
<gcupload username="${google.username}" password="${google.password}" projectname="ivysvn" filename="${dist.dir}/${ant.project.name}-${version}-bin.tgz" targetfilename="${ant.project.name}-${version}-bin.tgz" summary="${version} Binary Release" labels="Featured, Type-Archive, OpSys-All" />
</target>
</project>