Skip to content

Commit

Permalink
[bazel] Remove local parameter from bare_repository
Browse files Browse the repository at this point in the history
This is no longer used / usable with Bzlmod. Use `override_repo` in the
`MODULE.bazel` instead.

Signed-off-by: James Wainwright <[email protected]>
  • Loading branch information
jwnrt committed Dec 19, 2024
1 parent bee8bc1 commit b3481bd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions rules/repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,14 @@ def http_archive_or_local(local = None, **kwargs):
)

def _bare_repository_impl(rctx):
if rctx.attr.local:
# Although not particularly well documented, the `get_child` function will only add
# the workspace for relative paths, and simply ignore it if given an absolute path.
path = rctx.workspace_root.get_child(rctx.attr.local)

# NOTE By default, Bazel will automatically watch those directories and refetch
# the repository if they change.
for child in path.readdir():
rctx.symlink(child, child.basename)
elif rctx.attr.url:
if rctx.attr.url:
rctx.download_and_extract(
url = rctx.attr.url,
sha256 = rctx.attr.sha256,
stripPrefix = rctx.attr.strip_prefix,
)
else:
fail("Specify a `url` or `local` path")
fail("Specify a `url` path")

for rpath, lpath in rctx.attr.additional_files.items():
rctx.symlink(rctx.path(lpath), rpath)
Expand All @@ -56,7 +47,6 @@ bare_repository = repository_rule(
"url": attr.string(doc = "Location of an archive file (exclusive with `local`)."),
"sha256": attr.string(doc = "SHA256 of the archive."),
"strip_prefix": attr.string(doc = "Prefix to strip when extracting the archive."),
"local": attr.string(doc = "Path to a local subdirectory (exclusive with `url`)."),
"additional_files": attr.string_dict(
doc = "Additional files to place in the repository (mapping repo filename to local file).",
),
Expand Down
2 changes: 0 additions & 2 deletions third_party/tock/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ tock = module_extension(
def _tock_repos():
bare_repository(
name = "tock",
local = None,
strip_prefix = "tock-e81987f6a41e9b92f60fda1d5283f46b3cb597b5",
url = "https://github.com/tock/tock/archive/e81987f6a41e9b92f60fda1d5283f46b3cb597b5.tar.gz",
sha256 = "b7c239f3bd7e7727eee99814661424e1e50587fe9068cec1943a7bb6743ed777",
Expand Down Expand Up @@ -154,7 +153,6 @@ def _tock_repos():

bare_repository(
name = "libtock",
local = None,
strip_prefix = "libtock-rs-a2c6ad80648e3ba073e7433b4330706df052a6ae",
url = "https://github.com/tock/libtock-rs/archive/a2c6ad80648e3ba073e7433b4330706df052a6ae.tar.gz",
sha256 = "888d1925cd760e818385d13187286d6b87f763c548a4dc1bb26e55786dc95636",
Expand Down

0 comments on commit b3481bd

Please sign in to comment.