-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.gradle.kts
211 lines (174 loc) · 6.57 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 org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.models.ProductRelease
plugins {
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
alias(libs.plugins.kotlinJvm)
id("idea")
}
group = "com.redhat.devtools.intellij"
version = providers.gradleProperty("projectVersion").get() // Plugin version
val ideaVersion = providers.gradleProperty("platformVersion").get()
val javaVersion = 17
// Set the JVM language level used to build the project.
kotlin {
jvmToolchain(javaVersion)
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(javaVersion)
}
sourceCompatibility = JavaVersion.toVersion(javaVersion)
targetCompatibility = JavaVersion.toVersion(javaVersion)
}
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)
}
implementation(libs.devtools.common)
implementation(libs.kubernetes.client)
implementation(libs.kubernetes.model)
implementation(libs.kubernetes.model.common)
implementation(libs.openshift.client)
implementation(libs.kubernetes.httpclient.okhttp)
implementation(libs.jackson.core)
implementation(libs.commons.lang3)
// for unit tests
testImplementation(libs.assertj.core)
testImplementation(libs.mockito.inline)
testImplementation(libs.mockito.kotlin)
testImplementation(libs.kotlin.test.junit)
components {
withModule("com.redhat.devtools.intellij:intellij-common") {
withVariant("intellijPlatformComposedJar") {
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
}
}
}
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.IntellijIdeaUltimate, ideaVersion)
}
freeArgs = listOf(
"-mute",
"TemplateWordInPluginId,TemplateWordInPluginName"
)
}
}
tasks {
fun supportsEnhancedClassRedefinition(): Boolean {
val platformVersion = findProperty("platformVersion").toString().toFloatOrNull()
return platformVersion != null
&& platformVersion >= 2024.1
}
wrapper {
gradleVersion = providers.gradleProperty("gradleVersion").get()
}
runIde {
if (supportsEnhancedClassRedefinition()) {
jvmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:HotswapAgent=fatjar")
}
systemProperty("com.redhat.devtools.intellij.telemetry.mode", "debug")
}
test {
systemProperty("com.redhat.devtools.intellij.telemetry.mode", "disabled")
}
printProductsReleases {
channels = listOf(ProductRelease.Channel.EAP)
types = listOf(IntelliJPlatformType.IntellijIdeaCommunity)
untilBuild = provider { null }
}
}
configurations.all {
exclude(group = "org.slf4j", module = "slf4j-api")
}
sourceSets {
create("it") {
description = "integrationTest"
compileClasspath += sourceSets.main.get().compileClasspath + sourceSets.test.get().compileClasspath
runtimeClasspath += output + compileClasspath
}
}
configurations["itRuntimeOnly"].extendsFrom(configurations.testRuntimeOnly.get())
configurations["itImplementation"].extendsFrom(configurations.testImplementation.get())
val integrationTest by intellijPlatformTesting.testIde.registering {
task {
useJUnitPlatform()
systemProperty("com.redhat.devtools.intellij.telemetry.mode", "disabled")
description = "Runs the integration tests."
group = "verification"
testClassesDirs = sourceSets["it"].output.classesDirs
classpath = sourceSets["it"].runtimeClasspath
jvmArgs("-Djava.awt.headless=true")
shouldRunAfter(tasks["test"])
}
plugins {
robotServerPlugin()
}
dependencies {
testImplementation(libs.devtools.common)
testImplementation(libs.devtools.common.ui.test)
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(libs.gson)
}
}
// 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",
"-Duser.language=en -Duser.country=US"
)
}
systemProperty("robot-server.port", System.getProperty("robot-server.port"))
systemProperties["com.redhat.devtools.intellij.telemetry.mode"] = "disabled"
}
plugins {
robotServerPlugin()
}
}
// below is only to correctly configure IDEA project settings
idea {
module {
testSources.from(sourceSets["it"].java.srcDirs)
}
}