diff --git a/.changes/058bf26f-7f37-439a-9170-d0a2c9c84e3e.json b/.changes/058bf26f-7f37-439a-9170-d0a2c9c84e3e.json new file mode 100644 index 00000000000..9dd46f72f00 --- /dev/null +++ b/.changes/058bf26f-7f37-439a-9170-d0a2c9c84e3e.json @@ -0,0 +1,5 @@ +{ + "id": "058bf26f-7f37-439a-9170-d0a2c9c84e3e", + "type": "misc", + "description": "Upgrade to Gradle 9.0.0" +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index e027ebcf246..b586dc2c034 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,6 +14,18 @@ buildscript { // Add our custom gradle build logic to buildscript classpath classpath(libs.aws.kotlin.repo.tools.build.support) } + + configurations.classpath { + resolutionStrategy { + /* + Version bumping the SDK to 1.5.x in repo tools broke our buildscript classpath: + java.lang.NoSuchMethodError: 'void kotlinx.coroutines.CancellableContinuation.resume(java.lang.Object, kotlin.jvm.functions.Function3) + + FIXME: Figure out what broke our buildscipt classpath, this is a temporary fix + */ + force("com.squareup.okhttp3:okhttp-coroutines:5.0.0-alpha.14") + } + } } plugins { diff --git a/codegen/protocol-tests/build.gradle.kts b/codegen/protocol-tests/build.gradle.kts index 7064d116b31..06b31a2ef6c 100644 --- a/codegen/protocol-tests/build.gradle.kts +++ b/codegen/protocol-tests/build.gradle.kts @@ -73,63 +73,38 @@ dependencies { codegen(libs.smithy.aws.protocol.tests) } -abstract class ProtocolTestTask @Inject constructor(private val project: Project) : DefaultTask() { - /** - * The projection - */ - @get:Input - abstract val projectionName: Property - - /** - * The projection root directory - */ - @get:Input - abstract val projectionRootDirectory: Property - - @TaskAction - fun runTests() { - val projectionRootDir = project.file(projectionRootDirectory.get()) - println("[$projectionName] buildDir: $projectionRootDir") - if (!projectionRootDir.exists()) { - throw GradleException("$projectionRootDir does not exist") - } - val wrapper = if (System.getProperty("os.name").lowercase().contains("windows")) "gradlew.bat" else "gradlew" - val gradlew = project.rootProject.file(wrapper).absolutePath - - // NOTE - this still requires us to publish to maven local. - project.exec { - workingDir = projectionRootDir - executable = gradlew - args = listOf("test") - } - } -} - smithyBuild.projections.forEach { val protocolName = it.name - tasks.register("testProtocol-$protocolName") { - dependsOn(tasks.generateSmithyProjections) - group = "Verification" - projectionName.set(it.name) - projectionRootDirectory.set(smithyBuild.smithyKotlinProjectionPath(it.name).map { it.toString() }) - } + val dirProvider = smithyBuild + .smithyKotlinProjectionPath(protocolName) + .map { file(it.toString()) } - // FIXME This is a hack to work around how protocol tests aren't in the actual service model and thus codegen - // separately from service customizations. val copyStaticFiles = tasks.register("copyStaticFiles-$protocolName") { group = "codegen" from(rootProject.projectDir.resolve("services/$protocolName/common/src")) - into(smithyBuild.smithyKotlinProjectionSrcDir(it.name)) + into(smithyBuild.smithyKotlinProjectionSrcDir(protocolName)) } - tasks.generateSmithyProjections.configure { - finalizedBy(copyStaticFiles) + tasks.register("testProtocol-$protocolName") { + group = "Verification" + dependsOn(tasks.generateSmithyProjections, copyStaticFiles) + + doFirst { + val dir = dirProvider.get() + require(dir.exists()) { "$dir does not exist" } + + val wrapper = if (System.getProperty("os.name").lowercase().contains("windows")) "gradlew.bat" else "gradlew" + val gradlew = rootProject.layout.projectDirectory.file(wrapper).asFile.absolutePath + + workingDir = dir + executable = gradlew + args = listOf("test") + } } } tasks.register("testAllProtocols") { group = "Verification" - val allTests = tasks.withType() - dependsOn(allTests) + dependsOn(tasks.matching { it.name.startsWith("testProtocol-") }) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a3698519dff..179bfe40252 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ ksp-version = "2.2.0-2.0.2" # Keep in sync with kotlin-version dokka-version = "2.0.0" -aws-kotlin-repo-tools-version = "0.4.36" +aws-kotlin-repo-tools-version = "0.4.48" # libs coroutines-version = "1.10.2" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bf3beeb7dd3..4ba2524eb95 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https://services.gradle.org/distributions/gradle-8.14.2-bin.zip +distributionUrl=https://services.gradle.org/distributions/gradle-9.0.0-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/hll/dynamodb-mapper/dynamodb-mapper/build.gradle.kts b/hll/dynamodb-mapper/dynamodb-mapper/build.gradle.kts index 53ad4cd2875..a8f3af51954 100644 --- a/hll/dynamodb-mapper/dynamodb-mapper/build.gradle.kts +++ b/hll/dynamodb-mapper/dynamodb-mapper/build.gradle.kts @@ -113,7 +113,7 @@ if (project.NATIVE_ENABLED) { } } - listOf("jvmSourcesJar", "metadataSourcesJar").forEach { + listOf("jvmSourcesJar", "metadataSourcesJar", "jvmProcessResources").forEach { tasks.named(it) { dependsOn(moveGenSrc) } diff --git a/hll/hll-codegen/build.gradle.kts b/hll/hll-codegen/build.gradle.kts index 12769452a1f..19c65cade4b 100644 --- a/hll/hll-codegen/build.gradle.kts +++ b/hll/hll-codegen/build.gradle.kts @@ -30,11 +30,7 @@ dependencies { api(project(":aws-runtime:aws-core")) implementation(libs.ksp.api) implementation(libs.smithy.kotlin.runtime.core) - - testImplementation(libs.junit.jupiter) - testImplementation(libs.junit.jupiter.params) - testImplementation(libs.kotest.assertions.core.jvm) - testImplementation(libs.kotlin.test.junit5) + testImplementation(kotlin("test")) } val sourcesJar by tasks.creating(Jar::class) { diff --git a/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/core/TemplateEngineTest.kt b/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/core/TemplateEngineTest.kt index c853b989f7f..d4c87b7ca40 100644 --- a/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/core/TemplateEngineTest.kt +++ b/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/core/TemplateEngineTest.kt @@ -4,8 +4,8 @@ */ package aws.sdk.kotlin.hll.codegen.core -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals import kotlin.test.assertFailsWith class TemplateEngineTest { diff --git a/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/core/TemplateProcessorTest.kt b/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/core/TemplateProcessorTest.kt index ffc793866f7..36beab13464 100644 --- a/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/core/TemplateProcessorTest.kt +++ b/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/core/TemplateProcessorTest.kt @@ -6,9 +6,9 @@ package aws.sdk.kotlin.hll.codegen.core import aws.sdk.kotlin.hll.codegen.model.TypeRef import aws.sdk.kotlin.hll.codegen.model.TypeVar -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test import kotlin.test.assertContains +import kotlin.test.assertEquals class TemplateProcessorTest { @Test diff --git a/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/util/StringsTest.kt b/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/util/StringsTest.kt index c2f85036c6d..b630ce18956 100644 --- a/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/util/StringsTest.kt +++ b/hll/hll-codegen/src/test/kotlin/aws/sdk/kotlin/hll/codegen/util/StringsTest.kt @@ -4,8 +4,8 @@ */ package aws.sdk.kotlin.hll.codegen.util -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test +import kotlin.test.Test +import kotlin.test.assertEquals class StringsTest { @Test diff --git a/settings.gradle.kts b/settings.gradle.kts index 6dc165db0f0..e71df8416a2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -80,7 +80,6 @@ if ("dynamodb".isBootstrappedService) { include(":hll:dynamodb-mapper:dynamodb-mapper-schema-codegen") include(":hll:dynamodb-mapper:dynamodb-mapper-annotations") include(":hll:dynamodb-mapper:dynamodb-mapper-schema-generator-plugin") - include(":hll:dynamodb-mapper:tests:dynamodb-mapper-schema-generator-plugin-test") } else { logger.warn(":services:dynamodb is not bootstrapped, skipping :hll:dynamodb-mapper and subprojects") } diff --git a/tests/codegen/checksums/build.gradle.kts b/tests/codegen/checksums/build.gradle.kts index 6e7795fe4a6..1b41ee8ca69 100644 --- a/tests/codegen/checksums/build.gradle.kts +++ b/tests/codegen/checksums/build.gradle.kts @@ -6,12 +6,10 @@ import aws.sdk.kotlin.tests.codegen.Model description = "AWS SDK for Kotlin's checksums codegen test suite" -val tests = listOf( - CodegenTest("checksums", Model("checksums.smithy"), "aws.sdk.kotlin.test#TestService"), -) - smithyBuild { - this@Build_gradle.tests.forEach { test -> + listOf( + CodegenTest("checksums", Model("checksums.smithy"), "aws.sdk.kotlin.test#TestService"), + ).forEach { test -> projections.register(test.name) { imports = listOf(layout.projectDirectory.file(test.model.path + test.model.fileName).asFile.absolutePath) smithyKotlinPlugin {