-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
313 lines (256 loc) · 12.9 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
<project name="TestDox" default="build" basedir=".">
<target name="check.ant.version">
<echo taskname="ant.version" message="${ant.version}"/>
<condition property="ant.version.ok">
<or>
<contains string="${ant.version}" substring="1.7"/>
<contains string="${ant.version}" substring="1.8"/>
<contains string="${ant.version}" substring="1.9"/>
<contains string="${ant.version}" substring="2.0"/>
</or>
</condition>
</target>
<target name="ant.version.pass" depends="check.ant.version" unless="ant.version.ok">
<fail>This build script requires Ant 1.7 or later!</fail>
</target>
<target name="initialise" depends="ant.version.pass">
<property file="project.properties"/>
<property name="binary.extensions" value="**/*.png, **/*.jpg, **/*.jpeg, **/*.gif"/>
<property name="test.lib" value="lib/test"/>
<property name="runtime.lib" value="lib/runtime"/>
<property name="java.src" value="src/main/java"/>
<property name="test.src" value="src/test"/>
<property name="build" value="build"/>
<property name="classes" value="${build}/classes"/>
<property name="test.classes" value="${build}/test-classes"/>
<property name="test.results" value="${build}/test-results"/>
<property name="test.reports" value="${build}/test-reports"/>
<property name="clover" value="clover"/>
<property name="clover.lib.dir" value="${user.home}/.ant/lib"/>
<property name="clover.reports" value="${build}/clover-reports"/>
<property name="coverage.criteria" value="70%"/>
<property name="dist" value="${build}/dist"/>
<property name="distfile.name" value="${project.name}-${project.version}"/>
<filterset id="project.vars">
<filter token="PROJECT.VERSION" value="${project.version}"/>
<filter token="PROJECT.TITLE" value="${project.title}"/>
<filter token="PROJECT.NAME" value="${project.name}"/>
<filter token="PROJECT.DESCRIPTION" value="${project.description}"/>
<filter token="PROJECT.CHANGENOTES" value="${project.change-notes}"/>
<filter token="PROJECT.HOMEPAGE" value="${project.homepage}"/>
<filter token="PROJECT.VENDOR" value="${project.vendor}"/>
<filter token="PROJECT.VENDOR.EMAIL" value="${project.vendor.email}"/>
<filter token="PROJECT.VENDOR.HOMEPAGE" value="${project.vendor.homepage}"/>
</filterset>
<path id="clover.classpath">
<pathelement location="${clover.lib.dir}/clover.jar"/>
</path>
<condition property="clover.available">
<and>
<available file="${clover.lib.dir}/clover.jar" type="file"/>
<available file="${clover.lib.dir}/clover.license" type="file"/>
</and>
</condition>
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<pathelement location="lib/runtime/scala-library.jar"/>
<pathelement location="lib/test/scala-compiler.jar"/>
</classpath>
</taskdef>
<path id="compile.classpath">
<fileset dir="${runtime.lib}">
<include name="*.jar"/>
</fileset>
<fileset dir="${test.lib}">
<include name="*.jar"/>
</fileset>
</path>
<path id="maia.compile.classpath">
<fileset dir="${idea.home}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${classes}/maia"/>
<path refid="compile.classpath"/>
</path>
<path id="maia.test.classpath">
<pathelement location="${test.classes}/maia"/>
<path refid="clover.classpath"/>
<path refid="maia.compile.classpath"/>
</path>
<tstamp>
<format property="TODAY" pattern="d-MMMM-yyyy" locale="en"/>
<format property="DAY" pattern="d" locale="en"/>
<format property="MONTH" pattern="MM" locale="en"/>
<format property="YEAR" pattern="yyyy" locale="en"/>
</tstamp>
<filterset id="timestamp.vars">
<filter token="TIMESTAMP" value="${TODAY}"/>
<filter token="DAY" value="${DAY}"/>
<filter token="MONTH" value="${MONTH}"/>
<filter token="YEAR" value="${YEAR}"/>
</filterset>
</target>
<target name="check.maia.available" depends="initialise">
<condition property="maia.available">
<and>
<available classname="com.intellij.psi.JavaDirectoryService" classpathref="maia.compile.classpath"/>
<available classname="com.intellij.psi.JavaPsiFacade" classpathref="maia.compile.classpath"/>
</and>
</condition>
</target>
<target name="maia.available" depends="check.maia.available" unless="maia.available">
<fail>
IntelliJ IDEA X is not available. Please set the idea.home system property to the path of your IntelliJ IDEA X installation.
</fail>
</target>
<target name="clean" depends="initialise" description="Deletes all artifacts from a previous build">
<delete dir="${build}" failonerror="false"/>
</target>
<target name="compile.maia" depends="initialise, maia.available">
<mkdir dir="${classes}/maia"/>
<scalac destdir="${classes}/maia" classpathref="maia.compile.classpath">
<src path="${java.src}"/>
<src path="src/main/scala"/>
<include name="**/*.scala"/>
<include name="**/*.java"/>
</scalac>
<javac srcdir="${java.src}" destdir="${classes}/maia" debug="on">
<classpath refid="maia.compile.classpath"/>
</javac>
<copy todir="${classes}/maia" overwrite="true">
<fileset dir="src/main/resources" excludes="**/*.java, ${binary.extensions}"/>
<filterset>
<filter token="IDEA.SINCE-BUILD" value="90.116"/>
<filter token="IDEA.UNTIL-BUILD" value="99.9999"/>
<filter token="PROJECT.VERSION" value="${project.version} (IDEA X)"/>
</filterset>
<filterset refid="project.vars"/>
<filterset refid="timestamp.vars"/>
</copy>
<copy todir="${classes}/maia" overwrite="true">
<fileset dir="src/main/resources" includes="${binary.extensions}"/>
</copy>
</target>
<target name="compile.versions" depends="compile.maia" description="Compiles the project source files"/>
<target name="compile.tests.maia" depends="compile.maia">
<mkdir dir="${test.classes}/maia"/>
<scalac destdir="${test.classes}/maia" classpathref="maia.test.classpath">
<src path="${test.src}/java"/>
<src path="${test.src}/scala"/>
<include name="**/*.scala"/>
<include name="**/*.java"/>
</scalac>
<javac srcdir="${test.src}/java" destdir="${test.classes}/maia" debug="on">
<classpath refid="maia.test.classpath"/>
</javac>
</target>
<target name="compile.tests" depends="compile.tests.maia"/>
<target name="test.reports" depends="compile.tests" description="Runs all unit tests for this project">
<delete dir="${test.results}"/>
<mkdir dir="${test.results}"/>
<junit fork="true" forkmode="once" errorProperty="tests.failed" failureProperty="tests.failed"
haltonfailure="false" haltonerror="false" showoutput="true" printsummary="withOutAndErr"
includeantruntime="true" newenvironment="false">
<classpath refid="maia.test.classpath"/>
<formatter type="brief" usefile="false"/>
<batchtest todir="${test.results}">
<fileset dir="${test.classes}/maia">
<include name="**/*Test.class"/>
<exclude name="**/*ApiTest.class, **/*TestCase.class"/>
</fileset>
<formatter type="xml"/>
</batchtest>
</junit>
<test-idea-plugin eapName="maia"/>
<delete dir="${test.reports}"/>
<mkdir dir="${test.reports}"/>
<junitreport todir="${test.results}">
<fileset dir="${test.results}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.reports}"/>
</junitreport>
<fail message="Tests failed! Check test reports." if="tests.failed"/>
</target>
<target name="with.clover" depends="initialise" if="clover.available">
<taskdef resource="clovertasks"/>
<mkdir dir="${clover}"/>
<delete failonerror="true">
<fileset dir="${clover}" includes="clover.db*"/>
</delete>
<clover-setup enabled="true" initString="${clover}/clover.db">
<fileset dir="${java.src}" includes="**/*.java"/>
</clover-setup>
</target>
<target name="without.clover" depends="initialise" if="clover.available">
<taskdef resource="clovertasks"/>
<clover-setup enabled="false"/>
</target>
<target name="coverage.reports" depends="with.clover" if="clover.available">
<!-- generate a history point for the current coverage -->
<clover-historypoint historyDir="${clover}/history"/>
<clover-report>
<!-- generate a current report -->
<current alwaysReport="true" outfile="${clover.reports}" title="Clover Report for TestDox IDEA Plug-in">
<format type="html"/>
</current>
<!-- generate a historical report -->
<historical outfile="${clover.reports}" historyDir="${clover}/history">
<format type="html"/>
</historical>
</clover-report>
</target>
<target name="clover.check" depends="with.clover" if="clover.available">
<clover-check target="${coverage.criteria}" failureProperty="clover.check.failed"/>
</target>
<target name="coverage.check" depends="clover.check" if="clover.check.failed">
<fail message="Coverage criteria not met! Check coverage reports."/>
</target>
<target name="zip.versions" depends="compile.maia"
description="Creates deployable ZIP files for each version of IntelliJ IDEA">
<delete failonerror="true">
<fileset dir="${classes}" includes="**/*.class"/>
</delete>
<antcall inheritall="true" target="compile.versions"/>
<mkdir dir="${dist}"/>
<zip-idea-plugin eapName="maia"/>
</target>
<target name="build" description="Runs the continuous integration build"
depends="clean, with.clover, test.reports, coverage.reports, coverage.check, without.clover, zip.versions"/>
<macrodef name="test-idea-plugin">
<attribute name="eapName"/>
<sequential>
<property name="eapNameInMixedCase" value=""/>
<script language="javascript">
<![CDATA[
var eapNameInMixedCase = "@{eapName}".substr(0, 1).toUpperCase() + "@{eapName}".substr(1);
project.setProperty("eapNameInMixedCase", eapNameInMixedCase);
]]>
</script>
<junit fork="true" forkmode="once" errorProperty="tests.failed" failureProperty="tests.failed"
haltonfailure="false" haltonerror="false" showoutput="true" printsummary="withOutAndErr"
includeantruntime="true" newenvironment="false">
<classpath refid="@{eapName}.test.classpath"/>
<formatter type="brief" usefile="false"/>
<batchtest todir="${test.results}">
<fileset dir="${test.classes}/@{eapName}">
<include name="**/*${eapNameInMixedCase}*Test*.class"/>
</fileset>
<formatter type="xml"/>
</batchtest>
</junit>
</sequential>
</macrodef>
<macrodef name="zip-idea-plugin">
<attribute name="eapName"/>
<sequential>
<jar destfile="${dist}/${distfile.name}.jar" basedir="${classes}/@{eapName}" compress="true"/>
<zip destfile="${dist}/${distfile.name}.zip" compress="true" followsymlinks="true">
<zipfileset dir="${dist}" includes="${distfile.name}.jar" prefix="${project.name}/lib"/>
<zipfileset dir="${runtime.lib}" includes="*.jar" prefix="${project.name}/lib"/>
</zip>
<delete file="${dist}/${distfile.name}.jar" failonerror="true"/>
<buildnumber/>
</sequential>
</macrodef>
</project>