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
This commit is contained in:
Leonardo Romor
2025-01-02 14:11:04 +01:00
parent 0654d1d75d
commit 31a9dc1bc7

View File

@@ -30,6 +30,7 @@ args@{
# [1]: https://github.com/bazelbuild/rules_cc
, removeRulesCC ? true
, removeLocalConfigCc ? true
, removeLocalConfigSh ? true
, removeLocal ? true
# Use build --nobuild instead of fetch. This allows fetching the dependencies
@@ -154,10 +155,16 @@ stdenv.mkDerivation (fBuildAttrs // {
# Remove all built in external workspaces, Bazel will recreate them when building
rm -rf $bazelOut/external/{bazel_tools,\@bazel_tools.marker}
${lib.optionalString removeRulesCC "rm -rf $bazelOut/external/{rules_cc,\\@rules_cc.marker}"}
rm -rf $bazelOut/external/{embedded_jdk,\@embedded_jdk.marker}
${lib.optionalString removeLocalConfigCc "rm -rf $bazelOut/external/{local_config_cc,\\@local_config_cc.marker}"}
${lib.optionalString removeLocal "rm -rf $bazelOut/external/{local_*,\\@local_*.marker}"}
# For bazel version >= 6 with bzlmod.
${lib.optionalString removeLocalConfigCc "rm -rf $bazelOut/external/*[~+]{local_config_cc,local_config_cc.marker}"}
${lib.optionalString removeLocalConfigSh "rm -rf $bazelOut/external/*[~+]{local_config_sh,local_config_sh.marker}"}
${lib.optionalString removeLocal "rm -rf $bazelOut/external/*[~+]{local_jdk,local_jdk.marker}"}
# Clear markers
find $bazelOut/external -name '@*\.marker' -exec sh -c 'echo > {}' \;