-
Notifications
You must be signed in to change notification settings - Fork 26
/
build.xml
155 lines (132 loc) · 6.76 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
<?xml version="1.0" encoding="utf-8" ?>
<project name="CI-Eye" default="snapshot" basedir=".">
<property name="target.version" value="0.6.0"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="lib.dir" value="${basedir}/vendor/lib"/>
<property name="jslib.dir" value="${basedir}/vendor/jslib"/>
<property name="buildlib.dir" value="${basedir}/vendor/buildlib"/>
<tstamp><format property="build.number" pattern="yyyyMMddHHmmss" timezone="GMT"/></tstamp>
<tstamp><format property="build.timestamp" pattern="yyyy-MM-dd HH:mm:ss" timezone="GMT"/></tstamp>
<macrodef name="compile-module">
<attribute name="srcdir"/>
<attribute name="destdir"/>
<attribute name="classpathref"/>
<sequential>
<mkdir dir="@{destdir}"/>
<javac srcdir="@{srcdir}/java"
includes="**"
includeantruntime="false"
encoding="utf-8"
destdir="@{destdir}"
source="1.6"
target="1.6"
debug="true"
debuglevel="lines,source">
<classpath refid="@{classpathref}"/>
</javac>
<copy todir="@{destdir}">
<fileset dir="@{srcdir}/java" excludes="**/*.java"/>
<fileset dir="@{srcdir}/webapp"/>
<fileset dir="@{srcdir}/resources"/>
</copy>
</sequential>
</macrodef>
<target name="version-for-snapshot" unless="version.label">
<property name="version.label" value="${target.version}-SNAPSHOT-${build.number}"/>
</target>
<target name="version-for-release" unless="version.label">
<property name="version.label" value="${target.version}"/>
</target>
<target name="version" depends="version-for-snapshot,version-for-release">
<echo message="Building version ${version.label}"/>
<property name="main.jar" value="${build.dir}/ci-eye-${version.label}.jar"/>
<property name="test.jar" value="${build.dir}/ci-eye-tests-${version.label}.jar"/>
</target>
<target name="clean" description="Clean this project">
<delete dir="${build.dir}" failonerror="false"/>
<mkdir dir="${build.dir}"/>
</target>
<target name="jar-main" depends="clean,version">
<path id="compile-main.req">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<compile-module srcdir="${basedir}/src/main" destdir="${build.dir}/main" classpathref="compile-main.req"/>
<copy todir="${build.dir}/main">
<fileset dir="${jslib.dir}"/>
</copy>
<zip destfile="${build.dir}/main-deps.jar"><zipgroupfileset dir="${lib.dir}" includes="**/*.jar"/></zip>
<jar destfile="${main.jar}">
<fileset dir="${build.dir}/main"/>
<fileset dir="${basedir}" includes="LICENSE NOTICE README"/>
<zipfileset src="${build.dir}/main-deps.jar" excludes="**/META-INF/**"/>
<manifest>
<attribute name="Main-Class" value="org.netmelody.cieye.CiEye"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Implementation-Vendor" value="netmelody.org"/>
<attribute name="Implementation-Title" value="${ant.project.name}"/>
<attribute name="Implementation-Version" value="${version.label}"/>
<attribute name="Built-Date" value="${build.timestamp}"/>
</manifest>
</jar>
</target>
<target name="jar-test" depends="clean,jar-main">
<path id="compile-test.req">
<fileset file="${main.jar}"/>
<fileset dir="${buildlib.dir}" includes="**/*.jar"/>
</path>
<compile-module srcdir="${basedir}/src/test" destdir="${build.dir}/test" classpathref="compile-test.req"/>
<zip destfile="${build.dir}/test-deps.jar">
<zipgroupfileset dir="${buildlib.dir}">
<include name="hamcrest-core-*.jar"/>
<include name="hamcrest-library-*.jar"/>
<include name="jmock-*.jar"/>
<include name="junit-dep-*.jar"/>
<include name="menodora-*.jar"/>
</zipgroupfileset>
</zip>
<jar destfile="${test.jar}">
<fileset dir="${build.dir}/test"/>
<fileset dir="${basedir}" includes="LICENSE NOTICE README.md"/>
<zipfileset src="${build.dir}/test-deps.jar" excludes="**/META-INF/**"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Implementation-Vendor" value="netmelody.org"/>
<attribute name="Implementation-Title" value="${ant.project.name} Tests"/>
<attribute name="Implementation-Version" value="${version.label}"/>
<attribute name="Built-Date" value="${build.timestamp}"/>
</manifest>
</jar>
</target>
<target name="jar" description="Create jar files" depends="jar-main,jar-test"/>
<target name="test" description="Test this project" depends="jar">
<mkdir dir="${build.dir}/testreport"/>
<mkdir dir="${build.dir}/tmp"/>
<junit printsummary="yes" haltonfailure="yes" forkmode="once" tempdir="${build.dir}/tmp">
<classpath>
<pathelement location="${main.jar}"/>
<pathelement location="${test.jar}"/>
</classpath>
<formatter type="plain"/>
<batchtest fork="yes" todir="${build.dir}/testreport">
<zipfileset src="${test.jar}">
<include name="org/netmelody/cieye/**/*Test.class"/>
</zipfileset>
</batchtest>
</junit>
</target>
<target name="dependency-check" depends="clean,jar" description="Perform dependency checks">
<taskdef name="classycleDependencyCheck"
classname="classycle.ant.DependencyCheckingTask"
classpath="${buildlib.dir}/classycle-1.4.jar"/>
<classycleDependencyCheck definitionFile="dependencies.ddf" failOnUnwantedDependencies="true" includingClasses="org.netmelody.*">
<fileset file="${main.jar}"/>
</classycleDependencyCheck>
</target>
<target name="snapshot" description="Create a tested snapshot jar file" depends="test,dependency-check"/>
<target name="release" description="Create a tested release jar file" depends="version-for-release,snapshot"/>
<target name="shrink" depends="release">
<taskdef resource="proguard/ant/task.properties" classpath="${buildlib.dir}/proguard.jar" />
<copy file="${main.jar}" tofile="${build.dir}/ci-eye-in.jar"></copy>
<proguard configuration="ci-eye.pro"/>
</target>
</project>