Re: Do we want to make Ant's build reproducible?

Emmanuel Bourg <[email protected]> Sat, 11 Apr 2026 18:06:28 +0200
Newsgroups gmane.comp.jakarta.ant.devel
Message-ID <[email protected]>
Le 11/04/2026 à 16:44, Stefan Bodewig a écrit :
> Hi all
> 
> https://bz.apache.org/bugzilla/show_bug.cgi?id=61269 is not exactly a
> new issue but I completely forgot about it until Elliotte Rusty Harold
> asked about its state yesterday.
> 
> The issue is "Ant should support reproducible builds" where the request
> is more general than "Ant's own build should be reproducible". For a
> definition of reproducible builds and the things that need to be done,
> see https://reproducible-builds.org/docs/
> 
> For example this defines a SOURCE_DATE_EPOCH environment variable for a
> deterministic timestamp of the build output. <tstamp> already support
> this.
> 
> Given the nature of Ant builds I don't beliieve we can magically make
> arbitrary build processes reproducible but IMHO it would be a good idea
> to enable people to do so and not make it more difficult. Some things
> are already possible today like <zip>'s modificationtime attribute that
> ensures there the resulting archive does not depend on file times (I
> believe it still depends on filesystem traversal order right now).

The entries should be sorted if possible. In Debian there is a post 
build normalization that sorts the entries in the archives [1].


> Ant could even go further and - in the example above - could implicitly
> set <zip>'s modificationtime to the value of SOURCE_DATE_EPOCH if the
> attribute was not set and the environment variable present. In a similar
> way we could use default values for other things (locale in javadoc is
> something the Debian folks set, for example) if the variable is present
> - using it as a signal for "this build should be reproducible".

In Debian I used SOURCE_DATE_EPOCH as a trigger for locale and timezone 
normalization to not deviate too far from Ant upstream, but ideally the 
builds should be reproducible by default. In my opinion any task relying 
on the default locale or timezone should be modified to use default 
values unless the user provides specific values, whether 
SOURCE_DATE_EPOCH is set or not.

Emmanuel Bourg


[1] https://github.com/esoule/strip-nondeterminism