forked from redhat-developer/lsp4ij
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
211 lines (183 loc) · 6.82 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
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
import com.adarshr.gradle.testlogger.theme.ThemeType
import org.jetbrains.intellij.tasks.RunPluginVerifierTask.VerificationReportsFormats.*
import org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel.*
fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)
fun prop(name: String): String {
return properties(name).get()
}
plugins {
java // Java support
alias(libs.plugins.kotlin) // Kotlin support
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.testLogger) // Nice test logs
alias(libs.plugins.kover) // Gradle Kover Plugin
jacoco // Code coverage
}
group = prop("pluginGroup")
version = prop("pluginVersion")
val lsp4jVersion = prop("lsp4jVersion")
val flexmarkVersion = prop("flexmarkVersion")
// Configure project's dependencies
repositories {
mavenLocal()
mavenCentral()
maven { url = uri("https://repository.jboss.org/nexus/content/repositories/snapshots") }
maven { url = uri("https://repository.jboss.org/nexus/content/groups/public") }
maven { url = uri("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies") }
}
val lsp: Configuration by configurations.creating
sourceSets {
named("test") {
java.srcDir("src/test/java")
resources.srcDir("src/test/resources")
}
create("integrationTest") {
java.srcDir("src/it/java")
resources.srcDir("src/it/resources")
compileClasspath += sourceSets.main.get().output
compileClasspath += configurations.testImplementation.get()
runtimeClasspath += compileClasspath + sourceSets.test.get().output
}
}
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
implementation("org.zeroturnaround:zt-zip:1.14")
implementation("org.jsoup:jsoup:1.17.1")
implementation("org.eclipse.lsp4j:org.eclipse.lsp4j:$lsp4jVersion")
// Required by lsp4j as the version from IJ is incompatible
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.vladsch.flexmark:flexmark:$flexmarkVersion")
implementation("com.vladsch.flexmark:flexmark-ext-tables:$flexmarkVersion")
implementation("com.vladsch.flexmark:flexmark-ext-autolink:$flexmarkVersion")
implementation("com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:$flexmarkVersion")
testImplementation("com.redhat.devtools.intellij:intellij-common-ui-test-library:0.2.0")
testImplementation("org.assertj:assertj-core:3.19.0")
}
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
kotlin {
jvmToolchain {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.JETBRAINS
}
}
// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
pluginName = properties("pluginName")
version = properties("platformVersion")
type = properties("platformType")
updateSinceUntilBuild = false
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
}
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
configurations {
runtimeClasspath {
exclude(group = "org.slf4j", module = "slf4j-api")
}
testImplementation {
isCanBeResolved = true
}
}
testlogger {
theme = ThemeType.STANDARD
showExceptions = true
showStackTraces = true
showFullStackTraces = false
showCauses = true
slowThreshold = 2000
showSummary = true
showSimpleNames = false
showPassed = true
showSkipped = true
showFailed = true
showOnlySlow = false
showStandardStreams = false
showPassedStandardStreams = true
showSkippedStandardStreams = true
showFailedStandardStreams = true
logLevel = LogLevel.LIFECYCLE
}
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {
groups.empty()
repositoryUrl = properties("pluginRepositoryUrl")
}
tasks.withType<Test> {
environment("GRADLE_RELEASE_REPOSITORY","https://services.gradle.org/distributions")
systemProperty("idea.log.leaked.projects.in.tests", "false")
systemProperty( "idea.maven.test.mirror", "https://repo1.maven.org/maven2")
systemProperty( "com.redhat.devtools.intellij.telemetry.mode", "disabled")
}
tasks.withType<Copy> {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
tasks.register<Test>("integrationTest") {
useJUnitPlatform()
description = "Runs the integration tests."
group = "verification"
testClassesDirs = sourceSets["integrationTest"].output.classesDirs
classpath = sourceSets["integrationTest"].runtimeClasspath
outputs.upToDateWhen { false }
mustRunAfter(tasks["test"])
}
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
koverReport {
defaults {
xml {
onCheck = true
}
}
}
tasks {
wrapper {
gradleVersion = properties("gradleVersion").get()
}
runPluginVerifier {
failureLevel = listOf(INVALID_PLUGIN, COMPATIBILITY_PROBLEMS, MISSING_DEPENDENCIES )
verificationReportsFormats = listOf(MARKDOWN, HTML)
}
patchPluginXml {
version = properties("pluginVersion")
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")
//TODO inject changelog into plugin.xml change-notes
}
runIde {
//Use "debug" to send telemetry to dev source at segment.com
systemProperties["com.redhat.devtools.intellij.telemetry.mode"] = "debug" // "disabled"
}
// Configure UI tests plugin
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
runIdeForUiTests {
systemProperty("robot-server.port", "8082")
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
}
signPlugin {
certificateChain = environment("CERTIFICATE_CHAIN")
privateKey = environment("PRIVATE_KEY")
password = environment("PRIVATE_KEY_PASSWORD")
}
publishPlugin {
//dependsOn("patchChangelog") // TODO generate changelog
token = environment("PUBLISH_TOKEN")
channels = properties("channel").map { listOf(it) }
}
check {
dependsOn(jacocoTestReport)
}
}