Skip to content

Commit ae129b3

Browse files
authored
fix(build-data): remove CONFIG_MODE from build data (bazel-contrib#3801)
CONFIG_MODE was included in the build data but it is not actively used and can cause issues with reproducibility. Removing it simplifies the build data and improves reproducibility. Closes bazel-contrib#3793
1 parent 10e1f7c commit ae129b3

5 files changed

Lines changed: 2 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ END_UNRELEASED_TEMPLATE
5454

5555
{#v0-0-0-removed}
5656
### Removed
57+
* (build_data) Removed CONFIG_MODE from build data
58+
([#3793](https://github.com/bazel-contrib/rules_python/issues/3793)).
5759
* (coverage) Support for python 3.8 has been dropped from the bundled
5860
`coverage.py` wheel set, since coverage.py 7.6.2 dropped it.
5961

python/private/build_data_writer.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
$OutputPath = $env:OUTPUT
22
$Lines = @(
33
"TARGET $env:TARGET",
4-
"CONFIG_MODE $env:CONFIG_MODE",
54
"STAMPED $env:STAMPED"
65
)
76

python/private/build_data_writer.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/sh
22

33
echo "TARGET $TARGET" >> $OUTPUT
4-
echo "CONFIG_MODE $CONFIG_MODE" >> $OUTPUT
54
echo "STAMPED $STAMPED" >> $OUTPUT
65
if [ -n "$VERSION_FILE" ]; then
76
cat "$VERSION_FILE" >> "$OUTPUT"

python/private/py_executable.bzl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,9 +1578,6 @@ def _write_build_data(ctx):
15781578
executable = action_exe,
15791579
arguments = [action_args],
15801580
env = {
1581-
# Include config mode so that binaries can detect if they're
1582-
# being used as a build tool or not, allowing for runtime optimizations.
1583-
"CONFIG_MODE": "EXEC" if _is_tool_config(ctx) else "TARGET",
15841581
"INFO_FILE": info_file.path if info_file else "",
15851582
"OUTPUT": build_data.path,
15861583
# Include this so it's explicit, otherwise, one has to detect

tests/build_data/build_data_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def test_target_build_data(self):
1515
self.assertIn("BUILD_USER ", build_data)
1616
self.assertIn("BUILD_TIMESTAMP ", build_data)
1717
self.assertIn("FORMATTED_DATE ", build_data)
18-
self.assertIn("CONFIG_MODE TARGET", build_data)
1918
self.assertIn("STAMPED TRUE", build_data)
2019

2120
def test_tool_build_data(self):
@@ -25,7 +24,6 @@ def test_tool_build_data(self):
2524
build_data = fp.read()
2625

2726
self.assertIn("STAMPED FALSE", build_data)
28-
self.assertIn("CONFIG_MODE EXEC", build_data)
2927

3028

3129
unittest.main()

0 commit comments

Comments
 (0)