blob: 73b0988672902204b37e13417eec00479759f8a1 [file] [log] [blame]
david_williams39c5f652008-01-02 07:08:39 +00001<project
2 name="cc_project_build"
3 default="Build"
4 basedir=".">
david_williamsc2f548c2008-07-21 04:06:47 +00005 <!--
6 Standard properties pattern. Note: to be cross-platform,
7 "environment variables" are only appropriate for some variables,
8 e.g. ones we set, since properties are case sensitive, even if
9 the environment variables on your operating system are not, e.g.
10 it will be ${env.Path} not ${env.PATH} on Windows
11 -->
david_williams39c5f652008-01-02 07:08:39 +000012 <property
david_williamsc2f548c2008-07-21 04:06:47 +000013 environment="env"/>
14 <!--
15 Let users override standard properties, if desired. If
16 directory, file, or some properties do not exist, then standard
17 properties will be used.
18 -->
david_williams39c5f652008-01-02 07:08:39 +000019 <property
david_williamsc2f548c2008-07-21 04:06:47 +000020 file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties"/>
david_williams42f9b242006-11-27 18:45:14 +000021
david_williams66ec93d2009-11-21 07:06:30 +000022 <!-- = = = end standard properties pattern = = = -->
david_williams42f9b242006-11-27 18:45:14 +000023
david_williams66ec93d2009-11-21 07:06:30 +000024 <!-- if not otherwise set, build clean -->
david_williams39c5f652008-01-02 07:08:39 +000025 <property
26 name="build.clean"
david_williamsc2f548c2008-07-21 04:06:47 +000027 value="true"/>
28 <!--
29 set main builder file name, based on distribution, buildBranch
30 and build type
31 -->
david_williams0d90cde2008-01-05 05:59:43 +000032 <property
33 name="builder"
david_williamsc2f548c2008-07-21 04:06:47 +000034 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG_BUILDER}/build.xml"/>
35 <!--
36 If not set yet, by "caller", then fail fast. Normally this is
37 literally the project name from CruiseControl, but if running
38 "standalone", it would have to be set to something similar to
39 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"
david_williamsc2f548c2008-07-21 04:06:47 +000043 message="projectname must be set by caller"/>
david_williams42f9b242006-11-27 18:45:14 +000044
david_williams66ec93d2009-11-21 07:06:30 +000045 <!-- if not otherwise set, the following are good default values -->
david_williams39c5f652008-01-02 07:08:39 +000046 <property
47 name="mapVersionTag"
david_williamsc2f548c2008-07-21 04:06:47 +000048 value="HEAD"/>
49
david_williams66ec93d2009-11-21 07:06:30 +000050 <!-- main -->
david_williams39c5f652008-01-02 07:08:39 +000051 <target
52 name="Build">
david_williams320c0332008-01-05 05:55:44 +000053 <antcall
david_williamsc2f548c2008-07-21 04:06:47 +000054 target="doBuildPhase"/>
david_williams320c0332008-01-05 05:55:44 +000055 <antcall
david_williamsc2f548c2008-07-21 04:06:47 +000056 target="doTestPhase"/>
david_williams958e5832008-02-13 05:08:44 +000057 <antcall
david_williamsc2f548c2008-07-21 04:06:47 +000058 target="checkIfFailedTests"/>
david_williams320c0332008-01-05 05:55:44 +000059 </target>
60 <target
david_williams958e5832008-02-13 05:08:44 +000061 name="checkIfFailedTests"
62 depends="checkFailedFile"
63 if="failedMessage">
david_williamsa0c95f72008-02-13 05:14:14 +000064 <fail
david_williamsc2f548c2008-07-21 04:06:47 +000065 message="Build failed due to failing JUnits in the following test plugin(s):${line.separator}${failedMessage}"/>
david_williams958e5832008-02-13 05:08:44 +000066 </target>
david_williamsa0c95f72008-02-13 05:14:14 +000067 <target
david_williams66ec93d2009-11-21 07:06:30 +000068 name="checkFailedFile"
69 unless="passBuildEvenIfFailedTests">
david_williamsa0c95f72008-02-13 05:14:14 +000070 <loadresource
71 property="failedMessage"
72 quiet="true"
73 failonerror="false">
74 <file
david_williamsc2f548c2008-07-21 04:06:47 +000075 file="${env.PROJECT_PROJECTS}/${projectname}/workdir/junitFailureList.log"/>
david_williamsa0c95f72008-02-13 05:14:14 +000076 </loadresource>
77 </target>
david_williamsc2f548c2008-07-21 04:06:47 +000078 <!--
79 1) clean build if build.clean s set to true 2) retreive fresh
80 files from CVS 3) build and upload results
81 -->
82 <target
david_williamsd2fa7ee2008-02-03 21:32:17 +000083 name="doBuildPhase">
david_williams39c5f652008-01-02 07:08:39 +000084 <antcall
david_williamsc2f548c2008-07-21 04:06:47 +000085 target="doCleanBuild"/>
david_williams70831b52007-10-05 03:27:45 +000086
david_williams66ec93d2009-11-21 07:06:30 +000087 <!-- Create preliminary download site files -->
david_williams39c5f652008-01-02 07:08:39 +000088 <ant
89 antfile="${builder}"
david_williamsc2f548c2008-07-21 04:06:47 +000090 target="site"/>
david_williams66ec93d2009-11-21 07:06:30 +000091 <!--
92 copy what we have so far <ant
93 antfile="cc_copyArtifacts.xml"/>
94 -->
david_williams39c5f652008-01-02 07:08:39 +000095 </target>
96 <target
97 name="doCleanBuild"
98 unless="skipCleanBuild">
david_williams66ec93d2009-11-21 07:06:30 +000099 <!-- clean previous build -->
david_williams39c5f652008-01-02 07:08:39 +0000100 <antcall
david_williamsc2f548c2008-07-21 04:06:47 +0000101 target="clean"/>
david_williams66ec93d2009-11-21 07:06:30 +0000102 <!-- check out fresh set of appropriate files for the builder -->
david_williams39c5f652008-01-02 07:08:39 +0000103 <ant
david_williamsc2f548c2008-07-21 04:06:47 +0000104 antfile="checkout.xml"/>
david_williams66ec93d2009-11-21 07:06:30 +0000105 <!-- build and create preliminary download site files -->
david_williams39c5f652008-01-02 07:08:39 +0000106 <ant
107 antfile="${builder}"
david_williamsc2f548c2008-07-21 04:06:47 +0000108 target="build"/>
david_williams39c5f652008-01-02 07:08:39 +0000109 </target>
david_williamsc2f548c2008-07-21 04:06:47 +0000110 <!--
111 test phase runs tests, creates test summary files, and uploads
112 results
113 -->
david_williams39c5f652008-01-02 07:08:39 +0000114 <target
115 name="doTestPhase"
116 unless="skipUnitTests">
david_williamsd84c2202008-01-05 06:45:17 +0000117 <delete
118 dir="${env.PROJECT_TESTS}/${projectname}"
david_williamsc2f548c2008-07-21 04:06:47 +0000119 failonerror="false"/>
david_williams39c5f652008-01-02 07:08:39 +0000120 <ant
121 antfile="${builder}"
david_williamsc2f548c2008-07-21 04:06:47 +0000122 target="test"/>
david_williams39c5f652008-01-02 07:08:39 +0000123 <ant
124 antfile="${builder}"
david_williamsc2f548c2008-07-21 04:06:47 +0000125 target="site"/>
david_williams66ec93d2009-11-21 07:06:30 +0000126 <!-- <ant
david_williamsc2f548c2008-07-21 04:06:47 +0000127 antfile="cc_copyArtifacts.xml"/> -->
david_williams39c5f652008-01-02 07:08:39 +0000128 </target>
david_williamsc2f548c2008-07-21 04:06:47 +0000129
david_williams66ec93d2009-11-21 07:06:30 +0000130 <!-- clean task -->
david_williams39c5f652008-01-02 07:08:39 +0000131 <target
132 name="clean"
133 depends="check.clean"
134 if="doClean">
135 <delete
david_williams320c0332008-01-05 05:55:44 +0000136 dir="${env.PROJECT_PROJECTS}/${projectname}"
david_williamsc2f548c2008-07-21 04:06:47 +0000137 failonerror="false"/>
david_williams39c5f652008-01-02 07:08:39 +0000138 <delete
david_williams320c0332008-01-05 05:55:44 +0000139 dir="${env.PROJECT_TESTS}/${projectname}"
david_williamsc2f548c2008-07-21 04:06:47 +0000140 failonerror="false"/>
david_williamsb6058f52009-12-27 22:23:15 +0000141
david_williams39c5f652008-01-02 07:08:39 +0000142 </target>
143
david_williams66ec93d2009-11-21 07:06:30 +0000144 <!-- if build.clean is true, or does not exist, set doClean to true -->
david_williams39c5f652008-01-02 07:08:39 +0000145 <target
146 name="check.clean">
147 <condition
148 property="doClean">
149 <or>
150 <not>
151 <isset
david_williamsc2f548c2008-07-21 04:06:47 +0000152 property="build.clean"/>
david_williams39c5f652008-01-02 07:08:39 +0000153 </not>
154 <equals
155 arg1="${build.clean}"
david_williamsc2f548c2008-07-21 04:06:47 +0000156 arg2="true"/>
david_williams39c5f652008-01-02 07:08:39 +0000157 </or>
158 </condition>
159 </target>
160</project>