forked from rcoley93/intellij-haxe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.xml
243 lines (195 loc) · 10.3 KB
/
common.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
<project name="common">
<!-- This description is displayed when -projecthelp is added to the ant command line. -->
<description>
This project builds the Haxe plugin and/or tests for IDEA. The output
is a jar file "intellij-haxe-{version}.jar". To use the jar in IDEA,
it must be enabled via the "File->Settings" dialog, "Plugins" tab,
"Load File From Disk".
If build errors occur, it is likely that your system is not set up
identically to what these scripts expect. You may override any
setting locally by creating a file in the project root directory
called "local-build-overrides.xml". (Do NOT check it into the
repository! It will break continuous integration builds.) An
example file could look like:
<project name="local-overrides">
<echo>
Including local overrides...
</echo>
<property environment="env"/>
<property name="idea.installation.dir" location="$${env.HOME}/intellij_idea" />
<condition property="idea.ultimate.build" value="$${idea.installation.dir}/idea-IU-135.1286/" >
<matches pattern="13." string="$${version}"/>
</condition>
<condition property="idea.ultimate.build" value="$${idea.installation.dir}/idea-IU-139.1117.1/">
<matches pattern="14." string="$${version}"/>
</condition>
</project>
Or, more simply:
<project name="local-overrides">
<property name="idea.ultimate.build" location="/home/username/intellij_idea/idea-IU-135.1286/" />
</project>
</description>
<!-- Import local developer overrides, if they exist. -->
<dirname property="project.dir" file="${ant.file}"/>
<import file="${project.dir}/local-build-overrides.xml" optional="true"/>
<!-- set global properties for this build -->
<property name="build.compiler" value="modern"/>
<!-- See if we're being run from within IDEA (or at least an IDEA
directory is ANT_HOME). -->
<property name="idea.candidate.directory" location="${ant.home}/../.."/>
<property name="idea.build.id.file" value="build.txt"/>
<condition property="idea.ultimate.build" value="${idea.candidate.directory}">
<and>
<matches pattern=".*[\\/]lib[\\/]ant" string="${ant.home}"/>
<resourceexists>
<file file="${idea.candidate.directory}/${idea.build.id.file}"/>
</resourceexists>
</and>
</condition>
<!-- If nothing else, assume that the IDEA installation is in a subdirectory
of the project. This is the case when building on Travis.ci, for example. -->
<property name="idea.ultimate.build" location="${basedir}/idea-IU/" />
<echo level="debug">idea.ultimate.build is set to "${idea.ultimate.build}"</echo>
<echo level="debug">version is set to "${version}"</echo>
<!-- At this point, if we don't have a proper installation of IDEA,
then we won't get anywhere. Put up a sensible error. -->
<fail>
<condition>
<not>
<resourceexists>
<file file="${idea.ultimate.build}/${idea.build.id.file}"/>
</resourceexists>
</not>
</condition>
IDEA installation not found.
Either '${idea.ultimate.build}' does not exist, or it does not appear
to be a normal IDEA installation. (It should contain a build.txt file.)
See the description section at the top of this file (common.xml) for more
information.
You can tell this build where to find to your IDEA Ultimate build directory
by adding "-Didea.ultimate.build=path_to_your_IDEA_installation" to the
command line, where path_to_your_IDEA_installation is a directory on your
local machine.
Alternately, you can run this build by executing the build.sh file in the
project root directory, which will fetch a new installation for you.
</fail>
<!-- the version of intellij we are using as the SDK. -->
<loadfile property="idea.sdk.version" srcFile="${idea.ultimate.build}/build.txt"/>
<echo level="debug">Using installed IDEA version of ${idea.sdk.version}</echo>
<!-- Pull apart the build version into component pieces -->
<!-- Also look up the property string because we've got the info already here. -->
<script language="javascript">
<![CDATA[
var buildId = project.getProperty("idea.sdk.version");
var typeSep = buildId.indexOf("-");
var clSep = buildId.indexOf(".", typeSep + 1);
var bldSep = buildId.indexOf(".", clSep + 1);
var buildType = buildId.slice(0, typeSep);
var codeLine = buildId.slice(typeSep + 1, clSep);
var buildNumber = (bldSep >= 0 ? buildId.slice(clSep + 1, bldSep) : buildId.slice(clSep + 1));
var patchNumber = (bldSep >= 0 ? buildId.slice(bldSep + 1) : 0);
project.setNewProperty("idea.sdk.type", buildType);
project.setNewProperty("idea.sdk.codeline", codeLine);
project.setNewProperty("idea.sdk.build.number", buildNumber);
project.setNewProperty("idea.sdk.patch.number", patchNumber);
// Lookup table for properties files. Add new versions here.
var propertiesFile = "";
switch(parseInt(codeLine, 10)) {
case 143: propertiesFile = "idea_v15.properties";
case 141:
if (parseInt(buildNumber, 10) <= 2734) {
propertiesFile = "idea_v14.1.properties";
} else {
propertiesFile = "idea_v14.1.5.properties";
}
break;
case 139: propertiesFile = "idea_v14.properties"; break;
case 137: propertiesFile = "idea_v13.properties"; break;
case 135: propertiesFile = "idea_v13.properties"; break;
}
if (0 != propertiesFile.length) {
project.setNewProperty("plugin.properties.file", propertiesFile);
}
]]>
</script>
<target name="showParsedBuildId">
<echo>
Build ID is "${idea.sdk.version}"
Build type is "${idea.sdk.type}"
Build code line is "${idea.sdk.codeline}"
Build number is "${idea.sdk.build.number}"
Build patch is "${idea.sdk.patch.number}"
</echo>
</target>
<echo level="debug">Idea property file is ${plugin.properties.file}</echo>
<fail unless="plugin.properties.file">
Unable to load properties.
Could not locate properties for IDEA SDK version ${idea.sdk.version}.
If you are compiling a a newly released version of IDEA, perhaps the version
number(s) must be added to the lookup table in common.xml.
</fail>
<!-- The properties are mostly used as filters, but they can be useful for other things. -->
<property file="${plugin.properties.file}"/>
<!-- defines a path for code specific to an intellij version.
IntelliJ SDK has non-backward compatible changes which require
some duplicated Java files.
This property defaults to "src/common" if it wasn't specified in
the ${plugin.properties.file}, this way you can
choose not to include any version specific code -->
<property name="version.specific.code.location" location="src/common" />
<property name="plugin.autogen.warning">
==============================================================
W A R N I N G ! ! W A R N I N G ! ! W A R N I N G ! !
==============================================================
Warning!! This file is auto-generated. Do NOT edit it directly.
The corresponding source file can be found in the src/... directory.
==============================================================
W A R N I N G ! ! W A R N I N G ! ! W A R N I N G ! !
==============================================================
</property>
<!-- Copy and update the build version data to the Java template -->
<target name="generateIdeaSdkIdentifer" description="Generate the identifiers for IdeaTarget.java">
<!-- Need to overwrite always. Otherwise, copied files are newer and
won't be updated between build types (versions). -->
<property name="haxe.build.dir" value="com/intellij/plugins/haxe/build"/>
<property name="haxe.idea.sdk.identifier.file" value="IdeaSDKIdentifier.java"/>
<copy file="src/common/${haxe.build.dir}/${haxe.idea.sdk.identifier.file}.template"
tofile="gen/${haxe.build.dir}/${haxe.idea.sdk.identifier.file}" overwrite="true" verbose="true">
<filterset>
<filter token="idea.sdk.version" value="${idea.sdk.version}"/>
<filter token="idea.sdk.type" value="${idea.sdk.type}"/>
<filter token="idea.sdk.codeline" value="${idea.sdk.codeline}"/>
<filter token="idea.sdk.build.number" value="${idea.sdk.build.number}"/>
<filter token="idea.sdk.patch.number" value="${idea.sdk.patch.number}"/>
<filter token="replace.with.plugin.autogen.warning" value="${plugin.autogen.warning}"/>
</filterset>
</copy>
</target>
<!-- Copy the plugin.xml and replace elements within it with version appropriate data.-->
<property name="intellij-haxe.metainf.directory" value="src/META-INF"/>
<target name="metainf" description="Copy and update META-INF files with version-specific information">
<!-- Need to overwrite always. Otherwise, copied files are newer and
won't be updated between build types (versions). -->
<copy todir="gen/META-INF" overwrite="true" verbose="true">
<fileset dir="${intellij-haxe.metainf.directory}"/>
<filterset>
<filtersfile file="${plugin.properties.file}"/>
<!-- An odd construction, but it allows using a property in the filtered file. -->
<filter token="idea.sdk.version" value="${idea.sdk.version}"/>
<filter token="replace.with.plugin.autogen.warning" value="${plugin.autogen.warning}"/>
</filterset>
</copy>
</target>
<!-- Build all generated files -->
<target name="generateTemplatedFiles"
depends="metainf, generateIdeaSdkIdentifer"
description="Generates files from templates in the source tree."/>
<!-- Show pertinent build information -->
<target name="showIdeaBuild" description="Show build information, including SDK and version data.">
<echo>Requested version is set to "${version}"</echo>
<echo>Using installed IDEA version of ${idea.sdk.version}</echo>
<echo>Using IDEA build at "${idea.ultimate.build}"</echo>
<echo>Idea property file is ${plugin.properties.file}</echo>
<echo>Including version specific code from ${version.specific.code.location}</echo>
</target>
</project>