blob: 604fd13db297cad3fba0226779c41b874c02ad2f [file] [log] [blame]
david_williams33f76202010-09-19 04:11:05 +00001<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 create final build repo.
4 Eventually may want to "move" this to each component, in "post build" step?
5 See http://aniefer.blogspot.com/2009/08/versioning-p2-slides-from-eclipsecon.html
6 for example of comparator.
7-->
8<project
9 name="createFinalRepo"
10 default="build"
11 basedir=".">
12
david_williams0ee9c562010-10-05 03:51:49 +000013 <!-- = = = standard properties pattern = = = -->
14 <!--
david_williams33f76202010-09-19 04:11:05 +000015 Note to be cross-platform, "environment variables" are only
16 appropriate for some variables, e.g. ones we set, since
17 properties are case sensitive, even if the environment variables
18 on your operating system are not, e.g. it will be ${env.Path}
19 not ${env.PATH} on Windows
20 -->
21 <property
22 environment="env"/>
david_williams0ee9c562010-10-05 03:51:49 +000023 <!--
david_williams33f76202010-09-19 04:11:05 +000024 Let users override standard properties, if desired. If
25 directory, file, or some properties do not exist, then standard
26 properties will be used.
27 -->
28 <property
29 file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties"/>
30
david_williams0ee9c562010-10-05 03:51:49 +000031 <!-- = = = end standard properties pattern = = = -->
david_williams33f76202010-09-19 04:11:05 +000032
33
34
35 <fail
36 unless="wtp.builder.home"/>
37 <property
38 file="${wtp.builder.home}/build.properties"/>
39
40
david_williams9c32af12010-09-26 04:46:26 +000041 <!-- required to get proper value of branch specific values, for example,
42 baseComparatorRepoDir, since can vary from forward "integration" stream,
43 and "maintenance" branch -->
david_williams33f76202010-09-19 04:11:05 +000044 <property
45 name="keyCfgFile"
46 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
47 <echo
48 level="info"
49 message="keyCfgFile: ${keyCfgFile}"/>
50 <property
51 file="${keyCfgFile}"/>
52
53 <fail
54 unless="baseComparatorRepoDir"
55 message="baseComparatorRepoDir must be defined for this ant script"/>
david_williams0ee9c562010-10-05 03:51:49 +000056
david_williams8f592862010-10-11 17:12:02 +000057 <property
58 name="baseComparatorRepoDirTests"
59 value="${baseComparatorRepoDir}"/>
david_williams0ee9c562010-10-05 03:51:49 +000060
61 <!-- if not otherwise set, use these default properties
david_williams33f76202010-09-19 04:11:05 +000062 <property
63 name="repoDownloadBaseURL"
64 value="http://build.eclipse.org/webtools/committers"/> -->
65 <property
david_williams0929cae2010-10-05 03:16:29 +000066 name="repoDownloadBaseURL"
67 value=".."/>
david_williams33f76202010-09-19 04:11:05 +000068
david_williams0929cae2010-10-05 03:16:29 +000069 <fail
70 unless="env.PROJECT_PROJECTS"/>
71 <fail
72 unless="projectname"/>
73 <property
74 name="labelfile"
75 value="${env.PROJECT_PROJECTS}/${projectname}/workdir/label.properties"/>
76 <available
77 file="${labelfile}"
78 property="labelfileavailable"/>
79 <fail
80 unless="labelfileavailable"/>
81 <property
82 file="${labelfile}"/>
david_williams33f76202010-09-19 04:11:05 +000083
david_williams0929cae2010-10-05 03:16:29 +000084
85 <target
david_williams33f76202010-09-19 04:11:05 +000086 name="build"
david_williamsc039dcb2010-10-05 01:44:20 +000087 depends="doMirror,doMirrorTests">
david_williams33f76202010-09-19 04:11:05 +000088
david_williams0ee9c562010-10-05 03:51:49 +000089 <!-- add the new build to the composite -->
90 <!--
david_williams33f76202010-09-19 04:11:05 +000091 TODO: after promotion, do we need to delete repo's as directories removed? Or just do occasional cleanup,
92 if non-existent child repos are ignored
93 TODO: ok to use absolute file system locations for child repos? (And still access via http, later?
94-->
david_williams0ee9c562010-10-05 03:51:49 +000095 <!--
david_williams33f76202010-09-19 04:11:05 +000096
97 On build machine, URL's to repositories will look similar to following URL:
98
99 http://build.eclipse.org/webtools/committers/wtp-R3.3.0-I/20100914034658/I-3.3.0-20100914034658/repository/
100
101 which we translate as follows
102
103 repoDownloadBaseURL=http://build.eclipse.org/webtools/committers
104
david_williamsbceee742010-09-19 05:43:20 +0000105 ${repoDownloadBaseURL}/${projectname}/${timestamp}/${buildLabel}/repository/
david_williams33f76202010-09-19 04:11:05 +0000106
107 repoDownloadBaseURL is machine dependent (will differ from one build machine to another).
108
109 Will be different on "download server", as well.
110
111 -->
112
david_williams0ee9c562010-10-05 03:51:49 +0000113 <!-- remember, repoLocation won't exist until later, since it is at the "site", not the
david_williamsc039dcb2010-10-05 01:44:20 +0000114 working directory -->
david_williams71a14732010-10-11 06:19:13 +0000115
116 <!-- remember that repos are added to comparator set only when they are promoted to download location -->
david_williams33f76202010-09-19 04:11:05 +0000117 <property
118 name="repoLocation"
david_williamsbceee742010-09-19 05:43:20 +0000119 value="${repoDownloadBaseURL}/committers/${projectname}/${timestamp}/${buildLabel}/repository/"/>
david_williams33f76202010-09-19 04:11:05 +0000120 <echo
david_williamsc039dcb2010-10-05 01:44:20 +0000121 message="${line.separator}
david_williams71a14732010-10-11 06:19:13 +0000122 created final build repoository at location:${line.separator}
david_williamsc039dcb2010-10-05 01:44:20 +0000123 ${repoLocation}${line.separator}
david_williams71a14732010-10-11 06:19:13 +0000124 "/>
125<!--
david_williams33f76202010-09-19 04:11:05 +0000126 <p2.composite.repository
127 destination="file:/${baseComparatorRepoDir}">
128 <add>
129 <repository
130 location="${repoLocation}"/>
131 </add>
132 </p2.composite.repository>
david_williams71a14732010-10-11 06:19:13 +0000133-->
david_williams33f76202010-09-19 04:11:05 +0000134 </target>
135 <target
136 name="init">
137 <available
138 file="${baseComparatorRepoDir}"
139 type="dir"
140 property="baseComparatorRepoDirExists"/>
david_williams8f592862010-10-11 17:12:02 +0000141 <!-- we copy the comparator filter file, used only during tests, to build output location,
142 just so it is always available, even if tests ran later -->
143 <copy
144 file="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/comparatorfilter.properties"
145 todir="${buildDirectory}/${buildLabel}"/>
146
david_williams33f76202010-09-19 04:11:05 +0000147 </target>
148 <!-- normally, the "prime repository" should be created from previous release,
149 or similar, but if that hasn't been done, we'll automatically create an empty
150 composite repo which we've stored away for simplicity.-->
151 <target
152 name="primeRepo"
153 depends="init"
154 unless="baseComparatorRepoDirExists">
155 <mkdir
156 dir="${baseComparatorRepoDir}"/>
157 <copy
158 todir="${baseComparatorRepoDir}">
159 <fileset
160 dir="${wtp.builder.home}/emptyRepository/"/>
161 </copy>
david_williams0ee9c562010-10-05 03:51:49 +0000162 <!-- could probably just set to true, but we'll use same logic as in init, just in case -->
david_williams33f76202010-09-19 04:11:05 +0000163 <available
164 file="${baseComparatorRepoDir}"
165 type="dir"
166 property="baseComparatorRepoDirExists"/>
167 </target>
david_williams71a14732010-10-11 06:19:13 +0000168 <!-- normally, the "prime repository" should be created from previous release,
169 or similar, but if that hasn't been done, we'll automatically create an empty
170 composite repo which we've stored away for simplicity.-->
171 <target
172 name="primeTestRepo"
173 depends="init"
174 unless="baseComparatorTestRepoDirExists">
175 <mkdir
176 dir="${baseComparatorTestRepoDir}"/>
177 <copy
178 todir="${baseComparatorTestRepoDir}">
179 <fileset
180 dir="${wtp.builder.home}/emptyRepository/"/>
181 </copy>
182 <!-- could probably just set to true, but we'll use same logic as in init, just in case -->
183 <available
184 file="${baseComparatorTestRepoDir}"
185 type="dir"
186 property="baseComparatorTestRepoDirExists"/>
david_williams8f592862010-10-11 17:12:02 +0000187 </target>
david_williams33f76202010-09-19 04:11:05 +0000188 <target
189 name="doMirror"
david_williams0929cae2010-10-05 03:16:29 +0000190 depends="primeRepo">
david_williamsbceee742010-09-19 05:43:20 +0000191 <property
192 name="destinationDir"
193 value="${buildDirectory}/${buildLabel}/repository"/>
194 <echo
195 message="destinationDir: ${destinationDir}"/>
david_williams0929cae2010-10-05 03:16:29 +0000196
david_williams33f76202010-09-19 04:11:05 +0000197 <p2.mirror
198 ignoreErrors="true"
199 verbose="true"
200 log="${buildDirectory}/${buildLabel}/finalMirrorRepo.log">
david_williamsbceee742010-09-19 05:43:20 +0000201
202
203 <destination
204 kind="metadata"
205 location="file:/${destinationDir}"
206 name="Web Tools Platform Repository ${buildLabel}"/>
207 <destination
208 kind="artifact"
209 location="file:/${destinationDir}"
david_williams33f76202010-09-19 04:11:05 +0000210 name="Web Tools Platform Repository ${buildLabel}"/>
david_williamsc039dcb2010-10-05 01:44:20 +0000211
212
213 <source>
214 <repository
215 location="file:/${buildDirectory}/${buildLabel}/buildrepository/"/>
216 </source>
217
218 <comparator
219 comparator="org.eclipse.equinox.p2.repository.tools.jar.comparator"
220 comparatorLog="${buildDirectory}/${buildLabel}/comparator.log">
221 <repository
222 location="file:/${baseComparatorRepoDir}"/>
223 <exclude>
224 <artifact
225 id="org.eclipse.jpt.eclipselink.ui"/>
226 <artifact
227 id="org.eclipse.jpt.ui"/>
228
229 <artifact
230 id="org.eclipse.jst.jsp.core.tests"/>
231 </exclude>
232 </comparator>
david_williams0ee9c562010-10-05 03:51:49 +0000233
234 <!--
david_williams0929cae2010-10-05 03:16:29 +0000235 followStrict is sort of a safety measure. All our features should be strict, but in case not,
236 will show up early if not mirrored.
237
david_williams0929cae2010-10-05 03:16:29 +0000238
239 -->
david_williamsc039dcb2010-10-05 01:44:20 +0000240 <slicingoptions
david_williams0929cae2010-10-05 03:16:29 +0000241 followStrict="true"
david_williamse871f5f2010-10-05 03:43:28 +0000242 includeNonGreedy="false"
david_williams0ee9c562010-10-05 03:51:49 +0000243 includeOptional="false"/>
david_williamsc039dcb2010-10-05 01:44:20 +0000244
david_williams8d133902010-10-05 06:27:59 +0000245 <!--
246 Specify category and let it pull in its features.
247 TODO: would be best to make "property[@name='org.eclipse.equinox.p2.type.category']" part of the query,
248 but a) not sure if/how it will work and b) our names are distinct enough now this suffices.
249 -->
david_williams0ee9c562010-10-05 03:51:49 +0000250
david_williams5739c202010-10-05 06:12:46 +0000251 <iu
david_williamsda951f02010-10-05 06:45:49 +0000252 query="property[@name='org.eclipse.equinox.p2.name' and @value='Web Tools Platform (WTP) ${buildId}']"/>
253
254 <iu
255 query="property[@name='org.eclipse.equinox.p2.name' and @value='Web Tools Platform SDK (WTP SDK) ${buildId}']"/>
david_williamse2dfbbd2010-10-05 04:14:17 +0000256
david_williamsc039dcb2010-10-05 01:44:20 +0000257 </p2.mirror>
david_williams0ee9c562010-10-05 03:51:49 +0000258
259 <!-- create archived repo from contents of 'repository' at this point -->
david_williamsc039dcb2010-10-05 01:44:20 +0000260 <property
261 name="zippedrepo"
262 value="${build.distribution}-repo-${buildLabel}.zip"/>
263 <zip
264 destfile="${buildDirectory}/${buildLabel}/${zippedrepo}"
265 basedir="${buildDirectory}/${buildLabel}/repository"/>
266
267 <ant
268 antfile="${wtp.builder.home}/scripts/build/buildutilitiesp2.xml"
269 target="createChecksums">
270 <property
271 name="archiveName"
272 value="${zippedrepo}"/>
273 </ant>
274
275 </target>
276 <target
277 name="doMirrorTests"
david_williams71a14732010-10-11 06:19:13 +0000278 depends="primeTestRepo">
david_williamsc039dcb2010-10-05 01:44:20 +0000279 <property
280 name="destinationDir"
david_williams71a14732010-10-11 06:19:13 +0000281 value="${buildDirectory}/${buildLabel}/unittestrepository"/>
david_williamsc039dcb2010-10-05 01:44:20 +0000282 <echo
283 message="destinationDir: ${destinationDir}"/>
284
285 <p2.mirror
286 ignoreErrors="true"
287 verbose="true"
david_williams71a14732010-10-11 06:19:13 +0000288 log="${buildDirectory}/${buildLabel}/finalMirror-unittestrepository.log">
david_williamsc039dcb2010-10-05 01:44:20 +0000289
290
291 <destination
292 kind="metadata"
293 location="file:/${destinationDir}"
294 name="Web Tools Platform Repository ${buildLabel}"/>
295 <destination
296 kind="artifact"
297 location="file:/${destinationDir}"
298 name="Web Tools Platform Repository ${buildLabel}"/>
299
300
david_williams33f76202010-09-19 04:11:05 +0000301 <source>
302 <repository
david_williamsbceee742010-09-19 05:43:20 +0000303 location="file:/${buildDirectory}/${buildLabel}/buildrepository/"/>
david_williams33f76202010-09-19 04:11:05 +0000304 </source>
305
306 <comparator
307 comparator="org.eclipse.equinox.p2.repository.tools.jar.comparator"
david_williams81f90f22010-10-11 14:37:45 +0000308 comparatorLog="${buildDirectory}/${buildLabel}/comparator-unittest.log">
david_williams33f76202010-09-19 04:11:05 +0000309 <repository
310 location="file:/${baseComparatorRepoDir}"/>
311 <exclude>
312 <artifact
313 id="org.eclipse.jpt.eclipselink.ui"/>
david_williams0929cae2010-10-05 03:16:29 +0000314 <artifact
david_williamsbceee742010-09-19 05:43:20 +0000315 id="org.eclipse.jpt.ui"/>
david_williamsbceee742010-09-19 05:43:20 +0000316 <artifact
david_williams0929cae2010-10-05 03:16:29 +0000317 id="org.eclipse.jst.jsp.core.tests"/>
david_williams33f76202010-09-19 04:11:05 +0000318 </exclude>
319 </comparator>
320
david_williams0ee9c562010-10-05 03:51:49 +0000321 <slicingoptions
322 followStrict="true"
323 includeNonGreedy="false"
324 includeOptional="false"/>
david_williams8d133902010-10-05 06:27:59 +0000325
326 <!--
327 Specify category and let it pull in its features.
david_williams5739c202010-10-05 06:12:46 +0000328 -->
david_williams33f76202010-09-19 04:11:05 +0000329 <iu
david_williams5739c202010-10-05 06:12:46 +0000330 query="property[@name='org.eclipse.equinox.p2.name' and (@value='Web Tools Platform Tests (WTP Tests) ${buildId}')]"/>
331
david_williams33f76202010-09-19 04:11:05 +0000332
333 </p2.mirror>
david_williams0ee9c562010-10-05 03:51:49 +0000334
335 <!-- create archived repo from contents of 'repository' at this point -->
david_williams0929cae2010-10-05 03:16:29 +0000336 <property
david_williams259f3a02010-10-05 01:58:01 +0000337 name="zippedtestsrepo"
338 value="${build.distribution}-and-tests-repo-${buildLabel}.zip"/>
david_williams0929cae2010-10-05 03:16:29 +0000339 <zip
david_williams259f3a02010-10-05 01:58:01 +0000340 destfile="${buildDirectory}/${buildLabel}/${zippedtestsrepo}"
david_williams0929cae2010-10-05 03:16:29 +0000341 basedir="${buildDirectory}/${buildLabel}/repository"/>
david_williams259f3a02010-10-05 01:58:01 +0000342
david_williams0929cae2010-10-05 03:16:29 +0000343 <ant
344 antfile="${wtp.builder.home}/scripts/build/buildutilitiesp2.xml"
345 target="createChecksums">
346 <property
347 name="archiveName"
david_williams259f3a02010-10-05 01:58:01 +0000348 value="${zippedtestsrepo}"/>
david_williams0929cae2010-10-05 03:16:29 +0000349 </ant>
david_williams259f3a02010-10-05 01:58:01 +0000350
david_williams0929cae2010-10-05 03:16:29 +0000351
352
david_williams33f76202010-09-19 04:11:05 +0000353 </target>
354
355</project>