Skip to content

Commit

Permalink
Fix compatibility with Bazel 6.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Aug 20, 2024
1 parent d3a2982 commit 6b9c4a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/bcr/go_mod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ local_path_override(
path = "test_dep",
)

bazel_dep(name = "bazel_features", version = "1.14.0")
bazel_dep(name = "protobuf", version = "23.1", repo_name = "my_protobuf")
bazel_dep(name = "rules_go", version = "0.42.0", repo_name = "my_rules_go")
bazel_dep(name = "rules_license", version = "0.0.8")
Expand Down
7 changes: 7 additions & 0 deletions tests/bcr/go_mod/tests.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@bazel_features//:features.bzl", "bazel_features")
load("@rules_license//rules:providers.bzl", "PackageInfo")
load("@rules_testing//lib:analysis_test.bzl", "analysis_test", "test_suite")
load("@rules_testing//lib:truth.bzl", "subjects")
Expand All @@ -14,6 +15,12 @@ def _test_package_info(name):
)

def _test_package_info_impl(env, target):
# The package_info functionality requires REPO.bazel support, which is only
# available in Bazel 7 and higher. Use this unrelated feature launched in
# Bazel 7 as a hacky signal to skip the test if the feature is not
# available.
if not bazel_features.proto.starlark_proto_info:
return
env.expect.that_target(target).has_provider(PackageInfo)
subject = env.expect.that_target(target).provider(PackageInfo)
subject.package_name().equals("github.com/fmeum/dep_on_gazelle")
Expand Down

0 comments on commit 6b9c4a2

Please sign in to comment.