33 * SPDX-License-Identifier: Apache-2.0
44 */
55import aws.sdk.kotlin.gradle.dsl.configurePublishing
6- import aws.sdk.kotlin.gradle.kmp.IDEA_ACTIVE
76import aws.sdk.kotlin.gradle.kmp.configureKmpTargets
87
98plugins {
@@ -24,42 +23,6 @@ configureKmpTargets()
2423kotlin {
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 {
0 commit comments