Skip to content

Commit

Permalink
Update jarsigner logic for new Maven publishing plugin.
Browse files Browse the repository at this point in the history
The previous hook for signing jars before Maven PGP signatures
were generated was not actually being called.

Additionally, it was signing only the generic jar, not the
platform one which actually gets uploaded.  This may have worked
with previous combinations of Gradle/Maven publishing, but
currently the platform jar is not added to
`configurations.archives.allArtifacts` (possibly a separate bug).
Workaround: search all artifacts to be uploaded for candidate
jars.

Tested on Macos and Linux.
  • Loading branch information
prbprbprb committed Sep 9, 2020
1 parent 1283c13 commit f213789
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,6 @@ apply plugin: 'signing'

def isSnapshot = project.version.contains('SNAPSHOT')

signing {
required false
sign publishing.publications
}

tasks.register("signPublications").configure {
configurations.archives.allArtifacts.each {
if (it.type == 'jar' && it.classifier != 'sources' && it.classifier != 'javadoc') {
signJar(it.file.absolutePath)
}
}
}

publishing {
publications {
maven(MavenPublication) {
Expand Down Expand Up @@ -69,3 +56,17 @@ publishing {
}
}
}

signing {
required false
sign publishing.publications.maven
}

signMavenPublication.doFirst {
publishing.publications.maven.artifacts.each {
if (it.file.absolutePath.endsWith('.jar') && it.classifier != 'sources' && it.classifier != 'javadoc') {
logger.info("Signing jar: ${it.file.absolutePath}")
signJar(it.file.absolutePath)
}
}
}

0 comments on commit f213789

Please # to comment.