Skip to content

Commit

Permalink
Fix publishing via maven-publish plugin (#98)
Browse files Browse the repository at this point in the history
Failure before: https://ge.gradle.org/s/gxonim3jls274/failure#1

Signed-off-by: Marc Philipp <[email protected]>
  • Loading branch information
marcphilipp authored Mar 19, 2021
1 parent 544cae6 commit cbc7a97
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.testretry.build.GradleVersionData
import org.gradle.testretry.build.GradleVersionsCommandLineArgumentProvider
import java.net.URI

plugins {
java
Expand Down Expand Up @@ -52,8 +51,7 @@ shadowJar.configure {
include(dependency("org.ow2.asm:asm"))
}
relocate("org.objectweb.asm", "org.gradle.testretry.org.objectweb.asm")
@Suppress("DEPRECATION")
classifier = ""
archiveClassifier.set("")
from(file("../LICENSE")) {
into("META-INF")
}
Expand Down Expand Up @@ -115,7 +113,7 @@ publishing {
repositories {
maven {
name = "GradleBuildInternalSnapshots"
url = URI.create("https://repo.gradle.org/gradle/libs-snapshots-local")
url = uri("https://repo.gradle.org/gradle/libs-snapshots-local")
credentials {
username = project.findProperty("artifactoryUsername") as String?
password = project.findProperty("artifactoryPassword") as String?
Expand All @@ -124,24 +122,37 @@ publishing {
}
}

tasks.withType<Sign>().configureEach {
enabled = System.getenv("CI") != null
configurations {
configureEach {
outgoing {
val removed = artifacts.removeIf { it.classifier.isNullOrEmpty() }
if (removed) {
artifact(tasks.shadowJar) {
classifier = ""
}
}
}
}
// used by plugin-publish plugin
archives {
extendsFrom(signatures.get())
}
}

configure<SigningExtension> {
signing {
useInMemoryPgpKeys(System.getenv("PGP_SIGNING_KEY"), System.getenv("PGP_SIGNING_KEY_PASSPHRASE"))
sign(configurations.archives.get())
}

configurations.archives.get().extendsFrom(configurations.signatures.get())
signing {
sign(configurations.archives.get())
tasks.withType<Sign>().configureEach {
enabled = System.getenv("CI") != null
}

tasks.withType(Test::class).configureEach {
tasks.withType<Test>().configureEach {
maxParallelForks = 4
}

tasks.named<Test>("test") {
tasks.test {
systemProperty(
GradleVersionsCommandLineArgumentProvider.PROPERTY_NAME,
project.findProperty("testedGradleVersion") ?: gradle.gradleVersion
Expand Down

0 comments on commit cbc7a97

Please sign in to comment.