-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathbuild.gradle
110 lines (91 loc) · 3.66 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
plugins {
id("scala")
id("org.jetbrains.intellij") version "1.5.3"
id("de.undercouch.download") version "4.1.2"
id("com.palantir.git-version") version "0.12.3"
id("cz.alenkacz.gradle.scalafmt") version "1.16.2"
}
repositories {
mavenCentral()
}
// Build number ranges: https://plugins.jetbrains.com/docs/intellij/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-2022.1")
def pythonPluginForVersion = [
"IC-2021.1": "PythonCore:211.6693.119",
"IC-2021.2": "PythonCore:212.4746.96",
"IC-2021.3": "PythonCore:213.5744.248",
"IC-2022.1": "PythonCore:221.5080.210"
]
intellij {
version = intellijVersion
plugins = [pythonPluginForVersion.get(intellijVersion)]
}
publishPlugin {
token = System.getenv().getOrDefault("INTELLIJ_PUBLISH_TOKEN", "")
} doFirst {
def requiredVersion = JavaVersion.VERSION_11
if(JavaVersion.current() != requiredVersion)
throw new GradleException("The plugin should be published using JavaVersion $requiredVersion" )
}
import org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel
runPluginVerifier {
ideVersions = [intellijVersion]
failureLevel = FailureLevel.ALL
}
patchPluginXml {
sinceBuild = "211"
untilBuild = "221.*"
}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
// 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")
def scalaVersion = System.getenv().getOrDefault("TRAVIS_SCALA_VERSION", "2.13.3")
dependencies {
implementation("org.scala-lang:scala-library:$scalaVersion")
testImplementation("org.scalatest:scalatest_2.13:3.2.1")
testImplementation("org.scalatestplus:junit-4-12_2.13:3.2.1.0")
}
import de.undercouch.gradle.tasks.download.Download
task downloadJFlex(type: Download) {
src("https://cache-redirector.jetbrains.com/intellij-dependencies/org/jetbrains/intellij/deps/jflex/jflex/1.7.0-2/jflex-1.7.0-2.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) {
classpath = files("${buildDir}/downloads/JFlex.jar")
args = """--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")
}
tasks.named("wrapper") {
distributionType = Wrapper.DistributionType.ALL
}
compileScala.dependsOn(generateLexer)
test {
testLogging {
showStandardStreams = true
}
}