blob: f6b1aaa303908c6e3f29ad309ca4cd6a3ac09f4b [file] [log] [blame]
david_williams39c5f652008-01-02 07:08:39 +00001<project
2 name="cc_project_build"
3 default="Build"
4 basedir=".">
david_williams42f9b242006-11-27 18:45:14 +00005
david_williams39c5f652008-01-02 07:08:39 +00006 <!-- = = = standard properties pattern = = = -->
7 <!--
8 Note to be cross-platform, "environment variables" are only appropriate for
david_williams42f9b242006-11-27 18:45:14 +00009 some variables, e.g. ones we set, since properties are case sensitive, even if
10 the environment variables on your operating system are not, e.g. it will
11 be ${env.Path} not ${env.PATH} on Windows -->
david_williams39c5f652008-01-02 07:08:39 +000012 <property
13 environment="env" />
david_williams70831b52007-10-05 03:27:45 +000014
david_williams39c5f652008-01-02 07:08:39 +000015 <!--
16 Let users override standard properties, if desired.
17 If directory, file, or some properties do not exist,
18 then standard properties will be used.
david_williams42f9b242006-11-27 18:45:14 +000019 -->
david_williams39c5f652008-01-02 07:08:39 +000020 <property
21 file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties" />
david_williams42f9b242006-11-27 18:45:14 +000022
david_williams39c5f652008-01-02 07:08:39 +000023 <!-- = = = end standard properties pattern = = = -->
david_williams42f9b242006-11-27 18:45:14 +000024
david_williams39c5f652008-01-02 07:08:39 +000025 <!-- if not otherwise set, build clean -->
26 <property
27 name="build.clean"
28 value="true" />
david_williams70831b52007-10-05 03:27:45 +000029
david_williams0d90cde2008-01-05 05:59:43 +000030 <!-- set main builder file name, based on distribution, buildBranch and build type -->
31 <property
32 name="builder"
33 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG_BUILDER}/build.xml" />
34
david_williams39c5f652008-01-02 07:08:39 +000035 <!--
david_williams320c0332008-01-05 05:55:44 +000036 If not set yet, by "caller", then fail fast.
david_williams39c5f652008-01-02 07:08:39 +000037 Normally this is literally the project name from CruiseControl, but
david_williams320c0332008-01-05 05:55:44 +000038 if running "standalone", it would have to be set to something similar
39 to one of the cc_config project name, such as wtp-R3.0-I.
david_williams42f9b242006-11-27 18:45:14 +000040 -->
david_williams320c0332008-01-05 05:55:44 +000041 <fail
david_williams958e5832008-02-13 05:08:44 +000042 unless="projectname"
43 message="projectname must be set by caller" />
david_williams42f9b242006-11-27 18:45:14 +000044
david_williams39c5f652008-01-02 07:08:39 +000045 <!-- if not otherwise set, the following are good default values -->
46 <property
47 name="mapVersionTag"
48 value="HEAD" />
49 <target
50 name="Build">
david_williams320c0332008-01-05 05:55:44 +000051 <antcall
52 target="doBuildPhase" />
53 <antcall
54 target="doTestPhase" />
david_williams958e5832008-02-13 05:08:44 +000055 <antcall
56 target="checkIfFailedTests" />
david_williams320c0332008-01-05 05:55:44 +000057 </target>
58 <target
david_williams958e5832008-02-13 05:08:44 +000059 name="checkIfFailedTests"
60 depends="checkFailedFile"
61 if="failedMessage">
62 <fail
63 message="failedMessage" />
64 </target>
65 <target name="checkFailedFile">
66
67 <loadresource property="failedMessage" quiet="true" failonerror="false">
68 <file file="${buildDirectory}/junitFailureList.log" />
69 </loadresource>
70
71 </target>
72 <target
david_williamsd2fa7ee2008-02-03 21:32:17 +000073 name="doBuildPhase">
david_williams39c5f652008-01-02 07:08:39 +000074 <antcall
75 target="doCleanBuild" />
david_williams70831b52007-10-05 03:27:45 +000076
david_williams320c0332008-01-05 05:55:44 +000077 <!-- and create preliminary download site files -->
david_williams39c5f652008-01-02 07:08:39 +000078 <ant
79 antfile="${builder}"
80 target="site" />
david_williams320c0332008-01-05 05:55:44 +000081 <!-- upload what we have so far -->
david_williams39c5f652008-01-02 07:08:39 +000082 <ant
83 antfile="${builder}"
84 target="upload" />
david_williams39c5f652008-01-02 07:08:39 +000085 </target>
86 <target
87 name="doCleanBuild"
88 unless="skipCleanBuild">
89 <!-- clean previous build -->
90 <antcall
91 target="clean" />
david_williams39c5f652008-01-02 07:08:39 +000092 <!-- check out fresh set of appropriate files for the builder -->
93 <ant
94 antfile="checkout.xml" />
david_williams39c5f652008-01-02 07:08:39 +000095 <!-- build and create preliminary download site files -->
96 <ant
97 antfile="${builder}"
98 target="build" />
99 </target>
david_williams320c0332008-01-05 05:55:44 +0000100
101 <!-- test phase runs tests, creates test summary files, and uploads results -->
david_williams39c5f652008-01-02 07:08:39 +0000102 <target
103 name="doTestPhase"
104 unless="skipUnitTests">
david_williamsd84c2202008-01-05 06:45:17 +0000105 <delete
106 dir="${env.PROJECT_TESTS}/${projectname}"
107 failonerror="false" />
david_williams39c5f652008-01-02 07:08:39 +0000108 <ant
109 antfile="${builder}"
110 target="test" />
111 <ant
112 antfile="${builder}"
113 target="site" />
david_williams39c5f652008-01-02 07:08:39 +0000114 <ant
115 antfile="${builder}"
116 target="upload" />
117 </target>
david_williams320c0332008-01-05 05:55:44 +0000118
119 <!-- clean task -->
david_williams39c5f652008-01-02 07:08:39 +0000120 <target
121 name="clean"
122 depends="check.clean"
123 if="doClean">
124 <delete
david_williams320c0332008-01-05 05:55:44 +0000125 dir="${env.PROJECT_PROJECTS}/${projectname}"
david_williams39c5f652008-01-02 07:08:39 +0000126 failonerror="false" />
127 <delete
david_williams320c0332008-01-05 05:55:44 +0000128 dir="${env.PROJECT_TESTS}/${projectname}"
129 failonerror="false" />
david_williams8f7802c2008-01-05 09:09:47 +0000130 <!-- deleting ant working will be complicated, since sometimes same as releng.control -->
131 <!--
david_williams320c0332008-01-05 05:55:44 +0000132 <delete
133 dir="${env.ANT_WORKING}"
david_williams39c5f652008-01-02 07:08:39 +0000134 failonerror="false" />
david_williams8f7802c2008-01-05 09:09:47 +0000135 -->
david_williams39c5f652008-01-02 07:08:39 +0000136 </target>
137
david_williams320c0332008-01-05 05:55:44 +0000138 <!-- if build.clean if true, or does not exist, set doClean to true -->
david_williams39c5f652008-01-02 07:08:39 +0000139 <target
140 name="check.clean">
141 <condition
142 property="doClean">
143 <or>
144 <not>
145 <isset
146 property="build.clean" />
147 </not>
148 <equals
149 arg1="${build.clean}"
150 arg2="true" />
151 </or>
152 </condition>
153 </target>
154</project>