From 461ad4ae83aeb2f1a701a76297ebaaee2b9d62bc Mon Sep 17 00:00:00 2001 From: Philip Wedemann <22521688+hfhbd@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:32:12 +0100 Subject: [PATCH] Publish android lib (#310) Co-authored-by: hfhbd --- .../src/main/kotlin/publish.gradle.kts | 7 +++---- kotlinx-uuid-core/build.gradle.kts | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/gradle/build-logic/src/main/kotlin/publish.gradle.kts b/gradle/build-logic/src/main/kotlin/publish.gradle.kts index 8c2893d..866ccab 100644 --- a/gradle/build-logic/src/main/kotlin/publish.gradle.kts +++ b/gradle/build-logic/src/main/kotlin/publish.gradle.kts @@ -42,10 +42,9 @@ publishing { } signing { - val signingKey: String? by project - val signingPassword: String? by project - signingKey?.let { - useInMemoryPgpKeys(String(Base64.getDecoder().decode(it)).trim(), signingPassword) + val signingKey = providers.gradleProperty("signingKey") + if (signingKey.isPresent) { + useInMemoryPgpKeys(signingKey.get(), providers.gradleProperty("signingPassword").get()) sign(publishing.publications) } } diff --git a/kotlinx-uuid-core/build.gradle.kts b/kotlinx-uuid-core/build.gradle.kts index 0b6dec3..204673c 100644 --- a/kotlinx-uuid-core/build.gradle.kts +++ b/kotlinx-uuid-core/build.gradle.kts @@ -50,9 +50,19 @@ android { defaultConfig { minSdk = 21 + aarMetadata { + minCompileSdk = 21 + } testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } + publishing { + multipleVariants { + allVariants() + withJavadocJar() + } + } + compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -60,7 +70,7 @@ android { testOptions { managedDevices { localDevices { - register("pixel2api30") { + register("pixel2api34") { device = "Pixel 2" apiLevel = 34 systemImageSource = "aosp-atd" @@ -79,3 +89,9 @@ kotlin.sourceSets { } } } + +publishing.publications.register("androidLib", MavenPublication::class) { + afterEvaluate { + from(components["default"]) + } +}