diff --git a/.github/workflows/publish-maven.yml b/.github/workflows/publish-maven.yml index 5730218b30..a230e130d6 100644 --- a/.github/workflows/publish-maven.yml +++ b/.github/workflows/publish-maven.yml @@ -27,4 +27,4 @@ jobs: ORG_GRADLE_PROJECT_SIGNINGKEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }} ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} run: >- - ./gradlew publish + ./gradlew publish -Dorg.gradle.parallel=false diff --git a/buildSrc/src/main/groovy/rhino.library-conventions.gradle b/buildSrc/src/main/groovy/rhino.library-conventions.gradle index 5973ce60dd..c8369f213b 100644 --- a/buildSrc/src/main/groovy/rhino.library-conventions.gradle +++ b/buildSrc/src/main/groovy/rhino.library-conventions.gradle @@ -6,6 +6,7 @@ plugins { id 'rhino.java-conventions' id 'maven-publish' + id 'signing' id 'jacoco' id 'net.ltgt.errorprone' } @@ -98,6 +99,18 @@ task sourceJar(type: Jar) { } } +signing { + if (project.hasProperty('SIGNINGKEY')) { + // Check for ORG_GRADLE_PROJECT_SIGNINGKEY environment variable for use in CI system. + // Otherwise, do not sign. + def signingKey = getProperty('SIGNINGKEY') + def signingPassword = getProperty('SIGNINGPASSWORD') + useInMemoryPgpKeys(signingKey, signingPassword) + sign publishing.publications + } +} + + publishing { if (project.hasProperty("mavenPassword")) { repositories { diff --git a/rhino-all/build.gradle b/rhino-all/build.gradle index 2a6bd4b9cb..9821deaf4a 100644 --- a/rhino-all/build.gradle +++ b/rhino-all/build.gradle @@ -39,25 +39,30 @@ publishing { publications { rhinoall(MavenPublication) { from components.java - artifacts = [jar] - pom { - description = "Rhino JavaScript all-in-one JAR, not for use with modular Java projects" - url = "https://mozilla.github.io/rhino/" - licenses { - license { - name = "Mozilla Public License, Version 2.0" - url = "http://www.mozilla.org/MPL/2.0/index.txt" - } - } - scm { - connection = "scm:git:git@github.com:mozilla/rhino.git" - developerConnection = "scm:git:git@github.com:mozilla/rhino.git" - url = "git@github.com:mozilla/rhino.git" - } - organization { - name = "The Mozilla Foundation" - url = "http://www.mozilla.org" - } + artifacts = [jar, sourceJar, javadocJar] + pom.withXml { + def root = asNode() + + root.appendNode('description', "Rhino JavaScript all-in-one JAR, not for use with modular Java projects") + root.appendNode("url", "https://mozilla.github.io/rhino/") + + def p = root.appendNode("parent") + p.appendNode("groupId", "org.sonatype.oss") + p.appendNode("artifactId", "oss-parent") + p.appendNode("version", "7") + + def l = root.appendNode("licenses").appendNode("license") + l.appendNode("name", "Mozilla Public License, Version 2.0") + l.appendNode("url", "http://www.mozilla.org/MPL/2.0/index.txt") + + def scm = root.appendNode("scm") + scm.appendNode("connection", "scm:git:git@github.com:mozilla/rhino.git") + scm.appendNode("developerConnection", "scm:git:git@github.com:mozilla/rhino.git") + scm.appendNode("url", "git@github.com:mozilla/rhino.git") + + def o = root.appendNode("organization") + o.appendNode("name", "The Mozilla Foundation") + o.appendNode("url", "http://www.mozilla.org") } } } diff --git a/rhino-engine/build.gradle b/rhino-engine/build.gradle index 52bc35c2ff..0fffc30cc0 100644 --- a/rhino-engine/build.gradle +++ b/rhino-engine/build.gradle @@ -11,24 +11,29 @@ publishing { rhinoengine(MavenPublication) { from components.java artifacts = [jar, sourceJar, javadocJar] - pom { - description = "Rhino ScriptEngine implementation" - url = "https://mozilla.github.io/rhino/" - licenses { - license { - name = "Mozilla Public License, Version 2.0" - url = "http://www.mozilla.org/MPL/2.0/index.txt" - } - } - scm { - connection = "scm:git:git@github.com:mozilla/rhino.git" - developerConnection = "scm:git:git@github.com:mozilla/rhino.git" - url = "git@github.com:mozilla/rhino.git" - } - organization { - name = "The Mozilla Foundation" - url = "http://www.mozilla.org" - } + pom.withXml { + def root = asNode() + + root.appendNode('description', "Rhino ScriptEngine implementation") + root.appendNode("url", "https://mozilla.github.io/rhino/") + + def p = root.appendNode("parent") + p.appendNode("groupId", "org.sonatype.oss") + p.appendNode("artifactId", "oss-parent") + p.appendNode("version", "7") + + def l = root.appendNode("licenses").appendNode("license") + l.appendNode("name", "Mozilla Public License, Version 2.0") + l.appendNode("url", "http://www.mozilla.org/MPL/2.0/index.txt") + + def scm = root.appendNode("scm") + scm.appendNode("connection", "scm:git:git@github.com:mozilla/rhino.git") + scm.appendNode("developerConnection", "scm:git:git@github.com:mozilla/rhino.git") + scm.appendNode("url", "git@github.com:mozilla/rhino.git") + + def o = root.appendNode("organization") + o.appendNode("name", "The Mozilla Foundation") + o.appendNode("url", "http://www.mozilla.org") } } } diff --git a/rhino-tools/build.gradle b/rhino-tools/build.gradle index b94e0a7725..e70553298f 100644 --- a/rhino-tools/build.gradle +++ b/rhino-tools/build.gradle @@ -11,24 +11,29 @@ publishing { rhinotools(MavenPublication) { from components.java artifacts = [jar, sourceJar, javadocJar] - pom { - description = "Rhino tools, including shell and debugger" - url = "https://mozilla.github.io/rhino/" - licenses { - license { - name = "Mozilla Public License, Version 2.0" - url = "http://www.mozilla.org/MPL/2.0/index.txt" - } - } - scm { - connection = "scm:git:git@github.com:mozilla/rhino.git" - developerConnection = "scm:git:git@github.com:mozilla/rhino.git" - url = "git@github.com:mozilla/rhino.git" - } - organization { - name = "The Mozilla Foundation" - url = "http://www.mozilla.org" - } + pom.withXml { + def root = asNode() + + root.appendNode('description', "Rhino tools, including shell and debugger") + root.appendNode("url", "https://mozilla.github.io/rhino/") + + def p = root.appendNode("parent") + p.appendNode("groupId", "org.sonatype.oss") + p.appendNode("artifactId", "oss-parent") + p.appendNode("version", "7") + + def l = root.appendNode("licenses").appendNode("license") + l.appendNode("name", "Mozilla Public License, Version 2.0") + l.appendNode("url", "http://www.mozilla.org/MPL/2.0/index.txt") + + def scm = root.appendNode("scm") + scm.appendNode("connection", "scm:git:git@github.com:mozilla/rhino.git") + scm.appendNode("developerConnection", "scm:git:git@github.com:mozilla/rhino.git") + scm.appendNode("url", "git@github.com:mozilla/rhino.git") + + def o = root.appendNode("organization") + o.appendNode("name", "The Mozilla Foundation") + o.appendNode("url", "http://www.mozilla.org") } } } diff --git a/rhino-xml/build.gradle b/rhino-xml/build.gradle index d3aafc92b1..c1fa9baa57 100644 --- a/rhino-xml/build.gradle +++ b/rhino-xml/build.gradle @@ -11,24 +11,29 @@ publishing { rhinoxml(MavenPublication) { from components.java artifacts = [jar, sourceJar, javadocJar] - pom { - description = "Rhino XML support" - url = "https://mozilla.github.io/rhino/" - licenses { - license { - name = "Mozilla Public License, Version 2.0" - url = "http://www.mozilla.org/MPL/2.0/index.txt" - } - } - scm { - connection = "scm:git:git@github.com:mozilla/rhino.git" - developerConnection = "scm:git:git@github.com:mozilla/rhino.git" - url = "git@github.com:mozilla/rhino.git" - } - organization { - name = "The Mozilla Foundation" - url = "http://www.mozilla.org" - } + pom.withXml { + def root = asNode() + + root.appendNode('description', "Rhino XML support") + root.appendNode("url", "https://mozilla.github.io/rhino/") + + def p = root.appendNode("parent") + p.appendNode("groupId", "org.sonatype.oss") + p.appendNode("artifactId", "oss-parent") + p.appendNode("version", "7") + + def l = root.appendNode("licenses").appendNode("license") + l.appendNode("name", "Mozilla Public License, Version 2.0") + l.appendNode("url", "http://www.mozilla.org/MPL/2.0/index.txt") + + def scm = root.appendNode("scm") + scm.appendNode("connection", "scm:git:git@github.com:mozilla/rhino.git") + scm.appendNode("developerConnection", "scm:git:git@github.com:mozilla/rhino.git") + scm.appendNode("url", "git@github.com:mozilla/rhino.git") + + def o = root.appendNode("organization") + o.appendNode("name", "The Mozilla Foundation") + o.appendNode("url", "http://www.mozilla.org") } } } diff --git a/rhino/build.gradle b/rhino/build.gradle index 160df15559..1bf180c747 100644 --- a/rhino/build.gradle +++ b/rhino/build.gradle @@ -11,24 +11,33 @@ publishing { rhino(MavenPublication) { from components.java artifacts = [jar, sourceJar, javadocJar] - pom { - description = "Rhino JavaScript runtime jar, excludes XML, tools ScriptEngine wrapper" - url = "https://mozilla.github.io/rhino/" - licenses { - license { - name = "Mozilla Public License, Version 2.0" - url = "http://www.mozilla.org/MPL/2.0/index.txt" - } - } - scm { - connection = "scm:git:git@github.com:mozilla/rhino.git" - developerConnection = "scm:git:git@github.com:mozilla/rhino.git" - url = "git@github.com:mozilla/rhino.git" - } - organization { - name = "The Mozilla Foundation" - url = "http://www.mozilla.org" - } + // We need to use the "withXml" method here, rather than the + // "pom" element in Gradle, because we can't add the "parent" + // attribute otherwise, and without it Maven Central verification + // will fail. + pom.withXml { + def root = asNode() + + root.appendNode('description', "Rhino JavaScript runtime jar, excludes XML, tools, and ScriptEngine wrapper") + root.appendNode("url", "https://mozilla.github.io/rhino/") + + def p = root.appendNode("parent") + p.appendNode("groupId", "org.sonatype.oss") + p.appendNode("artifactId", "oss-parent") + p.appendNode("version", "7") + + def l = root.appendNode("licenses").appendNode("license") + l.appendNode("name", "Mozilla Public License, Version 2.0") + l.appendNode("url", "http://www.mozilla.org/MPL/2.0/index.txt") + + def scm = root.appendNode("scm") + scm.appendNode("connection", "scm:git:git@github.com:mozilla/rhino.git") + scm.appendNode("developerConnection", "scm:git:git@github.com:mozilla/rhino.git") + scm.appendNode("url", "git@github.com:mozilla/rhino.git") + + def o = root.appendNode("organization") + o.appendNode("name", "The Mozilla Foundation") + o.appendNode("url", "http://www.mozilla.org") } } }