Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable writing volatile bits in Scala statsfile (#11875)
Make Scala targets deterministic by disabling writing milliseconds timestamps into the statsfile. Before (cache disabled) ``` $ n=1; bazel clean; bazel build //libs-scala/adjustable-clock --execution_log_json_file=execlog$n.json; rsync -aL bazel-bin output$n $ n=2; bazel clean; bazel build //libs-scala/adjustable-clock --execution_log_json_file=execlog$n.json; rsync -aL bazel-bin output$n $ diff -u execlog1.json execlog2.json --- execlog1.json 2021-11-25 09:53:45.638891575 +0100 +++ execlog2.json 2021-11-25 10:01:52.831225558 +0100 @@ -311392,7 +311392,7 @@ }, { "path": "bazel-out/k8-opt/bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/scala_version.statsfile", "digest": { - "hash": "1c535baa94812c16d33b6b3dcf2dec8e12b77e3a28cd1280ca2c9678840c4de6", + "hash": "a7f6f1b168649c1c5346ff92c69f0095b68781690e4b3f33321d8f35af8b3d77", "sizeBytes": "16", "hashFunctionName": "SHA-256" } @@ -311705,7 +311705,7 @@ }, { "path": "bazel-out/k8-opt/bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/dependency_analyzer.statsfile", "digest": { - "hash": "b3af662512a906ec56abfb222f43af189b88b00ae0449bd44c25b7e90689c4db", + "hash": "d6c6e2a36754efea4863593a838fbfb500a66e0150d3c3e2e2490ad65c22a2cd", "sizeBytes": "16", "hashFunctionName": "SHA-256" } @@ -312025,7 +312025,7 @@ }, { "path": "bazel-out/k8-opt/bin/libs-scala/adjustable-clock/adjustable-clock.statsfile", "digest": { - "hash": "4326088227e5ecf2c21e76ddb6d77c9692ef1689dd146f65ec1e75c235382251", + "hash": "8a6b23f3c64ce3ff171772808ca0064af52bc145a32d1b6398de124aeb813c97", "sizeBytes": "16", "hashFunctionName": "SHA-256" } $ diff -r output1 output2 diff -ur output1/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/dependency_analyzer.statsfile output2/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/dependency_analyzer.statsfile --- output1/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/dependency_analyzer.statsfile 2021-11-25 09:53:41.706824833 +0100 +++ output2/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/dependency_analyzer.statsfile 2021-11-25 10:01:49.047160467 +0100 @@ -1 +1 @@ -build_time=2507 +build_time=2522 diff -ur output1/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/scala_version.statsfile output2/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/scala_version.statsfile --- output1/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/scala_version.statsfile 2021-11-25 09:53:39.110780774 +0100 +++ output2/bazel-bin/external/io_bazel_rules_scala/third_party/dependency_analyzer/src/main/scala_version.statsfile 2021-11-25 10:01:46.427115402 +0100 @@ -1 +1 @@ -build_time=4162 +build_time=3946 diff -ur output1/bazel-bin/libs-scala/adjustable-clock/adjustable-clock.statsfile output2/bazel-bin/libs-scala/adjustable-clock/adjustable-clock.statsfile --- output1/bazel-bin/libs-scala/adjustable-clock/adjustable-clock.statsfile 2021-11-25 09:53:45.282885532 +0100 +++ output2/bazel-bin/libs-scala/adjustable-clock/adjustable-clock.statsfile 2021-11-25 10:01:52.511220053 +0100 @@ -1 +1 @@ -build_time=3158 +build_time=3100 ``` After (cache disabled) ``` $ n=3; bazel clean; bazel build //libs-scala/adjustable-clock --execution_log_json_file=execlog$n.json; rsync -aL bazel-bin output$n $ n=4; bazel clean; bazel build //libs-scala/adjustable-clock --execution_log_json_file=execlog$n.json; rsync -aL bazel-bin output$n $ diff -u execlog3.json execlog4.json $ diff -ur output3 output4 ``` See bazelbuild/rules_scala#1298 changelog_begin changelog_end Co-authored-by: Andreas Herrmann <[email protected]>
- Loading branch information