|  | 
| 1 | 1 | /* | 
| 2 |  | - * Copyright (c) 2023-2024 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license. | 
|  | 2 | + * Copyright (c) 2023-2025 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license. | 
| 3 | 3 |  */ | 
| 4 | 4 | 
 | 
| 5 | 5 | import org.jetbrains.kotlin.gradle.* | 
| 6 | 6 | import org.jetbrains.kotlin.gradle.plugin.* | 
| 7 | 7 | 
 | 
| 8 | 8 | plugins { | 
| 9 | 9 |     id("ckbuild.multiplatform-base") | 
| 10 |  | -    id("com.android.library") | 
| 11 |  | -} | 
| 12 |  | - | 
| 13 |  | -android { | 
| 14 |  | -    namespace = "${project.group}.${project.name.replace("-", ".")}" | 
| 15 |  | -    compileSdk = 34 | 
| 16 |  | -    defaultConfig { | 
| 17 |  | -        minSdk = 21 | 
| 18 |  | -        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | 
| 19 |  | -    } | 
| 20 |  | - | 
| 21 |  | -    // setup for local dev, on CI same targets are tested but with different approach | 
| 22 |  | -    @Suppress("UnstableApiUsage") | 
| 23 |  | -    testOptions { | 
| 24 |  | -        managedDevices { | 
| 25 |  | -            localDevices { | 
| 26 |  | -                // minimal supported API | 
| 27 |  | -                create("androidApi21") { | 
| 28 |  | -                    device = "Pixel 2" | 
| 29 |  | -                    apiLevel = 21 | 
| 30 |  | -                    systemImageSource = "aosp" | 
| 31 |  | -                } | 
| 32 |  | -                // first API with full JDK 8 support | 
| 33 |  | -                create("androidApi27") { | 
| 34 |  | -                    device = "Pixel 2" | 
| 35 |  | -                    apiLevel = 27 | 
| 36 |  | -                    systemImageSource = "aosp" | 
| 37 |  | -                } | 
| 38 |  | -                // latest available for tests API | 
| 39 |  | -                create("androidApi33") { | 
| 40 |  | -                    device = "Pixel 2" | 
| 41 |  | -                    apiLevel = 33 | 
| 42 |  | -                    systemImageSource = "aosp" | 
| 43 |  | -                } | 
| 44 |  | -                // atd image is fast | 
| 45 |  | -                create("androidFast") { | 
| 46 |  | -                    device = "Pixel 2" | 
| 47 |  | -                    apiLevel = 33 | 
| 48 |  | -                    systemImageSource = "aosp-atd" | 
| 49 |  | -                } | 
| 50 |  | -            } | 
| 51 |  | -        } | 
| 52 |  | -    } | 
|  | 10 | +    id("com.android.kotlin.multiplatform.library") | 
| 53 | 11 | } | 
| 54 | 12 | 
 | 
| 55 | 13 | @OptIn(ExperimentalKotlinGradlePluginApi::class) | 
| 56 | 14 | kotlin { | 
| 57 | 15 |     jvmToolchain(8) | 
| 58 |  | -    androidTarget { | 
| 59 |  | -        instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test) | 
| 60 |  | -        unitTestVariant.sourceSetTree.set(KotlinSourceSetTree.unitTest) | 
|  | 16 | +    androidLibrary { | 
|  | 17 | +        namespace = "${project.group}.${project.name.replace("-", ".")}" | 
|  | 18 | +        compileSdk = 34 | 
|  | 19 | +        minSdk = 21 | 
|  | 20 | + | 
|  | 21 | +        withDeviceTestBuilder { | 
|  | 22 | +            // TODO? | 
|  | 23 | +            sourceSetTreeName = "test" | 
|  | 24 | +        }.configure { | 
|  | 25 | +            instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | 
|  | 26 | +//            managedDevices { | 
|  | 27 | +//                //    // setup for local dev, on CI same targets are tested but with different approach | 
|  | 28 | +//                @Suppress("UnstableApiUsage") | 
|  | 29 | +//                localDevices { | 
|  | 30 | +//                    // minimal supported API | 
|  | 31 | +////                    create("androidApi21") { | 
|  | 32 | +////                        device = "Pixel 2" | 
|  | 33 | +////                        apiLevel = 21 | 
|  | 34 | +////                        systemImageSource = "aosp" | 
|  | 35 | +////                    } | 
|  | 36 | +////                    // first API with full JDK 8 support | 
|  | 37 | +////                    create("androidApi27") { | 
|  | 38 | +////                        device = "Pixel 2" | 
|  | 39 | +////                        apiLevel = 27 | 
|  | 40 | +////                        systemImageSource = "aosp" | 
|  | 41 | +////                    } | 
|  | 42 | +////                    // latest available for tests API | 
|  | 43 | +////                    create("androidApi33") { | 
|  | 44 | +////                        device = "Pixel 2" | 
|  | 45 | +////                        apiLevel = 33 | 
|  | 46 | +////                        systemImageSource = "aosp" | 
|  | 47 | +////                    } | 
|  | 48 | +//                    // atd image is fast | 
|  | 49 | +//                    create("androidFast") { | 
|  | 50 | +//                        device = "Pixel 2" | 
|  | 51 | +//                        sdkVersion = 33 | 
|  | 52 | +//                        systemImageSource = "aosp-atd" | 
|  | 53 | +//                    } | 
|  | 54 | +//                } | 
|  | 55 | +//            } | 
|  | 56 | +        } | 
| 61 | 57 |     } | 
| 62 | 58 | 
 | 
| 63 | 59 |     sourceSets { | 
| 64 |  | -        invokeWhenCreated("androidInstrumentedTest") { | 
|  | 60 | +        named("androidDeviceTest") { | 
| 65 | 61 |             dependencies { | 
| 66 | 62 |                 implementation(versionCatalogs.named("libs").findLibrary("androidx-test").get()) | 
| 67 | 63 |             } | 
|  | 
0 commit comments