-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle.kts
135 lines (109 loc) · 3.62 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
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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
id("java")
id("jacoco")
id("com.diffplug.spotless") version "6.25.0"
id("org.jetbrains.kotlin.jvm") version "2.0.21"
id("org.jetbrains.intellij") version "1.17.4"
id("org.jetbrains.grammarkit") version "2022.3.2.2"
}
group = "dev.openfga.intellijplugin"
version = "0.1.3"
sourceSets["main"].java.srcDirs("src/main/java", "src/generated/java")
repositories {
mavenCentral()
}
dependencies {
implementation("org.antlr:antlr4:4.13.2")
implementation("dev.openfga:openfga-sdk:0.7.1")
implementation("org.dmfs:oauth2-essentials:0.22.1")
implementation("org.dmfs:httpurlconnection-executor:1.22.1")
implementation("org.apache.commons:commons-lang3:3.17.0")
implementation("dev.openfga:openfga-language:v0.2.0-beta.2")
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
testImplementation("junit:junit:4.13.2")
}
// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
version.set("2023.3")
type.set("IC") // Target IDE Platform
plugins.set(listOf(
"org.intellij.intelliLang",
"org.jetbrains.plugins.yaml",
"com.intellij.java"))
}
grammarKit {
jflexRelease.set("1.7.0-1")
grammarKitRelease.set("2021.1.2")
intellijRelease.set("203.7717.81")
}
spotless {
java {
target("src/main/java/dev/openfga/intellijplugin/**/*.java")
palantirJavaFormat()
removeUnusedImports()
importOrder()
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
compilerOptions.jvmTarget = JvmTarget.JVM_17
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
sourceCompatibility = "17"
targetCompatibility = "17"
dependsOn("generateLexer", "generateParser")
}
tasks {
check {
dependsOn(jacocoTestReport)
}
generateLexer {
sourceFile.set(file("src/main/java/dev/openfga/intellijplugin/parsing/OpenFGALexer.flex"))
targetOutputDir.set(file("src/generated/java/dev/openfga/intellijplugin/parsing"))
purgeOldFiles.set(true)
}
generateParser {
sourceFile.set(file("src/main/java/dev/openfga/intellijplugin/parsing/openfga.bnf"))
targetRootOutputDir.set(file("src/generated/java"))
pathToParser.set("dev/openfga/intellijplugin/parsing/OpenFGAParser.java")
pathToPsiRoot.set("dev/openfga/intellijplugin/psi")
purgeOldFiles.set(true)
dependsOn(generateLexer) // The lexer must be generated before parser otherwise we get build errors
}
test {
useJUnit()
configure<JacocoTaskExtension> {
isEnabled = true
isIncludeNoLocationClasses = true
excludes = listOf("jdk.internal.*")
}
testLogging {
showStandardStreams = true
events("PASSED", "SKIPPED", "FAILED", "STANDARD_OUT", "STANDARD_ERROR")
}
}
jacocoTestReport {
classDirectories.setFrom(instrumentCode)
reports {
xml.required = true
html.required = true
}
}
jacocoTestCoverageVerification {
classDirectories.setFrom(instrumentCode)
}
patchPluginXml {
sinceBuild.set("233")
untilBuild.set("242.*")
}
signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}
publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
}
}