Skip to content

Commit

Permalink
Configure release tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Pine committed Mar 29, 2023
1 parent c98f669 commit 36a3ed1
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 150 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
local.properties
/SecretRingKey.gpg
/secring.gpg
/zoomables_testing
/zoomables_testing
/buildSrc/src/main/kotlin/myPublishData.kt
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,14 @@ tasks.create<Delete>("clean") {
delete(rootProject.buildDir)
}

apply(from = "${rootDir}/scripts/publish-root.gradle")
nexusPublishing {
this.repositories {
sonatype {
stagingProfileId.set(publishData.sonatypeStagingProfileId)
username.set(publishData.ossrh.username)
password.set(publishData.ossrh.password)
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}
7 changes: 7 additions & 0 deletions buildSrc/src/main/kotlin/PublishData.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data class PublishData(val signing: Signing, val artifact: Artifact, val ossrh: OSSRH, val sonatypeStagingProfileId: String)

data class Signing(val keyname: String, val passphrase: String, val executable: String)

data class Artifact(val group: String, val version: String, val id: String)

data class OSSRH(val username: String, val password: String)
5 changes: 5 additions & 0 deletions buildSrc/src/main/kotlin/artifact.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
val artifact = Artifact(
group = "de.mr-pine.utils",
id = "zoomables",
version = "1.2.0"
)
92 changes: 0 additions & 92 deletions scripts/publish-module.gradle

This file was deleted.

34 changes: 0 additions & 34 deletions scripts/publish-root.gradle

This file was deleted.

70 changes: 48 additions & 22 deletions zoomables/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
kotlin("android")
`maven-publish`
alias(libs.plugins.dokka)
signing
}

android {
Expand Down Expand Up @@ -39,15 +40,22 @@ android {
buildFeatures {
compose = true
}

namespace = "de.mr_pine.zoomables"

publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}

tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += listOf("-Xexplicit-api=strict")
}

dependencies {

implementation(libs.androidx.ktx)
implementation(libs.compose.ui)
implementation(libs.compose.ui.util)
Expand All @@ -57,29 +65,47 @@ dependencies {
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}

/*ext {
PUBLISH_GROUP_ID = "de.mr-pine.utils"
PUBLISH_VERSION = "1.1.2"
PUBLISH_ARTIFACT_ID = "zoomables"
}*/
publishing {
publications {
register<MavenPublication>("zoomables") {
groupId = publishData.artifact.group
artifactId = publishData.artifact.id
version = publishData.artifact.version

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

//apply(from = "${rootProject.projectDir}/scripts/publish-module.gradle")
pom {
description.set("A library provides Composables that handle nice and smooth zooming behaviour for you")
name.set(publishData.artifact.id)
url.set("https://github.com/Mr-Pine/Zoomables")

// Because the components are created only during the afterEvaluate phase, you must
// configure your publications using the afterEvaluate() lifecycle method.
/*
afterEvaluate {
publishing {
publications {
mavenLocal(MavenPublication) {
// Applies the component for the release build variant.
from(components.release)
// You can then customize attributes of the publication as shown below.
groupId = PUBLISH_GROUP_ID
artifactId = PUBLISH_ARTIFACT_ID
version = PUBLISH_VERSION
licenses {
license {
name.set("Apache License 2.0")
url.set("https://github.com/Mr-Pine/Zoomables/blob/master/LICENSE")
}
}

developers {
developer {
id.set("Mr-Pine")
}
}

scm {
connection.set("scm:git:github.com/Mr-Pine/Zoomables.git")
developerConnection.set("scm:git:ssh://github.com/Mr-Pine/Zoomables.git")
url.set("https://github.com/Mr-Pine/Zoomables")
}
}
}

}
}*/
}

signing {
useGpgCmd()
sign(publishing.publications)
}

0 comments on commit 36a3ed1

Please sign in to comment.