forked from AmailP/robot-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
105 lines (86 loc) · 3.54 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
plugins {
id 'org.jetbrains.intellij' version "0.4.7"
id "de.undercouch.download" version '2.1.0'
id "com.palantir.git-version" version "0.12.0-rc2"
id "cz.alenkacz.gradle.scalafmt" version "1.8.0"
}
repositories {
mavenCentral()
}
// Build number ranges: http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html
// Python CE plugin: https://plugins.jetbrains.com/plugin/7322-python-community-edition
// Python plugin: https://plugins.jetbrains.com/plugin/631-python
// Intellij repositories: https://www.jetbrains.com/intellij-repository/releases
// https://www.jetbrains.com/intellij-repository/snapshots
version = gitVersion()
def intellijVersion = System.getenv().getOrDefault("IDEA_VERSION", "IC-193.4778.7-EAP-SNAPSHOT")
def pythonPluginForVersion = [
"IC-2017.3.5": "PythonCore:2017.3.173.4674.59",
"IC-2018.1.6": "PythonCore:2018.1.181.5087.50",
"IC-2018.2.4": "PythonCore:2018.2.182.4505.22",
"IC-183.4284.36": "PythonCore:2018.3.183.4284.36",
"IC-191.6183.87": "PythonCore:2019.1.191.6183.53",
"IC-192.5728.98": "PythonCore:2019.2.192.5728.98",
"IC-193.4778.7-EAP-SNAPSHOT": "PythonCore:193.4778.7",
]
intellij {
version = intellijVersion
plugins = [pythonPluginForVersion.get(intellijVersion)]
}
publishPlugin {
username 'AmailP'
token System.getenv().getOrDefault("INTELLIJ_PUBLISH_TOKEN", "")
} doFirst {
def requiredVersion = JavaVersion.VERSION_1_8
if(JavaVersion.current() != requiredVersion)
throw new GradleException("The plugin should be published using JavaVersion $requiredVersion" )
}
patchPluginXml {
sinceBuild "173"
untilBuild "193.*"
}
apply plugin: 'scala'
apply plugin: 'org.jetbrains.intellij'
sourceCompatibility = JavaVersion.VERSION_1_8
// Following two assignments are necessary to let the scala plugin handle both java and scala compilation
sourceSets.main.java.srcDirs = []
sourceSets.test.java.srcDirs = []
//
sourceSets.main.scala.srcDir 'src/main/java'
sourceSets.main.scala.srcDir 'src/main/java-gen'
sourceSets.test.scala.srcDir 'src/test/java'
dependencies {
compile 'org.scala-lang:scala-library:2.11.12'
testCompile 'org.scalatest:scalatest_2.11:2.2.5'
}
import de.undercouch.gradle.tasks.download.Download
task downloadJFlex(type: Download) {
src 'https://bintray.com/jetbrains/intellij-third-party-dependencies/download_file?file_path=org%2Fjetbrains%2Fintellij%2Fdeps%2Fjflex%2Fjflex%2F1.7.0%2Fjflex-1.7.0.jar'
dest "${buildDir}/downloads/JFlex.jar"
onlyIfNewer true
overwrite false
}
task downloadSkeleton(dependsOn: downloadJFlex, type: Download) {
src 'https://github.com/JetBrains/intellij-community/raw/master/tools/lexer/idea-flex.skeleton'
dest "${buildDir}/downloads/idea-flex.skeleton"
onlyIfNewer true
overwrite false
}
task generateLexer(dependsOn: downloadSkeleton, type: JavaExec) {
main '-jar'
args """${buildDir}/downloads/JFlex.jar
|--nobak
|--skel
|${buildDir}/downloads/idea-flex.skeleton
|-d
|${projectDir}/src/main/java-gen/amailp/intellij/robot/lexer
|${projectDir}/src/main/resources/amailp/intellij/robot/lexer/Robot.flex""".stripMargin().split('\n').toList()
inputs.file "${projectDir}/src/main/resources/amailp/intellij/robot/lexer/Robot.flex"
outputs.dir "${projectDir}/src/main/java-gen/amailp/intellij/robot/lexer"
}
compileScala.dependsOn(generateLexer)
test {
testLogging {
showStandardStreams = true
}
}