You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by kd...@apache.org on 2022/06/15 16:30:22 UTC

[nifi-maven] branch main updated (1285f4b -> 8a50344)

This is an automated email from the ASF dual-hosted git repository.

kdoran pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-maven.git


    from 1285f4b  Merge branch 'nifi-maven-1.3.3-rc1' into main
     new 015de63  [NIFI-9856] make build reproducible
     new 8a50344  [NIFI-9857] make output reproducible

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                    | 67 ++++++++++++++++--------------
 src/main/java/org/apache/nifi/NarMojo.java | 41 ++++++++++--------
 2 files changed, 59 insertions(+), 49 deletions(-)


[nifi-maven] 01/02: [NIFI-9856] make build reproducible

Posted by kd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kdoran pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-maven.git

commit 015de63ba3718369ff99323f3b4904471d9b7f72
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Thu Mar 31 19:03:37 2022 +0200

    [NIFI-9856] make build reproducible
---
 pom.xml | 40 +++++++++-------------------------------
 1 file changed, 9 insertions(+), 31 deletions(-)

diff --git a/pom.xml b/pom.xml
index ae660fd..4dd942c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.apache</groupId>
         <artifactId>apache</artifactId>
-        <version>17</version>
+        <version>25</version>
         <relativePath />
     </parent>
     <groupId>org.apache.nifi</groupId>
@@ -74,11 +74,12 @@
         <url>https://issues.apache.org/jira/browse/NIFI</url>
     </issueManagement>
     <properties>
-        <maven.compiler.source>1.7</maven.compiler.source>
-        <maven.compiler.target>1.7</maven.compiler.target>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
         <maven.min-version>3.1.0</maven.min-version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <project.build.outputTimestamp>2022-02-17T22:08:13Z</project.build.outputTimestamp>
         <inceptionYear>2014</inceptionYear>
     </properties>
     <build>
@@ -95,11 +96,6 @@
                         <showWarnings>true</showWarnings>
                     </configuration>
                 </plugin>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-war-plugin</artifactId>
-                    <version>2.5</version>
-                </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-dependency-plugin</artifactId>
@@ -122,12 +118,12 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-source-plugin</artifactId>
-                    <version>2.4</version>
+                    <version>3.2.1</version>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-jar-plugin</artifactId>
-                    <version>2.5</version>
+                    <version>3.2.2</version>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
@@ -146,9 +142,9 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-release-plugin</artifactId>
-                    <version>2.5.1</version>
+                    <version>3.0.0-M5</version>
                     <configuration>
-                        <useReleaseProfile>true</useReleaseProfile>
+                        <useReleaseProfile>false</useReleaseProfile>
                         <releaseProfiles>apache-release</releaseProfiles>
                         <autoVersionSubmodules>true</autoVersionSubmodules>
                         <goals>deploy</goals>
@@ -168,16 +164,6 @@
                         </execution>
                     </executions>
                 </plugin>
-                <plugin>
-                    <groupId>org.codehaus.mojo</groupId>
-                    <artifactId>rpm-maven-plugin</artifactId>
-                    <version>2.1.1</version>
-                </plugin>
-                <plugin>
-                    <groupId>org.antlr</groupId>
-                    <artifactId>antlr3-maven-plugin</artifactId>
-                    <version>3.5.2</version>
-                </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-checkstyle-plugin</artifactId>
@@ -360,14 +346,6 @@
                     </execution>
                 </executions>
             </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>8</source>
-                    <target>8</target>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
     <dependencies>
@@ -402,7 +380,7 @@
             just to simplify the dependencies list.                     -->
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-jar-plugin</artifactId>
-            <version>2.5</version>
+            <version>3.2.2</version>
         </dependency>
         <dependency>
             <groupId>org.apache.maven.plugin-tools</groupId>


[nifi-maven] 02/02: [NIFI-9857] make output reproducible

Posted by kd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kdoran pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-maven.git

commit 8a503445f095a6a13aa075714e4498ab4efa461c
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Thu Mar 31 22:36:27 2022 +0200

    [NIFI-9857] make output reproducible
---
 pom.xml                                    | 27 ++++++++++++++++++++
 src/main/java/org/apache/nifi/NarMojo.java | 41 +++++++++++++++++-------------
 2 files changed, 50 insertions(+), 18 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4dd942c..aa7c933 100644
--- a/pom.xml
+++ b/pom.xml
@@ -349,6 +349,11 @@
         </plugins>
     </build>
     <dependencies>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-archiver</artifactId>
+            <version>3.5.2</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-plugin-api</artifactId>
@@ -369,6 +374,28 @@
             <artifactId>maven-dependency-plugin</artifactId>
             <type>maven-plugin</type>
             <version>2.9</version>
