File: 0010-reproducible-javadoc-task.patch

package info (click to toggle)
ant 1.10.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 22,560 kB
  • sloc: java: 146,466; xml: 39,751; sh: 504; perl: 135; javascript: 65; python: 53; jsp: 38; makefile: 35
file content (24 lines) | stat: -rw-r--r-- 927 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Description: Improves the reproducibility of the javadoc task for the Debian
 builds by setting the locale to 'en' and the encoding to UTF-8 if none was
 specified and SOURCE_DATE_EPOCH is set.
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: no
--- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
@@ -1807,6 +1807,16 @@
      */
     @Override
     public void execute() throws BuildException {
+        if (System.getenv("SOURCE_DATE_EPOCH") != null) {
+            java.util.List<String> arguments = java.util.Arrays.asList(cmd.getCommandline());
+            if (!arguments.contains("-locale")) {
+                setLocale("en");
+            }
+            if (!arguments.contains("-encoding")) {
+                setEncoding("UTF-8");
+            }
+        }
+
         checkTaskName();
 
         final List<String> packagesToDoc = new Vector<>();