Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ plugins {
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.maven.publish.vanniktech) apply false
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ moshi = "1.15.1"
coroutines = "1.8.0"
junit5 = "5.10.2"
mockk = "1.13.10"
mavenPublish = "0.30.0"

[libraries]
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
Expand All @@ -24,3 +25,4 @@ mockk = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
maven-publish-vanniktech = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
81 changes: 20 additions & 61 deletions sdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
import com.vanniktech.maven.publish.SonatypeHost

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.ksp)
`maven-publish`
signing
alias(libs.plugins.maven.publish.vanniktech)
}

android {
Expand Down Expand Up @@ -69,63 +71,20 @@ dependencies {
testImplementation(libs.okhttp.mockwebserver)
}

// Maven Central publishing
publishing {
publications {
create<MavenPublication>("release") {
groupId = property("GROUP").toString()
artifactId = property("POM_ARTIFACT_ID").toString()
version = property("VERSION_NAME").toString()

afterEvaluate {
from(components["release"])
}

pom {
name.set(property("POM_NAME").toString())
description.set(property("POM_DESCRIPTION").toString())
url.set(property("POM_URL").toString())

licenses {
license {
name.set(property("POM_LICENCE_NAME").toString())
url.set(property("POM_LICENCE_URL").toString())
}
}

developers {
developer {
id.set(property("POM_DEVELOPER_ID").toString())
name.set(property("POM_DEVELOPER_NAME").toString())
url.set(property("POM_DEVELOPER_URL").toString())
}
}

scm {
url.set(property("POM_SCM_URL").toString())
connection.set(property("POM_SCM_CONNECTION").toString())
developerConnection.set(property("POM_SCM_DEV_CONNECTION").toString())
}
}
}
}

repositories {
maven {
name = "sonatype"
val releasesUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsUrl else releasesUrl

credentials {
username = findProperty("ossrhUsername")?.toString() ?: System.getenv("OSSRH_USERNAME")
password = findProperty("ossrhPassword")?.toString() ?: System.getenv("OSSRH_PASSWORD")
}
}
}
}

signing {
useGpgCmd()
sign(publishing.publications["release"])
// Maven Central publishing via the Central Portal (central.sonatype.com).
// Coordinates (GROUP / POM_ARTIFACT_ID / VERSION_NAME) and POM metadata (POM_*)
// are read automatically from gradle.properties. Credentials and the signing key
// come from ~/.gradle/gradle.properties (mavenCentralUsername / mavenCentralPassword
// / signingInMemoryKey / signingInMemoryKeyPassword) — never committed.
mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
signAllPublications()

configure(
AndroidSingleVariantLibrary(
variant = "release",
sourcesJar = true,
publishJavadocJar = true,
)
)
}
Loading