forked from redhat-developer/intellij-openshift-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
298 lines (260 loc) · 10.5 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
plugins {
id("idea")
id("java") // Java support
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
id("jacoco") // Code coverage
alias(libs.plugins.sonarqube) // SonarQube
}
group = "org.jboss.tools.intellij"
version = providers.gradleProperty("projectVersion").get() // Plugin version
val ideaVersion = providers.gradleProperty("platformVersion").get()
val devtoolsCommonForTests = "com.redhat.devtools.intellij:intellij-common:" + libs.devtools.common + ":test"
// Set the JVM language level used to build the project.
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
repositories {
mavenLocal()
maven { url = uri("https://repository.jboss.org") }
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
create(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion)
// Bundled Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
// for local plugin -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin-faq.html#how-to-add-a-dependency-on-a-plugin-available-in-the-file-system
//plugins.set(listOf(file("/path/to/plugin/")))
pluginVerifier()
instrumentationTools()
testFramework(TestFrameworkType.Platform)
}
components {
withModule("com.redhat.devtools.intellij:intellij-common") {
withVariant("intellijPlatformComposedJar") {
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
}
}
implementation(libs.openshift.client)
implementation(libs.devtools.common)
implementation(libs.keycloak)
implementation(libs.jjwt.impl)
implementation(libs.jjwt.jackson)
implementation(libs.converter.jackson)
implementation(libs.annotations) // to build against platform <= 2023.2
// for unit tests
testImplementation(libs.junit)
testImplementation(libs.mockito)
testImplementation(libs.easytesting)
testImplementation(libs.mockserver.client)
testImplementation(libs.mockserver.netty)
constraints {
implementation("io.undertow:undertow-core:2.3.15.Final") { // keycloak
because("https://security.snyk.io/vuln/SNYK-JAVA-IOUNDERTOW-6567186")
}
implementation("org.bouncycastle:bcprov-jdk18on:1.78.1") { // keycloak
because("https://security.snyk.io/vuln/SNYK-JAVA-ORGBOUNCYCASTLE-6612984")
}
implementation("com.squareup.okhttp3:okhttp:4.12.0") { // converter.jackson/retrofit
because("https://security.snyk.io/vuln/SNYK-JAVA-COMSQUAREUPOKHTTP3-2958044")
}
}
}
intellijPlatform {
buildSearchableOptions = false
pluginConfiguration {
ideaVersion {
sinceBuild = providers.gradleProperty("pluginSinceBuild")
untilBuild = provider { null }
}
}
publishing {
token = providers.gradleProperty("jetBrainsToken")
channels = providers.gradleProperty("jetBrainsChannel").map { listOf(it) }
}
pluginVerification {
ides {
ide(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion)
}
freeArgs = listOf(
"-mute",
"TemplateWordInPluginId,TemplateWordInPluginName"
)
}
}
tasks {
wrapper {
gradleVersion = providers.gradleProperty("gradleVersion").get()
}
runIde {
systemProperty("com.redhat.devtools.intellij.telemetry.mode", "debug")
findProperty("tools.dl.path")?.let { systemProperty("tools.dl.path", it) }
//systemProperty("jboss.sandbox.api.endpoint", "http://localhost:3000") // enable when running sandbox locally, see below
}
test {
systemProperty("com.redhat.devtools.intellij.telemetry.mode", "disabled")
jvmArgs("-Djava.awt.headless=true")
useJUnit()
testLogging {
events(TestLogEvent.FAILED)
exceptionFormat = TestExceptionFormat.FULL
showStackTraces = true
showStandardStreams = false
}
}
withType<Test> {
configure<JacocoTaskExtension> {
isIncludeNoLocationClasses = true
excludes = listOf("jdk.internal.*")
}
}
jacocoTestReport {
executionData.setFrom(fileTree(layout.buildDirectory).include("/jacoco/*.exec"))
classDirectories.setFrom(instrumentCode)
reports {
xml.required = true
}
}
jacocoTestCoverageVerification {
classDirectories.setFrom(instrumentCode)
}
sonar {
properties {
property("sonar.projectKey", "redhat-developer_intellij-openshift-connector")
property("sonar.organization", "redhat-developer")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.junit.reportsPath", layout.buildDirectory.dir("test-results").get().asFile.absolutePath)
property("sonar.gradle.skipCompile", "true")
}
}
register("runSandbox", JavaExec::class.java) {
group = "Execution"
description = "Run the Sandbox registration server in port 3000"
classpath = sourceSets.test.get().runtimeClasspath
mainClass.set("org.jboss.tools.intellij.openshift.ui.sandbox.SandboxRegistrationServerMock")
}
printProductsReleases {
channels = listOf(ProductRelease.Channel.EAP)
types = listOf(IntelliJPlatformType.IntellijIdeaCommunity)
untilBuild = provider { null }
}
}
sourceSets {
create("it") {
description = "integrationTest"
compileClasspath += sourceSets.main.get().compileClasspath + sourceSets.test.get().compileClasspath
runtimeClasspath += output + compileClasspath
}
}
configurations.all {
exclude(group = "org.slf4j", module = "slf4j-api")
exclude(group = "bundledPlugin", module = "Docker") // suppress multiple SLF4J providers
}
configurations["itRuntimeOnly"].extendsFrom(configurations.testRuntimeOnly.get())
configurations["itImplementation"].extendsFrom(configurations.testImplementation.get())
val integrationTest by intellijPlatformTesting.testIde.registering {
task {
systemProperty("com.redhat.devtools.intellij.telemetry.mode", "disabled")
findProperty("tools.dl.path")?.let { systemProperty("tools.dl.path", it) }
description = "Runs the integration tests."
group = "verification"
testClassesDirs = sourceSets["it"].output.classesDirs
classpath = sourceSets["it"].runtimeClasspath
testLogging {
events(TestLogEvent.FAILED)
exceptionFormat = TestExceptionFormat.FULL
showStackTraces = true
showStandardStreams = false
}
jvmArgs("-Djava.awt.headless=true")
useJUnitPlatform {
includeEngines("junit-vintage")
excludeEngines("junit-jupiter")
}
shouldRunAfter(tasks["test"])
}
dependencies {
testRuntimeOnly(libs.junit.vintage.engine)
testImplementation(libs.junit.platform.launcher)
testImplementation(libs.junit.platform.suite)
testImplementation(libs.junit.jupiter)
testImplementation(libs.junit.jupiter.api)
testImplementation(libs.junit.jupiter.engine)
testImplementation(devtoolsCommonForTests)
testImplementation(libs.devtools.common.ui.test)
testImplementation(libs.awaitility)
}
}
val integrationUITest by intellijPlatformTesting.testIde.registering {
task {
systemProperty("com.redhat.devtools.intellij.telemetry.mode", "disabled")
findProperty("tools.dl.path")?.let { systemProperty("tools.dl.path", it) }
findProperty("testProjectLocation")?.let { systemProperty("testProjectLocation", it) }
systemProperties["CLUSTER_ALREADY_LOGGED_IN"] = System.getenv("CLUSTER_ALREADY_LOGGED_IN") ?: false
description = "Runs the cluster integration UI tests."
group = "verification"
testClassesDirs = sourceSets["it"].output.classesDirs
classpath = sourceSets["it"].runtimeClasspath
testLogging {
events(TestLogEvent.FAILED)
exceptionFormat = TestExceptionFormat.FULL
showStackTraces = true
showStandardStreams = true
}
jvmArgs("-Djava.awt.headless=false") // use of clipboard in AboutPublicTest, set to false
val includes = if (System.getenv("CLUSTER_ALREADY_LOGGED_IN") == null) "**/PublicTestsSuite.class" else "**/ClusterTestsSuite.class"
include(includes)
useJUnitPlatform {
includeTags("ui-test")
}
shouldRunAfter(tasks["test"])
}
plugins {
robotServerPlugin()
}
dependencies {
testImplementation(libs.junit.platform.launcher)
testImplementation(libs.junit.platform.suite)
testImplementation(libs.junit.jupiter)
testImplementation(libs.junit.jupiter.api)
testImplementation(libs.junit.jupiter.engine)
testImplementation(devtoolsCommonForTests)
testImplementation(libs.devtools.common.ui.test)
testImplementation(libs.awaitility)
}
}
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-tasks.html#runIdeForUiTests
val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
task {
jvmArgumentProviders += CommandLineArgumentProvider {
listOf(
"-Dide.mac.message.dialogs.as.sheets=false",
"-Djb.privacy.policy.text=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false",
)
}
}
plugins {
robotServerPlugin()
}
}
// below is only to correctly configure IDEA project settings
idea {
module {
testSources.from(sourceSets["it"].java.srcDirs)
}
}