forked from flutter/flutter-intellij
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
255 lines (210 loc) · 8.31 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
<?xml version="1.0" encoding="UTF-8"?>
<!-- TODO(devoncarew): We can run non-IntelliJ tests, but we need to install the Dart
plugin in the IntelliJ sandbox in order to run Flutter IntelliJ unit tests. -->
<project name="flutter-intellij" default="build">
<property environment="env"/>
<!-- defaults -->
<!-- one of ideaIC, WebStorm, or android-studio-ide -->
<property name="idea.product" value="ideaIC"/>
<!-- the platform version, and substring to use when downloading from google storage -->
<property name="idea.version" value="2016.3.4"/>
<property name="google.storage.base" value="https://storage.googleapis.com/flutter_infra/flutter/intellij"/>
<condition property="extract.with.zip">
<contains string="${idea.product}" substring="android-studio"/>
</condition>
<patternset id="compiler.resources">
<exclude name="**/?*.java"/>
<exclude name="**/?*.form"/>
<exclude name="**/?*.class"/>
<exclude name="**/?*.kt"/>
</patternset>
<patternset id="ignored.files">
<exclude name="**/*~/**"/>
<exclude name="**/.DS_Store/**"/>
<exclude name="**/.git/**"/>
</patternset>
<target name="init">
<mkdir dir="artifacts"/>
<mkdir dir="build/src"/>
<mkdir dir="build/testSrc"/>
</target>
<target name="download.android" depends="init" if="extract.with.zip">
<property name="idea.home" location="artifacts/${idea.product}-${idea.version}"/>
<get src="${google.storage.base}/${idea.product}-${idea.version}-linux.zip"
dest="artifacts" usetimestamp="true"/>
<unzip src="artifacts/${idea.product}-${idea.version}-linux.zip" dest="${idea.home}">
<cutdirsmapper dirs="1"/>
</unzip>
</target>
<target name="download.idea" depends="init" unless="extract.with.zip">
<property name="idea.home" location="artifacts/${idea.product}-${idea.version}"/>
<get src="${google.storage.base}/${idea.product}-${idea.version}.tar.gz"
dest="artifacts" usetimestamp="true"/>
<gunzip src="artifacts/${idea.product}-${idea.version}.tar.gz"
dest="artifacts/${idea.product}-${idea.version}.tar"/>
<untar src="artifacts/${idea.product}-${idea.version}.tar" dest="${idea.home}">
<cutdirsmapper dirs="1"/>
</untar>
</target>
<target name="download-dart-plugin" depends="init" if="dart.plugin.version">
<!-- download the Dart plugin -->
<get src="${google.storage.base}/Dart-${dart.plugin.version}.zip" dest="artifacts/" usetimestamp="true"/>
<unzip src="artifacts/Dart-${dart.plugin.version}.zip" dest="artifacts"/>
</target>
<target name="download" depends="download.android, download.idea, download-dart-plugin">
<!-- download the javac2 jars -->
<get src="${google.storage.base}/intellij-javac2.zip" dest="artifacts/" usetimestamp="true"/>
<unzip src="artifacts/intellij-javac2.zip" dest="artifacts/javac2"/>
</target>
<target name="properties" depends="download">
<mkdir dir="${idea.home}/plugins/Dart/lib"/>
<mkdir dir="${basedir}/artifacts/Dart/lib"/>
<property name="javac2.home" value="artifacts/javac2"/>
<path id="javac2.classpath">
<pathelement location="${javac2.home}/javac2.jar"/>
<pathelement location="${javac2.home}/jdom.jar"/>
<pathelement location="${javac2.home}/asm-all.jar"/>
<pathelement location="${javac2.home}/jgoodies-forms.jar"/>
</path>
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
<taskdef name="instrumentIdeaExtensions" classname="com.intellij.ant.InstrumentIdeaExtensions" classpathref="javac2.classpath"/>
</target>
<target name="paths" depends="properties">
<path id="idea.jars">
<fileset dir="${idea.home}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${idea.home}/plugins/Dart/lib">
<include name="*.jar"/>
</fileset>
</path>
<path id="dartplugin.jars">
<fileset dir="${basedir}/artifacts/Dart/lib">
<include name="*.jar"/>
</fileset>
</path>
<path id="junit.jars">
<pathelement location="${idea.home}/lib/junit-*.jar"/>
</path>
<path id="src.sourcepath">
<dirset dir=".">
<include name="src"/>
<include name="resources"/>
<include name="gen"/>
<include name="third_party/intellij-plugins-dart/src"/>
</dirset>
</path>
<path id="testSrc.sourcepath">
<dirset dir=".">
<include name="testSrc/unit"/>
<include name="testSrc/integration"/>
<include name="third_party/intellij-plugins-dart/testSrc"/>
</dirset>
</path>
<echo message="travis_fold:start:ant.properties"/>
<echoproperties/>
<echo message="travis_fold:end:ant.properties"/>
</target>
<target name="build.src" depends="paths">
<echo message="Building against target ${idea.home}"/>
<javac2 destdir="build/src" memorymaximumsize="1000m" fork="true" includeantruntime="false">
<compilerarg line="-encoding UTF-8 -source 8 -target 8"/>
<classpath>
<path refid="idea.jars"/>
<path refid="dartplugin.jars"/>
</classpath>
<src refid="src.sourcepath"/>
<patternset refid="ignored.files"/>
</javac2>
<copy todir="build/src">
<fileset dir="src">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
<fileset dir="resources">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
<fileset dir="gen">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
<fileset dir="third_party/intellij-plugins-dart/src">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
<jar destfile="build/flutter-intellij.jar" duplicate="preserve">
<zipfileset dir="build/src"/>
<manifest>
<attribute name="Created-By" value="IntelliJ IDEA"/>
<attribute name="Manifest-Version" value="1.0"/>
</manifest>
</jar>
<length file="build/flutter-intellij.jar"/>
</target>
<target name="build.testSrc" depends="paths, build.src">
<echo message="Building against target ${idea.home}"/>
<javac2 destdir="build/testSrc" memorymaximumsize="1000m" fork="true" includeantruntime="false">
<compilerarg line="-encoding UTF-8 -source 8 -target 8"/>
<classpath>
<path refid="idea.jars"/>
<path refid="dartplugin.jars"/>
<path refid="junit.jars"/>
<pathelement location="build/src"/>
</classpath>
<src refid="testSrc.sourcepath"/>
<patternset refid="ignored.files"/>
</javac2>
<copy todir="build/testSrc">
<fileset dir="testSrc">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
<jar destfile="build/flutter-intellij-tests.jar">
<zipfileset dir="build/testSrc"/>
</jar>
<length file="build/flutter-intellij-tests.jar"/>
</target>
<target name="build" depends="build.src"/>
<target name="test" depends="build.testSrc">
<!-- create a Dart plugin directory -->
<copy todir="build/idea-sandbox/plugins/Dart/lib" flatten="true" failonerror="false">
<path refid="dartplugin.jars"/>
</copy>
<property name="idea.sandbox" location="build/idea-sandbox"/>
<junit fork="true"
forkmode="once"
failureproperty="tests.fail"
dir="${idea.home}">
<env key="flutter.sdk" value="${env.FLUTTER_SDK}"/>
<env key="idea.plugins.path" value="${idea.sandbox}/plugins"/>
<assertions>
<enable/>
</assertions>
<classpath>
<path>
<fileset dir="${idea.home}/lib">
<include name="*.jar"/>
</fileset>
</path>
<path refid="dartplugin.jars"/>
<pathelement location="build/flutter-intellij.jar"/>
<pathelement location="build/flutter-intellij-tests.jar"/>
</classpath>
<formatter type="plain" usefile="false"/>
<!-- This runs the unit tests (it does not run the integration tests). -->
<batchtest>
<fileset dir="testSrc/unit">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<fail if="tests.fail" message="Test task failed."/>
</target>
<target name="all" depends="build, test"/>
<target name="clean">
<delete dir="build"/>
</target>
</project>