From 06c06dac9218c4f9167ec7f4cb12f0a11cb7ea9a Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Fri, 13 Dec 2024 17:00:18 -0500 Subject: [PATCH 1/8] Remove duplicate instantiation of JVM platform --- aws-crt-kotlin/build.gradle.kts | 60 --------------------------------- build.gradle.kts | 2 +- 2 files changed, 1 insertion(+), 61 deletions(-) diff --git a/aws-crt-kotlin/build.gradle.kts b/aws-crt-kotlin/build.gradle.kts index ff4aa94..4f79bdc 100644 --- a/aws-crt-kotlin/build.gradle.kts +++ b/aws-crt-kotlin/build.gradle.kts @@ -24,42 +24,6 @@ configureKmpTargets() kotlin { explicitApi() - jvm { - attributes { - attribute( - TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE, - objects.named(TargetJvmEnvironment.STANDARD_JVM), - ) - } - } - - // KMP doesn't support sharing source sets for multiple JVM targets OR JVM + Android targets. - // We can manually declare a `jvmCommon` target and wire it up. It will compile fine but Intellij does - // not support this and the developer experience is abysmal. Kotlin/Native suffers a similar problem and - // we can use the same solution. Simply, if Intellij is running (i.e. the one invoking this script) then - // assume we are only building for JVM. Otherwise declare the additional JVM target for Android and - // set the sourceSet the same for both but with different runtime dependencies. - // See: - // * https://kotlinlang.org/docs/mpp-share-on-platforms.html#share-code-in-libraries - // * https://kotlinlang.org/docs/mpp-set-up-targets.html#distinguish-several-targets-for-one-platform - if (!IDEA_ACTIVE) { - - // NOTE: We don't actually need the Android plugin. All of the Android specifics are handled in aws-crt-java, - // we just need a variant with a different dependency set + some distinguishing attributes. - jvm("android") { - attributes { - attribute( - org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.Companion.attribute, - org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.androidJvm, - ) - attribute( - TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE, - objects.named(TargetJvmEnvironment.ANDROID), - ) - } - } - } - sourceSets { val commonMain by getting { dependencies { @@ -83,30 +47,6 @@ kotlin { implementation(libs.mockserver.netty) } } - - if (!IDEA_ACTIVE) { - val androidMain by getting { - // re-use the jvm (desktop) sourceSet. We only really care about declaring a variant with a different set - // of runtime dependencies - kotlin.srcDir("jvm/src") - dependsOn(commonMain) - dependencies { - // we need symbols we can resolve during compilation but at runtime (i.e. on device) we depend on the Android dependency - compileOnly(libs.crt.java) - val crtJavaVersion = libs.versions.crt.java.version.get() - implementation("software.amazon.awssdk.crt:aws-crt-android:$crtJavaVersion@aar") - - // FIXME - temporary integration with CompletableFuture while we work out a POC on the jvm target - implementation(libs.kotlinx.coroutines.jdk8) - } - } - - // disable compilation of android test source set. It is the same as the jvmTest sourceSet/tests. This - // sourceSet only exists to create a new variant that is the same in every way except the runtime - // dependency on aws-crt-android. To test this we would need to run it on device/emulator. - tasks.getByName("androidTest").enabled = false - tasks.getByName("compileTestKotlinAndroid").enabled = false - } } sourceSets.all { diff --git a/build.gradle.kts b/build.gradle.kts index 7f1b326..b79789a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -54,7 +54,7 @@ subprojects { if (project.typedProp("kotlinWarningsAsErrors") == true) { allprojects { tasks.withType { - kotlinOptions.allWarningsAsErrors = true + compilerOptions.allWarningsAsErrors = true } } } From 0686f6cec289f907a4335373d1cd78420204dcdf Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Mon, 16 Dec 2024 09:25:24 -0500 Subject: [PATCH 2/8] Upgrade crt-java version --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bb1a2e4..2938101 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ kotlin-version = "2.0.21" aws-kotlin-repo-tools-version = "0.4.13" # libs -crt-java-version = "0.31.3" +crt-java-version = "0.33.7" coroutines-version = "1.9.0" # testing From d9e2dbed0fa7d1346a03ff9d1a743811deeb91a2 Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Mon, 16 Dec 2024 10:21:41 -0500 Subject: [PATCH 3/8] Upgrade kotlinx-binary-compatibility-validator version and refactor to version catalog --- build.gradle.kts | 2 +- gradle/libs.versions.toml | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b79789a..248c628 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ buildscript { } plugins { - id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2" + alias(libs.plugins.kotlinx.binary.compatibility.validator) alias(libs.plugins.kotlin.multiplatform) apply false alias(libs.plugins.aws.kotlin.repo.tools.kmp) alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2938101..b4788d0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,11 +1,12 @@ [versions] -kotlin-version = "2.0.21" +kotlin-version = "2.1.0" -aws-kotlin-repo-tools-version = "0.4.13" +aws-kotlin-repo-tools-version = "0.4.14-SNAPSHOT" # libs -crt-java-version = "0.33.7" +crt-java-version = "0.31.3" coroutines-version = "1.9.0" +binary-compatibility-validator-version = "0.16.3" # testing junit-version = "5.10.1" @@ -40,5 +41,6 @@ mockserver-netty = { module = "org.mock-server:mockserver-netty", version.ref = [plugins] kotlin-multiplatform = {id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" } +kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator-version" } aws-kotlin-repo-tools-kmp = { id = "aws.sdk.kotlin.gradle.kmp", version.ref = "aws-kotlin-repo-tools-version" } aws-kotlin-repo-tools-artifactsizemetrics = { id = "aws.sdk.kotlin.gradle.artifactsizemetrics", version.ref = "aws-kotlin-repo-tools-version" } From cfccf0292a9c98ce11f336d26cc93c570440ee1b Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Mon, 16 Dec 2024 10:52:47 -0500 Subject: [PATCH 4/8] ktlintFormat --- aws-crt-kotlin/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/aws-crt-kotlin/build.gradle.kts b/aws-crt-kotlin/build.gradle.kts index 4f79bdc..74d15b3 100644 --- a/aws-crt-kotlin/build.gradle.kts +++ b/aws-crt-kotlin/build.gradle.kts @@ -3,7 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ import aws.sdk.kotlin.gradle.dsl.configurePublishing -import aws.sdk.kotlin.gradle.kmp.IDEA_ACTIVE import aws.sdk.kotlin.gradle.kmp.configureKmpTargets plugins { From 5a7062e36a1363706246e10c42545df0bd004634 Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Mon, 16 Dec 2024 10:53:41 -0500 Subject: [PATCH 5/8] Changelog --- .changes/337cca7e-6a38-4601-b5d2-9f8d12dd60f7.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/337cca7e-6a38-4601-b5d2-9f8d12dd60f7.json diff --git a/.changes/337cca7e-6a38-4601-b5d2-9f8d12dd60f7.json b/.changes/337cca7e-6a38-4601-b5d2-9f8d12dd60f7.json new file mode 100644 index 0000000..ad9d7ed --- /dev/null +++ b/.changes/337cca7e-6a38-4601-b5d2-9f8d12dd60f7.json @@ -0,0 +1,5 @@ +{ + "id": "337cca7e-6a38-4601-b5d2-9f8d12dd60f7", + "type": "misc", + "description": "Upgrade to Kotlin 2.1.0" +} \ No newline at end of file From 9a63b557ced6a341b1915f19863dd0ea5f0bedf1 Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Mon, 16 Dec 2024 10:58:20 -0500 Subject: [PATCH 6/8] Remove SNAPSHOT dependency --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b4788d0..7b79bd0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] kotlin-version = "2.1.0" -aws-kotlin-repo-tools-version = "0.4.14-SNAPSHOT" +aws-kotlin-repo-tools-version = "0.4.16" # libs crt-java-version = "0.31.3" From 81536c227ed03f1c66113b8dab36ea70715415b9 Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Mon, 16 Dec 2024 12:21:12 -0500 Subject: [PATCH 7/8] Upgrade to latest aws-kotlin-repo-tools, aws-crt-java --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7b79bd0..894bbe9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,10 @@ [versions] kotlin-version = "2.1.0" -aws-kotlin-repo-tools-version = "0.4.16" +aws-kotlin-repo-tools-version = "0.4.17" # libs -crt-java-version = "0.31.3" +crt-java-version = "0.33.7" coroutines-version = "1.9.0" binary-compatibility-validator-version = "0.16.3" From 5a77cb333fb0a2800b68072f247297e23c6a8335 Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Mon, 16 Dec 2024 12:55:20 -0500 Subject: [PATCH 8/8] Expand wildcard match on KotlinStdlib-2.x --- .brazil.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.brazil.json b/.brazil.json index 0a4b976..a937aec 100644 --- a/.brazil.json +++ b/.brazil.json @@ -1,6 +1,6 @@ { "dependencies": { - "org.jetbrains.kotlin:kotlin-stdlib:2.0.*": "KotlinStdlib-2.x", + "org.jetbrains.kotlin:kotlin-stdlib:2.*": "KotlinStdlib-2.x", "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.*": "KotlinxCoroutinesCoreJvm-1.x", "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.*": "KotlinxCoroutinesJdk8-1.x", "software.amazon.awssdk.crt:aws-crt:0.*": "Aws-crt-java-1.0.x"