-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
143 lines (121 loc) · 4.22 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
<project name="Cradiator" default="build">
<property name="app" value="cradiator"/>
<tstamp>
<format property="version" timezone="UTC" pattern="yyyyMMdd"/>
</tstamp>
<property name="distdir" value="build/${app}-dist"/>
<property name="teamcity.home" location="/Users/shawn42/lib/TeamCity"/>
<property name="teamcity.appdir" location="${teamcity.home}/webapps/ROOT/WEB-INF"/>
<property name="teamcity.runAll" location="${teamcity.home}/bin/runAll.sh"/>
<path id="build.classpath">
<!--<fileset dir="lib" includes="*.jar"/>-->
<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">
<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>
</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="jars" depends="jar.app"/>
<target name="jar.app" depends="compile, build.identifier, dir.dist">
<jar destfile="${distdir}/${app}.jar" compress="false">
<fileset dir="build/classes">
</fileset>
<fileset dir=".">
<include name="META-INF/**/*"/>
<include name="buildServerResources/**/*"/>
</fileset>
</jar>
</target>
<target name="build.identifier">
<echo file="build/classes/version.properties" message="cradiator.version=${version}"/>
</target>
<!--<target name="jar.tests" depends="compile, dir.dist">
<jar destfile="${distdir}/${app}-tests.jar" compress="false">
<fileset dir="build/classes">
<include name="nat/piazza/tests/**"/>
</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="no" showoutput="yes">
<classpath>
<path refid="build.classpath"/>
<fileset dir="${distdir}" includes="*.jar"/>
<fileset dir="tests" excludes="*.java"/>
</classpath>
<formatter type="brief" usefile="no"/>
<batchtest haltonfailure="yes">
<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">
<copy file="${distdir}/${app}.jar" todir="${teamcity.appdir}/lib"/>
</target>
<!-- assumes that team city is being run in a perpetual loop -->
<target name="deploy-and-restart" depends="clean, run.tests"
description="Deploys to a local TeamCity server and restarts it">
<copy file="${distdir}/${app}.jar" todir="${teamcity.appdir}/lib"/>
<teamcity action="stop"/>
<waitfor maxwait="1" maxwaitunit="minute" checkevery="500" checkeveryunit="millisecond" timeoutproperty="serverfound">
<not>
<socket port="8800" server="localhost" />
</not>
</waitfor>
<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.runAll}" dir="${teamcity.home}/bin/" spawn="true">
<arg value="@{action}"/>
</exec>
</sequential>
</macrodef>
</project>