blob: d9a2f2448ed6fadf95c1c955738e8fad9adb9691 [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">
david_williamsa0c95f72008-02-13 05:14:14 +000062 <fail
david_williams958e5832008-02-13 05:08:44 +000063 message="failedMessage" />
64 </target>
david_williamsa0c95f72008-02-13 05:14:14 +000065 <target
66 name="checkFailedFile">
67 <loadresource
68 property="failedMessage"
69 quiet="true"
70 failonerror="false">
71 <file
72 file="${env.PROJECT_PROJECTS}/${projectname}/workdir/junitFailureList.log" />
73 </loadresource>
74 </target>
david_williams958e5832008-02-13 05:08:44 +000075 <target
david_williamsd2fa7ee2008-02-03 21:32:17 +000076 name="doBuildPhase">
david_williams39c5f652008-01-02 07:08:39 +000077 <antcall
78 target="doCleanBuild" />
david_williams70831b52007-10-05 03:27:45 +000079
david_williams320c0332008-01-05 05:55:44 +000080 <!-- and create preliminary download site files -->
david_williams39c5f652008-01-02 07:08:39 +000081 <ant
82 antfile="${builder}"
83 target="site" />
david_williams320c0332008-01-05 05:55:44 +000084 <!-- upload what we have so far -->
david_williams39c5f652008-01-02 07:08:39 +000085 <ant
86 antfile="${builder}"
87 target="upload" />
david_williams39c5f652008-01-02 07:08:39 +000088 </target>
89 <target
90 name="doCleanBuild"
91 unless="skipCleanBuild">
92 <!-- clean previous build -->
93 <antcall
94 target="clean" />
david_williams39c5f652008-01-02 07:08:39 +000095 <!-- check out fresh set of appropriate files for the builder -->
96 <ant
97 antfile="checkout.xml" />
david_williams39c5f652008-01-02 07:08:39 +000098 <!-- build and create preliminary download site files -->
99 <ant
100 antfile="${builder}"
101 target="build" />
102 </target>
david_williams320c0332008-01-05 05:55:44 +0000103
104 <!-- test phase runs tests, creates test summary files, and uploads results -->
david_williams39c5f652008-01-02 07:08:39 +0000105 <target
106 name="doTestPhase"
107 unless="skipUnitTests">
david_williamsd84c2202008-01-05 06:45:17 +0000108 <delete
109 dir="${env.PROJECT_TESTS}/${projectname}"
110 failonerror="false" />
david_williams39c5f652008-01-02 07:08:39 +0000111 <ant
112 antfile="${builder}"
113 target="test" />
114 <ant
115 antfile="${builder}"
116 target="site" />
david_williams39c5f652008-01-02 07:08:39 +0000117 <ant
118 antfile="${builder}"
119 target="upload" />
120 </target>
david_williams320c0332008-01-05 05:55:44 +0000121
122 <!-- clean task -->
david_williams39c5f652008-01-02 07:08:39 +0000123 <target
124 name="clean"
125 depends="check.clean"
126 if="doClean">
127 <delete
david_williams320c0332008-01-05 05:55:44 +0000128 dir="${env.PROJECT_PROJECTS}/${projectname}"
david_williams39c5f652008-01-02 07:08:39 +0000129 failonerror="false" />
130 <delete
david_williams320c0332008-01-05 05:55:44 +0000131 dir="${env.PROJECT_TESTS}/${projectname}"
132 failonerror="false" />
david_williams8f7802c2008-01-05 09:09:47 +0000133 <!-- deleting ant working will be complicated, since sometimes same as releng.control -->
134 <!--
david_williams320c0332008-01-05 05:55:44 +0000135 <delete
136 dir="${env.ANT_WORKING}"
david_williams39c5f652008-01-02 07:08:39 +0000137 failonerror="false" />
david_williams8f7802c2008-01-05 09:09:47 +0000138 -->
david_williams39c5f652008-01-02 07:08:39 +0000139 </target>
140
david_williams320c0332008-01-05 05:55:44 +0000141 <!-- if build.clean if true, or does not exist, set doClean to true -->
david_williams39c5f652008-01-02 07:08:39 +0000142 <target
143 name="check.clean">
144 <condition
145 property="doClean">
146 <or>
147 <not>
148 <isset
149 property="build.clean" />
150 </not>
151 <equals
152 arg1="${build.clean}"
153 arg2="true" />
154 </or>
155 </condition>
156 </target>
157</project>