forked from scottcowan/teamcity-twitter-notifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
128 lines (110 loc) · 4.16 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
<project name="Nabaztag" default="build">
<property name="app" value="twitter"/>
<property name="version" value="0.2.1"/>
<property name="distdir" value="build/${app}-${version}"/>
<property name="teamcity.home" location="C:/TeamCity"/>
<property name="teamcity.appdir" location="${teamcity.home}/webapps/ROOT/WEB-INF"/>
<path id="build.classpath">
<fileset dir="lib" includes="*.jar"/>
<pathelement location="${teamcity.appdir}/classes"/>
<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 artifacts">
<delete dir="build"/>
</target>
<target name="zip" depends="run.tests">
<zip destfile="build/${app}-${version}.zip" compress="true">
<fileset dir="build">
<include name="${app}-${version}/*.jar"/>
<exclude name="**/*-tests*.jar"/>
</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.5"
target="1.5">
<src path="src"/>
<src path="tests"/>
</javac>
<copydir src="src"
dest="build/classes"
includes="**/*.properties"
excludes="**/*.java"/>
</target>
<target name="dir.build">
<mkdir dir="build"/>
</target>
<target name="dir.dist" depends="dir.build">
<mkdir dir="${distdir}"/>
</target>
<target name="jars"
depends="jar.app, jar.tests"/>
<target name="jar.app" depends="compile, dir.dist">
<jar destfile="${distdir}/${app}.jar" compress="false">
<fileset dir="build/classes">
<exclude name="com/agimatec/nabaztag/test/**"/>
</fileset>
<fileset dir=".">
<include name="META-INF/**/*"/>
<include name="buildServerResources/**/*"/>
</fileset>
</jar>
</target>
<target name="jar.tests" depends="compile, dir.dist">
<jar destfile="${distdir}/${app}-tests.jar" compress="false">
<fileset dir="build/classes">
<include name="com/sleepoverrated/twitter/test/**"/>
</fileset>
</jar>
</target>
<target name="run.tests" depends="jars">
<property name="outdir" value="build/reports/tests"/>
<mkdir dir="${outdir}"/>
<junit fork="yes" forkmode="once" printsummary="yes" showoutput="yes">
<classpath>
<path refid="build.classpath"/>
<fileset dir="${distdir}" includes="*.jar"/>
<fileset dir="tests" excludes="*.java"/>
</classpath>
<formatter type="brief" />
<batchtest haltonfailure="yes" todir="${outdir}">
<fileset dir="tests">
<include name="**/*Tests.java"/>
<exclude name="**/Abstract*"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="deploy" depends="clean, run.tests"
description="Deploys to a local TeamCity server">
<teamcity action="stop"/>
<copy file="${distdir}/${app}.jar" todir="${teamcity.appdir}/lib"/>
<teamcity action="start"/>
</target>
<target name="undeploy">
<teamcity action="stop"/>
<delete dir="${teamcity.appdir}/lib" includes="${app}.jar"/>
<teamcity action="start"/>
</target>
<macrodef name="teamcity">
<attribute name="action"/>
<sequential>
<exec executable="${teamcity.home}/bin/runAll.sh">
<arg value="@{action}"/>
</exec>
</sequential>
</macrodef>
</project>