-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.xml
131 lines (110 loc) · 4.37 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
<project name="tcjson" default="build">
<property name="app" value="tcjson"/>
<property name="build.sysclasspath" value="ignore"/>
<property name="version" value="1.2-dev"/>
<property name="distdir" value="build/${app}-${version}"/>
<property name="teamcity.home" location="${basedir}/../TeamCity"/>
<property name="teamcity.appdir" location="${teamcity.home}/webapps/ROOT/WEB-INF"/>
<property name="teamcity.plugindir" location="${user.home}/.BuildServer/plugins"/>
<path id="build.classpath">
<fileset dir="lib" includes="*.jar"/>
<pathelement location="build/classes"/>
<fileset dir="${teamcity.home}/lib" includes="*.jar" excludes="${app}*.jar"/>
<fileset dir="${teamcity.appdir}/lib" includes="*.jar" excludes="${app}*.jar"/>
</path>
<target name="test">
<pathconvert property="tmp" refid="build.classpath"/>
<echo message="${tmp}"/>
</target>
<target name="build"
description="Builds everything from scratch"
depends="clean, zip"/>
<target name="clean"
description="Removes all build artefacts">
<delete dir="build"/>
</target>
<target name="zip" depends="run.tests">
<copy file="teamcity-plugin.xml" todir="${distdir}">
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
<zip destfile="build/${app}-${version}.zip" compress="true">
<fileset dir="${distdir}">
<include name="**/*"/>
<exclude name="*-tests.jar"/>
</fileset>
<fileset dir="build/classes">
<include name="version.properties"/>
</fileset>
</zip>
</target>
<target name="compile" depends="dir.build">
<mkdir dir="build/classes"/>
<javac classpathref="build.classpath"
destdir="build/classes"
debug="yes"
failonerror="yes"
source="1.6"
target="1.6">
<src path="src/main"/>
</javac>
<mkdir dir="build/test-classes"/>
<javac classpathref="build.classpath"
destdir="build/test-classes"
debug="yes"
failonerror="yes"
source="1.6"
target="1.6">
<src path="src/tests"/>
</javac>
</target>
<target name="dir.build">
<mkdir dir="build"/>
</target>
<target name="dir.dist" depends="dir.build">
<mkdir dir="${distdir}/server"/>
</target>
<target name="jars"
depends="jar.app, jar.tests"/>
<target name="jar.app" depends="compile, build.identifier, dir.dist">
<jar destfile="${distdir}/server/${app}.jar" compress="false">
<fileset dir="build/classes"/>
<fileset dir="src">
<include name="META-INF/**/*"/>
</fileset>
</jar>
</target>
<target name="jar.tests" depends="compile, dir.dist">
<jar destfile="${distdir}/${app}-tests.jar" compress="false">
<fileset dir="build/test-classes"/>
</jar>
</target>
<target name="build.identifier">
<echo file="build/classes/version.properties" message="version=${version}${line.separator}" append="false"/>
<exec executable="bash" output="build/classes/version.properties" append="true">
<arg value="get-git-info.sh"/>
</exec>
</target>
<target name="run.tests" depends="jars">
<property name="outdir" value="build/reports/tests"/>
<mkdir dir="${outdir}"/>
<junit fork="yes" forkmode="once" printsummary="no" showoutput="yes">
<classpath>
<path refid="build.classpath"/>
<fileset dir="${distdir}" includes="*.jar"/>
<fileset dir="${distdir}/server" includes="*.jar"/>
</classpath>
<formatter type="brief" usefile="no"/>
<batchtest haltonfailure="yes">
<fileset dir="src/tests">
<include name="**/*Tests.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="deploy" depends="clean, run.tests, zip"
description="Deploys to a local TeamCity server">
<copy file="build/${app}-${version}.zip" todir="${teamcity.plugindir}"/>
</target>
</project>