Skip to content

Commit 4a40fbb

Browse files
authored
chore: compat with Bazel 5 (#68)
The @@ syntax for canonical repo name did not exist
1 parent a3bdec2 commit 4a40fbb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

aws/repositories.bzl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ aws_repositories = repository_rule(
156156
attrs = _ATTRS,
157157
)
158158

159+
def _is_bazel_6_or_greater():
160+
return "apple_binary" not in dir(native)
161+
159162
def _aws_alias_impl(rctx):
160163
rctx.file("BUILD.bazel", """\
161164
load("@bazel_skylib//rules:native_binary.bzl", "native_binary")
@@ -164,16 +167,16 @@ native_binary(
164167
name = "aws",
165168
src = select(
166169
{{
167-
"@bazel_tools//src/conditions:linux_x86_64": "@@{0}_linux-x86_64//:aws",
168-
"@bazel_tools//src/conditions:linux_aarch64": "@@{0}_linux-aarch64//:aws",
169-
"@bazel_tools//src/conditions:darwin_x86_64": "@@{0}_darwin//:aws",
170-
"@bazel_tools//src/conditions:darwin_arm64": "@@{0}_darwin//:aws",
170+
"@bazel_tools//src/conditions:linux_x86_64": "{0}_linux-x86_64//:aws",
171+
"@bazel_tools//src/conditions:linux_aarch64": "{0}_linux-aarch64//:aws",
172+
"@bazel_tools//src/conditions:darwin_x86_64": "{0}_darwin//:aws",
173+
"@bazel_tools//src/conditions:darwin_arm64": "{0}_darwin//:aws",
171174
}},
172175
),
173176
out = "aws",
174177
visibility = ["//visibility:public"],
175178
)
176-
""".format(rctx.name))
179+
""".format(("@@" if _is_bazel_6_or_greater() else "@") + rctx.name))
177180

178181
aws_alias = repository_rule(
179182
_aws_alias_impl,

0 commit comments

Comments
 (0)