[Jython-checkins] jython: Restore PGP signing and extend to all artefacts in each bundle.

jeff.allen jython-checkins at python.org
Fri Nov 1 00:57:46 EDT 2019


https://hg.python.org/jython/rev/7028af43600e
changeset:   8306:7028af43600e
user:        Jeff Allen <ja.py at farowl.co.uk>
date:        Wed Oct 30 21:32:16 2019 +0000
summary:
  Restore PGP signing and extend to all artefacts in each bundle.

files:
  build.gradle           |   36 ++++++++
  maven/build.xml        |  118 ++++++++++++++++++++--------
  maven/pom-template.xml |   18 ++-
  3 files changed, 129 insertions(+), 43 deletions(-)


diff --git a/build.gradle b/build.gradle
--- a/build.gradle
+++ b/build.gradle
@@ -729,6 +729,42 @@
             artifact sourcesJar
             // Also provide the docs. (Some javadoc errors currently.)
             artifact javadocJar
+
+            pom {
+                // Same description as in ~/maven/pom-template
+                name = 'Jython'
+                description =
+                    'Jython is an implementation of the high-level, dynamic, object-oriented\n' +
+                    'language Python written in 100% Pure Java, and seamlessly integrated with\n' +
+                    'the Java platform. It thus allows you to run Python on any Java platform.'
+                url = 'https://www.jython.org/'
+
+                // We use the PSF 2.0, but only most recently, but actually a bundle.
+                licenses {
+                    license {
+                        name = 'Jython Software License'
+                        // Not actually the license URL, but linked from here.
+                        url = 'https://www.jython.org/'
+                        distribution = 'repo'
+                    }
+                }
+
+                // Point to hg repositories hosetd by PSF (up to 2.7.2, anyway).
+                scm {
+                    connection = 'scm:hg:https://hg.python.org/jython'
+                    developerConnection = 'scm:hg:ssh://hg@hg.python.org/jython'
+                    url = 'https://hg.python.org/jython'
+                }
+
+                // Could list us all, but why not just the list for now?
+                developers {
+                    developer {
+                        id = 'jython'
+                        name = 'Jython Developers'
+                        email = 'jython-dev at lists.sourceforge.net'
+                    }
+                }
+            }
         }
     }
 
diff --git a/maven/build.xml b/maven/build.xml
--- a/maven/build.xml
+++ b/maven/build.xml
@@ -83,12 +83,7 @@
   </target>
 
   <target name="bundle-slim" depends="prepare" if="gradle.published">
-    <jar jarfile="${pubs.dir}/jython-slim-${jython.version}-bundle.jar">
-        <fileset dir="${gradle.repo}/${m2.groupDir}/jython-slim/${jython.version}">
-            <include name="*.pom"/>
-            <include name="*.jar"/>
-        </fileset>
-    </jar>
+    <m2-bundle-gradle artifactId="jython-slim" version="${jython.version}"/>
   </target>
 
   <target name="install-all" depends="install, install-standalone"/>
@@ -138,51 +133,102 @@
     </sequential>
   </macrodef>
 
-  <!-- Stage (in ${build.maven}) and bundle an artifact in ${pubs.dir} for release -->
+  <!-- Stage (in @{stageDir}), creating a POM, and adding the version to names used.
+       Then create a bundle in ${pubs.dir} for release. -->
   <macrodef name="m2-bundle">
     <attribute name="artifactId"/>
     <attribute name="version"/>
+    <attribute name="fromDir" default="${dist.dir}" />
+    <attribute name="stageDir" default="${build.maven}" />
+    <attribute name="basename" default="@{artifactId}-@{version}" />
     <sequential>
-      <stage artifactId="@{artifactId}" version="@{version}"/>
-      <jar jarfile="${pubs.dir}/@{artifactId}-@{version}-bundle.jar">
-        <fileset dir="${build.maven}"/>
-      </jar>
-    </sequential>
-  </macrodef>
+      <!-- Clean the staging directory. -->
+      <delete dir="@{stageDir}" />
+      <mkdir dir="@{stageDir}" />
 
-  <!-- Stage artefacts for Maven (copy to a clean ${build.maven} adding version). -->
-  <macrodef name="stage">
-    <attribute name="artifactId"/>
-    <attribute name="version"/>
-    <attribute name="fromDir" default="${dist.dir}"/>
-    <sequential>
+      <!-- Copy over the primary artifact from @{fromDir} to the staging area. -->
+      <copy file="@{fromDir}/@{artifactId}.jar" tofile="@{stageDir}/@{basename}.jar"/>
 
-      <!-- Clean the temporary directory where we "stage" the primary and secondary artefacts. -->
-      <delete dir="${build.maven}"/>
-      <mkdir dir="${build.maven}"/>
+      <!-- The source and Javadoc are already prepared (but add the version to the name). -->
+      <copy file="@{fromDir}/sources.jar" tofile="@{stageDir}/@{basename}-sources.jar"/>
+      <copy file="@{fromDir}/javadoc.jar" tofile="@{stageDir}/@{basename}-javadoc.jar"/>
 
       <!-- Create the POM from the given template with placeholders replaced. -->
       <copy file="maven/pom-template.xml"
-            tofile="${build.maven}/@{artifactId}-@{version}.pom">
+            tofile="@{stageDir}/@{basename}.pom">
         <filterset>
           <filter token="PROJECT-VERSION" value="@{version}"/>
           <filter token="ARTIFACT-ID" value="@{artifactId}"/>
         </filterset>
       </copy>
 
