Skip to content

Commit

Permalink
[7.5.0] Remove BUILD.bazel before symlinking when creating new_local_…
Browse files Browse the repository at this point in the history
…repository (#24900)

Fixes #24770

Closes #24887.

PiperOrigin-RevId: 714107497
Change-Id: Ib914aa54b2afa2a90fcce2f2263b9c1b2d2c193c

Commit
6a141ea

Co-authored-by: Dave Roth <[email protected]>
  • Loading branch information
bazel-io and davexroth authored Jan 14, 2025
1 parent bf204b6 commit c427e34
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 c427e34

Please sign in to comment.