forked from JetBrains/la-clojure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
296 lines (243 loc) · 9.16 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
<project name="Build Clojure plugin for IntelliJ IDEA" default="deploy.plugin">
<!-- Properties file -->
<!--<property file="clojure.properties"/>-->
<property name="jdk.home" value="${java.home}"/>
<property name="project.dir" value="."/>
<property name="src.dir" value="./src"/>
<property name="project.lib" value="${project.dir}/lib"/>
<property name="project.dest" value="${project.dir}/out/production/clojure-plugin"/>
<property name="test.dest" value="${project.dir}/out/test/clojure-plugin"/>
<property name="test.dist" value="${project.dir}/test_dist"/>
<property name="main.dist" value="${project.dir}/dist"/>
<property name="idea.pack" value="${project.dir}/idea_pack"/>
<property name="tools.jar.dir" value="${java.home}/lib"/>
<path id="tools.path">
<fileset dir="${tools.jar.dir}">
<include name="**/*tools.jar"/>
</fileset>
</path>
<property name="0" value="unknown"/>
<property name="build.vcs.number.clojure_svn" value="unknown"/>
<property name="plugin.revision" value="${build.vcs.number.clojure_svn}"/>
<property name="plugin.build.number" value="${build.number}"/>
<property name="plugin.version" value="${clojure.plugin.version}.${plugin.build.number}"/>
<path id="jdk.classpath">
<fileset dir="${java.home}">
<include name="lib/*.jar"/>
</fileset>
</path>
<path id="idea.classpath">
<fileset dir="${idea.home}/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${idea.home}/plugins">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="base.path">
<path refid="jdk.classpath"/>
<path refid="idea.classpath"/>
<path refid="tools.path"/>
<fileset dir="${clojure.lib}">
<include name="clojure.jar"/>
</fileset>
<fileset dir="${project.lib}">
<include name="*.jar"/>
</fileset>
<fileset dir="${clojure.contrib}">
<include name="clojure-contrib.jar"/>
</fileset>
</path>
<path id="clojure.base.path">
<path refid="jdk.classpath"/>
<path refid="idea.classpath"/>
<path refid="tools.path"/>
<pathelement location="${src.dir}"/>
<pathelement location="${project.dest}"/>
<fileset dir="${clojure.lib}">
<include name="clojure.jar"/>
</fileset>
<fileset dir="${clojure.contrib}">
<include name="clojure-contrib.jar"/>
</fileset>
</path>
<condition property="need.to.unzip">
<available file="${idea.pack}"/>
</condition>
<target name="unzip.last.successful.IDEA.build" if="need.to.unzip">
<mkdir dir="${idea.home}"/>
<unzip dest="${idea.home}">
<fileset dir="${idea.pack}">
<include name="*.zip"/>
</fileset>
</unzip>
</target>
<target name="init">
<mkdir dir="${project.dest}"/>
</target>
<target name="clean" depends="init">
<delete dir="build" includes="**/*"/>
</target>
<target name="make.lexer">
<java jar="${project.lib}/JFlex.jar" output="jflex.log" fork="true" maxmemory="512m">
<arg value="--charat"/>
<arg value="-skel"/>
<arg value="${project.lib}/idea-flex.skeleton"/>
<arg value="src/org/jetbrains/plugins/clojure/lexer/clojure.flex"/>
</java>
</target>
<target name="make.scala" depends="make.lexer, unzip.last.successful.IDEA.build">
<mkdir dir="${project.dest}"/>
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<pathelement location="${project.lib}/scala-compiler.jar"/>
<pathelement location="${project.lib}/scala-library.jar"/>
</classpath>
</taskdef>
<scalac destdir="${project.dest}"
srcdir="${project.dir}"
force="changed"
fork="true"
jvmargs="-Xmx1024M -Xms768M -Xss1024k -server">
<classpath>
<path refid="base.path"/>
</classpath>
<include name="src/**/*.scala"/>
<include name="src/**/*.java"/>
</scalac>
</target>
<target name="make.java" depends="make.scala">
<!-- Read SINCE and UNTIL properties -->
<loadfile property="idea.build" srcFile="${idea.home}/build.txt" failonerror="true"/>
<!--Copy descriptor-->
<copy todir="${project.dest}/META-INF">
<fileset dir="${project.dir}/META-INF"/>
</copy>
<!--Copy resources-->
<copy todir="${project.dest}">
<fileset dir="${project.dir}/resources/"/>
</copy>
<!--Copy resource bundle-->
<copy file="${project.dir}/src/org/jetbrains/plugins/clojure/ClojureBundle.properties"
tofile="${project.dest}/org/jetbrains/plugins/clojure/ClojureBundle.properties"/>
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="idea.classpath"/>
<!--Compile project Java files-->
<javac2 srcdir="${project.dir}"
destdir="${project.dest}"
debug="true">
<classpath refid="base.path"/>
<include name="src/**/*.java"/>
<include name="src/**/*.form"/>
</javac2>
</target>
<target name="make.clojure" depends="make.java">
<!-- Compile project Clojure files -->
<java classname="clojure.lang.Compile">
<classpath refid="clojure.base.path"/>
<sysproperty key="clojure.compile.path" value="${project.dest}"/>
<!-- TODO: rework! -->
<arg value="org.jetbrains.plugins.clojure.refactoring.rename.RenameClojureFileProcessor"/>
</java>
</target>
<target name="make.plugin" depends="make.clojure">
<replace file="${project.dest}/META-INF/plugin.xml" token="VERSION" value="${plugin.version}"/>
<replace file="${project.dest}/META-INF/plugin.xml" token="SINCE_IDEA" value="${idea.build}"/>
<replace file="${project.dest}/META-INF/plugin.xml" token="UNTIL_IDEA" value="${idea.build}"/>
</target>
<target name="deploy.plugin" depends="clean, make.plugin">
<mkdir dir="${project.dir}/tempjar/clojure-plugin/lib"/>
<jar destfile="${project.dir}/tempjar/clojure-plugin/lib/clojure-intellij-plugin.jar">
<fileset dir="${project.dest}" includes="**/*"/>
<manifest>
<attribute name="Revision" value="${plugin.revision}"/>
<attribute name="Build number" value="${plugin.build.number}"/>
<attribute name="Build" value="${plugin.version}"/>
</manifest>
</jar>
<copy todir="${project.dir}/tempjar/clojure-plugin/lib">
<fileset dir="${project.lib}">
<include name="scala-library.jar"/>
</fileset>
<fileset dir="${clojure.lib}">
<include name="clojure.jar"/>
</fileset>
<fileset dir="${clojure.contrib}">
<include name="clojure-contrib.jar"/>
</fileset>
</copy>
<mkdir dir="${main.dist}"/>
<zip destfile="${main.dist}/clojure-intellij-bin-${plugin.version}.zip" basedir="${project.dir}/tempjar"/>
<delete dir="${project.dir}/tempjar"/>
<!-- Zip sources-->
<zip destfile="${main.dist}/clojure-intellij-src-${plugin.version}.zip" basedir="${project.dir}"
includes="src/**/*.java,
src/**/*.properties,
src/**/*.flex,
src/**/*.jar,
src/**/*.skeleton,
src/**/*.form,
build.xml,
clojure.properties,
resources/**/*.png,
META-INF/**/*.xml,
lib/**/*,
test/**/*"
/>
</target>
<target name="build.tests" depends="make.plugin">
<mkdir dir="${test.dest}"/>
<javac srcdir="${project.dir}"
destdir="${test.dest}"
debug="true">
<classpath refid="base.path"/>
<classpath>
<path location="${project.dest}"/>
</classpath>
<include name="test/**/*.java"/>
</javac>
<!--<copy toDir="${project.lib}/testdata">-->
<!--<fileset dir="${base.dir}/testdata"/>-->
<!--<fileset dir="${scalax.dir}/testdata"/>-->
<!--</copy>-->
</target>
<target name="run.tests" depends="build.tests">
<mkdir dir="${test.dist}"/>
<mkdir dir="${project.dir}/logs"/>
<mkdir dir="${test.dist}/config"/>
<mkdir dir="${test.dist}/system"/>
<junit fork="yes"
dir="${project.dir}"
showoutput="yes"
printsummary="yes"
haltonfailure="no"
haltonerror="no">
<classpath>
<path location="${project.lib}"/>
<path location="${project.dest}"/>
<path location="${test.dest}"/>
<path refid="base.path"/>
</classpath>
<jvmarg value="-Xbootclasspath/p:./lib/boot/boot.jar"/>
<jvmarg value="-Djava.awt.headless=true"/>
<jvmarg value="-Xmx350M"/>
<jvmarg value="-ea"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5568"/>
<!-- Useful for internal tests -->
<!--<jvmarg value="-Didea.platform.prefix=Idea"/>-->
<jvmarg value="-Didea.config.path=${test.dist}/config"/>
<jvmarg value="-Didea.system.path=${test.dist}/system"/>
<jvmarg value="-Didea.plugins.path=${project.dest}/.."/>
<jvmarg value="-Didea.load.plugins.id=org.intellij.clojure"/>
<formatter type="plain"/>
<batchtest todir="${project.dir}/logs">
<fileset dir="${test.dest}">
<include name="**/*Test.class"/>
<exclude name="**/*ActualTest.class"/>
</fileset>
</batchtest>
</junit>
<delete dir="${test.dist}"/>
</target>
</project>