-      <!-- XXX: License is already in the jars and maven central is
-                rejecting this in the bundle - investigate.
-      <copy file="LICENSE.txt" tofile="${build.maven}/LICENSE.txt"/>
-      -->
+      <!-- Sign everything. -->
+      <sign-all stageDir="@{stageDir}" artifactId="@{artifactId}" version="@{version}"/>
+
+      <!-- JAR-up the entire contents of the staging directory. -->
+      <jar jarfile="${pubs.dir}/@{basename}-bundle.jar">
+        <fileset dir="@{stageDir}"/>
+      </jar>
+    </sequential>
+  </macrodef>
+
+  <!-- Stage (in @{stageDir}), a gradle-built artifact in which Gradle has created a POM,
+       and the secondary artifacts (source, javadoc) with the version in the file names.
+       Then create a bundle in ${pubs.dir} for release. -->
+  <macrodef name="m2-bundle-gradle">
+    <attribute name="artifactId"/>
+    <attribute name="version"/>
+    <attribute name="fromDir"
+               default="${gradle.repo}/${m2.groupDir}/@{artifactId}/@{version}"/>
+    <attribute name="stageDir" default="${build.maven}" />
+    <attribute name="basename" default="@{artifactId}-@{version}" />
+    <sequential>
+      <!-- Clean the staging directory. -->
+      <delete dir="@{stageDir}" />
+      <mkdir dir="@{stageDir}" />
+
+      <!-- Copy over all the artifacts from @{fromDir} to the staging area. -->
+      <copy todir="@{stageDir}">
+        <fileset dir="@{fromDir}">
+          <include name="*.jar" />
+          <include name="*.pom" />
+        </fileset>
+      </copy>
 
-      <!-- Copy over the primary artefact from @{fromDir} to the staging area. -->
-      <copy file="@{fromDir}/@{artifactId}.jar"
-            tofile="${build.maven}/@{artifactId}-@{version}.jar"/>
+      <!-- Sign everything. -->
+      <sign-all stageDir="@{stageDir}" artifactId="@{artifactId}" version="@{version}"/>
+
+      <!-- JAR-up the entire contents of the staging directory. -->
+      <jar jarfile="${pubs.dir}/@{basename}-bundle.jar">
+        <fileset dir="@{stageDir}"/>
+      </jar>
+    </sequential>
+  </macrodef>
 
-      <!-- The source and Javadoc are the same each time (but add the version to the name). -->
-      <copy file="@{fromDir}/sources.jar" tofile="${build.maven}/@{artifactId}-@{version}-sources.jar"/>
-      <copy file="@{fromDir}/javadoc.jar" tofile="${build.maven}/@{artifactId}-@{version}-javadoc.jar"/>
+  <!-- Add detached signature for single artifact in staging directory. -->
+  <macrodef name="sign-detached">
+    <attribute name="file" />
+    <attribute name="stageDir" />
+    <sequential>
+      <!-- Generate a detached signature for each artifact in the bundle. -->
+      <exec executable="gpg" dir="@{stageDir}">
+        <arg value="-ab"/>
+        <arg value="@{file}"/>
+      </exec>
+    </sequential>
+  </macrodef>
 
+  <!-- Add detached signatures for group of artifacts in staging directory. -->
+  <macrodef name="sign-all">
+    <attribute name="artifactId" />
+    <attribute name="version" />
+    <attribute name="stageDir" />
+    <attribute name="basename" default="@{artifactId}-@{version}" />
+    <sequential>
+      <sign-detached stageDir="@{stageDir}" file="@{basename}.pom" />
+      <sign-detached stageDir="@{stageDir}" file="@{basename}.jar" />
+      <sign-detached stageDir="@{stageDir}" file="@{basename}-sources.jar" />
+      <sign-detached stageDir="@{stageDir}" file="@{basename}-javadoc.jar" />
     </sequential>
   </macrodef>
 
@@ -208,11 +254,11 @@
   </target>
 
   <target name="prepare" depends="build-jython, validate-pom, version">
-    <local name="artefacts"/>
-    <property name="artefacts"
+    <local name="artifacts"/>
+    <property name="artifacts"
               value="${gradle.repo}/${m2.groupDir}/jython-slim/${jython.version}" />
     <condition property="gradle.published">
-      <available file="${artefacts}" type="dir"/>
+      <available file="${artifacts}" type="dir"/>
     </condition>
   </target>
 
diff --git a/maven/pom-template.xml b/maven/pom-template.xml
--- a/maven/pom-template.xml
+++ b/maven/pom-template.xml
@@ -9,29 +9,33 @@
     <packaging>jar</packaging>
     <name>Jython</name>
     <version>@PROJECT-VERSION@</version>
-    <url>http://www.jython.org/</url>
+    <url>https://www.jython.org/</url>
+
     <description>
         Jython is an implementation of the high-level, dynamic, object-oriented
         language Python written in 100% Pure Java, and seamlessly integrated with
         the Java platform. It thus allows you to run Python on any Java platform.
     </description>
+
     <licenses>
         <license>
             <name>Jython Software License</name>
-            <url>http://www.jython.org/Project/license.html</url>
+            <url>https://www.jython.org/Project/license.html</url>
             <distribution>repo</distribution>
         </license>
     </licenses>
+
     <scm>
-        <connection>scm:hg:http://hg.python.org/jython</connection>
+        <connection>scm:hg:https://hg.python.org/jython</connection>
         <developerConnection>scm:hg:ssh://hg@hg.python.org/jython</developerConnection>
-        <url>http://hg.python.org/jython</url>
+        <url>https://hg.python.org/jython</url>
     </scm>
-    <!-- Just put my name in for now to make the maven uploader happy -->
+
     <developers>
         <developer>
-            <id>fwierzbicki</id>
-            <name>Frank Wierzbicki</name>
+            <id>jython</id>
+            <name>Jython Developers</name>
+            <email>jython-dev at lists.sourceforge.net</email>
         </developer>
     </developers>
 </project>

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list