You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2026/08/14 04:46:48 UTC

(ant-antlibs-cyclonedx) branch main updated (4771e74 -> 2a91ff7)

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

asf-gitbox-commits pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/ant-antlibs-cyclonedx.git


    from 4771e74  forgot to update pom
     new 6b257a1  update common antlib infrastructure
     new 2a91ff7  mimic getBuildDate change of Ant's master branch

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:
 common                                              |  2 +-
 .../org/apache/ant/cyclonedx/ComponentBomTask.java  |  8 ++++----
 src/main/org/apache/ant/cyclonedx/DateUtils.java    | 21 ++++++++++-----------
 3 files changed, 15 insertions(+), 16 deletions(-)


(ant-antlibs-cyclonedx) 02/02: mimic getBuildDate change of Ant's master branch

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

asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ant-antlibs-cyclonedx.git

commit 2a91ff72bfff1f2961bd106915ad079b6d333f31
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Fri Aug 14 06:46:19 2026 +0200

    mimic getBuildDate change of Ant's master branch
---
 .../org/apache/ant/cyclonedx/ComponentBomTask.java  |  8 ++++----
 src/main/org/apache/ant/cyclonedx/DateUtils.java    | 21 ++++++++++-----------
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/main/org/apache/ant/cyclonedx/ComponentBomTask.java b/src/main/org/apache/ant/cyclonedx/ComponentBomTask.java
index 9466583..d4970cc 100644
--- a/src/main/org/apache/ant/cyclonedx/ComponentBomTask.java
+++ b/src/main/org/apache/ant/cyclonedx/ComponentBomTask.java
@@ -280,11 +280,11 @@ public class ComponentBomTask extends Task {
 
     private Bom createBom() throws IOException {
         Bom bom = new Bom();
-        Map.Entry<Date, Boolean> currentTimeAndReproducibleBuildsFlag = DateUtils.getNow(getProject());
-        bom.setSerialNumber(getSerialNumber(currentTimeAndReproducibleBuildsFlag.getKey(),
-                                            Boolean.TRUE.equals(currentTimeAndReproducibleBuildsFlag.getValue())));
+        Date currentTime = DateUtils.getBuildDate(getProject());
+        bom.setSerialNumber(getSerialNumber(currentTime,
+                                            System.getenv(DateUtils.ENV_SOURCE_DATE_EPOCH) != null));
 
-        Metadata meta = createMetadata(currentTimeAndReproducibleBuildsFlag.getKey());
+        Metadata meta = createMetadata(currentTime);
 
         Map<String, String> knownComponents = new HashMap<>();
         List<Component> resolvedComponents = new ArrayList<>();
diff --git a/src/main/org/apache/ant/cyclonedx/DateUtils.java b/src/main/org/apache/ant/cyclonedx/DateUtils.java
index 3752287..9c68cfc 100644
--- a/src/main/org/apache/ant/cyclonedx/DateUtils.java
+++ b/src/main/org/apache/ant/cyclonedx/DateUtils.java
@@ -17,10 +17,8 @@
  */
 package org.apache.ant.cyclonedx;
 
-import java.util.AbstractMap;
 import java.time.Instant;
 import java.util.Date;
-import java.util.Map;
 import java.util.Optional;
 import java.util.TimeZone;
 import java.util.function.Function;
@@ -31,35 +29,36 @@ import org.apache.tools.ant.Project;
 
 final class DateUtils {
 
-    private static final String ENV_SOURCE_DATE_EPOCH = "SOURCE_DATE_EPOCH";
+    static final String ENV_SOURCE_DATE_EPOCH = "SOURCE_DATE_EPOCH";
 
     /**
-     * Consults the magic properties {@link MagicNames.TSTAMP_NOW_ISO} and {@link MagicNames.TSTAMP_NOW} as well as the
-     * environment variable {@code SOURCE_DATE_EPOCH} for predefined values of "now" and falls back to {@code new
-     * Date()} if neiter is set.
+     * Consults {@linkplain #ENV_SOURCE_DATE_EPOCH SOURCE_DATE_EPOCH} environment variable and
+     * the magic properties {@link MagicNames#TSTAMP_NOW_ISO} and {@link MagicNames#TSTAMP_NOW}
+     * for predefined values of the build date and falls back to {@code new Date()} if neither is set.
      *
-     * <p>{@code SOURCE_DATE_EPOCH} takes precendence over {@link MagicNames.TSTAMP_NOW_ISO} which in turn takes precendence over {@link MagicNames.TSTAMP_NOW}.</p>
+     * <p>{@code SOURCE_DATE_EPOCH} takes precedence over {@link MagicNames#TSTAMP_NOW_ISO} which
+     * in turn takes precedence over {@link MagicNames#TSTAMP_NOW}.</p>
      *
      * @param project Project instance to use when looking up the magic properties.
-     * @return a tuple of "now" and a boolean flag that indicates whether {@code SOURCE_DATE_EPOCH} has been set.
+     * @return "build date" as explained above
      * @since CycloneDX Antlib 0.2
      */
     // stolen from Ant 1.10.18
-    static Map.Entry<Date, Boolean> getNow(Project project) {
+    static Date getBuildDate(Project project) {
         final String epoch = System.getenv(ENV_SOURCE_DATE_EPOCH);
         if (epoch != null) {
             // Value of SOURCE_DATE_EPOCH will be an integer, representing seconds.
             try {
                 Date d = new Date(Long.parseLong(epoch) * 1000L);
                 project.log("Honouring environment variable " + ENV_SOURCE_DATE_EPOCH + " which has been set to " + epoch);
-                return new AbstractMap.SimpleImmutableEntry(d, true);
+                return d;
             } catch(NumberFormatException e) {
                 // ignore
                 project.log("Ignoring invalid value '" + epoch + "' for " + ENV_SOURCE_DATE_EPOCH
                             + " environment variable", Project.MSG_DEBUG);
             }
         }
-        return new AbstractMap.SimpleImmutableEntry(getNowAsDate(project), false);
+        return getNowAsDate(project);
     }
 
     private static Date getNowAsDate(Project p) {


(ant-antlibs-cyclonedx) 01/02: update common antlib infrastructure

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

asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ant-antlibs-cyclonedx.git

commit 6b257a1b987fd3afbc8cadfb6070370736d13081
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Fri Aug 14 06:38:19 2026 +0200

    update common antlib infrastructure
---
 common | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common b/common
index 08aa3ef..d07c59a 160000
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 08aa3efdbec177de04e5a9d7f9a5ca787d612a4e
+Subproject commit d07c59aee87528c5b5f3ea441d6a292309dd0a35