Skip to content

Commit

Permalink
Simplify publishing config setup
Browse files Browse the repository at this point in the history
  • Loading branch information
janseeger committed Nov 22, 2023
1 parent 0963326 commit 517a229
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class AndroidLibraryReleasePlugin : Plugin<Project> {

setupReleaseBuild()
setupVersionInfo()
val publication = setupPublishing()
setupSigning(publication)
setupPublishing()
setupSigning()
}
}
}
Expand Down Expand Up @@ -59,7 +59,7 @@ private fun Properties.getVersionName(): String {
return "$major.$minor.$patch"
}

private fun Project.setupPublishing(): Publication {
private fun Project.setupPublishing() {
extensions.configure<PublishingExtension> {
publications {
register<MavenPublication>("release") {
Expand All @@ -86,7 +86,6 @@ private fun Project.setupPublishing(): Publication {
}
}
}
return extensions.getByType(PublishingExtension::class.java).publications["release"]
}

private fun MavenPublication.setPom() {
Expand All @@ -108,11 +107,12 @@ private fun MavenPublication.setPom() {
}
}

private fun Project.setupSigning(publication: Publication) {
private fun Project.setupSigning() {
val publishingExtension = extensions.getByType(PublishingExtension::class.java)
extensions.configure<SigningExtension> {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publication)
sign(publishingExtension.publications["release"])
}
}
}

0 comments on commit 517a229

Please sign in to comment.