Skip to content

Commit 6abf638

Browse files
authored
Update to Gradle 8.5 (#4034)
Needed to make Java 21 integration tests pass
1 parent 987d1d0 commit 6abf638

File tree

15 files changed

+83
-32
lines changed

15 files changed

+83
-32
lines changed

buildSrc/src/main/kotlin/toolkit-integration-testing.gradle.kts

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import software.aws.toolkits.gradle.ciOnly
2+
import software.aws.toolkits.gradle.findFolders
3+
import software.aws.toolkits.gradle.intellij.IdeVersions
4+
15
// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
26
// SPDX-License-Identifier: Apache-2.0
37

@@ -15,13 +19,20 @@ sourceSets {
1519

1620
compileClasspath += main.get().output + test.get().output
1721
runtimeClasspath += main.get().output + test.get().output
22+
23+
// different convention for intellij projects
24+
plugins.withType<ToolkitIntellijSubpluginPlugin> {
25+
val ideProfile = IdeVersions.ideProfile(project)
26+
java.srcDirs(findFolders(project, "it", ideProfile))
27+
resources.srcDirs(findFolders(project, "it-resources", ideProfile))
28+
}
1829
}
1930
}
2031

2132
configurations.getByName("integrationTestCompileClasspath") {
2233
extendsFrom(configurations.getByName(JavaPlugin.TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME))
23-
isCanBeResolved = true
2434
}
35+
2536
configurations.getByName("integrationTestRuntimeClasspath") {
2637
extendsFrom(configurations.getByName(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME))
2738
isCanBeResolved = true
@@ -39,15 +50,36 @@ idea {
3950
}
4051
}
4152

42-
tasks.register<Test>("integrationTest") {
53+
val integTestTask = tasks.register<Test>("integrationTest") {
4354
group = LifecycleBasePlugin.VERIFICATION_GROUP
4455
description = "Runs the integration tests."
4556
testClassesDirs = integrationTests.output.classesDirs
4657
classpath = integrationTests.runtimeClasspath
4758

59+
ciOnly {
60+
environment.remove("AWS_ACCESS_KEY_ID")
61+
environment.remove("AWS_SECRET_ACCESS_KEY")
62+
environment.remove("AWS_SESSION_TOKEN")
63+
}
64+
4865
mustRunAfter(tasks.test)
4966
}
5067

5168
tasks.check {
5269
dependsOn(integrationTests.compileJavaTaskName, integrationTests.getCompileTaskName("kotlin"))
5370
}
71+
72+
afterEvaluate {
73+
plugins.withType<ToolkitIntellijSubpluginPlugin> {
74+
// weird implicit dependency issue, maybe with how the task graph works?
75+
// or because tests are on the ide classpath for some reason?
76+
tasks.named("classpathIndexCleanup") {
77+
mustRunAfter(tasks.named("compileIntegrationTestKotlin"))
78+
}
79+
80+
// intellij plugin overrides with instrumented classes that we don't want or need
81+
integTestTask.configure {
82+
testClassesDirs = integrationTests.output.classesDirs
83+
}
84+
}
85+
}

buildSrc/src/main/kotlin/toolkit-intellij-subplugin.gradle.kts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ sourceSets {
4040
java.srcDirs(findFolders(project, "tst", ideProfile))
4141
resources.srcDirs(findFolders(project, "tst-resources", ideProfile))
4242
}
43-
44-
plugins.withType<ToolkitIntegrationTestingPlugin> {
45-
maybeCreate("integrationTest").apply {
46-
java.srcDirs(findFolders(project, "it", ideProfile))
47-
resources.srcDirs(findFolders(project, "it-resources", ideProfile))
48-
}
49-
}
5043
}
5144

5245
configurations {
@@ -241,12 +234,6 @@ tasks.withType<RunIdeForUiTestTask>().all {
241234
}
242235
}
243236

