| <project name="cc_project_build" default="cc_project_build" basedir="."> |
| |
| <!-- main --> |
| <target name="cc_project_build" depends="init"> |
| |
| <antcall target="doBuildPhase" /> |
| <antcall target="doPackagePhase" /> |
| <antcall target="doTestPhase" /> |
| <antcall target="checkIfFailedTests" /> |
| </target> |
| <target name="checkIfFailedTests" depends="checkFailedFile, init" 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" depends="init"> |
| <loadresource property="failedMessage" quiet="true" failonerror="false"> |
| <file file="${env.PROJECT_PROJECTS}/${projectname}/workdir/junitFailureList.log" /> |
| </loadresource> |
| </target> |
| <!-- |
| 1) clean build if build.clean is not set or set to true 2) retreive fresh |
| files from CVS 3) build and upload results |
| --> |
| <target name="doBuildPhase" depends="init"> |
| <antcall target="doCleanBuild" /> |
| |
| <!-- Create preliminary download site files --> |
| <ant antfile="${builder}" target="site" /> |
| |
| <ant antfile="cc_copyArtifacts.xml" /> |
| |
| </target> |
| |
| <!-- skipCleanBuild was intended to mean "do not rebuild, just re-run unit tests, |
| TODO: but, do not think it currently works. Should investigate/fix someday. --> |
| <target name="doCleanBuild" unless="skipCleanBuild" depends="init"> |
| |
| <!-- added for even when doing repeat builds, might want fresh |
| time stamps TODO: may need work.--> |
| <delete file="${env.PROJECT_PROJECTS}/${projectname}/workdir/label.properties" failonerror="false" /> |
| |
| <!-- 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 --> |
| <echo message="preparing to start main build in builder: ${builder}" /> |
| <echo message="build.clean: ${build.clean}" /> |
| <echo message="doClean: ${doClean}" /> |
| |
| <echo message="checkout.builder.clean: ${checkout.builder.clean}" /> |
| <echo message="doCleanBuilder: ${doCleanBuilder}" /> |
| <ant antfile="${builder}" target="build" /> |
| </target> |
| |
| <!-- |
| test phase runs tests, creates test summary files, and uploads |
| results |
| --> |
| <target name="doTestPhase" unless="skipUnitTests" depends="init"> |
| <delete quiet="true" dir="${env.PROJECT_TESTS}/${projectname}" failonerror="false" /> |
| <ant antfile="${builder}" target="test" /> |
| <ant antfile="${builder}" target="site" /> |
| |
| </target> |
| <target name="doPackagePhase" depends="init"> |
| <ant antfile="${builder}" target="package" /> |
| <!-- TODO: we probably don't need to call "site" here ... just adding new zips/repos ... no prep required? --> |
| <ant antfile="${builder}" target="site" /> |
| <ant antfile="cc_copyArtifacts.xml" /> |
| </target> |
| <!-- clean task --> |
| <target name="clean" depends="init" if="doClean"> |
| <delete quiet="true" dir="${env.PROJECT_PROJECTS}/${projectname}" failonerror="false" /> |
| <delete quiet="true" dir="${env.PROJECT_TESTS}/${projectname}" failonerror="false" /> |
| |
| </target> |
| |
| |
| |
| <target name="init" unless="ccProjectBuildInitialized" depends="init.build.clean,init.check.builder.clean"> |
| |
| <!-- |
| 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 = = = --> |
| |
| |
| <!-- |
| 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" /> |
| |
| |
| |
| <property name="ccProjectBuildInitialized" value="true" /> |
| <echoproperties /> |
| <echo message="finishied initializing cc_project_build" /> |
| </target> |
| |
| <!-- if build.clean is true, or does not exist, set doClean to true, |
| that is, 'false' is only way to not do a clean build --> |
| <target name="init.build.clean"> |
| <condition property="doClean"> |
| <or> |
| <not> |
| <isset property="build.clean" /> |
| </not> |
| <equals arg1="${build.clean}" arg2="true" /> |
| </or> |
| </condition> |
| <echo message="build.clean: ${build.clean}" /> |
| <echo message="doClean: ${doClean}" /> |
| |
| </target> |
| <!-- |
| set doCleanBuilder property checkout.build.clean is set in |
| checkout.properties from the project properties directory |
| --> |
| <target name="init.check.builder.clean"> |
| |
| <condition property="doCleanBuilder"> |
| <or> |
| <not> |
| <isset property="checkout.builder.clean" /> |
| </not> |
| <equals arg1="${checkout.builder.clean}" arg2="true" /> |
| </or> |
| </condition> |
| |
| <echo message="checkout.builder.clean: ${checkout.builder.clean}" /> |
| <echo message="doCleanBuilder: ${doCleanBuilder}" /> |
| |
| </target> |
| |
| </project> |