From 30f380147fe0e8da3565b756581ade991230dce3 Mon Sep 17 00:00:00 2001 From: Jaewoong Cheon Date: Fri, 6 Jan 2023 20:38:00 +0900 Subject: [PATCH 1/2] Migrate to vannitech's maven publish plugin --- build.gradle.kts | 1 + savedstate-ktx/build.gradle.kts | 97 ++++++++++----------------------- 2 files changed, 29 insertions(+), 69 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f91e0e4..ffca94f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,6 +9,7 @@ buildscript { dependencies { classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20") classpath("com.android.tools.build:gradle:7.3.1") + classpath("com.vanniktech:gradle-maven-publish-plugin:0.23.1") } } diff --git a/savedstate-ktx/build.gradle.kts b/savedstate-ktx/build.gradle.kts index 3a0dfe5..44fa589 100644 --- a/savedstate-ktx/build.gradle.kts +++ b/savedstate-ktx/build.gradle.kts @@ -1,16 +1,15 @@ -import java.util.Properties +import com.vanniktech.maven.publish.SonatypeHost plugins { id("org.jetbrains.kotlin.android") id("com.android.library") - id("maven-publish") - id("signing") + id("com.vanniktech.maven.publish") } android { - namespace = "${project.group}" - + namespace = "io.woong.savedstate" compileSdk = 33 + defaultConfig { minSdk = 21 targetSdk = 33 @@ -25,13 +24,6 @@ android { kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } - - publishing { - singleVariant("release") { - withSourcesJar() - withJavadocJar() - } - } } dependencies { @@ -48,69 +40,36 @@ dependencies { androidTestImplementation("androidx.activity:activity-ktx:1.6.1") } -publishing { - repositories { - maven { - name = "sonatype" - url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = localProperty("OSSRH_USERNAME") - password = localProperty("OSSRH_PASSWORD") - } - } - } - - publications { - create("release") { - afterEvaluate { - from(components.getByName("release")) - } +mavenPublishing { + publishToMavenCentral(SonatypeHost.S01) + signAllPublications() - groupId = "${project.group}" - artifactId = "savedstate-ktx" - version = "${project.version}" + coordinates("io.woong.savedstate", "savedstate-ktx", "${project.version}") - pom { - name.set("savedstate-ktx") - description.set("Kotlin extensions for Android SavedStateHandle") - url.set("https://github.com/cheonjaewoong/savedstate-ktx") + pom { + name.set("savedstate-ktx") + description.set("Kotlin extensions library for Android SavedStateHandle") + url.set("https://github.com/cheonjaewoong/savedstate-ktx") - licenses { - license { - name.set("MIT") - url.set("https://github.com/cheonjaewoong/savedstate-ktx/blob/master/LICENSE.txt") - } - } - - developers { - developer { - id.set("cheonjaewoong") - name.set("Jaewoong Cheon") - email.set("cheonjaewoong@gmail.com") - } - } - - scm { - url.set("https://github.com/cheonjaewoong/savedstate-ktx") - connection.set("scm:git:git://github.com/cheonjaewoong/savedstate-ktx.git") - developerConnection.set("scm:git:ssh://git@github.com/cheonjaewoong/savedstate-ktx.git") - } + licenses { + license { + name.set("MIT") + url.set("https://github.com/cheonjaewoong/savedstate-ktx/blob/master/LICENSE.txt") } } - } -} -signing { - sign(publishing.publications) -} + developers { + developer { + id.set("cheonjaewoong") + name.set("Jaewoong Cheon") + email.set("cheonjaewoong@gmail.com") + } + } -fun localProperty(name: String): String? { - val localPropertiesFile = project.rootProject.file("local.properties") - if (!localPropertiesFile.exists()) { - return null - } - val properties = localPropertiesFile.reader().use { reader -> - Properties().apply { load(reader) } + scm { + url.set("https://github.com/cheonjaewoong/savedstate-ktx") + connection.set("scm:git:git://github.com/cheonjaewoong/savedstate-ktx.git") + developerConnection.set("scm:git:ssh://git@github.com/cheonjaewoong/savedstate-ktx.git") + } } - return properties.getProperty(name, null) } From 35312e21820ba18a9ec7410bb645de8b7b2b7098 Mon Sep 17 00:00:00 2001 From: Jaewoong Cheon Date: Fri, 6 Jan 2023 20:38:40 +0900 Subject: [PATCH 2/2] Bump dependencies Exposed dependency - coroutines-core: 1.4.1 -> 1.6.3 Testing dependencies - androidx.test:runner: 1.5.1 -> 1.5.2 - androidx.test.ext:junit-ktx: 1.1.4 -> 1.1.5 - androidx.test.espresso:espresso-core: 3.5.0 -> 3.5.1 --- savedstate-ktx/build.gradle.kts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/savedstate-ktx/build.gradle.kts b/savedstate-ktx/build.gradle.kts index 44fa589..9d28ec6 100644 --- a/savedstate-ktx/build.gradle.kts +++ b/savedstate-ktx/build.gradle.kts @@ -27,14 +27,14 @@ android { } dependencies { - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3") api("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1") implementation("androidx.core:core-ktx:1.9.0") androidTestImplementation("androidx.test:core-ktx:1.5.0") - androidTestImplementation("androidx.test:runner:1.5.1") - androidTestImplementation("androidx.test.ext:junit-ktx:1.1.4") - androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0") + androidTestImplementation("androidx.test:runner:1.5.2") + androidTestImplementation("androidx.test.ext:junit-ktx:1.1.5") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") androidTestImplementation("com.google.truth:truth:1.1.3") androidTestImplementation("androidx.appcompat:appcompat:1.5.1") androidTestImplementation("androidx.activity:activity-ktx:1.6.1")