Skip to content

Commit

Permalink
chore: compat with Bazel 5 (#68)
Browse files Browse the repository at this point in the history
The @@ syntax for canonical repo name did not exist
  • Loading branch information
alexeagle authored May 3, 2024
1 parent a3bdec2 commit 4a40fbb
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions aws/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ aws_repositories = repository_rule(
attrs = _ATTRS,
)

def _is_bazel_6_or_greater():
return "apple_binary" not in dir(native)

def _aws_alias_impl(rctx):
rctx.file("BUILD.bazel", """\
load("@bazel_skylib//rules:native_binary.bzl", "native_binary")
Expand All @@ -164,16 +167,16 @@ native_binary(
name = "aws",
src = select(
{{
"@bazel_tools//src/conditions:linux_x86_64": "@@{0}_linux-x86_64//:aws",
"@bazel_tools//src/conditions:linux_aarch64": "@@{0}_linux-aarch64//:aws",
"@bazel_tools//src/conditions:darwin_x86_64": "@@{0}_darwin//:aws",
"@bazel_tools//src/conditions:darwin_arm64": "@@{0}_darwin//:aws",
"@bazel_tools//src/conditions:linux_x86_64": "{0}_linux-x86_64//:aws",
"@bazel_tools//src/conditions:linux_aarch64": "{0}_linux-aarch64//:aws",
"@bazel_tools//src/conditions:darwin_x86_64": "{0}_darwin//:aws",
"@bazel_tools//src/conditions:darwin_arm64": "{0}_darwin//:aws",
}},
),
out = "aws",
visibility = ["//visibility:public"],
)
""".format(rctx.name))
""".format(("@@" if _is_bazel_6_or_greater() else "@") + rctx.name))

aws_alias = repository_rule(
_aws_alias_impl,
Expand Down

0 comments on commit 4a40fbb

Please sign in to comment.