+            <exclusions>
+            	<exclusion>
+            		<groupId>org.apache.maven.doxia</groupId>
+            		<artifactId>doxia-site-renderer</artifactId>
+            	</exclusion>
+            	<exclusion>
+            		<groupId>org.apache.maven.reporting</groupId>
+            		<artifactId>maven-reporting-api</artifactId>
+            	</exclusion>
+            	<exclusion>
+            		<groupId>org.apache.maven.reporting</groupId>
+            		<artifactId>maven-reporting-impl</artifactId>
+            	</exclusion>
+            	<exclusion>
+            		<groupId>org.apache.maven.doxia</groupId>
+            		<artifactId>doxia-sink-api</artifactId>
+            	</exclusion>
+            	<exclusion>
+            		<groupId>org.codehaus.plexus</groupId>
+            		<artifactId>plexus-io</artifactId>
+            	</exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.maven.shared</groupId>
diff --git a/src/main/java/org/apache/nifi/NarMojo.java b/src/main/java/org/apache/nifi/NarMojo.java
index 37056af..ee0133a 100644
--- a/src/main/java/org/apache/nifi/NarMojo.java
+++ b/src/main/java/org/apache/nifi/NarMojo.java
@@ -91,6 +91,7 @@ import java.nio.file.Files;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -98,6 +99,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeSet;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.stream.Collectors;
@@ -466,12 +468,6 @@ public class NarMojo extends AbstractMojo {
     @Parameter(property = "buildRevision", defaultValue = "${buildRevision}", required = false)
     protected String buildRevision;
 
-    @Parameter(property = "buildJdk", defaultValue = "${java.version}", required = false)
-    protected String buildJdk;
-
-    @Parameter(property = "builtBy", defaultValue = "${user.name}", required = false)
-    protected String builtBy;
-
     /**
      * Allows a NAR to specify if it's resources should be cloned when a component that depends on this NAR
      * is performing class loader isolation.
@@ -496,6 +492,15 @@ public class NarMojo extends AbstractMojo {
     @Component
     private ProjectBuilder projectBuilder;
 
+    /**
+     * Timestamp for reproducible output archive entries, either formatted as ISO 8601
+     * <code>yyyy-MM-dd'T'HH:mm:ssXXX</code> or as an int representing seconds since the epoch (like
+     * <a href="https://reproducible-builds.org/docs/source-date-epoch/">SOURCE_DATE_EPOCH</a>).
+     *
+     * @since 3.2.3
+     */
+    @Parameter( defaultValue = "${project.build.outputTimestamp}" )
+    private String outputTimestamp;
 
 
     @Override
@@ -589,15 +594,6 @@ public class NarMojo extends AbstractMojo {
                 if (notEmpty(buildRevision)) {
                     writeXmlTag(xmlWriter, "revision", buildRevision);
                 }
-                if (notEmpty(buildJdk)) {
-                    writeXmlTag(xmlWriter, "jdk", buildJdk);
-                }
-                if (notEmpty(builtBy)) {
-                    writeXmlTag(xmlWriter, "builtBy", builtBy);
-                }
-
-                final SimpleDateFormat dateFormat = new SimpleDateFormat(BUILD_TIMESTAMP_FORMAT);
-                writeXmlTag(xmlWriter, "timestamp", dateFormat.format(new Date()));
                 xmlWriter.writeEndElement();
 
                 // Write extensions
@@ -653,11 +649,18 @@ public class NarMojo extends AbstractMojo {
                                     final Class<?> docWriterClass, final XMLStreamWriter xmlWriter, final File additionalDetailsDir)
         throws InvocationTargetException, NoSuchMethodException, ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {
 
-        for (final ExtensionDefinition definition : extensionDefinitions) {
+        final Set<ExtensionDefinition> sorted = new TreeSet<>(new Comparator<ExtensionDefinition>() {
+            public int compare(ExtensionDefinition e1, ExtensionDefinition e2) {
+                return e1.getExtensionName().compareTo(e2.getExtensionName());
+            }
+        });
+        sorted.addAll(extensionDefinitions);
+
+        for (final ExtensionDefinition definition : sorted) {
             writeDocumentation(definition, classLoader, docWriterClass, xmlWriter);
         }
 
-        final Set<String> extensionNames = extensionDefinitions.stream()
+        final Set<String> extensionNames = sorted.stream()
             .map(ExtensionDefinition::getExtensionName)
             .collect(Collectors.toSet());
 
@@ -1028,8 +1031,10 @@ public class NarMojo extends AbstractMojo {
         final File outputDirectory = projectBuildDirectory;
         File narFile = getNarFile(outputDirectory, finalName, classifier);
         MavenArchiver archiver = new MavenArchiver();
+        archiver.setCreatedBy("Apache NiFi Nar Maven Plugin", "org.apache.nifi", "nifi-nar-maven-plugin");
         archiver.setArchiver(jarArchiver);
         archiver.setOutputFile(narFile);
+        Date timestamp = archiver.configureReproducible(outputTimestamp); // configure for Reproducible Builds based on outputTimestamp value
         archive.setForced(forceCreation);
 
         try {
@@ -1088,7 +1093,7 @@ public class NarMojo extends AbstractMojo {
             }
 
             SimpleDateFormat dateFormat = new SimpleDateFormat(BUILD_TIMESTAMP_FORMAT);
-            archive.addManifestEntry("Build-Timestamp", dateFormat.format(new Date()));
+            archive.addManifestEntry("Build-Timestamp", dateFormat.format(timestamp == null ? new Date() : timestamp));
 
             archive.addManifestEntry("Clone-During-Instance-Class-Loading", String.valueOf(cloneDuringInstanceClassLoading));