Skip to content

Commit 7d8324a

Browse files
authored
Revert "Publish using vaniktech maven plugin (#357)" (#388)
This reverts commit 92db21a.
1 parent a66079e commit 7d8324a

2 files changed

Lines changed: 60 additions & 25 deletions

File tree

fladle-plugin/build.gradle.kts

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import com.vanniktech.maven.publish.SonatypeHost
21
import org.gradle.api.tasks.testing.logging.TestLogEvent
32

43
group = "com.osacky.flank.gradle"
@@ -15,7 +14,6 @@ plugins {
1514
`kotlin-dsl`
1615
`java-gradle-plugin`
1716
alias(libs.plugins.gradle.plugin.publish)
18-
alias(libs.plugins.vanniktech.maven.publish)
1917
alias(libs.plugins.kotlinter)
2018
`maven-publish`
2119
signing
@@ -73,29 +71,68 @@ tasks.register<Jar>("javadocJar") {
7371
archiveClassifier.set("javadoc")
7472
}
7573

76-
mavenPublishing {
77-
publishToMavenCentral(SonatypeHost.DEFAULT)
78-
signAllPublications()
79-
pom {
80-
url.set("https://github.com/runningcode/fladle")
81-
licenses {
82-
license {
83-
name.set("The Apache License, Version 2.0")
84-
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
85-
}
86-
}
87-
developers {
88-
developer {
89-
id.set("runningcode")
90-
name.set("Nelson Osacky")
91-
}
92-
}
93-
scm {
94-
connection.set("scm:git:git://github.com/runningcode/fladle.git")
95-
developerConnection.set("scm:git:ssh://github.com/runningcode/fladle.git")
96-
url.set("https://github.com/runningcode/fladle")
74+
val isReleaseBuild : Boolean = !version.toString().endsWith("SNAPSHOT")
75+
76+
val sonatypeUsername : String? by project
77+
val sonatypePassword : String? by project
78+
79+
publishing {
80+
repositories {
81+
repositories {
82+
maven {
83+
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
84+
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
85+
url = if (isReleaseBuild) releasesRepoUrl else snapshotsRepoUrl
86+
credentials {
87+
username = sonatypeUsername
88+
password = sonatypePassword
9789
}
90+
}
9891
}
92+
}
93+
publications {
94+
afterEvaluate {
95+
named<MavenPublication>("fladlePluginMarkerMaven") {
96+
pom.configureForFladle("Fladle")
97+
}
98+
99+
named<MavenPublication>("pluginMaven") {
100+
artifact(tasks["sourcesJar"])
101+
artifact(tasks["javadocJar"])
102+
pom.configureForFladle("Fladle")
103+
}
104+
named<MavenPublication>("fulladlePluginMarkerMaven") {
105+
pom.configureForFladle("Fulladle")
106+
}
107+
}
108+
}
109+
}
110+
111+
signing {
112+
isRequired = isReleaseBuild
113+
}
114+
115+
fun org.gradle.api.publish.maven.MavenPom.configureForFladle(pluginName: String) {
116+
name.set(pluginName)
117+
description.set(project.description)
118+
url.set("https://github.com/runningcode/fladle")
119+
licenses {
120+
license {
121+
name.set("The Apache License, Version 2.0")
122+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
123+
}
124+
}
125+
developers {
126+
developer {
127+
id.set("runningcode")
128+
name.set("Nelson Osacky")
129+
}
130+
}
131+
scm {
132+
connection.set("scm:git:git://github.com/runningcode/fladle.git")
133+
developerConnection.set("scm:git:ssh://github.com/runningcode/fladle.git")
134+
url.set("https://github.com/runningcode/fladle")
135+
}
99136
}
100137

101138
tasks.withType(Test::class.java).configureEach {

gradle/libs.versions.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ kotlinter = { id = "org.jmailen.kotlinter", version = "3.9.0" }
88

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

11-
vanniktech-maven-publish = {id = "com.vanniktech.maven.publish", version = "0.25.3" }
12-
1311
kgp = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin"}
1412
agp = { id = "com.android.application", version.ref = "agp-version"}
1513

0 commit comments

Comments
 (0)