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