david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 1 | <project |
| 2 | name="cc_project_build" |
| 3 | default="Build" |
| 4 | basedir="."> |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 5 | <!-- |
| 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_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 12 | <property |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 13 | 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_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 19 | <property |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 20 | file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties"/> |
david_williams | 42f9b24 | 2006-11-27 18:45:14 +0000 | [diff] [blame] | 21 | |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 22 | <!-- = = = end standard properties pattern = = = --> |
david_williams | 42f9b24 | 2006-11-27 18:45:14 +0000 | [diff] [blame] | 23 | |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 24 | <!-- if not otherwise set, build clean --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 25 | <property |
| 26 | name="build.clean" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 27 | value="true"/> |
| 28 | <!-- |
| 29 | set main builder file name, based on distribution, buildBranch |
| 30 | and build type |
| 31 | --> |
david_williams | 0d90cde | 2008-01-05 05:59:43 +0000 | [diff] [blame] | 32 | <property |
| 33 | name="builder" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 34 | 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_williams | 42f9b24 | 2006-11-27 18:45:14 +0000 | [diff] [blame] | 40 | --> |
david_williams | 320c033 | 2008-01-05 05:55:44 +0000 | [diff] [blame] | 41 | <fail |
david_williams | 958e583 | 2008-02-13 05:08:44 +0000 | [diff] [blame] | 42 | unless="projectname" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 43 | message="projectname must be set by caller"/> |
david_williams | 42f9b24 | 2006-11-27 18:45:14 +0000 | [diff] [blame] | 44 | |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 45 | <!-- if not otherwise set, the following are good default values --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 46 | <property |
| 47 | name="mapVersionTag" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 48 | value="HEAD"/> |
| 49 | |
david_williams | 1e71b28 | 2008-03-10 10:12:40 +0000 | [diff] [blame] | 50 | <!-- main --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 51 | <target |
| 52 | name="Build"> |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 53 | |
david_williams | 320c033 | 2008-01-05 05:55:44 +0000 | [diff] [blame] | 54 | <antcall |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 55 | target="doBuildPhase"/> |
david_williams | 320c033 | 2008-01-05 05:55:44 +0000 | [diff] [blame] | 56 | <antcall |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 57 | target="doTestPhase"/> |
david_williams | 958e583 | 2008-02-13 05:08:44 +0000 | [diff] [blame] | 58 | <antcall |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 59 | target="checkIfFailedTests"/> |
| 60 | |
david_williams | 320c033 | 2008-01-05 05:55:44 +0000 | [diff] [blame] | 61 | </target> |
| 62 | <target |
david_williams | 958e583 | 2008-02-13 05:08:44 +0000 | [diff] [blame] | 63 | name="checkIfFailedTests" |
| 64 | depends="checkFailedFile" |
| 65 | if="failedMessage"> |
david_williams | a0c95f7 | 2008-02-13 05:14:14 +0000 | [diff] [blame] | 66 | <fail |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 67 | message="Build failed due to failing JUnits in the following test plugin(s):${line.separator}${failedMessage}"/> |
david_williams | 958e583 | 2008-02-13 05:08:44 +0000 | [diff] [blame] | 68 | </target> |
david_williams | a0c95f7 | 2008-02-13 05:14:14 +0000 | [diff] [blame] | 69 | <target |
| 70 | name="checkFailedFile"> |
| 71 | <loadresource |
| 72 | property="failedMessage" |
| 73 | quiet="true" |
| 74 | failonerror="false"> |
| 75 | <file |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 76 | file="${env.PROJECT_PROJECTS}/${projectname}/workdir/junitFailureList.log"/> |
david_williams | a0c95f7 | 2008-02-13 05:14:14 +0000 | [diff] [blame] | 77 | </loadresource> |
| 78 | </target> |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 79 | <!-- |
| 80 | 1) clean build if build.clean s set to true 2) retreive fresh |
| 81 | files from CVS 3) build and upload results |
| 82 | --> |
| 83 | <target |
david_williams | d2fa7ee | 2008-02-03 21:32:17 +0000 | [diff] [blame] | 84 | name="doBuildPhase"> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 85 | <antcall |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 86 | target="doCleanBuild"/> |
david_williams | 70831b5 | 2007-10-05 03:27:45 +0000 | [diff] [blame] | 87 | |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 88 | <!-- Create preliminary download site files --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 89 | <ant |
| 90 | antfile="${builder}" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 91 | target="site"/> |
| 92 | |
| 93 | <!-- copy what we have so far |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 94 | <ant |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 95 | antfile="cc_copyArtifacts.xml"/> --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 96 | </target> |
| 97 | <target |
| 98 | name="doCleanBuild" |
| 99 | unless="skipCleanBuild"> |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 100 | <!-- clean previous build --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 101 | <antcall |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 102 | target="clean"/> |
| 103 | <!-- check out fresh set of appropriate files for the builder --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 104 | <ant |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 105 | antfile="checkout.xml"/> |
| 106 | <!-- build and create preliminary download site files --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 107 | <ant |
| 108 | antfile="${builder}" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 109 | target="build"/> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 110 | </target> |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 111 | <!-- |
| 112 | test phase runs tests, creates test summary files, and uploads |
| 113 | results |
| 114 | --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 115 | <target |
| 116 | name="doTestPhase" |
| 117 | unless="skipUnitTests"> |
david_williams | d84c220 | 2008-01-05 06:45:17 +0000 | [diff] [blame] | 118 | <delete |
| 119 | dir="${env.PROJECT_TESTS}/${projectname}" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 120 | failonerror="false"/> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 121 | <ant |
| 122 | antfile="${builder}" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 123 | target="test"/> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 124 | <ant |
| 125 | antfile="${builder}" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 126 | target="site"/> |
| 127 | <!-- <ant |
| 128 | antfile="cc_copyArtifacts.xml"/> --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 129 | </target> |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 130 | |
| 131 | <!-- clean task --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 132 | <target |
| 133 | name="clean" |
| 134 | depends="check.clean" |
| 135 | if="doClean"> |
| 136 | <delete |
david_williams | 320c033 | 2008-01-05 05:55:44 +0000 | [diff] [blame] | 137 | dir="${env.PROJECT_PROJECTS}/${projectname}" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 138 | failonerror="false"/> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 139 | <delete |
david_williams | 320c033 | 2008-01-05 05:55:44 +0000 | [diff] [blame] | 140 | dir="${env.PROJECT_TESTS}/${projectname}" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 141 | failonerror="false"/> |
| 142 | <!-- |
| 143 | deleting ant working will be complicated, since sometimes |
| 144 | same as releng.control |
| 145 | --> |
| 146 | <!-- |
| 147 | <delete dir="${env.ANT_WORKING}" failonerror="false" /> |
| 148 | --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 149 | </target> |
| 150 | |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 151 | <!-- if build.clean is true, or does not exist, set doClean to true --> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 152 | <target |
| 153 | name="check.clean"> |
| 154 | <condition |
| 155 | property="doClean"> |
| 156 | <or> |
| 157 | <not> |
| 158 | <isset |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 159 | property="build.clean"/> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 160 | </not> |
| 161 | <equals |
| 162 | arg1="${build.clean}" |
david_williams | c2f548c | 2008-07-21 04:06:47 +0000 | [diff] [blame] | 163 | arg2="true"/> |
david_williams | 39c5f65 | 2008-01-02 07:08:39 +0000 | [diff] [blame] | 164 | </or> |
| 165 | </condition> |
| 166 | </target> |
| 167 | </project> |