14
14
15
15
import org.jetbrains.changelog.Changelog
16
16
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
17
+ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
17
18
import java.time.LocalDate
18
19
import java.time.ZoneId
19
20
import java.time.format.DateTimeFormatter
20
21
22
+ // !IMPORTANT!: to refer "libs", use ./gradle/libs.versions.toml
23
+
21
24
fun properties (key : String ) = providers.gradleProperty(key)
22
25
fun environment (key : String ) = providers.environmentVariable(key)
23
26
fun dateValue (pattern : String ): String =
@@ -44,10 +47,17 @@ val plugins = listOf(
44
47
PluginDescriptor (
45
48
jvmTargetVersion = JavaVersion .VERSION_17 ,
46
49
since = " 233.11799" ,
47
- getUntil = { provider { " 242 .*" } },
50
+ getUntil = { provider { " 241 .*" } },
48
51
sdkVersion = " 2023.3" ,
49
52
sourceFolder = " IC-233"
50
53
),
54
+ PluginDescriptor (
55
+ jvmTargetVersion = JavaVersion .VERSION_21 ,
56
+ since = " 242.20224" ,
57
+ getUntil = { provider { " 242.*" } },
58
+ sdkVersion = " 2024.2" ,
59
+ sourceFolder = " IC-242"
60
+ ),
51
61
PluginDescriptor (
52
62
jvmTargetVersion = JavaVersion .VERSION_21 ,
53
63
since = " 243.12818" ,
@@ -61,23 +71,14 @@ val descriptor = plugins.first { it.sourceFolder == productName }
61
71
62
72
group = properties(" pluginGroup" ).get()
63
73
version = properties(" pluginVersion" ).get()
64
- val remoteRobotVersion = " 0.11.23"
65
- val okHttp3Version = " 4.12.0"
66
- val kotestVersion = " 5.9.1"
67
- val retrofit2Vertion = " 2.11.0"
68
- val junitVersion = " 5.11.1"
69
- val mockkVersion = " 1.13.12"
70
- val jGraphTVersion = " 1.5.2"
71
- val zoweKotlinSdkVersion = " 0.5.0"
72
- val javaAnalyticsVersion = " 3.5.1"
73
74
74
75
plugins {
75
- id(" org.jetbrains.intellij.platform" ) version " 2.1.0"
76
- id(" org.jetbrains.changelog" ) version " 2.2.1"
77
- kotlin(" jvm" ) version " 1.9.22"
76
+ alias(libs.plugins.gradle) // IntelliJ Platform Gradle Plugin
77
+ alias(libs.plugins.kotlinJvm)
78
+ alias(libs.plugins.changelog)
79
+ alias(libs.plugins.kover)
80
+ alias(libs.plugins.dependencycheck)
78
81
java
79
- id(" org.jetbrains.kotlinx.kover" ) version " 0.8.3"
80
- id(" org.owasp.dependencycheck" ) version " 10.0.4"
81
82
}
82
83
83
84
repositories {
@@ -108,6 +109,25 @@ kotlin {
108
109
}
109
110
}
110
111
112
+ /* * Source sets configuration */
113
+ sourceSets {
114
+ main {
115
+ java {
116
+ srcDir(" src/${descriptor.sourceFolder} /kotlin" )
117
+ }
118
+ resources {
119
+ srcDir(" src/${descriptor.sourceFolder} /resources" )
120
+ }
121
+ }
122
+ create(" uiTest" ) {
123
+ compileClasspath + = sourceSets.main.get().compileClasspath + sourceSets.test.get().compileClasspath
124
+ runtimeClasspath + = output + compileClasspath
125
+ }
126
+ }
127
+
128
+ configurations[" uiTestRuntimeOnly" ].extendsFrom(configurations.testRuntimeOnly.get())
129
+ configurations[" uiTestImplementation" ].extendsFrom(configurations.testImplementation.get())
130
+
111
131
dependencies {
112
132
intellijPlatform {
113
133
// intellijIdeaCommunity(descriptor.sdkVersion)
@@ -116,27 +136,18 @@ dependencies {
116
136
jetbrainsRuntime()
117
137
instrumentationTools()
118
138
testFramework(TestFrameworkType .Plugin .Java )
139
+ testFramework(TestFrameworkType .Starter , configurationName = " uiTestImplementation" )
119
140
}
120
- implementation(group = " com.squareup.retrofit2" , name = " retrofit" , version = retrofit2Vertion)
121
- implementation(" com.squareup.retrofit2:converter-gson:$retrofit2Vertion " )
122
- implementation(" com.squareup.retrofit2:converter-scalars:$retrofit2Vertion " )
123
- implementation(" com.squareup.okhttp3:okhttp:$okHttp3Version " )
124
- implementation(" org.jgrapht:jgrapht-core:$jGraphTVersion " )
125
- implementation(" org.zowe.sdk:zowe-kotlin-sdk:$zoweKotlinSdkVersion " )
126
- implementation(" com.segment.analytics.java:analytics:$javaAnalyticsVersion " )
127
- implementation(" org.junit.jupiter:junit-jupiter-params:$junitVersion " )
128
- testImplementation(" org.junit.jupiter:junit-jupiter-api:$junitVersion " )
129
- testImplementation(" io.mockk:mockk:$mockkVersion " )
130
- testImplementation(" io.kotest:kotest-assertions-core:$kotestVersion " )
131
- testImplementation(" io.kotest:kotest-runner-junit5:$kotestVersion " )
132
- testImplementation(" com.intellij.remoterobot:remote-robot:$remoteRobotVersion " )
133
- testImplementation(" com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion " )
134
- testImplementation(" com.squareup.okhttp3:mockwebserver:$okHttp3Version " )
135
- testImplementation(" com.squareup.okhttp3:okhttp-tls:$okHttp3Version " )
136
- testImplementation(" com.squareup.okhttp3:logging-interceptor:$okHttp3Version " )
137
- testImplementation(" com.intellij.remoterobot:ide-launcher:$remoteRobotVersion " )
138
- testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:$junitVersion " )
139
- testRuntimeOnly(" org.junit.vintage:junit-vintage-engine:$junitVersion " )
141
+ implementation(libs.retrofit2)
142
+ implementation(libs.retrofit2.converter.gson)
143
+ implementation(libs.retrofit2.converter.scalars)
144
+ implementation(libs.okhttp3)
145
+ implementation(libs.jgrapht.core)
146
+ implementation(libs.zowe.kotlin.sdk)
147
+ implementation(libs.segment.analytics)
148
+ testImplementation(libs.mockk)
149
+ testImplementation(libs.kotest.assertions.core)
150
+ testImplementation(libs.kotest.runner.junit5)
140
151
}
141
152
142
153
intellijPlatform {
@@ -222,27 +233,17 @@ tasks {
222
233
)
223
234
}
224
235
225
- // withType<ClasspathIndexCleanupTask> {
226
- // onlyIf {
227
- // gradle.startParameter.taskNames.contains("test")
228
- // }
229
- // dependsOn(compileTestKotlin)
230
- // }
231
-
232
- //
233
- // withType<ClasspathIndexCleanupTask> {
234
- // onlyIf {
235
- // gradle.startParameter.taskNames.contains("uiTest")
236
- // }
237
- // dependsOn("compileUiTestKotlin")
238
- // }
236
+ withType<KotlinCompile >().configureEach {
237
+ if (name == " compileUiTestKotlin" ) {
238
+ onlyIf {
239
+ gradle.startParameter.taskNames.any { it.contains(" uiTests" ) }
240
+ }
241
+ }
242
+ }
239
243
240
244
test {
241
245
useJUnitPlatform()
242
246
243
- // To run unit tests only and do not trigger "uiTest" task related things (like "compileUiTestKotlin")
244
- onlyIf { ! gradle.startParameter.taskNames.contains(" uiTest" ) }
245
-
246
247
testLogging {
247
248
events(" passed" , " skipped" , " failed" )
248
249
}
@@ -312,102 +313,101 @@ tasks {
312
313
.map { it }
313
314
)
314
315
}
315
-
316
- // TODO: fix
317
- // downloadRobotServerPlugin {
318
- // version.set(remoteRobotVersion)
319
- // }
320
-
321
- // TODO: fix
322
- // runIdeForUiTests {
323
- // systemProperty("idea.trust.all.projects", "true")
324
- // systemProperty("ide.show.tips.on.startup.default.value", "false")
325
- // }
326
316
}
327
317
328
318
/* *
329
- * Adds uiTest source sets
319
+ * UI tests task. Describes setup that provides the tools to run UI tests.
320
+ * This task is available only for IDEs since version 242
330
321
*/
331
- sourceSets {
332
- main {
333
- java {
334
- srcDir(" src/${descriptor.sourceFolder} /kotlin" )
335
- }
336
- resources {
337
- srcDir(" src/${descriptor.sourceFolder} /resources" )
322
+ // https://github.com/JetBrains/intellij-community/blob/master/platform/remote-driver/README.md
323
+ val uiTests by intellijPlatformTesting.testIdeUi.registering {
324
+ task {
325
+ enabled = gradle.startParameter.taskNames.any { it.contains(" uiTests" ) } && descriptor.since >= " 242"
326
+ archiveFile.set(tasks.buildPlugin.flatMap { it.archiveFile })
327
+ testClassesDirs = sourceSets[" uiTest" ].output.classesDirs
328
+ classpath = sourceSets[" uiTest" ].runtimeClasspath
329
+
330
+ useJUnitPlatform {
331
+ isScanForTestClasses = false
332
+ includeTags(" New" )
338
333
}
339
- }
340
- create(" uiTest" ) {
341
- compileClasspath + = sourceSets.main.get().output
342
- runtimeClasspath + = sourceSets.main.get().output
343
- java.srcDirs(" src/uiTest/java" , " src/uiTest/kotlin" )
344
- resources.srcDirs(" src/uiTest/resources" )
345
- }
346
- }
347
334
348
- /* *
349
- * configures the UI Tests to inherit the testImplementation in dependencies
350
- */
351
- val uiTestImplementation by configurations.getting {
352
- extendsFrom(configurations.testImplementation.get())
353
- }
354
-
355
- /* *
356
- * configures the UI Tests to inherit the testRuntimeOnly in dependencies
357
- */
358
- configurations[" uiTestRuntimeOnly" ].extendsFrom(configurations.testRuntimeOnly.get())
335
+ jvmArgumentProviders + = CommandLineArgumentProvider {
336
+ listOf (
337
+ " -Xmx2g" ,
338
+ " -Xms512m" ,
339
+ " -Dide.test.version=${descriptor.sdkVersion} " ,
340
+ " -Dplugin.path=${tasks.buildPlugin.flatMap { it.archiveFile }.get().asFile.absolutePath} " ,
341
+ " -Dui.tests.mock.project.path=src/uiTest/resources/mock_project" ,
342
+ " -Didea.trust.all.projects=true" ,
343
+ " -Dide.show.tips.on.startup.default.value=false" ,
344
+ " -Didea.log.config.properties.file=src/uiTest/resources/log.properties" ,
345
+ " -Didea.log.path=src/uiTest/resources/mock_project" ,
346
+ // TODO: delete
347
+ " -DideLaunchFolder=ide_for_launch" ,
348
+ " -DremoteRobotUrl=http://127.0.0.1" ,
349
+ " -DideaBuildVersionForTest=ideaIC-242.20224.91" ,
350
+ " -DrobotServerForTest=robot-server-plugin-0.11.23" ,
351
+ " -Didea.trust.all.projects=true" ,
352
+ " -Dide.show.tips.on.startup.default.value=false" ,
353
+ " -Dkotest.framework.classpath.scanning.autoscan.disable=true" ,
354
+ )
355
+ }
359
356
360
- /* *
361
- * runs UI tests
362
- */
363
- val uiTest = task<Test >(" uiTest" ) {
364
- description = " Runs the integration tests for UI."
365
- group = " verification"
366
- systemProperty(" ideLaunchFolder" , System .getProperty(" ideLaunchFolder" ))
367
- systemProperty(" forMainframePath" , System .getProperty(" forMainframePath" ))
368
- systemProperty(" remoteRobotUrl" , System .getProperty(" remoteRobotUrl" ))
369
- systemProperty(" ideaVersionForTest" , System .getProperty(" ideaVersionForTest" ))
370
- systemProperty(" ideaBuildVersionForTest" , System .getProperty(" ideaBuildVersionForTest" ))
371
- systemProperty(" robotServerForTest" , System .getProperty(" robotServerForTest" ))
372
- testClassesDirs = sourceSets[" uiTest" ].output.classesDirs
373
- classpath = sourceSets[" uiTest" ].runtimeClasspath
374
- useJUnitPlatform {
375
- excludeTags(" FirstTime" )
376
- excludeTags(" SmokeTest" )
377
- }
378
- testLogging {
379
- events(" passed" , " skipped" , " failed" )
357
+ testLogging {
358
+ events(" passed" , " skipped" , " failed" , " standardOut" , " standardError" )
359
+ }
380
360
}
381
- }
382
361
383
- /* *
384
- * Runs the first UI test, which agrees to the license agreement
385
- */
386
- val firstTimeUiTest = task<Test >(" firstTimeUiTest" ) {
387
- description = " Gets rid of license agreement, etc."
388
- group = " verification"
389
- testClassesDirs = sourceSets[" uiTest" ].output.classesDirs
390
- classpath = sourceSets[" uiTest" ].runtimeClasspath
391
- useJUnitPlatform {
392
- includeTags(" FirstTime" )
393
- }
394
- testLogging {
395
- events(" passed" , " skipped" , " failed" )
362
+ plugins {
363
+ robotServerPlugin()
396
364
}
397
- }
398
365
399
- /* *
400
- * Runs the smoke ui test
401
- */
402
- val smokeUiTest = task< Test >( " smokeUiTest " ) {
403
- description = " Gets rid of license agreement, etc. "
404
- group = " verification "
405
- testClassesDirs = sourceSets[ " uiTest " ].output.classesDirs
406
- classpath = sourceSets[ " uiTest " ].runtimeClasspath
407
- useJUnitPlatform {
408
- includeTags( " SmokeTest " )
409
- }
410
- testLogging {
411
- events( " passed " , " skipped " , " failed " )
366
+ dependencies {
367
+ // testImplementation(libs.junit.platform.launcher)
368
+ // testImplementation(libs.junit.platform.suite)
369
+ // testImplementation(libs.junit.jupiter)
370
+ // testImplementation(libs.junit.jupiter.engine)
371
+ testImplementation(libs.junit.jupiter.api)
372
+ testImplementation(libs.junit.jupiter.params)
373
+ testImplementation(libs.okhttp3.mockwebserver)
374
+ testImplementation(libs.okhttp3.okhttp.tls)
375
+ // TODO: revise and delete old unnecessary deps
376
+ testImplementation( " com.intellij.remoterobot:ide-launcher:0.11.23 " )
377
+ testImplementation( " com.intellij.remoterobot:remote-robot:0.11.23 " )
378
+ testImplementation( " com.intellij.remoterobot:remote-fixtures:0.11.23 " )
412
379
}
413
380
}
381
+
382
+ // TODO: fix
383
+ // /**
384
+ // * Runs the first UI test, which agrees to the license agreement
385
+ // */
386
+ // val firstTimeUiTest = task<Test>("firstTimeUiTest") {
387
+ // description = "Gets rid of license agreement, etc."
388
+ // group = "verification"
389
+ // testClassesDirs = sourceSets["uiTest"].output.classesDirs
390
+ // classpath = sourceSets["uiTest"].runtimeClasspath
391
+ // useJUnitPlatform {
392
+ // includeTags("FirstTime")
393
+ // }
394
+ // testLogging {
395
+ // events("passed", "skipped", "failed")
396
+ // }
397
+ // }
398
+ //
399
+ // /**
400
+ // * Runs the smoke ui test
401
+ // */
402
+ // val smokeUiTest = task<Test>("smokeUiTest") {
403
+ // description = "Gets rid of license agreement, etc."
404
+ // group = "verification"
405
+ // testClassesDirs = sourceSets["uiTest"].output.classesDirs
406
+ // classpath = sourceSets["uiTest"].runtimeClasspath
407
+ // useJUnitPlatform {
408
+ // includeTags("SmokeTest")
409
+ // }
410
+ // testLogging {
411
+ // events("passed", "skipped", "failed")
412
+ // }
413
+ // }
0 commit comments