blob: 68e8bf619536df6f38944566032f5f01b6679c17 [file] [log] [blame]
<project
name="cc_project_build"
default="Build"
basedir=".">
<!-- = = = standard properties pattern = = = -->
<!--
Note to be cross-platform, "environment variables" are only appropriate for
some variables, e.g. ones we set, since properties are case sensitive, even if
the environment variables on your operating system are not, e.g. it will
be ${env.Path} not ${env.PATH} on Windows -->
<property
environment="env" />
<!--
Let users override standard properties, if desired.
If directory, file, or some properties do not exist,
then standard properties will be used.
-->
<property
file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties" />
<!-- = = = end standard properties pattern = = = -->
<!-- if not otherwise set, build clean -->
<property
name="build.clean"
value="true" />
<!-- set main builder file name, based on distribution, buildBranch and build type -->
<property
name="builder"
value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG_BUILDER}/build.xml" />
<!--
If not set yet, by "caller", then fail fast.
Normally this is literally the project name from CruiseControl, but
if running "standalone", it would have to be set to something similar
to one of the cc_config project name, such as wtp-R3.0-I.
-->
<fail
unless="projectname"
message="projectname must be set by caller" />
<!-- if not otherwise set, the following are good default values -->
<property
name="mapVersionTag"
value="HEAD" />
<target
name="Build">
<antcall
target="doBuildPhase" />
<antcall
target="doTestPhase" />
<antcall
target="checkIfFailedTests" />
</target>
<target
name="checkIfFailedTests"
depends="checkFailedFile"
if="failedMessage">
<fail
message="Build failed due to failing JUnits in the following test plugin(s):${line.separator}${failedMessage}" />
</target>
<target
name="checkFailedFile">
<loadresource
property="failedMessage"
quiet="true"
failonerror="false">
<file
file="${env.PROJECT_PROJECTS}/${projectname}/workdir/junitFailureList.log" />
</loadresource>
</target>
<target
name="doBuildPhase">
<antcall
target="doCleanBuild" />
<!-- and create preliminary download site files -->
<ant
antfile="${builder}"
target="site" />
<!-- upload what we have so far -->
<ant
antfile="${builder}"
target="upload" />
</target>
<target
name="doCleanBuild"
unless="skipCleanBuild">
<!-- clean previous build -->
<antcall
target="clean" />
<!-- check out fresh set of appropriate files for the builder -->
<ant
antfile="checkout.xml" />
<!-- build and create preliminary download site files -->
<ant
antfile="${builder}"
target="build" />
</target>
<!-- test phase runs tests, creates test summary files, and uploads results -->
<target
name="doTestPhase"
unless="skipUnitTests">
<delete
dir="${env.PROJECT_TESTS}/${projectname}"
failonerror="false" />
<ant
antfile="${builder}"
target="test" />
<ant
antfile="${builder}"
target="site" />
<ant
antfile="${builder}"
target="upload" />
</target>
<!-- clean task -->
<target
name="clean"
depends="check.clean"
if="doClean">
<delete
dir="${env.PROJECT_PROJECTS}/${projectname}"
failonerror="false" />
<delete
dir="${env.PROJECT_TESTS}/${projectname}"
failonerror="false" />
<!-- deleting ant working will be complicated, since sometimes same as releng.control -->
<!--
<delete
dir="${env.ANT_WORKING}"
failonerror="false" />
-->
</target>
<!-- if build.clean if true, or does not exist, set doClean to true -->
<target
name="check.clean">
<condition
property="doClean">
<or>
<not>
<isset
property="build.clean" />
</not>
<equals
arg1="${build.clean}"
arg2="true" />
</or>
</condition>
</target>
</project>