aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/BuildInfo.java
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2017-03-22 17:39:10 +0000
committerGravatar Yue Gan <yueg@google.com>2017-03-23 09:49:34 +0000
commit48631eab923a0a04c27320253dd770a2f545eed7 (patch)
tree094492ff357767dae301a449407c1736158c8bdb /src/main/java/com/google/devtools/build/lib/analysis/BuildInfo.java
parente3ccf8fe9fc1cb1922a55f923398f8064bf1bd04 (diff)
Honor SOURCE_DATE_EPOCH in bootstrapping
Currently, a stamped bazel binary contains the actual timestamp at build time. This means, that building bazel we either include no version information at all, or the binary contains a not reproducible time stamp. Both are not acceptable from the point of view of a downstream maintainer of a bazel package, where the requirement is that the package be reproducible, but the binary still provide sensible version information. Fortunately, there is a suggested standard to solve this problem taking the "current time" from the SOURCE_DATE_EPOCH environment variable, if set, rather than the actual time. See https://reproducible-builds.org/specs/source-date-epoch/. Honor this proposed standard, so that bazel can reasonably be packaged downstream. See issue #2240. Note that we only use the environment variable in our bootstrap script; for bazel itself we communicate that information via an appropriate option. -- Change-Id: I55409a117285b9a3446421179c20f4e8c59088f8 Reviewed-on: https://cr.bazel.build/9467 PiperOrigin-RevId: 150896326 MOS_MIGRATED_REVID=150896326
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/BuildInfo.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/BuildInfo.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BuildInfo.java b/src/main/java/com/google/devtools/build/lib/analysis/BuildInfo.java
index 681818bfc1..7af9837012 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BuildInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BuildInfo.java
@@ -23,7 +23,10 @@ public class BuildInfo {
* Named constants for the BuildInfo keys.
*/
public static final String BUILD_EMBED_LABEL = "BUILD_EMBED_LABEL";
-
+
+ /** Named constant for the reference timestamp to be included. */
+ public static final String SOURCE_DATE_EPOCH = "SOURCE_DATE_EPOCH";
+
/**
* The name of the user that performs the build.
*/