This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.xml
398 lines (355 loc) · 19.3 KB
/
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="ceylon-ide-intellij" default="help" basedir=".">
<tstamp>
<format property="NOW" pattern="yyyyMMddHHmm" />
</tstamp>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/../ceylon/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<property name="ceylon.root.dir" value="${basedir}/../ceylon" />
<property name="projects.base.dir" value="${basedir}/.." />
<property name="build.dir" value="${basedir}/ant-build" />
<property file="user-build.properties" />
<property file="build.properties" />
<property name="ceylon.verbosity" value="false" />
<property name="ceylon.executable" value="${dist.bin.dir}/ceylon" />
<property name="out.repo" location="modules" />
<property name="ceylon.repo.dir" location="${user.home}/.ceylon/repo" />
<!-- ANTLR -->
<property name="base.path" location="../ceylon/lib"/>
<property file="../ceylon/lib/build.properties"/>
<property file="../ceylon/common-build.properties"/>
<property name="gensrc" location="gensrc"/>
<property name="gen" location="gen"/>
<property name="antlr.src" location="Ceylon.g"/>
<property name="antlr.dst" location="${gensrc}"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${ceylon.root.dir}/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<path id="ant-tasks">
<pathelement location="${ceylon.ant.lib}" />
</path>
<target name="ceylondefs">
<typedef resource="org/eclipse/ceylon/ant/antlib.xml" classpathref="ant-tasks" />
<moduleset id="modules.source">
<module name="org.eclipse.ceylon.ide.intellij" />
</moduleset>
<reposet id="reposet.compile">
<repo url="${out.repo}" />
<repo url="flat:${intellij.repo.dir}"/>
<repo url="${basedir}/../ceylon-ide-common/repo"/>
<repo url="${ceylon.repo.dir}" />
</reposet>
</target>
<condition property="ideaRootDefined">
<isset property="ideaRoot"/>
</condition>
<!-- Local repository -->
<property name="intellij.repo.dir" location="${basedir}/intellij-repository" />
<loadproperties srcfile="${basedir}/resources/IdeaModuleToImport.properties" prefix="moduleToImport."/>
<propertyselector property="modulesToImport"
delimiter=","
match="moduleToImport\.(.*)"
select="\1"
casesensitive="true" />
<target name="importModule">
<propertycopy name="moduleName" from="moduleToImport.${moduleToImport}" />
<echo>${moduleName}</echo>
<if>
<available file="${ideaRoot}/lib/${moduleToImport}"/>
<then>
<copy file="${ideaRoot}/lib/${moduleToImport}"
tofile="${intellij.repo.dir}/${moduleName}-current.jar"/>
</then>
<elseif>
<available file="${ideaRoot}/plugins/gradle/lib/${moduleToImport}"/>
<then>
<copy file="${ideaRoot}/plugins/gradle/lib/${moduleToImport}"
tofile="${intellij.repo.dir}/${moduleName}-current.jar"/>
</then>
</elseif>
<elseif>
<available file="${ideaRoot}/plugins/Groovy/lib/${moduleToImport}"/>
<then>
<copy file="${ideaRoot}/plugins/Groovy/lib/${moduleToImport}"
tofile="${intellij.repo.dir}/${moduleName}-current.jar"/>
</then>
</elseif>
<elseif>
<available file="${ideaRoot}/plugins/maven/lib/${moduleToImport}"/>
<then>
<copy file="${ideaRoot}/plugins/maven/lib/${moduleToImport}"
tofile="${intellij.repo.dir}/${moduleName}-current.jar"/>
</then>
</elseif>
<else>
<fail message="Failed to find required dependency '${moduleToImport}' in IntelliJ installation"/>
</else>
</if>
</target>
<target name="copy-intellij-dependencies">
<delete dir="${intellij.repo.dir}" failonerror="false"/>
<mkdir dir="${intellij.repo.dir}"/>
<fail unless="ideaRootDefined"
message="Please set the 'ideaRoot' property to the root of the IntelliJ IDEA installation (which must contain a 'lib' sub-folder)"/>
<copy file="${java.home}/../lib/tools.jar" tofile="${intellij.repo.dir}/jdk.tools-current.jar"/>
<foreach list="${modulesToImport}" param="moduleToImport" target="importModule">
</foreach>
<!-- Merge several jars -->
<delete file="${intellij.repo.dir}/com.intellij.idea-current.jar"/>
<delete file="${intellij.repo.dir}/com.intellij.openapi-current.jar"/>
<delete file="${intellij.repo.dir}/com.intellij.util-current.jar"/>
<zip destfile="${intellij.repo.dir}/com.intellij.idea-current.jar">
<zipgroupfileset dir="${ideaRoot}/lib/">
<include name="idea.jar"/>
<include name="openapi.jar"/>
<include name="util.jar"/>
</zipgroupfileset>
</zip>
<zip destfile="${intellij.repo.dir}/com.intellij.openapi-current.jar" whenempty="create" basedir="." excludes="**"/>
<zip destfile="${intellij.repo.dir}/com.intellij.util-current.jar" whenempty="create" basedir="." excludes="**"/>
</target>
<target name="antlr.tree"
description="Generate code from ANTLR grammar">
<mkdir dir="${antlr.dst}/org/eclipse/ceylon/compiler/typechecker/treegen"/>
<java classname="org.antlr.Tool" dir="${basedir}" fork="yes">
<arg value="-fo"/>
<arg value="${antlr.dst}/org/eclipse/ceylon/compiler/typechecker/treegen"/>
<arg value="grammar/IdeaAstTypesGen.g"/>
<arg value="grammar/PsiIntfGen.g"/>
<arg value="grammar/PsiImplGen.g"/>
<arg value="grammar/PsiFactoryGen.g"/>
<arg value="grammar/NodeToIElementTypeMapGen.g"/>
<classpath>
<pathelement location="${antlr.lib}"/>
</classpath>
</java>
<delete>
<fileset dir="${antlr.dst}/org/eclipse/ceylon/compiler/typechecker/treegen"
includes="*.tokens"/>
</delete>
</target>
<path id="grammar-common-classpath">
<pathelement location="${antlr.lib}"/>
<pathelement location="${dist.repo.dir}/${ceylon.typechecker.jar}"/>
<pathelement location="${dist.repo.dir}/${ceylon.model.jar}"/>
</path>
<target name="treegen" depends="antlr.tree">
<mkdir dir="${build.classes}"/>
<javac
srcdir="grammar:${gensrc}"
destdir="${build.classes}"
debug="true"
encoding="UTF-8">
<classpath refid="grammar-common-classpath"/>
<include name="org/eclipse/ceylon/compiler/typechecker/treegen/*.java"/>
</javac>
</target>
<target name="tree" depends="treegen"
description="Generate the tree builder code">
<fail message="The 'openapi.jar' archive of the IDEA installation could not be found. Please check that the 'ideaRoot' property is set or that the ant process is started with the IDEA-bundle Ant tool.">
<condition>
<not>
<available file="${ideaRoot}/lib/openapi.jar" />
</not>
</condition>
</fail>
<mkdir dir="${basedir}/gen"/>
<property name="NodesFile" location="../ceylon/typechecker/antlr/Ceylon.nodes"/>
<java classname="org.eclipse.ceylon.compiler.typechecker.treegen.GenerateIdeaElements" dir="${basedir}" fork="yes">
<arg value="${NodesFile}"/>
<arg path="${gen}"/>
<classpath>
<path refid="grammar-common-classpath"/>
<pathelement location="${build.classes}"/>
</classpath>
</java>
<javac
srcdir="src:${gen}:grammar"
destdir="${build.classes}"
debug="true"
encoding="UTF-8">
<classpath>
<path refid="grammar-common-classpath"/>
<pathelement location="${ideaRoot}/lib/openapi.jar"/>
<pathelement location="${ideaRoot}/lib/util.jar"/>
<pathelement location="${ideaRoot}/lib/annotations.jar"/>
</classpath>
<include name="*.java"/>
<include name="org/eclipse/ceylon/ide/intellij/psi/CeylonPsi.java"/>
</javac>
<java classname="TokenTypesGenerator" dir="${basedir}" fork="yes">
<arg path="gen"/>
<classpath>
<path refid="grammar-common-classpath"/>
<pathelement location="${build.classes}"/>
</classpath>
</java>
<java classname="CeylonPsiVisitorGenerator" dir="${basedir}" fork="yes">
<arg path="gen"/>
<classpath>
<path refid="grammar-common-classpath"/>
<pathelement location="${build.classes}"/>
<pathelement location="${ideaRoot}/lib/openapi.jar"/>
<pathelement location="${ideaRoot}/lib/util.jar"/>
</classpath>
</java>
</target>
<target name="help">
<echo>Options for building the Ceylon IDE plugins:
ant clean - Cleans the build environment
ant build - Builds Ceylon IDE for IntelliJ
</echo>
</target>
<path id="ceylon.runtime">
<pathelement path="${dist.repo.dir}/org/eclipse/ceylon/common/${embedded.ceylon.version}/org.eclipse.ceylon.common-${embedded.ceylon.version}.jar" />
<pathelement path="${dist.repo.dir}/org/eclipse/ceylon/module-resolver/${embedded.ceylon.version}/org.eclipse.ceylon.module-resolver-${embedded.ceylon.version}.jar" />
<pathelement path="${dist.repo.dir}/ceylon/language/${embedded.ceylon.version}/ceylon.language-${embedded.ceylon.version}.car" />
<pathelement path="${dist.repo.dir}/org/eclipse/ceylon/model/${embedded.ceylon.version}/org.eclipse.ceylon.model-${embedded.ceylon.version}.jar" />
<pathelement path="${dist.repo.dir}/org/eclipse/ceylon/langtools/classfile/${embedded.ceylon.version}/org.eclipse.ceylon.langtools.classfile-${embedded.ceylon.version}.jar" />
</path>
<path id="compile.runtime.classpath">
<path refid="ceylon.runtime"/>
<fileset dir="${ideaRoot}/lib" includes="**/*.jar"/>
</path>
<path id="compile.ide.classpath">
<path refid="compile.runtime.classpath"/>
<pathelement path="${build.dir}/runtime"/>
<path refid="dist.classpath"/>
<pathelement path="${dist.repo.dir}/org/tautua/markdownpapers/core/1.2.7/org.tautua.markdownpapers.core-1.2.7.jar" />
<pathelement path="${dist.repo.dir}/org/antlr/stringtemplate/3.2.1/org.antlr.stringtemplate-3.2.1.jar" />
<pathelement path="${dist.repo.dir}/org/jboss/logmanager/2.0.3.Final/org.jboss.logmanager-2.0.3.Final.jar" />
<pathelement path="${dist.repo.dir}/org/antlr/antlr/2.7.7/org.antlr.antlr-2.7.7.jar" />
<pathelement path="${dist.repo.dir}/org/apache/httpcomponents/httpcore/4.3.2/org.apache.httpcomponents.httpcore-4.3.2.jar" />
<pathelement path="${dist.repo.dir}/org/antlr/runtime/3.4/org.antlr.runtime-3.4.jar" />
<pathelement path="${dist.repo.dir}/org/apache/commons/codec/1.8/org.apache.commons.codec-1.8.jar" />
<pathelement path="${dist.repo.dir}/net/minidev/json-smart/1.1.1/net.minidev.json-smart-1.1.1.jar" />
<pathelement path="${dist.repo.dir}/org/apache/httpcomponents/httpclient/4.3.2/org.apache.httpcomponents.httpclient-4.3.2.jar" />
<pathelement path="${dist.repo.dir}/org/apache/commons/logging/1.1.1/org.apache.commons.logging-1.1.1.jar" />
<pathelement path="${dist.repo.dir}/com/github/rjeschke/txtmark/0.13/com.github.rjeschke.txtmark-0.13.jar" />
<pathelement path="${dist.repo.dir}/com/github/lookfirst/sardine/5.1/com.github.lookfirst.sardine-5.1.jar" />
<pathelement path="${dist.repo.dir}/org/eclipse/ceylon/maven-support/2.0/org.eclipse.ceylon.maven-support-2.0.jar" />
<pathelement path="${dist.repo.dir}/org/eclipse/ceylon/cli/${embedded.ceylon.version}/org.eclipse.ceylon.cli-${embedded.ceylon.version}.jar" />
<pathelement path="${dist.repo.dir}/org/eclipse/ceylon/compiler/js/${embedded.ceylon.version}/org.eclipse.ceylon.compiler.js-${embedded.ceylon.version}.jar" />
<pathelement path="${dist.repo.dir}/org/eclipse/ceylon/compiler/java/${embedded.ceylon.version}/org.eclipse.ceylon.compiler.java-${embedded.ceylon.version}.jar" />
<pathelement path="${dist.repo.dir}/org/eclipse/ceylon/typechecker/${embedded.ceylon.version}/org.eclipse.ceylon.typechecker-${embedded.ceylon.version}.jar" />
<pathelement path="${dist.repo.dir}/org/eclipse/ceylon/tool/provider/${embedded.ceylon.version}/org.eclipse.ceylon.tool.provider-${embedded.ceylon.version}.jar" />
<pathelement path="${dist.repo.dir}/ceylon/runtime/${embedded.ceylon.version}/ceylon.runtime-${embedded.ceylon.version}.jar" />
<pathelement path="${dist.libs.dir}/ceylon-bootstrap.jar" />
</path>
<path id="dist.classpath">
<pathelement path="${basedir}/modules/org/eclipse/ceylon/ide/intellij/current/org.eclipse.ceylon.ide.intellij-current.car" />
<pathelement path="${projects.base.dir}/ceylon-ide-common/modules/org/eclipse/ceylon/ide/common/${module.org.eclipse.ceylon.ide.common.version}/org.eclipse.ceylon.ide.common-${module.org.eclipse.ceylon.ide.common.version}.car" />
<pathelement path="${projects.base.dir}/ceylon-ide-common/repo/org/jgrapht/core/0.9.1/org.jgrapht.core-0.9.1.jar" />
<pathelement path="${projects.base.dir}/ceylon-ide-common/repo/net/lingala/zip4j/1.3.2/net.lingala.zip4j-1.3.2.jar" />
<pathelement path="${projects.base.dir}/ceylon-sdk/modules/ceylon/collection/${embedded.ceylon.version}/ceylon.collection-${embedded.ceylon.version}.car" />
<pathelement path="${projects.base.dir}/ceylon-sdk/modules/ceylon/interop/java/${embedded.ceylon.version}/ceylon.interop.java-${embedded.ceylon.version}.car" />
<pathelement path="${projects.base.dir}/ceylon.tool.converter.java2ceylon/modules/ceylon/tool/converter/java2ceylon/${embedded.ceylon.version}/ceylon.tool.converter.java2ceylon-${embedded.ceylon.version}.car" />
<pathelement path="${projects.base.dir}/ceylon.tool.converter.java2ceylon/repo/org/antlr/antlr4-runtime-osgi/4.5.1/org.antlr.antlr4-runtime-osgi-4.5.1.jar" />
</path>
<target name="build-ide">
<taskdef name="javac2" classname="com.intellij.ant.Javac2">
<classpath refid="compile.runtime.classpath"/>
</taskdef>
<mkdir dir="${build.dir}/CeylonIDEA/classes"/>
<mkdir dir="${build.dir}/CeylonIDEA/lib"/>
<javac srcdir="${basedir}/jps-plugin/src"
destdir="${build.dir}/CeylonIDEA/classes"
debug="true" debuglevel="lines,vars,source"
source="1.6" target="1.6"
classpathref="compile.ide.classpath">
</javac>
<copy todir="${build.dir}/CeylonIDEA/classes">
<fileset dir="${basedir}/jps-plugin/src" includes="META-INF/**"/>
</copy>
<javac2 srcdir="${basedir}/src"
destdir="${build.dir}/CeylonIDEA/classes"
debug="true" debuglevel="lines,vars,source"
classpathref="compile.ide.classpath">
</javac2>
<copy todir="${build.dir}/CeylonIDEA/classes">
<fileset dir="${basedir}/resources"/>
</copy>
<mkdir dir="${build.dir}/CeylonIDEA/classes/embeddedDist"/>
<copy todir="${build.dir}/CeylonIDEA/classes/embeddedDist">
<fileset dir="${projects.base.dir}/ceylon/dist/dist" includes="**"/>
</copy>
<copy todir="${build.dir}/CeylonIDEA">
<fileset dir="${basedir}/resources" includes="META-INF/**"/>
</copy>
<if>
<contains string="${module.org.eclipse.ceylon.ide.intellij.version}" substring="-SNAPSHOT"/>
<then>
<replace file="${build.dir}/CeylonIDEA/META-INF/plugin.xml"
value="${module.org.eclipse.ceylon.ide.intellij.version}-${NOW}">
<replacetoken>$pluginVersion$</replacetoken>
</replace>
</then>
<else>
<replace file="${build.dir}/CeylonIDEA/META-INF/plugin.xml"
value="${module.org.eclipse.ceylon.ide.intellij.version}">
<replacetoken>$pluginVersion$</replacetoken>
</replace>
</else>
</if>
<copy todir="${build.dir}/CeylonIDEA/lib" flatten="true">
<path refid="dist.classpath"/>
</copy>
<zip destfile="${basedir}/out/installation-packages/CeylonIDEA.zip"
basedir="${build.dir}" includes="CeylonIDEA/**"/>
</target>
<target name="generate-update-site">
<property name="updatePluginsFile" location="${basedir}/out/installation-packages/updatePlugins.xml"/>
<delete dir="${updatePluginsFile}"/>
<xmlproperty file="${build.dir}/CeylonIDEA/META-INF/plugin.xml" prefix="CeylonIDEA"/>
<echoxml file="${updatePluginsFile}">
<plugin-repository>
<ff>"Custom Languages"</ff>
<category name="Custom Languages">
<idea-plugin>
<id>${CeylonIDEA.idea-plugin.id}</id>
<name>${CeylonIDEA.idea-plugin.name}</name>
<version>${CeylonIDEA.idea-plugin.version}</version>
<idea-version since-build="${CeylonIDEA.idea-plugin.idea-version(since-build)}"/>
<downloadUrl>./CeylonIDEA.zip</downloadUrl>
</idea-plugin>
</category>
</plugin-repository>
</echoxml>
</target>
<target name="build"
depends="copy-intellij-dependencies,build-quick"
description="Builds the IDE plugin">
</target>
<target name="build-quick"
depends="tree,ceylondefs"
description="Builds the IDE plugin without rebuilding the flat repository">
<ceylon-compile executable="${ceylon.executable}"
verbose="${ceylon.verbosity}"
encoding="UTF-8"
pack200="true"
fork="true"
mavenoverrides="${basedir}/overrides.xml"
out="${out.repo}">
<source value="${basedir}/src"/>
<source value="${gen}"/>
<source value="${basedir}/source"/>
<reposet refid="reposet.compile"/>
<moduleset refid="modules.source"/>
</ceylon-compile>
<antcall target="build-ide"/>
<antcall target="generate-update-site"/>
</target>
<target name="clean"
description="Cleans the build environment">
<delete dir="${out.repo}" />
<delete dir="${gen}" />
<delete dir="${gensrc}" />
<delete dir="${build.classes}" />
<delete dir="${build.dir}"/>
</target>
</project>