Hi all

a few weeks ago I added a new method to DateUtis: getNow
https://github.com/apache/ant/commit/928be61e77a19328ce13d44e89ddc5f77fcbe4b4

I'm afraid the change may be flying under the radar, so I want to point
it out specifically.

The <tstamp> tasks knows three different sources that can define the
notion of "now" externally. Two magic properties and one environment
variable. The latter is what Debian builds use when they want to make a
builds reproducible[1] and is well supported by eco systems other than
Java.

The new methods uses the same three external sources using the same
priorities as <tstamp>. It returns a tuple of "now" and a boolean flag
that indicates whether reproducible builds are requested by the user -
which only is true if SOURCE_DATE_EPOCH is set. This matches the logic
in tstamp which forces the timezone to be UTC and locale to be en_US if
the environment variable is set. I'm not 100% sure this is the right
decision but more than 50% :-).

The method is now also used by <propertyfile> for the timestamp comment
written to the generated file as well. Also the main branch of the
CycloneDX Antlib contains a copy as I wanted the SBOMs to have to option
of being reproducible. <propertyfile> also sets the timezone based on
the boolean flag, the CycloneDX Antlib generates a stable UUID as serial
number for the SBOM as side effect.

Ironically I haven't found a way to use the method in <tstamp> itself as
the logic in this task depends on protected methods that people may have
overwritten.

Stefan

[1] https://reproducible-builds.org/docs/source-date-epoch/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to