Skip to content

Commit

Permalink
Set up publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
zsmb13 committed May 10, 2024
1 parent 108493e commit bfebfd1
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
1 change: 1 addition & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies {
compileOnly(libs.android.gradle.plugin)
compileOnly(libs.android.tools.common)
compileOnly(libs.kotlin.gradle.plugin)
compileOnly(libs.maven.publish)
}

gradlePlugin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import com.android.build.gradle.LibraryExtension
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project
Expand All @@ -12,14 +14,15 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
with(pluginManager) {
apply("com.android.library")
apply("org.jetbrains.kotlin.multiplatform")
apply("com.vanniktech.maven.publish")
}

configure<KotlinMultiplatformExtension> {
androidTarget {
publishLibraryVariants("release")
compilations.all {
kotlinOptions {
jvmTarget = "17"
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
}
Expand All @@ -38,8 +41,39 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
minSdk = 21
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.DEFAULT)
signAllPublications()

pom {
name.set("requireKTX")
description.set("Kotlin utilities for easily grabbing required values")
inceptionYear.set("2020")
url.set("https://github.com/zsmb13/requireKTX")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("zsmb13")
name.set("Márton Braun")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:github.com/zsmb13/requireKTX.git")
developerConnection.set("scm:git:ssh://github.com/zsmb13/requireKTX.git")
url.set("https://github.com/zsmb13/requireKTX/tree/main")
}
}
}
}
Expand Down
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.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.mavenPublish) apply false
}
6 changes: 5 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.code.style=official

# Publishing
group=co.zsmb
version=1.3.0
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ junit = "4.13.2"
junit-jupiter-api = "5.9.2"
kotlin = "1.9.24"
material = "1.12.0"
maven-publish = "0.28.0"
navigation-runtime = "2.7.7"
robolectric = "4.12.1"
work-runtime = "2.9.0"
Expand All @@ -25,6 +26,7 @@ junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", vers
kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
material = { module = "com.google.android.material:material", version.ref = "material" }
maven-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "maven-publish" }
navigation-runtime = { module = "androidx.navigation:navigation-runtime", version.ref = "navigation-runtime" }
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
work-runtime = { module = "androidx.work:work-runtime", version.ref = "work-runtime" }
Expand All @@ -33,4 +35,5 @@ work-runtime = { module = "androidx.work:work-runtime", version.ref = "work-runt
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" }
requireKtxLibrary = { id = "co.zsmb.requirektx.library", version = "unspecified" }

0 comments on commit bfebfd1

Please sign in to comment.