Skip to content

Commit

Permalink
Publish using vaniktech maven plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
runningcode committed Nov 5, 2023
1 parent e5964c2 commit ab9b948
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 55 deletions.
78 changes: 23 additions & 55 deletions fladle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.vanniktech.maven.publish.SonatypeHost
import org.gradle.api.tasks.testing.logging.TestLogEvent

group = "com.osacky.flank.gradle"
Expand All @@ -14,6 +15,7 @@ plugins {
`kotlin-dsl`
`java-gradle-plugin`
alias(libs.plugins.gradle.plugin.publish)
alias(libs.plugins.vanniktech.maven.publish)
alias(libs.plugins.kotlinter)
`maven-publish`
signing
Expand Down Expand Up @@ -76,63 +78,29 @@ val isReleaseBuild : Boolean = !version.toString().endsWith("SNAPSHOT")
val sonatypeUsername : String? by project
val sonatypePassword : String? by project

publishing {
repositories {
repositories {
maven {
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = if (isReleaseBuild) releasesRepoUrl else snapshotsRepoUrl
credentials {
username = sonatypeUsername
password = sonatypePassword
mavenPublishing {
publishToMavenCentral(SonatypeHost.DEFAULT)
signAllPublications()
pom {
url.set("https://github.com/runningcode/fladle")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("runningcode")
name.set("Nelson Osacky")
}
}
scm {
connection.set("scm:git:git://github.com/runningcode/fladle.git")
developerConnection.set("scm:git:ssh://github.com/runningcode/fladle.git")
url.set("https://github.com/runningcode/fladle")
}
}
}
}
publications {
afterEvaluate {
named<MavenPublication>("fladlePluginMarkerMaven") {
pom.configureForFladle("Fladle")
}

named<MavenPublication>("pluginMaven") {
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
pom.configureForFladle("Fladle")
}
named<MavenPublication>("fulladlePluginMarkerMaven") {
pom.configureForFladle("Fulladle")
}
}
}
}

signing {
isRequired = isReleaseBuild
}

fun org.gradle.api.publish.maven.MavenPom.configureForFladle(pluginName: String) {
name.set(pluginName)
description.set(project.description)
url.set("https://github.com/runningcode/fladle")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("runningcode")
name.set("Nelson Osacky")
}
}
scm {
connection.set("scm:git:git://github.com/runningcode/fladle.git")
developerConnection.set("scm:git:ssh://github.com/runningcode/fladle.git")
url.set("https://github.com/runningcode/fladle")
}
}

tasks.withType(Test::class.java).configureEach {
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ kotlinter = { id = "org.jmailen.kotlinter", version = "3.9.0" }

gradle-plugin-publish = {id = "com.gradle.plugin-publish", version = "1.2.1" }

vanniktech-maven-publish = {id = "com.vanniktech.maven.publish", version = "0.25.3" }

kgp = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin"}
agp = { id = "com.android.application", version.ref = "agp-version"}

Expand Down

0 comments on commit ab9b948

Please sign in to comment.