@@ -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.2" // 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
@@ -96,11 +99,18 @@ jvmVersion = when (javaVersion) {
96
99
throw IllegalArgumentException (" javaVersion must be defined in the product matrix as either \" 17\" or \" 21\" , but is not for $ideaVersion " )
97
100
}
98
101
}
102
+
99
103
kotlin {
100
104
compilerOptions {
101
105
apiVersion.set(KotlinVersion .KOTLIN_2_1 )
102
106
jvmTarget = jvmVersion
103
107
}
108
+ // This is how you specify the specific JVM requirements, this may be a requirement for the Starter test framework
109
+ // jvmToolchain {
110
+ // languageVersion = JavaLanguageVersion.of(21)
111
+ // @Suppress("UnstableApiUsage")
112
+ // vendor = JvmVendorSpec.JETBRAINS
113
+ // }
104
114
}
105
115
106
116
var javaCompatibilityVersion: JavaVersion
@@ -117,18 +127,79 @@ javaCompatibilityVersion = when (javaVersion) {
117
127
throw IllegalArgumentException (" javaVersion must be defined in the product matrix as either \" 17\" or \" 21\" , but is not for $ideaVersion " )
118
128
}
119
129
}
130
+
120
131
java {
121
132
sourceCompatibility = javaCompatibilityVersion
122
133
targetCompatibility = javaCompatibilityVersion
123
134
}
124
135
136
+ sourceSets {
137
+ main {
138
+ java.srcDirs(
139
+ listOf (
140
+ " src" ,
141
+ " third_party/vmServiceDrivers"
142
+ )
143
+ )
144
+ // Add kotlin.srcDirs if we start using Kotlin in the main plugin.
145
+ resources.srcDirs(
146
+ listOf (
147
+ " src" ,
148
+ " resources"
149
+ )
150
+ )
151
+ }
152
+ test {
153
+ java.srcDirs(
154
+ listOf (
155
+ " src" ,
156
+ " testSrc/unit" ,
157
+ " third_party/vmServiceDrivers"
158
+ )
159
+ )
160
+ resources.srcDirs(
161
+ listOf (
162
+ " resources" ,
163
+ " testData" ,
164
+ " testSrc/unit"
165
+ )
166
+ )
167
+ }
168
+
169
+ create(" integration" , Action <SourceSet > {
170
+ java.srcDirs(" testSrc/integration" )
171
+ kotlin.srcDirs(" testSrc/integration" )
172
+ resources.srcDirs(" testSrc/integration" )
173
+ compileClasspath + = sourceSets[" main" ].output + sourceSets[" test" ].output
174
+ runtimeClasspath + = sourceSets[" main" ].output + sourceSets[" test" ].output
175
+ })
176
+ }
177
+
178
+ // Configure IntelliJ IDEA to recognize integration as test sources
179
+ idea {
180
+ module {
181
+ testSources.from(sourceSets[" integration" ].kotlin.srcDirs)
182
+ testResources.from(sourceSets[" integration" ].resources.srcDirs)
183
+ }
184
+ }
185
+
186
+ val integrationImplementation: Configuration by configurations.getting {
187
+ extendsFrom(configurations.testImplementation.get())
188
+ }
189
+
190
+ val integrationRuntimeOnly: Configuration by configurations.getting {
191
+ extendsFrom(configurations.testRuntimeOnly.get())
192
+ }
193
+
125
194
dependencies {
126
195
intellijPlatform {
127
196
// Documentation on the default target platform methods:
128
197
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#default-target-platforms
129
198
// Android Studio versions can be found at: https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
130
199
androidStudio(ideaVersion)
131
200
testFramework(TestFrameworkType .Platform )
201
+ testFramework(TestFrameworkType .Starter , configurationName = " integrationImplementation" )
202
+ testFramework(TestFrameworkType .JUnit5 , configurationName = " integrationImplementation" )
132
203
133
204
// Plugin dependency documentation:
134
205
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#plugins
@@ -172,6 +243,14 @@ dependencies {
172
243
)
173
244
)
174
245
)
246
+
247
+ // UI Test dependencies
248
+ integrationImplementation(" org.kodein.di:kodein-di-jvm:7.26.1" )
249
+ integrationImplementation(" org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0" )
250
+
251
+ // JUnit 5 is required for UI tests
252
+ integrationImplementation(" org.junit.jupiter:junit-jupiter:5.11.4" )
253
+ integrationRuntimeOnly(" org.junit.platform:junit-platform-launcher" )
175
254
}
176
255
177
256
intellijPlatform {
@@ -219,37 +298,41 @@ intellijPlatform {
219
298
}
220
299
}
221
300
222
- sourceSets {
223
- main {
224
- java.srcDirs(
225
- listOf (
226
- " src" ,
227
- " third_party/vmServiceDrivers"
228
- )
229
- )
230
- // Add kotlin.srcDirs if we start using Kotlin in the main plugin.
231
- resources.srcDirs(
232
- listOf (
233
- " src" ,
234
- " resources"
235
- )
236
- )
237
- }
238
- test {
239
- java.srcDirs(
240
- listOf (
241
- " src" ,
242
- " testSrc/unit" ,
243
- " third_party/vmServiceDrivers"
244
- )
301
+ tasks {
302
+ register<Test >(" integration" ) {
303
+ description = " Runs only the UI integration tests that start the IDE"
304
+ group = " verification"
305
+ testClassesDirs = sourceSets[" integration" ].output.classesDirs
306
+ classpath = sourceSets[" integration" ].runtimeClasspath
307
+ useJUnitPlatform {
308
+ includeTags(" ui" )
309
+ }
310
+
311
+ // UI tests should run sequentially (not in parallel) to avoid conflicts
312
+ maxParallelForks = 1
313
+
314
+ // Increase memory for UI tests
315
+ minHeapSize = " 1g"
316
+ maxHeapSize = " 4g"
317
+
318
+ systemProperty(" path.to.build.plugin" , buildPlugin.get().archiveFile.get().asFile.absolutePath)
319
+ systemProperty(" idea.home.path" , prepareTestSandbox.get().getDestinationDir().parentFile.absolutePath)
320
+ systemProperty(
321
+ " allure.results.directory" , project.layout.buildDirectory.get().asFile.absolutePath + " /allure-results"
245
322
)
246
- resources.srcDirs(
247
- listOf (
248
- " resources" ,
249
- " testData" ,
250
- " testSrc/unit"
323
+
324
+ // Disable IntelliJ test listener that conflicts with standard JUnit
325
+ systemProperty(" idea.test.cyclic.buffer.size" , " 0" )
326
+
327
+ // Add required JVM arguments
328
+ jvmArgumentProviders + = CommandLineArgumentProvider {
329
+ mutableListOf (
330
+ " --add-opens=java.base/java.lang=ALL-UNNAMED" ,
331
+ " --add-opens=java.desktop/javax.swing=ALL-UNNAMED"
251
332
)
252
- )
333
+ }
334
+
335
+ dependsOn(buildPlugin)
253
336
}
254
337
}
255
338
0 commit comments