-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #469 from ancho/asciidoctorj-1.6.0
Asciidoctorj 1.6.0 - pom generation fix
- Loading branch information
Showing
5 changed files
with
73 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ dependencies { | |
} | ||
|
||
jar.enabled = false | ||
signPom.enabled = false | ||
|
||
configurations.all { | ||
artifacts.clear() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
ext.pom = file("$buildDir/publications/jars/pom-default.xml") | ||
ext.signedPom = file("$buildDir/publications/jars/pom-default.xml.asc") | ||
|
||
if ( !project.hasProperty('skip.signing') ){ | ||
apply plugin: 'signing' | ||
|
||
signing { | ||
sign configurations.archives | ||
} | ||
|
||
if ( !signing.signatory ) { | ||
logger.warn "No Signatory configured for project $project.name. Skip signing! See https://docs.gradle.org/current/userguide/signing_plugin.html" | ||
signArchives.enabled = false | ||
ext."skip.signing" = true | ||
} | ||
|
||
task signPom(type: Sign) { | ||
group "publishing" | ||
description "Sign the projects pom file" | ||
|
||
inputs.file pom | ||
outputs.file signedPom | ||
|
||
doLast{ | ||
|
||
def input = pom.newInputStream() | ||
def output = signedPom.newOutputStream() | ||
try{ | ||
signatory.sign(input, output) | ||
} | ||
catch (Exception e){ | ||
logger.error e.message | ||
} | ||
finally { | ||
input.close() | ||
output.close() | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* The signPom Task depends on the GenerateMavenPom task which gets dynamically added | ||
* with a name derived from a publication. In our case 'jars'. | ||
* | ||
* Our jars publication registers the signed pom as artifact. | ||
* If the task does not run before publishJarsPublicationToMavenLocal this task will fail. | ||
*/ | ||
tasks.whenTaskAdded { | ||
|
||
switch (it.name) { | ||
case "generatePomFileForJarsPublication": | ||
signPom.dependsOn it | ||
break | ||
case "publishJarsPublicationToMavenLocal": | ||
it.dependsOn signPom | ||
break | ||
} | ||
} | ||
} |