-
-
Notifications
You must be signed in to change notification settings - Fork 156
/
Copy pathbuild.gradle
278 lines (234 loc) · 6.83 KB
/
build.gradle
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
plugins {
id 'org.jetbrains.intellij' version "0.4.10"
id "org.jetbrains.kotlin.jvm" version "1.3.50"
id 'de.undercouch.download' version "4.0.0"
}
ext {
if (elixirVersion.startsWith("1.5") || elixirVersion.startsWith("1.6")) {
quoterVersion = "1.0.0"
} else {
quoterVersion = "2.1.0"
}
cachePath = "${rootDir}/cache"
elixirPath = "${cachePath}/elixir-${elixirVersion}"
quoterUnzippedPath = "${cachePath}/elixir-${elixirVersion}-intellij_elixir-${quoterVersion}"
if (elixirVersion.startsWith("1.5") || elixirVersion.startsWith("1.6") || elixirVersion.startsWith("1.7")) {
quoterExe = "${quoterUnzippedPath}/_build/dev/rel/intellij_elixir/bin/intellij_elixir"
} else {
quoterExe = "${quoterUnzippedPath}/rel/intellij_elixir/bin/intellij_elixir"
}
quoterZipPath = "${cachePath}/intellij_elixir-${quoterVersion}.zip"
quoterZipRootPath = "${cachePath}/intellij_elixir-${quoterVersion}"
if (project.hasProperty("isRelease") && isRelease) {
versionSuffix = ""
} else {
def date = new Date().format("yyyyMMddHHmmss", TimeZone.getTimeZone("UTC"))
versionSuffix = "-pre+$date"
}
version "$baseVersion$versionSuffix"
}
allprojects {
apply plugin: 'java'
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
}
sourceSets {
main {
java.srcDirs 'src', 'gen'
resources.srcDirs 'resources'
}
test {
java.srcDir 'tests'
}
}
allprojects {
apply plugin: 'org.jetbrains.intellij'
intellij {
def intellij_erlang_version
if (ideaVersion.startsWith("2019.2")) {
intellij_erlang_version = "0.11.1008"
} else if (ideaVersion.startsWith("2019.1")) {
intellij_erlang_version = "0.11.1004"
} else if (ideaVersion.startsWith("2018.3")) {
intellij_erlang_version = "0.11.1000"
} else if (ideaVersion.startsWith("2018.2")) {
intellij_erlang_version = "0.11.985"
} else if (ideaVersion.startsWith("2018.1")) {
intellij_erlang_version = "0.11.976"
} else if (ideaVersion.startsWith("2017.3")) {
intellij_erlang_version = "0.10.966"
} else if (ideaVersion.startsWith("2017.2")) {
intellij_erlang_version = "0.9.958"
} else if (ideaVersion.startsWith("2017.1.")) {
intellij_erlang_version = "0.9.939"
} else if (ideaVersion.startsWith("2016.3.")) {
intellij_erlang_version = "0.9.912"
} else {
throw new IllegalArgumentException("ideaVersion is not a recognized MAJOR.MINOR for IntelliJ Erlang compatibility")
}
plugins = [// needed for jps builder
"java",
"org.jetbrains.erlang:${intellij_erlang_version}",
// always have IdeaVIM installed in sandbox
"IdeaVIM:0.48",
"PsiViewer:3.28.93"]
pluginName 'intellij-elixir'
version ideaVersion
downloadSources Boolean.valueOf(sources)
updateSinceUntilBuild = false
}
patchPluginXml {
def stripTag = { text, tag -> text.replace("<${tag}>", "").replace("</${tag}>", "") }
def bodyInnerHTML = { path ->
stripTag(stripTag(file(path).text, "html"), "body")
}
changeNotes bodyInnerHTML("resources/META-INF/changelog.html")
pluginDescription bodyInnerHTML("resources/META-INF/description.html")
}
publishPlugin {
username publishUsername
password publishPassword
channels publishChannels
}
}
apply plugin: "kotlin"
//noinspection GroovyAssignabilityCheck,GrUnresolvedAccess
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
//noinspection GrUnresolvedAccess
kotlinOptions {
apiVersion = "1.2"
jvmTarget = "1.8"
}
}
def compilationPackages = ['org/intellij/elixir/build/**', 'org/intellij/elixir/jps/**']
test {
environment "ELIXIR_LANG_ELIXIR_PATH", elixirPath
environment "ELIXIR_EBIN_DIRECTORY", "${elixirPath}/lib/elixir/ebin/"
environment "ELIXIR_VERSION", elixirVersion
useJUnit {
exclude compilationPackages
}
testLogging {
exceptionFormat = 'full'
}
}
task testCompilation(type: Test, group: 'Verification', dependsOn: [classes, testClasses]) {
useJUnit {
include compilationPackages
}
testLogging {
exceptionFormat = 'full'
}
}
repositories {
maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' }
maven { url 'https://maven-central.storage.googleapis.com' }
mavenCentral()
}
dependencies {
compile project('jps-builder')
compile project('jps-shared')
compile group: 'org.erlang.otp', name: 'jinterface', version: '1.6.1'
compile group: 'commons-io', name: 'commons-io', version: '2.5'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.2.9'
testCompile group: 'org.objenesis', name: 'objenesis', version: '2.4'
}
project(':jps-builder') {
dependencies {
compile project(':jps-shared')
}
}
apply plugin: 'idea'
idea {
project {
jdkName = javaVersion
languageLevel = javaVersion
}
module {
generatedSourceDirs += file('gen')
}
}
task getElixir {
doLast {
def folder = new File(elixirPath)
if (!folder.isDirectory() || folder.list().size() == 0) {
download {
src "https://github.com/elixir-lang/elixir/archive/v${elixirVersion}.zip"
dest "${rootDir}/cache/Elixir.${elixirVersion}.zip"
overwrite false
}
}
def binFolder = new File("${elixirPath}/bin")
if (!binFolder.isDirectory() || folder.list().size() == 0) {
copy {
from zipTree("${rootDir}/cache/Elixir.${elixirVersion}.zip")
into "${rootDir}/cache/"
}
exec {
workingDir elixirPath
commandLine "make"
}
}
}
}
task getQuoter {
doLast {
download {
src "https://github.com/KronicDeth/intellij_elixir/archive/v${quoterVersion}.zip"
dest quoterZipPath
overwrite false
}
def folder = new File(quoterUnzippedPath)
if (!folder.isDirectory() || folder.list().size() == 0) {
copy {
from zipTree(quoterZipPath)
into cachePath
}
def quoterZipRootFile = new File(quoterZipRootPath)
quoterZipRootFile.renameTo(quoterUnzippedPath)
}
}
}
task getQuoterDeps(dependsOn: getQuoter) {
doLast {
exec {
workingDir quoterUnzippedPath
executable "mix"
args "deps.get"
}
}
}
task releaseQuoter(dependsOn: getQuoterDeps) {
doLast {
def file = new File(quoterExe)
if (!file.canExecute()) {
exec {
workingDir quoterUnzippedPath
executable "mix"
args "release"
}
}
}
}
compileJava {
}
compileTestJava {
dependsOn getElixir
dependsOn getQuoter
}
task runQuoter(type: Exec, dependsOn: releaseQuoter) {
executable quoterExe
args "start"
}
task stopQuoter(type: Exec, dependsOn: releaseQuoter) {
executable quoterExe
args "stop"
}
runIde {
jvmArgs "-Didea.ProcessCanceledException=disabled"
}
test {
dependsOn runQuoter
finalizedBy stopQuoter
}