blob: 98357b08b0a4ef86ee0df2ce711f46d75d92e6df [file] [log] [blame]
tlea2ed2272011-10-04 23:20:52 +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
13 <!-- = = = standard properties pattern = = = -->
14 <!--
15 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 environment="env"/>
22 <!--
23 Let users override standard properties, if desired. If
24 directory, file, or some properties do not exist, then standard
25 properties will be used.
26 -->
27 <property file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties"/>
28
29 <!-- = = = end standard properties pattern = = = -->
30
31
32
33 <fail unless="wtp.builder.home"/>
34 <property file="${wtp.builder.home}/build.properties"/>
35
36
37 <!-- required to get proper value of branch specific values, for example,
38 baseComparatorRepoDir, since can vary from forward "integration" stream,
39 and "maintenance" branch -->
40 <property
41 name="keyCfgFile"
42 value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
43 <echo
44 level="info"
45 message="keyCfgFile: ${keyCfgFile}"/>
46 <property file="${keyCfgFile}"/>
47
48 <fail
49 unless="baseComparatorRepoDir"
50 message="baseComparatorRepoDir must be defined for this ant script"/>
51
52 <property
53 name="baseComparatorRepoDirTests"
54 value="${baseComparatorRepoDir}"/>
55
56 <!-- if not otherwise set, use these default properties
57 <property
58 name="repoDownloadBaseURL"
59 value="http://build.eclipse.org/webtools/committers"/> -->
60 <property
61 name="repoDownloadBaseURL"
62 value=".."/>
63
64 <fail unless="env.PROJECT_PROJECTS"/>
65 <fail unless="projectname"/>
66 <property
67 name="labelfile"
68 value="${env.PROJECT_PROJECTS}/${projectname}/workdir/label.properties"/>
69 <available
70 file="${labelfile}"
71 property="labelfileavailable"/>
72 <fail unless="labelfileavailable"/>
73 <property file="${labelfile}"/>
74
75
76 <target
77 name="build"
78 depends="doMirror,doMirrorTests">
79
80 <!-- add the new build to the composite -->
81 <!--
82 TODO: after promotion, do we need to delete repo's as directories removed? Or just do occasional cleanup,
83 if non-existent child repos are ignored
84 TODO: ok to use absolute file system locations for child repos? (And still access via http, later?
85-->
86 <!--
87
88 On build machine, URL's to repositories will look similar to following URL:
89
90 http://build.eclipse.org/webtools/committers/wtp-R3.3.0-I/20100914034658/I-3.3.0-20100914034658/repository/
91
92 which we translate as follows
93
94 repoDownloadBaseURL=http://build.eclipse.org/webtools/committers
95
96 ${repoDownloadBaseURL}/${projectname}/${timestamp}/${buildLabel}/repository/
97
98 repoDownloadBaseURL is machine dependent (will differ from one build machine to another).
99
100 Will be different on "download server", as well.
101
102 -->
103
104 <!-- remember, repoLocation won't exist until later, since it is at the "site", not the
105 working directory -->
106
107 <!-- remember that repos are added to comparator set only when they are promoted to download location -->
108 <property
109 name="repoLocation"
110 value="${repoDownloadBaseURL}/committers/${projectname}/${timestamp}/${buildLabel}/repository/"/>
111 <echo
112 message="${line.separator}
113 created final build repoository at location:${line.separator}
114 ${repoLocation}${line.separator}
115 "/>
116<!--
117 <p2.composite.repository
118 destination="file:/${baseComparatorRepoDir}">
119 <add>
120 <repository
121 location="${repoLocation}"/>
122 </add>
123 </p2.composite.repository>
124-->
125 </target>
126 <target name="init">
127 <available
128 file="${baseComparatorRepoDir}"
129 type="dir"
130 property="baseComparatorRepoDirExists"/>
131 <!-- we copy the comparator filter file, used only during tests, to build output location,
132 just so it is always available, even if tests ran later -->
133 <copy
134 file="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/comparatorfilter.properties"
135 todir="${buildDirectory}/${buildLabel}"/>
136
137 </target>
138 <!-- normally, the "prime repository" should be created from previous release,
139 or similar, but if that hasn't been done, we'll automatically create an empty
140 composite repo which we've stored away for simplicity.-->
141 <target
142 name="primeRepo"
143 depends="init"
144 unless="baseComparatorRepoDirExists">
145 <mkdir dir="${baseComparatorRepoDir}"/>
146 <copy todir="${baseComparatorRepoDir}">
147 <fileset dir="${wtp.builder.home}/emptyRepository/"/>
148 </copy>
149 <!-- could probably just set to true, but we'll use same logic as in init, just in case -->
150 <available
151 file="${baseComparatorRepoDir}"
152 type="dir"
153 property="baseComparatorRepoDirExists"/>
154 </target>
155 <!-- normally, the "prime repository" should be created from previous release,
156 or similar, but if that hasn't been done, we'll automatically create an empty
157 composite repo which we've stored away for simplicity.-->
158 <target
159 name="primeTestRepo"
160 depends="init"
161 unless="baseComparatorTestRepoDirExists">
162 <mkdir dir="${baseComparatorTestRepoDir}"/>
163 <copy todir="${baseComparatorTestRepoDir}">
164 <fileset dir="${wtp.builder.home}/emptyRepository/"/>
165 </copy>
166 <!-- could probably just set to true, but we'll use same logic as in init, just in case -->
167 <available
168 file="${baseComparatorTestRepoDir}"
169 type="dir"
170 property="baseComparatorTestRepoDirExists"/>
171 </target>
172 <target
173 name="doMirror"
174 depends="primeRepo">
175 <property
176 name="destinationDir"
177 value="${buildDirectory}/${buildLabel}/repository"/>
178 <echo message="destinationDir: ${destinationDir}"/>
179
180 <p2.mirror
181 ignoreErrors="true"
182 verbose="true"
183 log="${buildDirectory}/${buildLabel}/finalMirrorRepo.log">
184
185
186 <destination
187 kind="metadata"
188 location="file:/${destinationDir}"
189 name="Web Tools Platform Repository ${buildLabel}"/>
190 <destination
191 kind="artifact"
192 location="file:/${destinationDir}"
193 name="Web Tools Platform Repository ${buildLabel}"/>
194
195
196 <source>
197 <repository location="file:/${buildDirectory}/${buildLabel}/buildrepository/"/>
198 </source>
199
200 <comparator
201 comparator="org.eclipse.equinox.p2.repository.tools.jar.comparator"
202 comparatorLog="${buildDirectory}/${buildLabel}/comparator.log">
203 <repository location="file:/${baseComparatorRepoDir}"/>
204 <exclude>
205 <artifact id="org.eclipse.jpt.eclipselink.ui"/>
206 <artifact id="org.eclipse.jpt.ui"/>
207
208 <artifact id="org.eclipse.jst.jsp.core.tests"/>
209 </exclude>
210 </comparator>
211
212 <!--
213 followStrict is sort of a safety measure. All our features should be strict, but in case not,
214 will show up early if not mirrored.
215
216
217 -->
218 <slicingoptions
219 followStrict="true"
220 includeNonGreedy="false"
221 includeOptional="false"/>
222
223 <!--
224 Specify category and let it pull in its features.
225 TODO: would be best to make "property[@name='org.eclipse.equinox.p2.type.category']" part of the query,
226 but a) not sure if/how it will work and b) our names are distinct enough now this suffices.
227 -->
228
tled902a1d2011-10-28 18:59:38 +0000229 <iu query="property[@name='org.eclipse.equinox.p2.name' and @value='Dali Java Persistence Tools Platform ${buildId}']"/>
tlea2ed2272011-10-04 23:20:52 +0000230
tled902a1d2011-10-28 18:59:38 +0000231 <iu query="property[@name='org.eclipse.equinox.p2.name' and @value='Dali Java Persistence Tools Platform SDK ${buildId}']"/>
tlea2ed2272011-10-04 23:20:52 +0000232
233 </p2.mirror>
234
235 <!-- create archived repo from contents of 'repository' at this point -->
236 <property
237 name="zippedrepo"
238 value="${build.distribution}-repo-${buildLabel}.zip"/>
239 <zip
240 destfile="${buildDirectory}/${buildLabel}/${zippedrepo}"
241 basedir="${buildDirectory}/${buildLabel}/repository"/>
242
243 <ant
244 antfile="${wtp.builder.home}/scripts/build/buildutilitiesp2.xml"
245 target="createChecksums">
246 <property
247 name="archiveName"
248 value="${zippedrepo}"/>
249 </ant>
250
251 </target>
252 <target
253 name="doMirrorTests"
254 depends="primeTestRepo">
255 <property
256 name="destinationDirTests"
257 value="${buildDirectory}/${buildLabel}/repositoryunittests"/>
258 <echo message="destinationDirTests: ${destinationDirTests}"/>
259
260 <p2.mirror
261 ignoreErrors="true"
262 verbose="true"
263 log="${buildDirectory}/${buildLabel}/finalMirror-unittestrepository.log">
264
265
266 <destination
267 kind="metadata"
268 location="file:/${destinationDirTests}"
269 name="Web Tools Platform Repository for Unit Tests ${buildLabel}"/>
270 <destination
271 kind="artifact"
272 location="file:/${destinationDirTests}"
273 name="Web Tools Platform Repository for Unit Tests ${buildLabel}"/>
274
275
276 <source>
277 <repository location="file:/${buildDirectory}/${buildLabel}/buildrepository/"/>
278 </source>
279
280 <comparator
281 comparator="org.eclipse.equinox.p2.repository.tools.jar.comparator"
282 comparatorLog="${buildDirectory}/${buildLabel}/comparator-unittest.log">
283 <repository location="file:/${baseComparatorRepoDir}"/>
284 <exclude>
285 <artifact id="org.eclipse.jpt.eclipselink.ui"/>
286 <artifact id="org.eclipse.jpt.ui"/>
287 <artifact id="org.eclipse.jst.jsp.core.tests"/>
288 </exclude>
289 </comparator>
290
291 <slicingoptions
292 followStrict="true"
293 includeNonGreedy="false"
294 includeOptional="false"/>
295
296 <!--
297 Specify category and let it pull in its features.
298 -->
tled902a1d2011-10-28 18:59:38 +0000299 <iu query="property[@name='org.eclipse.equinox.p2.name' and (@value='Dali Java Persistence Tools Platform Tests ${buildId}')]"/>
tlea2ed2272011-10-04 23:20:52 +0000300
301
302 </p2.mirror>
303
304 <!-- create archived repo from contents of 'repository' at this point -->
305 <property
306 name="zippedtestsrepo"
307 value="${build.distribution}-tests-repo-${buildLabel}.zip"/>
308 <zip
309 destfile="${buildDirectory}/${buildLabel}/${zippedtestsrepo}"
310 basedir="${buildDirectory}/${buildLabel}/repositoryunittests"/>
311
312 <ant
313 antfile="${wtp.builder.home}/scripts/build/buildutilitiesp2.xml"
314 target="createChecksums">
315 <property
316 name="archiveName"
317 value="${zippedtestsrepo}"/>
318 </ant>
319
320
321
322 </target>
323
324</project>