blob: 510ab3427eb6516567244f78aafcfdb67e18d3a4 [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"/>
<!-- main -->
<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"
unless="passBuildEvenIfFailedTests">
<loadresource
property="failedMessage"
quiet="true"
failonerror="false">
<file
file="${env.PROJECT_PROJECTS}/${projectname}/workdir/junitFailureList.log"/>
</loadresource>
</target>
<!--
1) clean build if build.clean s set to true 2) retreive fresh
files from CVS 3) build and upload results
-->
<target
name="doBuildPhase">
<antcall
target="doCleanBuild"/>
<!-- Create preliminary download site files -->
<ant
antfile="${builder}"
target="site"/>
<!--
copy what we have so far <ant
antfile="cc_copyArtifacts.xml"/>
-->
</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="cc_copyArtifacts.xml"/> -->
</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 is 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>