Skip to content

Commit 31a9dc1

Browse files
committed
build-bazel-package: added rm of extra local folders for toolchain configuration in latest bazel versions.
This patch updates the set of folders to remove (as they contain non-reproducible nix store hashes) for the bazel fetch stage
1 parent 0654d1d commit 31a9dc1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkgs/build-support/build-bazel-package/default.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ args@{
3030
# [1]: https://github.com/bazelbuild/rules_cc
3131
, removeRulesCC ? true
3232
, removeLocalConfigCc ? true
33+
, removeLocalConfigSh ? true
3334
, removeLocal ? true
3435

3536
# Use build --nobuild instead of fetch. This allows fetching the dependencies
@@ -154,10 +155,16 @@ stdenv.mkDerivation (fBuildAttrs // {
154155
# Remove all built in external workspaces, Bazel will recreate them when building
155156
rm -rf $bazelOut/external/{bazel_tools,\@bazel_tools.marker}
156157
${lib.optionalString removeRulesCC "rm -rf $bazelOut/external/{rules_cc,\\@rules_cc.marker}"}
158+
157159
rm -rf $bazelOut/external/{embedded_jdk,\@embedded_jdk.marker}
158160
${lib.optionalString removeLocalConfigCc "rm -rf $bazelOut/external/{local_config_cc,\\@local_config_cc.marker}"}
159161
${lib.optionalString removeLocal "rm -rf $bazelOut/external/{local_*,\\@local_*.marker}"}
160162
163+
# For bazel version >= 6 with bzlmod.
164+
${lib.optionalString removeLocalConfigCc "rm -rf $bazelOut/external/*[~+]{local_config_cc,local_config_cc.marker}"}
165+
${lib.optionalString removeLocalConfigSh "rm -rf $bazelOut/external/*[~+]{local_config_sh,local_config_sh.marker}"}
166+
${lib.optionalString removeLocal "rm -rf $bazelOut/external/*[~+]{local_jdk,local_jdk.marker}"}
167+
161168
# Clear markers
162169
find $bazelOut/external -name '@*\.marker' -exec sh -c 'echo > {}' \;
163170

0 commit comments

Comments
 (0)