blob: 08ce631cd62c606101af07e0d5354aea8a38b9e9 [file] [log] [blame]
nickboldt03a6f082019-02-12 15:17:11 -05001<!--
2 Copyright (c) 2006, 2019 IBM Corporation and others.
3 This program and the accompanying materials
4 are made available under the terms of the Eclipse Public License 2.0
5 which accompanies this distribution, and is available at
6 https://www.eclipse.org/legal/epl-2.0/
7
8 SPDX-License-Identifier: EPL-2.0
9
10 Contributors:
11 IBM Corporation - initial API and implementation
12 -->
david_williamsae0e4cb2006-11-11 02:55:51 +000013<project
david_williams05dbe622007-12-09 01:20:57 +000014 name="PDECustomTargets"
15 default="noDefault"
david_williams403beae2007-12-09 02:10:40 +000016 basedir=".">
david_williams1183f7b2009-10-28 00:32:09 +000017 <!--
18 = = = standard properties pattern = = = Note to be
19 cross-platform, "environment variables" are only appropriate for
20 some variables, e.g. ones we set, since properties are case
21 sensitive, even if the environment variables on your operating
22 system are not, e.g. it will be ${env.Path} not ${env.PATH} on
23 Windows
24 -->
david_williamsb3ef3732011-03-01 05:02:09 +000025 <property environment="env"/>
david_williams1183f7b2009-10-28 00:32:09 +000026 <!--
27 Let users override standard properties, if desired. If
28 directory, file, or some properties do not exist, then standard
29 properties will be used.
30 -->
david_williamsb3ef3732011-03-01 05:02:09 +000031 <property file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties"/>
david_williams403beae2007-12-09 02:10:40 +000032
david_williams1183f7b2009-10-28 00:32:09 +000033 <!-- let this project specify properties, if not already set -->
david_williamsb3ef3732011-03-01 05:02:09 +000034 <property file="build.properties"/>
david_williams1183f7b2009-10-28 00:32:09 +000035 <fail
36 message="dependency.properties must be specified by distribution script"
37 unless="dependency.properties"/>
david_williamsb641ce32008-07-01 03:36:40 +000038 <fail
39 unless="buildDirectory"
david_williams1183f7b2009-10-28 00:32:09 +000040 message="buildDirectory must be set"/>
david_williamsb3ef3732011-03-01 05:02:09 +000041 <echo message="buildDirectory: ${buildDirectory}"/>
david_williams92d59912010-06-07 16:07:48 +000042 <property
43 name="archiveName"
44 value="${component}-buildrepo-${buildLabel}.zip"/>
45 <property
46 name="p2.metadata.repo.name"
47 value="WTP Build repository: ${buildLabel}/${component}"/>
48 <property
49 name="p2.artifact.repo.name"
50 value="WTP Build repository: ${buildLabel}/${component}"/>
51 <property
52 name="p2buildrepoDirectory"
david_williams49f39c52010-06-08 10:57:04 +000053 value="${buildDirectory}/${buildLabel}/buildrepository/${component}/"/>
david_williams92d59912010-06-07 16:07:48 +000054 <property
55 name="p2.build.repo"
56 value="file://${p2buildrepoDirectory}/"/>
57 <property
david_williamsab744512010-09-12 04:48:21 +000058 name="p2.category.definition.file"
david_williams99caa012011-03-05 06:33:25 +000059 value="${buildDirectory}/maps/${env.RELENG}/components/${component}/category.xml"/>
david_williams7e568c72010-09-12 09:04:15 +000060
david_williamsab744512010-09-12 04:48:21 +000061 <property
david_williams92d59912010-06-07 16:07:48 +000062 name="p2.category.definition"
david_williamsab744512010-09-12 04:48:21 +000063 value="file:/${p2.category.definition.file}"/>
david_williams7e568c72010-09-12 09:04:15 +000064
65
david_williamsb3ef3732011-03-01 05:02:09 +000066 <echo message="p2.build.repo: ${p2.build.repo}"/>
67 <echo message="p2.category.definition: ${p2.category.definition}"/>
david_williams1183f7b2009-10-28 00:32:09 +000068 <!--
69 Run a given ${target} on all elements being built Add on <ant>
70 task for each top level element being built.
david_williamsb641ce32008-07-01 03:36:40 +000071 -->
david_williams92d59912010-06-07 16:07:48 +000072 <available
73 property="allElementsFile"
74 file="${builder}/allElements.xml"
75 value="${builder}/allElements.xml"/>
76 <property
77 name="allElementsFile"
78 location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/>
david_williamsb3ef3732011-03-01 05:02:09 +000079 <import file="${allElementsFile}"/>
80 <target name="allElements">
david_williams403beae2007-12-09 02:10:40 +000081 <echo
82 level="info"
david_williams92d59912010-06-07 16:07:48 +000083 message="target: ${target} "/>
david_williams403beae2007-12-09 02:10:40 +000084 <echo
david_williams92d59912010-06-07 16:07:48 +000085 level="info"
david_williams1183f7b2009-10-28 00:32:09 +000086 message="basedir: ${basedir}"/>
david_williams403beae2007-12-09 02:10:40 +000087 <echo
david_williamsb641ce32008-07-01 03:36:40 +000088 level="info"
david_williams1183f7b2009-10-28 00:32:09 +000089 message="component: ${component}"/>
david_williamsb641ce32008-07-01 03:36:40 +000090 <echo
david_williams92d59912010-06-07 16:07:48 +000091 level="info"
david_williams1183f7b2009-10-28 00:32:09 +000092 message="buildDirectory: ${buildDirectory}"/>
david_williams403beae2007-12-09 02:10:40 +000093 <echo
david_williams92d59912010-06-07 16:07:48 +000094 level="info"
david_williams1183f7b2009-10-28 00:32:09 +000095 message="baseLocation: ${baseLocation}"/>
david_williams403beae2007-12-09 02:10:40 +000096 <echo
david_williams92d59912010-06-07 16:07:48 +000097 level="info"
david_williams1183f7b2009-10-28 00:32:09 +000098 message="generic target: ${genericTargets}"/>
99 <echo
david_williams92d59912010-06-07 16:07:48 +0000100 level="info"
101 message="topLevelElementId: ${topLevelElementId}"/>
david_williamsb3ef3732011-03-01 05:02:09 +0000102 <echo message="compilerArg: ${compilerArg}"/>
103 <echo message="individualSourceBundles: ${individualSourceBundles}"/>
104 <antcall target="allElementsDelegator"/>
david_williamsae0e4cb2006-11-11 02:55:51 +0000105 </target>
david_williams92d59912010-06-07 16:07:48 +0000106
david_williams1183f7b2009-10-28 00:32:09 +0000107 <!--
david_williams92d59912010-06-07 16:07:48 +0000108 Check out map files from repository
david_williamsb641ce32008-07-01 03:36:40 +0000109 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000110 <target name="getMapFiles">
david_williams92d59912010-06-07 16:07:48 +0000111
112 <!-- for now, get all, at once. May componetize later. -->
david_williamsb641ce32008-07-01 03:36:40 +0000113 <ant
114 antfile="${wtp.builder.home}/scripts/build/maptasks.xml"
david_williams92d59912010-06-07 16:07:48 +0000115 target="fetchAllMaps"/>
david_williamsae0e4cb2006-11-11 02:55:51 +0000116 </target>
117
david_williams6ac0ea22007-02-28 02:25:23 +0000118
david_williams92d59912010-06-07 16:07:48 +0000119 <!--
david_williamsb641ce32008-07-01 03:36:40 +0000120 Steps to do before setup
121 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000122 <target name="preSetup">
david_williams92d59912010-06-07 16:07:48 +0000123 </target>
david_williamsb641ce32008-07-01 03:36:40 +0000124 <!--
david_williams1183f7b2009-10-28 00:32:09 +0000125 Steps to do after setup but before starting the build proper
david_williamsb641ce32008-07-01 03:36:40 +0000126 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000127 <target name="postSetup">
david_williamsd913e922006-11-13 07:24:21 +0000128 <dirname
129 file="${ant.file}"
david_williams1183f7b2009-10-28 00:32:09 +0000130 property="component.dir"/>
david_williams403beae2007-12-09 02:10:40 +0000131 <echo
132 level="debug"
david_williams1183f7b2009-10-28 00:32:09 +0000133 message="ant.file: ${ant.file}"/>
david_williams403beae2007-12-09 02:10:40 +0000134 <echo
135 level="debug"
david_williams1183f7b2009-10-28 00:32:09 +0000136 message="component.dir: ${component.dir}"/>
david_williamsae0e4cb2006-11-11 02:55:51 +0000137
david_williams8f11ee72007-06-30 08:22:55 +0000138 <!-- Get the dependencies -->
david_williamsb3ef3732011-03-01 05:02:09 +0000139 <antcall target="getDependencies"/>
david_williams7e568c72010-09-12 09:04:15 +0000140
david_williamsb3ef3732011-03-01 05:02:09 +0000141 <antcall target="updateCategoriesFiles"/>
david_williams8f11ee72007-06-30 08:22:55 +0000142 </target>
david_williams1183f7b2009-10-28 00:32:09 +0000143 <!--
144 =====================================================================
145 -->
david_williams8f11ee72007-06-30 08:22:55 +0000146 <!-- Get the dependencies based on releng maps -->
david_williams1183f7b2009-10-28 00:32:09 +0000147 <!--
148 =====================================================================
149 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000150 <target name="getDependencies">
david_williamsd913e922006-11-13 07:24:21 +0000151 <ant
david_williamsbf62a202010-09-27 05:03:32 +0000152 antfile="${wtp.builder.home}/scripts/dependency/dependency.xml"
david_williamsd913e922006-11-13 07:24:21 +0000153 target="get">
154 <property
david_williamsd913e922006-11-13 07:24:21 +0000155 name="base.install.dir"
david_williams1183f7b2009-10-28 00:32:09 +0000156 value="${buildRoot}"/>
david_williamsb3ef3732011-03-01 05:02:09 +0000157 <property
158 name="tobeinstalled.properties"
david_williams99caa012011-03-05 06:33:25 +0000159 value="${buildDirectory}/maps/${env.RELENG}/components/${component}/tobeInstalled.properties"/>
david_williamsbf62a202010-09-27 05:03:32 +0000160
david_williamsae0e4cb2006-11-11 02:55:51 +0000161 </ant>
david_williams8f11ee72007-06-30 08:22:55 +0000162 </target>
david_williamsd913e922006-11-13 07:24:21 +0000163
david_williamsb641ce32008-07-01 03:36:40 +0000164 <!--
david_williams92d59912010-06-07 16:07:48 +0000165 Steps to do before fetching the build elements
david_williamsb641ce32008-07-01 03:36:40 +0000166 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000167 <target name="preFetch">
david_williams92d59912010-06-07 16:07:48 +0000168 </target>
david_williamsb3ef3732011-03-01 05:02:09 +0000169 <target name="postFetch">
170 <ant
171 antfile="${wtp.builder.home}/scripts/build/maptasks.xml"
172 target="unrewriteMaps"/>
173
david_williams92d59912010-06-07 16:07:48 +0000174 </target>
david_williams9e7f5842011-03-06 03:32:03 +0000175
david_williams92d59912010-06-07 16:07:48 +0000176 <!--
177 Steps to do before the repositories are being processed
david_williamsb641ce32008-07-01 03:36:40 +0000178 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000179 <target name="preProcessRepos">
david_williams92d59912010-06-07 16:07:48 +0000180 </target>
181 <!--
182 Steps to do after the repositories have been processed
183 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000184 <target name="postProcessRepos">
david_williams92d59912010-06-07 16:07:48 +0000185 </target>
david_williamsae0e4cb2006-11-11 02:55:51 +0000186
david_williamsb641ce32008-07-01 03:36:40 +0000187 <!--
david_williams92d59912010-06-07 16:07:48 +0000188 Steps to do before generating the build scripts.
david_williamsb641ce32008-07-01 03:36:40 +0000189 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000190 <target name="preGenerate">
david_williams92d59912010-06-07 16:07:48 +0000191 </target>
david_williams93e3fb52008-10-08 06:15:10 +0000192
193 <!--
david_williams92d59912010-06-07 16:07:48 +0000194 Steps to do after generating the build scripts.
david_williams93e3fb52008-10-08 06:15:10 +0000195 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000196 <target name="postGenerate">
david_williams9e7f5842011-03-06 03:32:03 +0000197
david_williamsd2606a72011-03-06 01:58:09 +0000198 <ant antfile="${wtp.builder.home}/scripts/build/customizeAccessRules.xml"/>
david_williams8f11ee72007-06-30 08:22:55 +0000199 </target>
david_williams1183f7b2009-10-28 00:32:09 +0000200 <!--
201 Steps to do before running the build.xmls for the elements being
202 built.
david_williamsb641ce32008-07-01 03:36:40 +0000203 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000204 <target name="preProcess">
david_williamsae0e4cb2006-11-11 02:55:51 +0000205 <replace
206 dir="${buildDirectory}/plugins"
207 value="${timestamp}"
208 token="@build@">
david_williamsb3ef3732011-03-01 05:02:09 +0000209 <include name="**/about.mappings"/>
david_williamsae0e4cb2006-11-11 02:55:51 +0000210 </replace>
211 </target>
david_williamsb641ce32008-07-01 03:36:40 +0000212 <!--
david_williams1183f7b2009-10-28 00:32:09 +0000213 Steps to do after running the build.xmls for the elements being
214 built.
david_williamsb641ce32008-07-01 03:36:40 +0000215 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000216 <target name="postProcess">
217 <condition property="logsAvailable">
218 <istrue value="${javacVerbose}"/>
david_williamsae0e4cb2006-11-11 02:55:51 +0000219 </condition>
david_williamsb3ef3732011-03-01 05:02:09 +0000220 <antcall target="gatherLogs"/>
david_williamsae0e4cb2006-11-11 02:55:51 +0000221 </target>
222
david_williams92d59912010-06-07 16:07:48 +0000223 <!-- Steps to do before running assemble. -->
david_williamsb3ef3732011-03-01 05:02:09 +0000224 <target name="preAssemble">
david_williams92d59912010-06-07 16:07:48 +0000225 </target>
david_williamsae0e4cb2006-11-11 02:55:51 +0000226
david_williamsb641ce32008-07-01 03:36:40 +0000227 <!--
david_williams92d59912010-06-07 16:07:48 +0000228 Steps to do after running assemble.
david_williamsb641ce32008-07-01 03:36:40 +0000229 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000230 <target name="postAssemble">
david_williams92d59912010-06-07 16:07:48 +0000231
232 <ant
233 antfile="${wtp.builder.home}/scripts/build/buildutilitiesp2.xml"
234 target="conditionAndSignJars"/>
235 <ant
236 antfile="${wtp.builder.home}/scripts/build/buildutilitiesp2.xml"
237 target="finishPackages"/>
david_williamse93df372010-09-13 03:53:24 +0000238
239
david_williams92d59912010-06-07 16:07:48 +0000240 </target>
david_williamsae0e4cb2006-11-11 02:55:51 +0000241
david_williamsb641ce32008-07-01 03:36:40 +0000242 <!--
david_williams92d59912010-06-07 16:07:48 +0000243 Steps to do after the build is done.
david_williamsb641ce32008-07-01 03:36:40 +0000244 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000245 <target name="prePackage">
david_williams92d59912010-06-07 16:07:48 +0000246 </target>
247
248 <!-- Steps to do after running package. -->
david_williamsb3ef3732011-03-01 05:02:09 +0000249 <target name="postPackage">
david_williams92d59912010-06-07 16:07:48 +0000250 </target>
david_williamsae0e4cb2006-11-11 02:55:51 +0000251
david_williamsb641ce32008-07-01 03:36:40 +0000252 <!--
david_williams92d59912010-06-07 16:07:48 +0000253 Steps to do after the build is done.
david_williamsb641ce32008-07-01 03:36:40 +0000254 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000255 <target name="postBuild">
david_williams92d59912010-06-07 16:07:48 +0000256 </target>
david_williamsae0e4cb2006-11-11 02:55:51 +0000257
david_williamsb641ce32008-07-01 03:36:40 +0000258 <!--
david_williams92d59912010-06-07 16:07:48 +0000259 Steps to do to test the build results
david_williams1183f7b2009-10-28 00:32:09 +0000260 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000261 <target name="test">
david_williams92d59912010-06-07 16:07:48 +0000262 </target>
david_williamsae0e4cb2006-11-11 02:55:51 +0000263
david_williamsb641ce32008-07-01 03:36:40 +0000264 <!--
david_williams92d59912010-06-07 16:07:48 +0000265 Steps to do to publish the build results
david_williamsb641ce32008-07-01 03:36:40 +0000266 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000267 <target name="publish">
david_williams92d59912010-06-07 16:07:48 +0000268 </target>
david_williamsae0e4cb2006-11-11 02:55:51 +0000269
david_williamsb641ce32008-07-01 03:36:40 +0000270 <!--
david_williams92d59912010-06-07 16:07:48 +0000271 Helper targets
david_williamsb641ce32008-07-01 03:36:40 +0000272 -->
david_williamsae0e4cb2006-11-11 02:55:51 +0000273 <target
274 name="gatherLogs"
275 if="logsAvailable">
david_williamsb3ef3732011-03-01 05:02:09 +0000276 <mkdir dir="${buildDirectory}/${buildLabel}/${compilelogsDir}"/>
david_williams403beae2007-12-09 02:10:40 +0000277 <echo
278 level="debug"
david_williams1183f7b2009-10-28 00:32:09 +0000279 message="logExtension: ${logExtension}"/>
david_williamsb3ef3732011-03-01 05:02:09 +0000280 <antcall target="allElements">
david_williamsae0e4cb2006-11-11 02:55:51 +0000281 <param
282 name="target"
david_williams1183f7b2009-10-28 00:32:09 +0000283 value="gatherLogs"/>
david_williams803b3cd2007-12-13 07:37:16 +0000284 <param
285 name="logExtension"
david_williams1183f7b2009-10-28 00:32:09 +0000286 value="${logExtension}"/>
david_williamsae0e4cb2006-11-11 02:55:51 +0000287 </antcall>
david_williamsae0e4cb2006-11-11 02:55:51 +0000288 <unzip
david_williams92d59912010-06-07 16:07:48 +0000289 dest="${buildDirectory}/${buildLabel}/${compilelogsDir}"
david_williamsae0e4cb2006-11-11 02:55:51 +0000290 overwrite="true">
david_williamsb3ef3732011-03-01 05:02:09 +0000291 <fileset dir="${buildDirectory}/features/${topLevelElementId}">
292 <include name="**/*.log.zip"/>
david_williamsae0e4cb2006-11-11 02:55:51 +0000293 </fileset>
294 </unzip>
david_williams92d59912010-06-07 16:07:48 +0000295 <!--
296 workaround: see
297 https://bugs.eclipse.org/bugs/show_bug.cgi?id=156043 and
298 https://bugs.eclipse.org/bugs/show_bug.cgi?id=172361 and
299 https://bugs.eclipse.org/bugs/show_bug.cgi?id=294070
300 -->
david_williamsddf11402009-11-04 03:46:23 +0000301
david_williams92d59912010-06-07 16:07:48 +0000302 <copy
303 todir="${buildDirectory}/${buildLabel}/${compilelogsDir}/plugins"
304 overwrite="true">
305 <!--
306 we want all @dot.xml files, but assumes a certain
307 structure, to include directory for name of plugin
308 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000309 <fileset dir="${buildDirectory}/features/">
310 <include name="**/feature.temp.folder/"/>
311 <exclude name="**/*tests*feature*/feature.temp.folder/"/>
david_williams92d59912010-06-07 16:07:48 +0000312 </fileset>
313 <compositemapper>
314 <mapper
315 type="regexp"
316 from="(.*)/plugins/(.*)/@dot.xml"
317 to="/\2/@dot.xml"/>
318 <mapper
319 type="regexp"
320 from="(.*)/plugins/(.*)/(.*)bin.xml"
321 to="/\2/\3bin.xml"/>
322 </compositemapper>
323 </copy>
324
david_williamsae0e4cb2006-11-11 02:55:51 +0000325 </target>
david_williamsae0e4cb2006-11-11 02:55:51 +0000326 <target
327 name="clean"
328 unless="noclean">
david_williamsb3ef3732011-03-01 05:02:09 +0000329 <antcall target="allElements">
david_williamsae0e4cb2006-11-11 02:55:51 +0000330 <param
331 name="target"
david_williams1183f7b2009-10-28 00:32:09 +0000332 value="cleanElement"/>
david_williamsae0e4cb2006-11-11 02:55:51 +0000333 </antcall>
334 </target>
335
david_williamsb641ce32008-07-01 03:36:40 +0000336 <!--
david_williamsab744512010-09-12 04:48:21 +0000337 Note: buildId is typically of the form "3.3.0"
338 may want to use buildLabel, which is of form I-3.3.0-20100912032913
339 -->
340
david_williams7e568c72010-09-12 09:04:15 +0000341 <target
342 name="updateCategoriesFiles"
343 depends="checkCategoriesFiles"
344 if="categoryFileExists">
345 <replace
346 file="${p2.category.definition.file}"
347 value="${buildId}"
348 token="@buildversionid@">
349 </replace>
350
351
352 </target>
david_williamsb3ef3732011-03-01 05:02:09 +0000353 <target name="checkCategoriesFiles">
david_williams7e568c72010-09-12 09:04:15 +0000354 <available
355 file="${p2.category.definition.file}"
356 property="categoryFileExists"/>
david_williams9e7f5842011-03-06 03:32:03 +0000357 </target>
358
359
david_williamsab744512010-09-12 04:48:21 +0000360 <!--
david_williams92d59912010-06-07 16:07:48 +0000361 Default target
david_williamsb641ce32008-07-01 03:36:40 +0000362 -->
david_williamsb3ef3732011-03-01 05:02:09 +0000363 <target name="noDefault">
david_williams403beae2007-12-09 02:10:40 +0000364 <echo
365 level="error"
david_williams1183f7b2009-10-28 00:32:09 +0000366 message="You must specify a target when invoking this file"/>
david_williamsae0e4cb2006-11-11 02:55:51 +0000367 </target>
david_williams1183f7b2009-10-28 00:32:09 +0000368</project>