@@ -28,6 +28,8 @@ allprojects {
28
28
29
29
repositories {
30
30
mavenCentral()
31
+ maven(" https://cache-redirector.jetbrains.com/packages.jetbrains.team/maven/p/ij/intellij-ide-starter" )
32
+ maven(" https://mvnrepository.com/artifact/com.jetbrains.intellij.tools/ide-starter-driver" )
31
33
intellijPlatform {
32
34
defaultRepositories()
33
35
}
@@ -41,6 +43,7 @@ plugins {
41
43
id(" org.jetbrains.intellij.platform" ) version " 2.7.0" // IntelliJ Platform Gradle Plugin
42
44
id(" org.jetbrains.kotlin.jvm" ) version " 2.2.0" // Kotlin support
43
45
id(" org.jetbrains.changelog" ) version " 2.2.0" // Gradle Changelog Plugin
46
+ idea // IntelliJ IDEA support
44
47
}
45
48
46
49
// By default (e.g. when we call `runIde` during development), the plugin version is SNAPSHOT
@@ -90,11 +93,17 @@ jvmVersion = when (javaVersion) {
90
93
throw IllegalArgumentException (" javaVersion must be defined in the product matrix as either \" 17\" or \" 21\" , but is not for $ideaVersion " )
91
94
}
92
95
}
96
+
93
97
kotlin {
94
98
compilerOptions {
95
99
apiVersion.set(KotlinVersion .KOTLIN_2_1 )
96
100
jvmTarget = jvmVersion
97
101
}
102
+ jvmToolchain {
103
+ languageVersion = JavaLanguageVersion .of(21 )
104
+ @Suppress(" UnstableApiUsage" )
105
+ vendor = JvmVendorSpec .JETBRAINS
106
+ }
98
107
}
99
108
100
109
var javaCompatibilityVersion: JavaVersion
@@ -111,18 +120,79 @@ javaCompatibilityVersion = when (javaVersion) {
111
120
throw IllegalArgumentException (" javaVersion must be defined in the product matrix as either \" 17\" or \" 21\" , but is not for $ideaVersion " )
112
121
}
113
122
}
123
+
114
124
java {
115
125
sourceCompatibility = javaCompatibilityVersion
116
126
targetCompatibility = javaCompatibilityVersion
117
127
}
118
128
129
+ sourceSets {
130
+ main {
131
+ java.srcDirs(
132
+ listOf (
133
+ " src" ,
134
+ " third_party/vmServiceDrivers"
135
+ )
136
+ )
137
+ // Add kotlin.srcDirs if we start using Kotlin in the main plugin.
138
+ resources.srcDirs(
139
+ listOf (
140
+ " src" ,
141
+ " resources"
142
+ )
143
+ )
144
+ }
145
+ test {
146
+ java.srcDirs(
147
+ listOf (
148
+ " src" ,
149
+ " testSrc/unit" ,
150
+ " third_party/vmServiceDrivers"
151
+ )
152
+ )
153
+ resources.srcDirs(
154
+ listOf (
155
+ " resources" ,
156
+ " testData" ,
157
+ " testSrc/unit"
158
+ )
159
+ )
160
+ }
161
+
162
+ create(" integration" , Action <SourceSet > {
163
+ java.srcDirs(" testSrc/integration" )
164
+ kotlin.srcDirs(" testSrc/integration" )
165
+ resources.srcDirs(" testSrc/integration" )
166
+ compileClasspath + = sourceSets[" main" ].output + sourceSets[" test" ].output
167
+ runtimeClasspath + = sourceSets[" main" ].output + sourceSets[" test" ].output
168
+ })
169
+ }
170
+
171
+ // Configure IntelliJ IDEA to recognize integration as test sources
172
+ idea {
173
+ module {
174
+ testSources.from(sourceSets[" integration" ].kotlin.srcDirs)
175
+ testResources.from(sourceSets[" integration" ].resources.srcDirs)
176
+ }
177
+ }
178
+
179
+ val integrationImplementation: Configuration by configurations.getting {
180
+ extendsFrom(configurations.testImplementation.get())
181
+ }
182
+
183
+ val integrationRuntimeOnly: Configuration by configurations.getting {
184
+ extendsFrom(configurations.testRuntimeOnly.get())
185
+ }
186
+
119
187
dependencies {
120
188
intellijPlatform {
121
189
// Documentation on the default target platform methods:
122
190
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#default-target-platforms
123
191
// Android Studio versions can be found at: https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
124
192
androidStudio(ideaVersion)
125
193
testFramework(TestFrameworkType .Platform )
194
+ testFramework(TestFrameworkType .Starter , configurationName = " integrationImplementation" )
195
+ testFramework(TestFrameworkType .JUnit5 , configurationName = " integrationImplementation" )
126
196
127
197
// Plugin dependency documentation:
128
198
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#plugins
@@ -166,6 +236,14 @@ dependencies {
166
236
)
167
237
)
168
238
)
239
+
240
+ // UI Test dependencies
241
+ integrationImplementation(" org.kodein.di:kodein-di-jvm:7.26.1" )
242
+ integrationImplementation(" org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0" )
243
+
244
+ // JUnit 5 is required for UI tests
245
+ integrationImplementation(" org.junit.jupiter:junit-jupiter:5.11.4" )
246
+ integrationRuntimeOnly(" org.junit.platform:junit-platform-launcher" )
169
247
}
170
248
171
249
intellijPlatform {
@@ -213,37 +291,42 @@ intellijPlatform {
213
291
}
214
292
}
215
293
216
- sourceSets {
217
- main {
218
- java.srcDirs(
219
- listOf (
220
- " src" ,
221
- " third_party/vmServiceDrivers"
222
- )
223
- )
224
- // Add kotlin.srcDirs if we start using Kotlin in the main plugin.
225
- resources.srcDirs(
226
- listOf (
227
- " src" ,
228
- " resources"
229
- )
230
- )
231
- }
232
- test {
233
- java.srcDirs(
234
- listOf (
235
- " src" ,
236
- " testSrc/unit" ,
237
- " third_party/vmServiceDrivers"
238
- )
294
+ tasks {
295
+ register<Test >(" integration" ) {
296
+ description = " Runs only the UI integration tests that start the IDE"
297
+ group = " verification"
298
+ testClassesDirs = sourceSets[" integration" ].output.classesDirs
299
+ classpath = sourceSets[" integration" ].runtimeClasspath
300
+ useJUnitPlatform {
301
+ includeTags(" ui" )
302
+ }
303
+
304
+ // UI tests should run sequentially (not in parallel) to avoid conflicts
305
+ maxParallelForks = 1
306
+
307
+ // Increase memory for UI tests
308
+ minHeapSize = " 1g"
309
+ maxHeapSize = " 4g"
310
+
311
+ systemProperty(" path.to.build.plugin" , buildPlugin.get().archiveFile.get().asFile.absolutePath)
312
+ systemProperty(" idea.home.path" , prepareTestSandbox.get().getDestinationDir().parentFile.absolutePath)
313
+ systemProperty(
314
+ " allure.results.directory" , project.layout.buildDirectory.get().asFile.absolutePath + " /allure-results"
239
315
)
240
- resources.srcDirs(
241
- listOf (
242
- " resources" ,
243
- " testData" ,
244
- " testSrc/unit"
316
+ // systemProperty("uiPlatformBuildVersion", providers.gradleProperty("uiPlatformBuildVersion").get())
317
+
318
+ // Disable IntelliJ test listener that conflicts with standard JUnit
319
+ systemProperty(" idea.test.cyclic.buffer.size" , " 0" )
320
+
321
+ // Add required JVM arguments
322
+ jvmArgumentProviders + = CommandLineArgumentProvider {
323
+ mutableListOf (
324
+ " --add-opens=java.base/java.lang=ALL-UNNAMED" ,
325
+ " --add-opens=java.desktop/javax.swing=ALL-UNNAMED"
245
326
)
246
- )
327
+ }
328
+
329
+ dependsOn(buildPlugin)
247
330
}
248
331
}
249
332
0 commit comments