Skip to content

Commit 25f0a8e

Browse files
authored
misc: Upgrade to Kotlin 2.1.0 (#123)
1 parent 2ad4bdd commit 25f0a8e

File tree

5 files changed

+14
-67
lines changed

5 files changed

+14
-67
lines changed

.brazil.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"org.jetbrains.kotlin:kotlin-stdlib:2.0.*": "KotlinStdlib-2.x",
3+
"org.jetbrains.kotlin:kotlin-stdlib:2.*": "KotlinStdlib-2.x",
44
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.*": "KotlinxCoroutinesCoreJvm-1.x",
55
"org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.*": "KotlinxCoroutinesJdk8-1.x",
66
"software.amazon.awssdk.crt:aws-crt:0.*": "Aws-crt-java-1.0.x"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"id": "337cca7e-6a38-4601-b5d2-9f8d12dd60f7",
3+
"type": "misc",
4+
"description": "Upgrade to Kotlin 2.1.0",
5+
"requiresMinorVersionBump": true
6+
}

aws-crt-kotlin/build.gradle.kts

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
import aws.sdk.kotlin.gradle.dsl.configurePublishing
6-
import aws.sdk.kotlin.gradle.kmp.IDEA_ACTIVE
76
import aws.sdk.kotlin.gradle.kmp.configureKmpTargets
87

98
plugins {
@@ -24,42 +23,6 @@ configureKmpTargets()
2423
kotlin {
2524
explicitApi()
2625

27-
jvm {
28-
attributes {
29-
attribute<org.gradle.api.attributes.java.TargetJvmEnvironment>(
30-
TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
31-
objects.named(TargetJvmEnvironment.STANDARD_JVM),
32-
)
33-
}
34-
}
35-
36-
// KMP doesn't support sharing source sets for multiple JVM targets OR JVM + Android targets.
37-
// We can manually declare a `jvmCommon` target and wire it up. It will compile fine but Intellij does
38-
// not support this and the developer experience is abysmal. Kotlin/Native suffers a similar problem and
39-
// we can use the same solution. Simply, if Intellij is running (i.e. the one invoking this script) then
40-
// assume we are only building for JVM. Otherwise declare the additional JVM target for Android and
41-
// set the sourceSet the same for both but with different runtime dependencies.
42-
// See:
43-
// * https://kotlinlang.org/docs/mpp-share-on-platforms.html#share-code-in-libraries
44-
// * https://kotlinlang.org/docs/mpp-set-up-targets.html#distinguish-several-targets-for-one-platform
45-
if (!IDEA_ACTIVE) {
46-
47-
// NOTE: We don't actually need the Android plugin. All of the Android specifics are handled in aws-crt-java,
48-
// we just need a variant with a different dependency set + some distinguishing attributes.
49-
jvm("android") {
50-
attributes {
51-
attribute(
52-
org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.Companion.attribute,
53-
org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.androidJvm,
54-
)
55-
attribute(
56-
TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
57-
objects.named(TargetJvmEnvironment.ANDROID),
58-
)
59-
}
60-
}
61-
}
62-
6326
sourceSets {
6427
val commonMain by getting {
6528
dependencies {
@@ -83,30 +46,6 @@ kotlin {
8346
implementation(libs.mockserver.netty)
8447
}
8548
}
86-
87-
if (!IDEA_ACTIVE) {
88-
val androidMain by getting {
89-
// re-use the jvm (desktop) sourceSet. We only really care about declaring a variant with a different set
90-
// of runtime dependencies
91-
kotlin.srcDir("jvm/src")
92-
dependsOn(commonMain)
93-
dependencies {
94-
// we need symbols we can resolve during compilation but at runtime (i.e. on device) we depend on the Android dependency
95-
compileOnly(libs.crt.java)
96-
val crtJavaVersion = libs.versions.crt.java.version.get()
97-
implementation("software.amazon.awssdk.crt:aws-crt-android:$crtJavaVersion@aar")
98-
99-
// FIXME - temporary integration with CompletableFuture while we work out a POC on the jvm target
100-
implementation(libs.kotlinx.coroutines.jdk8)
101-
}
102-
}
103-
104-
// disable compilation of android test source set. It is the same as the jvmTest sourceSet/tests. This
105-
// sourceSet only exists to create a new variant that is the same in every way except the runtime
106-
// dependency on aws-crt-android. To test this we would need to run it on device/emulator.
107-
tasks.getByName("androidTest").enabled = false
108-
tasks.getByName("compileTestKotlinAndroid").enabled = false
109-
}
11049
}
11150

11251
sourceSets.all {

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515
}
1616

1717
plugins {
18-
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
18+
alias(libs.plugins.kotlinx.binary.compatibility.validator)
1919
alias(libs.plugins.kotlin.multiplatform) apply false
2020
alias(libs.plugins.aws.kotlin.repo.tools.kmp)
2121
alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics)
@@ -54,7 +54,7 @@ subprojects {
5454
if (project.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
5555
allprojects {
5656
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
57-
kotlinOptions.allWarningsAsErrors = true
57+
compilerOptions.allWarningsAsErrors = true
5858
}
5959
}
6060
}

gradle/libs.versions.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[versions]
2-
kotlin-version = "2.0.21"
2+
kotlin-version = "2.1.0"
33

4-
aws-kotlin-repo-tools-version = "0.4.13"
4+
aws-kotlin-repo-tools-version = "0.4.17"
55

66
# libs
7-
crt-java-version = "0.31.3"
7+
crt-java-version = "0.33.7"
88
coroutines-version = "1.9.0"
9+
binary-compatibility-validator-version = "0.16.3"
910

1011
# testing
1112
junit-version = "5.10.1"
@@ -40,5 +41,6 @@ mockserver-netty = { module = "org.mock-server:mockserver-netty", version.ref =
4041

4142
[plugins]
4243
kotlin-multiplatform = {id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" }
44+
kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator-version" }
4345
aws-kotlin-repo-tools-kmp = { id = "aws.sdk.kotlin.gradle.kmp", version.ref = "aws-kotlin-repo-tools-version" }
4446
aws-kotlin-repo-tools-artifactsizemetrics = { id = "aws.sdk.kotlin.gradle.artifactsizemetrics", version.ref = "aws-kotlin-repo-tools-version" }

0 commit comments

Comments
 (0)