Skip to content

Commit 6723b1f

Browse files
committed
WIP
1 parent 2521521 commit 6723b1f

File tree

6 files changed

+52
-54
lines changed

6 files changed

+52
-54
lines changed

build-logic/src/main/kotlin/ckbuild.multiplatform-android.gradle.kts

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,63 @@
11
/*
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.
33
*/
44

55
import org.jetbrains.kotlin.gradle.*
66
import org.jetbrains.kotlin.gradle.plugin.*
77

88
plugins {
99
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")
5311
}
5412

5513
@OptIn(ExperimentalKotlinGradlePluginApi::class)
5614
kotlin {
5715
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+
}
6157
}
6258

6359
sourceSets {
64-
invokeWhenCreated("androidInstrumentedTest") {
60+
named("androidDeviceTest") {
6561
dependencies {
6662
implementation(versionCatalogs.named("libs").findLibrary("androidx-test").get())
6763
}

build-logic/src/main/kotlin/ckbuild.multiplatform-base.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.gradle.tasks.*
1717

1818
plugins {
1919
kotlin("multiplatform")
20-
id("org.jetbrains.kotlinx.kover")
20+
// id("org.jetbrains.kotlinx.kover")
2121
}
2222

2323
// true by default

build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* Copyright (c) 2023-2025 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
import ckbuild.*
65
import org.jetbrains.kotlin.gradle.targets.js.nodejs.*
76
import org.jetbrains.kotlin.gradle.targets.js.npm.*
87
import org.jetbrains.kotlin.gradle.targets.wasm.nodejs.*
@@ -11,7 +10,7 @@ import org.jetbrains.kotlin.gradle.targets.wasm.npm.*
1110
plugins {
1211
alias(libs.plugins.kotlin.dokka)
1312

14-
alias(libs.plugins.android.library) apply false
13+
alias(libs.plugins.android.kotlin.multiplatform.library) apply false
1514
alias(libs.plugins.kotlin.multiplatform) apply false
1615
alias(libs.plugins.kotlin.plugin.serialization) apply false
1716

cryptography-providers/jdk/android-tests/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010

1111
kotlin {
1212
sourceSets {
13-
androidInstrumentedTest.dependencies {
13+
commonTest.dependencies {
1414
implementation(projects.cryptographyProviderJdk)
1515
}
1616
}

cryptography-providers/tests/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import ckbuild.*
66
import org.jetbrains.kotlin.gradle.*
7+
import org.jetbrains.kotlin.gradle.plugin.*
78

89
plugins {
910
id("ckbuild.multiplatform-base")
@@ -22,7 +23,9 @@ kotlin {
2223
applyDefaultHierarchyTemplate {
2324
common {
2425
group("nonJs") {
25-
withAndroidTarget()
26+
withCompilations {
27+
it.target.platformType == KotlinPlatformType.androidJvm
28+
}
2629
withJvm()
2730
withWasmJs()
2831
withWasmWasi()

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
6262
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
6363
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
6464
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "kotlin-dokka" }
65-
android-library = { id = "com.android.library", version.ref = "android" }
65+
android-kotlin-multiplatform-library = { id = "com.android.kotlin.multiplatform.library", version.ref = "android" }

0 commit comments

Comments
 (0)