-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle.kts
109 lines (90 loc) · 2.58 KB
/
build.gradle.kts
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
import org.jetbrains.grammarkit.tasks.GenerateLexerTask
import org.jetbrains.grammarkit.tasks.GenerateParserTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val ideaVersion = "2021.3.1" //prop("ideaVersion")
group = "com.lfrobeen"
version = "2.0.0"
plugins {
idea
kotlin("jvm") version "1.6.20"
id("org.jetbrains.intellij") version "1.5.2"
id("org.jetbrains.grammarkit") version "2021.2.2"
id("de.undercouch.download") version "3.4.3"
id("net.saliman.properties") version "1.4.6"
id("com.palantir.git-version") version "0.11.0"
}
apply {
plugin("idea")
plugin("kotlin")
plugin("org.jetbrains.grammarkit")
plugin("org.jetbrains.intellij")
}
repositories {
mavenCentral()
maven("https://dl.bintray.com/jetbrains/markdown")
maven("https://plugins.gradle.org/m2/")
}
idea {
module {
generatedSourceDirs.add(file("src/main/gen"))
}
}
intellij {
pluginName.set("intellij-datalog")
version.set(ideaVersion)
updateSinceUntilBuild.set(false)
instrumentCode.set(false)
// https://plugins.jetbrains.com/docs/intellij/annotator.html#required-project-configuration-changes
// plugins.set(listOf("com.intellij.java"))
}
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
sourceSets {
main {
java.srcDirs("src/main/gen")
resources.srcDirs("src/main/resources")
}
test {
resources.srcDirs("src/test/resources")
}
}
kotlin {
sourceSets {
main {
kotlin.srcDirs("src/main/kotlin")
}
test {
kotlin.srcDirs("src/test/kotlin")
}
}
}
val generateDatalogLexer = task<GenerateLexerTask>("generateDatalogLexer") {
source.set("src/main/grammars/datalog.flex")
targetDir.set("src/main/gen/com/lfrobeen/datalog/lang/lexer")
targetClass.set("DatalogLexer")
purgeOldFiles.set(true)
}
val generateDatalogParser = task<GenerateParserTask>("generateDatalogParser") {
source.set("src/main/grammars/datalog.bnf")
targetRoot.set("src/main/gen")
pathToParser.set("/datalog/lang/parser/DatalogParser.java")
pathToPsiRoot.set("/datalog/lang/psi")
purgeOldFiles.set(true)
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
languageVersion = "1.6"
apiVersion = "1.5"
freeCompilerArgs = listOf("-Xjvm-default=all")
}
dependsOn(
generateDatalogLexer,
generateDatalogParser
)
}
tasks.withType<Copy> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}