244-
// weird implicit dependency issue, maybe with how the task graph works?
245-
// or because tests are on the ide classpath for some reason?
246-
tasks.named("classpathIndexCleanup") {
247-
mustRunAfter(tasks.named("compileIntegrationTestKotlin"))
248-
}
249-
250237
configurations.instrumentedJar.configure {
251238
// when the "instrumentedJar" configuration is selected, gradle is unable to resolve configurations needed by jacoco
252239
// to calculate coverage, so we declare these as seconary artifacts on the primary "instrumentedJar" implicit variant

buildspec/linuxIntegrationTests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ phases:
4545
>$AWS_CONFIG_FILE echo "[default]
4646
role_arn=$ASSUME_ROLE_ARN
4747
credential_source=EcsContainer"
48-
48+
- ls -alh $AWS_CONFIG_FILE
49+
- cat $AWS_CONFIG_FILE
4950
- chmod +x gradlew
5051
- DISPLAY=:22 ./gradlew -PideProfileName=$ALTERNATIVE_IDE_PROFILE_NAME integrationTest coverageReport -x :jetbrains-rider:integrationTest --info --console plain
5152
- |

detekt-rules/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dependencies {
1313
testImplementation(libs.junit4)
1414
testImplementation(libs.assertj)
1515

16+
// only used to make test work
1617
testRuntimeOnly(libs.slf4j.api)
1718
testRuntimeOnly(libs.junit5.jupiterVintage)
1819
}

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ kotlin.code.style=official
1919
org.gradle.parallel=true
2020
org.gradle.caching=true
2121
org.gradle.jvmargs=-Xmx2048m
22+
23+
# prefer non-enterprise variant of test-retry
24+
systemProp.gradle.enterprise.testretry.enabled=false

gradle/libs.versions.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ assertJ = "3.20.2" # Upgrading leads to SAM errors: https://youtrack.jetbrains.c
55
awsSdk = "2.20.111"
66
commonmark = "0.17.1"
77
detekt = "1.23.5"
8-
intellijGradle = "1.13.2"
8+
intellijGradle = "1.17.0"
99
intellijRemoteRobot = "0.11.21"
1010
jackson = "2.15.1"
1111
jacoco = "0.8.11"
@@ -24,9 +24,10 @@ node-gradle = "7.0.1"
2424
telemetryGenerator = "1.0.182"
2525
testLogger = "3.1.0"
2626
testRetry = "1.5.2"
27-
slf4j = "1.7.36"
27+
# test-only; platform provides slf4j transitively at runtime. <233, 1.7.36; >=233, 2.0.9
28+
slf4j = "2.0.9"
2829
sshd = "2.11.0"
29-
wiremock = "2.35.0"
30+
wiremock = "3.3.1"
3031
undercouch-download = "5.2.1"
3132
zjsonpatch = "0.4.11"
3233

@@ -96,10 +97,11 @@ mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "
9697
mockk = { module = "io.mockk:mockk", version.ref="mockk" }
9798
telemetryGenerator = { module = "software.aws.toolkits:telemetry-generator", version.ref = "telemetryGenerator" }
9899
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
100+
slf4j-jdk14 = { module = "org.slf4j:slf4j-jdk14", version.ref = "slf4j" }
99101
sshd-core = { module = "org.apache.sshd:sshd-core", version.ref = "sshd" }
100102
sshd-scp = { module = "org.apache.sshd:sshd-scp", version.ref = "sshd" }
101103
sshd-sftp = { module = "org.apache.sshd:sshd-sftp", version.ref = "sshd" }
102-
wiremock = { module = "com.github.tomakehurst:wiremock-jre8", version.ref = "wiremock" }
104+
wiremock = { module = "org.wiremock:wiremock", version.ref = "wiremock" }
103105
zjsonpatch = { module = "com.flipkart.zjsonpatch:zjsonpatch", version.ref = "zjsonpatch" }
104106

105107
[bundles]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

jetbrains-core/build.gradle.kts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ val ideProfile = IdeVersions.ideProfile(project)
1616
plugins {
1717
id("toolkit-kotlin-conventions")
1818
id("toolkit-testing")
19-
id("toolkit-integration-testing")
2019
id("toolkit-intellij-subplugin")
20+
id("toolkit-integration-testing")
2121
}
2222

2323
buildscript {
@@ -73,6 +73,10 @@ val gatewayArtifacts by configurations.creating {
7373
}
7474

7575
val gatewayJar = tasks.create<Jar>("gatewayJar") {
76+
// META-INF/plugin.xml is a duplicate?
77+
// unclear why the exclude() statement didn't work
78+
duplicatesStrategy = DuplicatesStrategy.INCLUDE
79+
7680
dependsOn(tasks.instrumentedJar)
7781

7882
archiveBaseName.set("aws-toolkit-jetbrains-IC-GW")
@@ -104,7 +108,7 @@ tasks.prepareSandbox {
104108
}
105109

106110
tasks.testJar {
107-
// classpath.index is a duplicated
111+
// classpath.index is a duplicate
108112
duplicatesStrategy = DuplicatesStrategy.INCLUDE
109113
}
110114

@@ -147,7 +151,16 @@ dependencies {
147151
testImplementation(libs.mockk)
148152
testImplementation(libs.kotlin.coroutinesTest)
149153
testImplementation(libs.kotlin.coroutinesDebug)
150-
testImplementation(libs.wiremock)
154+
testImplementation(libs.wiremock) {
155+
// conflicts with transitive inclusion from docker plugin
156+
exclude(group = "org.apache.httpcomponents.client5")
157+
}
158+
159+
// slf4j is v1.7.36 for <233
160+
// in <233, the classpass binding functionality picks up the wrong impl of StaticLoggerBinder (from the maven plugin instead of IDE platform) and causes a NoClassDefFoundError
161+
// instead of trying to fix the classpath, since it's built by gradle-intellij-plugin, shove slf4j >= 2.0.9 onto the test classpath, which uses a ServiceLoader and call it done
162+
testImplementation(libs.slf4j.api)
163+
testRuntimeOnly(libs.slf4j.jdk14)
151164
}
152165

153166
// fix implicit dependency on generated source

jetbrains-core/it/software/aws/toolkits/jetbrains/core/AwsSdkClientProxyTest.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import org.mockito.kotlin.any
2424
import org.mockito.kotlin.spy
2525
import org.mockito.kotlin.times
2626
import org.mockito.kotlin.verify
27+
import software.amazon.awssdk.profiles.ProfileFileLocation
2728
import software.amazon.awssdk.regions.Region
2829
import software.amazon.awssdk.services.s3.S3Client
2930

@@ -52,6 +53,9 @@ class AwsSdkClientProxyTest {
5253

5354
@Before
5455
fun setUp() {
56+
println("file: ${ProfileFileLocation.configurationFilePath()}")
57+
println("loca: ${ProfileFileLocation.configurationFileLocation()}")
58+
println("envv: ${System.getenv("AWS_CONFIG_FILE")}")
5559
awsSdkClient = AwsSdkClient()
5660
Disposer.register(disposableRule.disposable, awsSdkClient)
5761

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
software.aws.toolkits.level=FINE
2+
software.amazon.awssdk.auth.credentials.AwsCredentialsProviderChain.level=FINEST

0 commit comments

Comments
 (0)