Skip to content

Commit

Permalink
Remove existing BUILD.bazel before symlinking when creating new_local…
Browse files Browse the repository at this point in the history
…_repository

Fixes #24770
  • Loading branch information
davexroth committed Jan 9, 2025
1 parent 9b36f96 commit e75004f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/build_defs/repo/local.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def _new_local_repository_impl(rctx):
rctx.watch(child)

if rctx.attr.build_file != None:
# Remove any existing BUILD.bazel in the repository to ensure
# the symlink to the defined build_file doesn't fail.
rctx.delete("BUILD.bazel")
rctx.symlink(rctx.attr.build_file, "BUILD.bazel")
if rctx.os.name.startswith("windows"):
rctx.watch(rctx.attr.build_file) # same reason as above
Expand Down

0 comments on commit e75004f

Please sign in to comment.