apply the publishing configuration directly, rather than inside the java plugin config (#2599)
This commit is contained in:
parent
9ac3629416
commit
3cc6dd5bae
138
build.gradle.kts
138
build.gradle.kts
|
|
@ -402,95 +402,95 @@ subprojects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
plugins.apply("signing")
|
plugins.apply("signing")
|
||||||
|
|
||||||
plugins.apply("de.marcphilipp.nexus-publish")
|
plugins.apply("de.marcphilipp.nexus-publish")
|
||||||
|
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
publications {
|
publications {
|
||||||
register<MavenPublication>("mavenPublication") {
|
register<MavenPublication>("mavenPublication") {
|
||||||
val release = findProperty("otel.release")
|
val release = findProperty("otel.release")
|
||||||
if (release != null) {
|
if (release != null) {
|
||||||
val versionParts = version.split('-').toMutableList()
|
val versionParts = version.split('-').toMutableList()
|
||||||
versionParts[0] += "-${release}"
|
versionParts[0] += "-${release}"
|
||||||
version = versionParts.joinToString("-")
|
version = versionParts.joinToString("-")
|
||||||
}
|
}
|
||||||
groupId = "io.opentelemetry"
|
groupId = "io.opentelemetry"
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
// not available until evaluated.
|
// not available until evaluated.
|
||||||
artifactId = the<BasePluginConvention>().archivesBaseName
|
artifactId = the<BasePluginConvention>().archivesBaseName
|
||||||
description = project.description
|
description = project.description
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins.withId("java-platform") {
|
||||||
|
from(components["javaPlatform"])
|
||||||
|
}
|
||||||
|
plugins.withId("java-library") {
|
||||||
|
from(components["java"])
|
||||||
|
}
|
||||||
|
|
||||||
|
versionMapping {
|
||||||
|
allVariants {
|
||||||
|
fromResolutionResult()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
plugins.withId("java-platform") {
|
pom {
|
||||||
from(components["javaPlatform"])
|
name.set("OpenTelemetry Java")
|
||||||
}
|
url.set("https://github.com/open-telemetry/opentelemetry-java")
|
||||||
plugins.withId("java-library") {
|
|
||||||
from(components["java"])
|
|
||||||
}
|
|
||||||
|
|
||||||
versionMapping {
|
licenses {
|
||||||
allVariants {
|
license {
|
||||||
fromResolutionResult()
|
name.set("The Apache License, Version 2.0")
|
||||||
|
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pom {
|
developers {
|
||||||
name.set("OpenTelemetry Java")
|
developer {
|
||||||
url.set("https://github.com/open-telemetry/opentelemetry-java")
|
id.set("opentelemetry")
|
||||||
|
name.set("OpenTelemetry")
|
||||||
licenses {
|
url.set("https://github.com/open-telemetry/community")
|
||||||
license {
|
|
||||||
name.set("The Apache License, Version 2.0")
|
|
||||||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
developers {
|
scm {
|
||||||
developer {
|
connection.set("scm:git:git@github.com:open-telemetry/opentelemetry-java.git")
|
||||||
id.set("opentelemetry")
|
developerConnection.set("scm:git:git@github.com:open-telemetry/opentelemetry-java.git")
|
||||||
name.set("OpenTelemetry")
|
url.set("git@github.com:open-telemetry/opentelemetry-java.git")
|
||||||
url.set("https://github.com/open-telemetry/community")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
scm {
|
|
||||||
connection.set("scm:git:git@github.com:open-telemetry/opentelemetry-java.git")
|
|
||||||
developerConnection.set("scm:git:git@github.com:open-telemetry/opentelemetry-java.git")
|
|
||||||
url.set("git@github.com:open-telemetry/opentelemetry-java.git")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
configure<NexusPublishExtension> {
|
configure<NexusPublishExtension> {
|
||||||
repositories {
|
repositories {
|
||||||
sonatype()
|
sonatype()
|
||||||
}
|
|
||||||
|
|
||||||
connectTimeout.set(Duration.ofMinutes(5))
|
|
||||||
clientTimeout.set(Duration.ofMinutes(5))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val publishToSonatype by tasks.getting
|
connectTimeout.set(Duration.ofMinutes(5))
|
||||||
releaseTask.configure {
|
clientTimeout.set(Duration.ofMinutes(5))
|
||||||
finalizedBy(publishToSonatype)
|
}
|
||||||
}
|
|
||||||
rootProject.tasks.named("closeAndReleaseRepository") {
|
|
||||||
mustRunAfter(publishToSonatype)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(Sign::class) {
|
val publishToSonatype by tasks.getting
|
||||||
onlyIf { System.getenv("CI") != null }
|
releaseTask.configure {
|
||||||
}
|
finalizedBy(publishToSonatype)
|
||||||
|
}
|
||||||
|
rootProject.tasks.named("closeAndReleaseRepository") {
|
||||||
|
mustRunAfter(publishToSonatype)
|
||||||
|
}
|
||||||
|
|
||||||
configure<SigningExtension> {
|
tasks.withType(Sign::class) {
|
||||||
useInMemoryPgpKeys(System.getenv("GPG_PRIVATE_KEY"), System.getenv("GPG_PASSWORD"))
|
onlyIf { System.getenv("CI") != null }
|
||||||
sign(the<PublishingExtension>().publications["mavenPublication"])
|
}
|
||||||
}
|
|
||||||
|
configure<SigningExtension> {
|
||||||
|
useInMemoryPgpKeys(System.getenv("GPG_PRIVATE_KEY"), System.getenv("GPG_PASSWORD"))
|
||||||
|
sign(the<PublishingExtension>().publications["mavenPublication"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue