Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 849f8a25cf219bd73fa87316e8f67a43ee48cd7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (c) 2016 IBM Corporation and others.
  All rights reserved. This program and the accompanying materials
  are made available under the terms of the Eclipse Public License v1.0
  which accompanies this distribution, and is available at
  http://www.eclipse.org/legal/epl-v10.html

  Contributors:
  David Williams - initial API and implementation
-->

<!--
  A utility ant script which gets the Eclipse Platform binary from 'archive' server then uses it to
  install additional tools and utilities from several p2 repositories: from 'downloads', the 'build' machine,
  and one that is on an 'external' site, to actually test that proxies work. (The external one is a "real" project,
  so this script should not be ran so often to "stress" that site, or throw off their download statistics.)

  Hudson jobs (or builds) can call a script like this one from generic ant
  as one of it first build steps to get the eclipse tools or applications, such as antRunner.
-->
<project
  name="getBaseBuilder"
  default="getBaseBuilder"
  basedir=".">

  <target
    name="init"
    unless="getBaseBuilderInitialized">

    <property environment="env" />

    <!-- this property file is optional. It's primarily used to set
      the "proxy setting preferences" for Eclpse. -->
    <property file="platformSpecific.properties" />

    <!-- jvm usually set in the platformSpecific.properties file, but if not, we
      will force one possibly valid value. -->
    <property
      name="jvm"
      value="/shared/common/jdk1.8.0_x64-latest/bin" />


    <condition
      property="TMP"
      value="${env.TMP_DIR}">
      <isset property="env.TMP_DIR" />
    </condition>
    <condition
      property="TMP"
      value="${TMP_DIR}">
      <isset property="TMP_DIR" />
    </condition>

    <condition
      property="TMP"
      value="${env.BUILD_ROOT}/tmp">
      <isset property="${env.BUILD_ROOT}" />
    </condition>

    <condition
      property="TMP"
      value="${BUILD_ROOT}/tmp">
      <isset property="${BUILD_ROOT}" />
    </condition>

    <property
      name="TMP"
      value="${basedir}/tmp" />

    <fail
      unless="TMP"
      message="TMP not defined, since TMP_DIR nor BUILD_ROOT was defined" />
    <echo message="TMP: ${TMP}" />

    <mkdir dir="${TMP}" />

    <condition
      property="basedownloadHost"
      value="${env.BASE_DOWNLOAD_HOST}"
      else="download.eclipse.org">
      <isset property="env.BASE_DOWNLOAD_HOST" />
    </condition>
    <!--
      TODO: need make platform independent, as in test.xml, to compute right one.
      (and, pass in?)
      (and make "version" variable)
    -->
    <!-- example of typical value, when "directory" and "label" are different
      <property name="eclipseBaseDir" value="S-4.6M3-201510291100"/>
      <property name="eclispeBaseLabel" value="4.6M3"/>
    -->
    <!-- for I or M build (which is the unusual case) the build directory and label are the same -->
    <property
      name="eclipseBaseDir"
      value="S-4.7RC3-201705312000" />
    <property
      name="eclispeBaseLabel"
      value="4.7RC3" />

    <property
      name="platformURL"
      value="http://${basedownloadHost}/eclipse/downloads/drops4/${eclipseBaseDir}" />
    <!--
      We used to use binary platform, since smaller, but moved to SDK, to be able to use API Tools.
      But then moved back to Platform, after having some cases where we need to pick up new fixes from
      API tools while continuting to use older "base" for stability.
    -->
    <property
      name="platformFile"
      value="eclipse-platform-${eclispeBaseLabel}-linux-gtk-x86_64.tar.gz" />

    <!--
      mavenproperties.properties is produced during the build and contains
      significant variables (and values) that control the build. In this context,
      'eclipserun-repo' is the one we want, so we only have to set it one place.
      In "post-build" work, WORKSPACE is passed in as the "drop directory" on
      the build machine, which is where the properties are written.
    -->
    <property file="${WORKSPACE}/mavenproperties.properties" />

    <echo message="eclipserun-repo: ${eclipserun-repo}" />
    <!--
      just in case mavenproperties.properties did not exist, we also
      set a default value here. And, for now, at least, we have some
      special logic to provide clear message "it was not set". We can
      remove that, or change to a "fail" if we find it is always set
      as expected in the ways we use it. (such as, may not exist yet,
      if this is called too early?)
    -->

    <condition
      property="eclipserun-repo-is-set"
      value="${eclipserun-repo}"
      else="not set">
      <isset property="eclipserun-repo" />
    </condition>
    <echo message="DEBUG: Before setting default, eclisperun-repo was found to be ${eclipserun-repo-is-set}" />
    <!-- the following setting is just to make sure we have a reasonable "fallback" value, such as when
      using this script on Hudson to do "clean up" of repositories. Should change it to "well known" version,
      such as updates/4.6/ once it is ready.
    -->
    <property
      name="eclipserun-repo"
      value="http://download.eclipse.org/eclipse/updates/4.7-I-builds/" />
    <echo message="eclipserun-repo: ${eclipserun-repo}" />

    <property
      name="apiTools.repository"
      value="${eclipserun-repo}" />
    <property
      name="apiTools.iu"
      value="org.eclipse.pde.api.tools" />
    <!-- since we specify specific repo for api tools, we can leave version to "highest" -->
    <property
      name="apiTools.iu.version"
      value="" />

    <property
      name="buildTools.repository"
      value="http://build.eclipse.org/eclipse/buildtools/" />
    <property
      name="buildTools.feature"
      value="org.eclipse.releng.build.tools.feature.feature.group" />
    <!-- Here, even though not specific repo, we always want the "latest". But, if that ever changes,
      we can specify a concrete version here.
    -->
    <property
      name="buildTools.feature.version"
      value="" />

    <property
      name="buildTools.derby.feature"
      value="org.apache.derby.core.feature.feature.group" />
    <property
      name="buildTools.derby.feature.version"
      value="" />

    <property
      name="webtools.repository"
      value="http://download.eclipse.org/webtools/releng/repository/" />
    <property
      name="webtools.feature"
      value="org.eclipse.wtp.releng.tools.feature.feature.group" />
    <property
      name="webtools.feature.version"
      value="1.2.0.v201102200505-21-7w312213311616" />

    <!--
      This repo ONLY used for testing proxies. Not production runs.
      Have included this "external" site, just to give a true
      test of the proxies themselves. I got this site from "marketplace"
      and because this is a "real" project for someone, we should not
      overuse the "test" aspect, or will throw off their numbers.
      If it is ever desired to "run this test" ever day, or similar,
      then a better "test site" should be found or created. -->
    <property
      name="external.repository"
      value=" http://fabrizioiannetti.github.io/p2/" />
    <property
      name="external.feature"
      value="com.github.fabeclipse.textedgrep_feature.feature.group" />
    <property
      name="external.feature.version"
      value="" />

    <!-- assign default WORKSPACE if not on Hudson, for local testing if nothing else -->
    <property
      name="WORKSPACE"
      value="${basedir}" />
    <echo message="WORKSPACE: ${WORKSPACE}" />

    <!--
      The desired folder name (made to stay consistent with cvs module name,
      even though Git project is named eclipse.platform.releng.basebuilder.
      And, *this* script does not even need to git the Git project!
    -->
    <property
      name="folderName"
      value="org.eclipse.releng.basebuilder" />

    <property
      name="java8vmbindir"
      value="/shared/common/jdk1.8.0_x64-latest/bin/" />

    <property
      name="getBaseBuilderInitialized"
      value="true" />
  </target>


  <target
    name="getBaseBuilder"
    depends="init">
    <!-- remove old one, if there, and make sure one exists for eventual checkout/copy/globmapper -->
    <delete dir="${WORKSPACE}/${folderName}" />
    <mkdir dir="${WORKSPACE}/${folderName}" />
    <antcall target="fetchBasePlatform" />
  </target>

  <target
    name="fetchBasePlatform"
    depends="init"
    if="platformURL">
    <get
      dest="${TMP}/${platformFile}"
      src="${platformURL}/${platformFile}"
      usetimestamp="true" />
    <!-- untar is broken in Ant 1.9.4. See https://bz.apache.org/bugzilla/show_bug.cgi?id=56641 -->
    <untar
      compression="gzip"
      src="${TMP}/${platformFile}"
      dest="${TMP}">
    </untar>
    <!-- untar is broken in Ant 1.9.4. See https://bz.apache.org/bugzilla/show_bug.cgi?id=56641
      <exec
      executable="/bin/tar"
      dir="${TMP}">
      <arg value="-xf" />
      <arg value="${TMP}/${platformFile}" />
      </exec>
    -->
    <chmod perm="ugo+x">
      <fileset dir="${TMP}/eclipse">
        <include name="eclipse" />
        <include name="*.so*" />
      </fileset>
    </chmod>

    <antcall target="installSettings" />

    <exec
      dir="${TMP}/eclipse"
      failonerror="true"
      executable="${TMP}/eclipse/eclipse">
      <arg value="-nosplash" />
      <arg value="-debug" />
      <arg value="-consolelog" />
      <arg value="-data" />
      <arg value="${WORKSPACE}/workspace-toolsinstall" />
      <arg value="-application" />
      <arg value="org.eclipse.equinox.p2.director" />
      <arg value="-repository" />
      <arg value="${eclipserun-repo},${buildTools.repository},${webtools.repository}" />
      <arg value="-installIU" />
      <arg
        value="${apiTools.iu}/${apiTools.iu.version},${buildTools.feature}/${buildTools.feature.version},${webtools.feature}/${webtools.feature.version},${buildTools.derby.feature}/${buildTools.derby.feature.version}" />
      <arg value="-vm" />
      <arg value="${java8vmbindir}" />
      <!-- vmargs must come last -->
      <arg value="-vmargs" />
      <arg value="-Djava.io.tmpdir=${TMP}" />
    </exec>

    <!-- we "move" so the directory structure so it flat under basebuilder ...
      for compatibility to very old code/scripts -->
    <move todir="${WORKSPACE}/${folderName}">
      <fileset dir="${TMP}/eclipse/" />
    </move>

    <echo
      message="platform and tools installed. platformURL: ${platformURL} platform: ${platformFile}, fetched using tychoeclipsebuilder/getBaseBuilderAndTools.xml" />
    <echo message="The following were the properties in effect:" />
    <echoproperties />
  </target>
  <target
    name="installSettings"
    if="org.eclipse.core.net.prefs">
    <property
      name="settingsDir"
      value="org.eclipse.releng.basebuilder/configuration/.settings" />

    <mkdir dir="${settingsDir}" />
    <echo
      message="${org.eclipse.core.net.prefs}"
      file="${settingsDir}/org.eclipse.core.net.prefs" />
  </target>

</project>

Back to the top