Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 375a51c731a0bf75ea9a77c31938e52708920d83 (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
<?xml version="1.0" encoding="UTF-8"?>
<!--
  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="downloadHost"
      value="${env.DOWNLOAD_HOST}"
      else="archive.eclipse.org">
      <isset property="env.DOWNLOAD_HOST" />
    </condition>
    <!--
      TODO: need make platform independent, as in test.xml, to compute right one.
      (and, pass in?)
      (and make "version" variable)
    -->
    <property
      name="platformURL"
      value="http://${downloadHost}/eclipse/downloads/drops4/R-4.5.2-201602121500" />
    <!--
      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.
    -->
    <property
      name="platformFile"
      value="eclipse-platform-4.5.2-linux-gtk-x86_64.tar.gz" />

    <property
      name="eclipserun-repo"
      value="http://download.eclipse.org/eclipse/updates/4.5/R-4.5.2-201602121500" />
    <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 "hightest" -->
    <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" />

    <!-- 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 history.
    -->
    <property
      name="folderName"
      value="org.eclipse.releng.basebuilder" />

    <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>
    -->
    <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},${external.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},${external.feature}/${external.feature.version}" />
      <arg value="-vm" />
      <arg value="${jvm}" />
      <!-- 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 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