-
Notifications
You must be signed in to change notification settings - Fork 19
/
ide-build.xml
407 lines (373 loc) · 17.1 KB
/
ide-build.xml
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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<?xml version="1.0" encoding="UTF-8"?>
<project name="ceylon-ide-eclipse" default="help" basedir="." xmlns:if="ant:if">
<tstamp>
<format property="NOW" pattern="yyyyMMddHHmm" />
</tstamp>
<property file="build.properties"/>
<property name="projects.dir" value="${basedir}/projects"/>
<property name="ceylon.dist.dir" value="${basedir}/dist"/>
<property name="ceylon.repo.dir" value="${ceylon.dist.dir}/repo"/>
<property name="gitprojects" value="ceylon.formatter,ceylon.tool.converter.java2ceylon,ceylon-ide-common,ceylon-ide-eclipse,ceylon-ide-intellij" />
<property name="ceylonmodules" value="ceylon.formatter,ceylon.tool.converter.java2ceylon,ceylon-ide-common" />
<property name="msg.needlocalorsiblings" value="Needs 'local' or 'siblings' target to be mentioned first" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="../ceylon-dist/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<target name="help">
<echo>Options for building the Ceylon IE plugins:
ant setup - Sets up a new clean environment for development
ant status - Shows the Git status of the sibling projects
ant update - Updates the Git repository of the sibling projects
ant publish - Cleans and builds all sibling projects
ant ide - Builds the IDE components for all sibling projects
ant clean - Cleans the build environment
To build the Eclipse plugin:
mvn clean install -DskipTests
To build the IntelliJ plugin:
See the README of the ceylon-ide-intellij project for instructions
</echo>
</target>
<target name="setup" depends="siblings,git-clone"
description="Sets up a new clean environment for development">
</target>
<target name="setup-admins"
description="Sets up a new clean environment for developers with write access to the core repositories">
<property name="github-url" value="[email protected]:"/>
<antcall target="setup" />
</target>
<target name="eclipse" depends="siblings,publish,ide-quick,eclipse-quick">
</target>
<target name="eclipse-quick" depends="siblings">
<ant antfile="${projects.base.dir}/ceylon-ide-eclipse/build.xml"
target="build"
dir="${projects.base.dir}/ceylon-ide-eclipse"
inheritall="false"
useNativeBasedir="true">
<property name="build-against" value="${build-against}"/>
</ant>
</target>
<target name="intellij" depends="siblings,publish,ide-quick,intellij-quick">
</target>
<target name="intellij-quick" depends="siblings">
<ant antfile="${projects.base.dir}/ceylon-ide-intellij/build.xml"
target="build"
dir="${projects.base.dir}/ceylon-ide-intellij"
inheritall="false"
useNativeBasedir="true">
</ant>
</target>
<target name="publish" depends="siblings,publish-quick"
description="Publishes all sibling projects" />
<target name="publish-quick" depends="siblings">
<foreach list="${ceylonmodules}"
target="publish-item"
param="project.item.name"
inheritall="true" />
</target>
<target name="publish-item">
<fail unless="projects.base.dir" />
<fail unless="project.item.name" />
<ant antfile="${projects.base.dir}/${project.item.name}/build.xml"
target="publish"
dir="${projects.base.dir}/${project.item.name}"
inheritall="false"
useNativeBasedir="true">
<!--property name="ceylon.repo.dir" value="${ceylon.repo.dir}"/>
<property name="ceylon.dist.dir" value="${ceylon.dist.dir}"/-->
</ant>
</target>
<target name="ide" depends="siblings">
<property name="buildtarget" value="ide-internal" />
<antcall target="ide-quick"/>
</target>
<target name="ide-quick" depends="siblings">
<foreach list="${ceylonmodules}"
target="ide-item"
param="project.item.name"
inheritall="true" />
</target>
<target name="ide-item">
<fail unless="projects.base.dir" />
<fail unless="project.item.name" />
<ant antfile="${projects.base.dir}/${project.item.name}/build.xml"
target="ide-quick"
dir="${projects.base.dir}/${project.item.name}"
inheritall="false"
useNativeBasedir="true">
<!--property name="ceylon.repo.dir" value="${ceylon.repo.dir}"/>
<property name="ceylon.dist.dir" value="${ceylon.dist.dir}"/-->
</ant>
</target>
<target name="update" depends="siblings,git-update"
description="Updates sibling projects with latest code from git">
</target>
<target name="status" depends="siblings,git-status"
description="Shows git status of all sibling projects">
</target>
<target name="local"
description="Builds using dependent projects in the ${projects.dir} directory.
Used with another target such as 'package'.">
<property name="projects.base.dir" value="${projects.dir}"/>
<property name="ceylon-formatter.dir" value="${projects.base.dir}/ceylon.formatter"/>
<property name="ceylon-converter.dir" value="${projects.base.dir}/ceylon.tool.converter.java2ceylon"/>
<property name="ceylon-ide-common.dir" value="${projects.base.dir}/ceylon-ide-common"/>
<property name="ceylon-ide-eclipse.dir" value="${projects.base.dir}/ceylon-ide-eclipse"/>
<property name="ceylon-ide-intellij.dir" value="${projects.base.dir}/ceylon-ide-intellij"/>
<property name="dist.name" value="ceylon-${ceylon.version}"/>
<property name="github-url" value="https://github.com/"/>
</target>
<target name="siblings"
description="Builds using dependent projects in existing sibling project folders.
Used with another target such as 'package'">
<property name="projects.base.dir" value="${basedir}/.." />
<property name="ceylon-formatter.dir" value="${projects.base.dir}/ceylon.formatter"/>
<property name="ceylon-converter.dir" value="${projects.base.dir}/ceylon.tool.converter.java2ceylon"/>
<property name="ceylon-ide-common.dir" value="${projects.base.dir}/ceylon-ide-common"/>
<property name="ceylon-ide-eclipse.dir" value="${projects.base.dir}/ceylon-ide-eclipse"/>
<property name="ceylon-ide-intellij.dir" value="${projects.base.dir}/ceylon-ide-intellij"/>
<property name="dist.name" value="ceylon-${ceylon.version}-custom-${NOW}"/>
<property name="github-url" value="https://github.com/"/>
</target>
<!-- Helper target, used to create a sha1 checksum file -->
<!-- Requires 'file' as a parameter. -->
<target name="sha1sum">
<fail unless="file" />
<fail if="filename" />
<fail if="value" />
<basename file="${file}" property="filename" />
<checksum file="${file}" property="value" algorithm="sha1" />
<echo file="${file}.sha1" message="${value}" />
</target>
<target name="git-clone-or-pull">
<fail unless="projects.base.dir" message="${msg.needlocalorsiblings}" />
<mkdir dir="${projects.base.dir}"/>
<foreach list="${gitprojects}"
target="git-clone-or-pull-item"
param="project.item.name"
inheritall="true" />
</target>
<target name="git-clone-or-pull-item">
<fail unless="projects.base.dir" />
<fail unless="project.item.name" />
<if>
<available file="${projects.base.dir}/${project.item.name}" type="dir" />
<then>
<echo>Updating ${project.item.name}:</echo>
<antcall target="checkout-internal-item">
<param name="tag-internal" value="master" />
</antcall>
<exec executable="git" dir="${projects.base.dir}/${project.item.name}" failonerror="yes">
<arg value="pull"/>
<arg value="--ff-only"/>
</exec>
</then>
<else>
<echo>Cloning ${project.item.name}:</echo>
<exec executable="git" dir="${projects.base.dir}" failonerror="yes">
<arg value="clone"/>
<arg value="${github-url}ceylon/${project.item.name}.git"/>
</exec>
</else>
</if>
</target>
<target name="git-clone">
<fail unless="projects.base.dir" message="${msg.needlocalorsiblings}" />
<mkdir dir="${projects.base.dir}"/>
<foreach list="${gitprojects}"
target="git-clone-item"
param="project.item.name"
inheritall="true" />
</target>
<target name="git-clone-item">
<fail unless="projects.base.dir" />
<fail unless="project.item.name" />
<if>
<available file="${projects.base.dir}/${project.item.name}" type="dir" />
<else>
<echo>Cloning ${project.item.name}:</echo>
<exec executable="git" dir="${projects.base.dir}" failonerror="yes">
<arg value="clone"/>
<arg value="${github-url}ceylon/${project.item.name}.git"/>
</exec>
</else>
</if>
</target>
<target name="git-update">
<fail unless="projects.base.dir" message="${msg.needlocalorsiblings}" />
<mkdir dir="${projects.base.dir}"/>
<foreach list="${gitprojects}"
target="git-update-item"
param="project.item.name"
inheritall="true" />
</target>
<target name="git-update-item">
<fail unless="projects.base.dir" />
<fail unless="project.item.name" />
<echo>Updating ${project.item.name}:</echo>
<if>
<available file="${projects.base.dir}/${project.item.name}/.git/ceylon-update" type="file" />
<then>
<exec executable="${projects.base.dir}/${project.item.name}/.git/ceylon-update"
dir="${projects.base.dir}/${project.item.name}" failonerror="no">
</exec>
</then>
<else>
<exec executable="git" dir="${projects.base.dir}/${project.item.name}" failonerror="no">
<arg value="pull"/>
<arg value="--rebase"/>
</exec>
</else>
</if>
</target>
<target name="git-status">
<fail unless="projects.base.dir" message="${msg.needlocalorsiblings}" />
<mkdir dir="${projects.base.dir}"/>
<foreach list="${gitprojects}"
target="git-status-item"
param="project.item.name"
inheritall="true" />
</target>
<target name="git-status-item">
<fail unless="projects.base.dir" />
<fail unless="project.item.name" />
<if>
<available file="${projects.base.dir}/${project.item.name}" type="dir" />
<then>
<echo>Status of ${project.item.name}:</echo>
<exec executable="git" dir="${projects.base.dir}/${project.item.name}" failonerror="yes">
<arg value="status"/>
<arg value="--short"/>
<arg value="--branch"/>
</exec>
</then>
</if>
</target>
<property name="branch-for-last-release-updates" value="1.2.0-fixes"/>
<target name="eclipse-switch-to-last-release-updates" depends="siblings">
<fail unless="projects.base.dir" message="${msg.needlocalorsiblings}" />
<foreach list="ceylon-ide-common,ceylon-ide-eclipse"
target="checkout-internal-item"
param="project.item.name"
inheritall="true" >
<param name="tag-internal" value="${branch-for-last-release-updates}" />
</foreach>
</target>
<target name="eclipse-switch-back-to-master" depends="siblings">
<fail unless="projects.base.dir" message="${msg.needlocalorsiblings}" />
<foreach list="ceylon-ide-common,ceylon-ide-eclipse"
target="checkout-internal-item"
param="project.item.name"
inheritall="true" >
<param name="tag-internal" value="master" />
</foreach>
</target>
<target name="check-branch-for-last-release-updates" depends="siblings">
<fail unless="projects.base.dir" message="${msg.needlocalorsiblings}" />
<foreach list="ceylon-ide-common,ceylon-ide-eclipse"
target="check-branch-for-last-release-updates-item"
param="project.item.name"
inheritall="true" />
</target>
<target name="check-branch-for-last-release-updates-item">
<fail unless="projects.base.dir" />
<fail unless="project.item.name" />
<if>
<available file="${projects.base.dir}/${project.item.name}" type="dir" />
<then>
<echo>Checking current branch for project : ${project.item.name}</echo>
<exec executable="git" dir="${projects.base.dir}/${project.item.name}" failonerror="yes" outputproperty="gitOutput">
<arg value="branch"/>
<arg value="--contains"/>
</exec>
<echo>${gitOutput}</echo>
<if>
<not>
<contains string="${gitOutput}" substring="* ${branch-for-last-release-updates}"/>
</not>
<then>
<fail message="The 'ceylon-ide-eclipse' and 'ceylon-ide-common' projects should be on branch '${branch-for-last-release-updates}' to build against the last release\n To switch to the last release maintenance branch run:\n 'ant eclipse-swicth-to-last-release-updates'"/>
</then>
</if>
</then>
</if>
</target>
<target name="checkout" depends="local">
<fail unless="tag" />
<antcall target="checkout-internal">
<param name="tag-internal" value="${tag}" />
</antcall>
</target>
<target name="checkout-internal">
<fail unless="tag-internal" />
<foreach list="${gitprojects}"
target="checkout-internal-item"
param="project.item.name"
inheritall="true" />
</target>
<target name="checkout-internal-item">
<fail unless="projects.base.dir" />
<fail unless="project.item.name" />
<fail unless="tag-internal" />
<exec executable="git" dir="${projects.base.dir}/${project.item.name}" failonerror="yes">
<arg value="fetch"/>
<arg value="--tags"/>
</exec>
<exec executable="git" dir="${projects.base.dir}/${project.item.name}" failonerror="yes">
<arg value="checkout"/>
<arg value="-q"/>
<arg value="${tag-internal}"/>
</exec>
</target>
<target name="checkout-master" depends="local">
<antcall target="checkout-internal">
<param name="tag-internal" value="master" />
</antcall>
</target>
<target name="checkout-tagged" if="tag" depends="local">
<echo message="Checking out tag '${tag}'" />
<antcall target="checkout-internal">
<param name="tag-internal" value="${tag}" />
</antcall>
</target>
<target name="git-gc">
<fail unless="projects.base.dir" message="${msg.needlocalorsiblings}" />
<mkdir dir="${projects.base.dir}"/>
<foreach list="${gitprojects}"
target="git-gc-item"
param="project.item.name"
inheritall="true" />
</target>
<target name="git-gc-item">
<fail unless="projects.base.dir" />
<fail unless="project.item.name" />
<if>
<available file="${projects.base.dir}/${project.item.name}" type="dir" />
<then>
<echo>Compacting ${project.item.name}...</echo>
<exec executable="git" dir="${projects.base.dir}/${project.item.name}" failonerror="yes">
<arg value="gc"/>
</exec>
</then>
</if>
</target>
<target name="clean" depends="siblings"
description="Cleans all sub projects">
<fail unless="projects.base.dir" message="${msg.needlocalorsiblings}" />
<foreach list="${gitprojects}"
target="clean-item"
param="project.item.name"
inheritall="true" />
</target>
<target name="clean-item">
<fail unless="projects.base.dir" />
<fail unless="project.item.name" />
<echo>Cleaning ${project.item.name}</echo>
<ant antfile="${projects.base.dir}/${project.item.name}/build.xml"
target="clean"
dir="${projects.base.dir}/${project.item.name}"
inheritall="false"
useNativeBasedir="true"/>
</target>
</project>