Skip to content

Commit

Permalink
Remove BUILD.bazel before symlinking when creating new_local_repository
Browse files Browse the repository at this point in the history
Fixes #24770

Closes #24887.

PiperOrigin-RevId: 714107497
Change-Id: Ib914aa54b2afa2a90fcce2f2263b9c1b2d2c193c
  • Loading branch information
davexroth authored and copybara-github committed Jan 10, 2025
1 parent b69cba6 commit 6a141ea
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 6a141ea

Please sign in to comment.