-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build and test commands fail when bzlmod is enabled. #42
Comments
I assume 25e6d80. Interesting, I poked a bit at this and it seems to have to do with the platform transitions on the I've applied the following patch to see if a fully qualified label helps (I also updated skylib, just to be sure this hasn't been fixed in the meantime) diff --git a/MODULE.bazel b/MODULE.bazel
index 782f0c6..d592a79 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -3,7 +3,7 @@ module(
version = "0.3.0",
compatibility_level = 0,
)
-bazel_dep(name = "bazel_skylib", version = "1.2.1")
+bazel_dep(name = "bazel_skylib", version = "1.4.0")
bazel_dep(name = "platforms", version = "0.0.5")
sh_configure = use_extension("//bzlmod:extensions.bzl", "sh_configure")
diff --git a/tests/sh_binaries/sh_binaries_test.bzl b/tests/sh_binaries/sh_binaries_test.bzl
index f9df010..97c8f88 100644
--- a/tests/sh_binaries/sh_binaries_test.bzl
+++ b/tests/sh_binaries/sh_binaries_test.bzl
@@ -916,7 +916,7 @@ def _windows_strip_exe_test_impl(ctx):
windows_strip_exe_test = analysistest.make(
_windows_strip_exe_test_impl,
config_settings = {
- "//command_line_option:platforms": "//tests/sh_binaries:windows",
+ "//command_line_option:platforms": "@rules_sh//tests/sh_binaries:windows",
},
# TODO[AH] The target_under_test should be provided in the exec
# configuration to be sure that the Windows platform check considers the
@@ -958,7 +958,7 @@ def _linux_keep_exe_test_impl(ctx):
linux_keep_exe_test = analysistest.make(
_linux_keep_exe_test_impl,
config_settings = {
- "//command_line_option:platforms": "//tests/sh_binaries:linux",
+ "//command_line_option:platforms": "@rules_sh//tests/sh_binaries:linux",
},
# TODO[AH] The target_under_test should be provided in the exec
# configuration to be sure that the Windows platform check considers the However, this still fails
It looks like this transition is evaluated in the scope of Indeed, if I patch skylib to define the needed platforms and change the tests to use these then these tests pass (while other still fail): diff --git a/BUILD b/BUILD
index 11751a9..00de021 100644
--- a/BUILD
+++ b/BUILD
@@ -4,6 +4,20 @@ licenses(["notice"])
package(default_visibility = ["//visibility:public"])
+platform(
+ name = "linux",
+ constraint_values = [
+ "@platforms//os:linux",
+ ],
+)
+
+platform(
+ name = "windows",
+ constraint_values = [
+ "@platforms//os:windows",
+ ],
+)
+
# buildifier: disable=skylark-comment
# gazelle:exclude skylark_library.bzl
diff --git a/MODULE.bazel b/MODULE.bazel
index 1d18e9a..4b8464c 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -22,8 +22,8 @@ bazel_dep(name = "rules_cc", version = "0.0.2", dev_dependency = True)
# Needed for bazelci and for building distribution tarballs.
# If using an unreleased version of bazel_skylib via git_override, apply
# MODULE.bazel-remove-override.patch to remove the following lines:
-bazel_dep(name = "bazel_skylib_gazelle_plugin", dev_dependency = True)
-local_path_override(
- module_name = "bazel_skylib_gazelle_plugin",
- path = "gazelle",
-) patch to rules_sh diff --git a/MODULE.bazel b/MODULE.bazel
index 782f0c6..417a27e 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -3,7 +3,8 @@ module(
version = "0.3.0",
compatibility_level = 0,
)
-bazel_dep(name = "bazel_skylib", version = "1.2.1")
+bazel_dep(name = "bazel_skylib", version = "1.4.0")
+local_path_override(module_name = "bazel_skylib", path = "/home/aj/tweag.io/bazel/bazel-skylib")
bazel_dep(name = "platforms", version = "0.0.5")
sh_configure = use_extension("//bzlmod:extensions.bzl", "sh_configure")
diff --git a/tests/sh_binaries/sh_binaries_test.bzl b/tests/sh_binaries/sh_binaries_test.bzl
index f9df010..811851a 100644
--- a/tests/sh_binaries/sh_binaries_test.bzl
+++ b/tests/sh_binaries/sh_binaries_test.bzl
@@ -916,7 +916,7 @@ def _windows_strip_exe_test_impl(ctx):
windows_strip_exe_test = analysistest.make(
_windows_strip_exe_test_impl,
config_settings = {
- "//command_line_option:platforms": "//tests/sh_binaries:windows",
+ "//command_line_option:platforms": "@bazel_skylib//:windows",
},
# TODO[AH] The target_under_test should be provided in the exec
# configuration to be sure that the Windows platform check considers the
@@ -958,7 +958,7 @@ def _linux_keep_exe_test_impl(ctx):
linux_keep_exe_test = analysistest.make(
_linux_keep_exe_test_impl,
config_settings = {
- "//command_line_option:platforms": "//tests/sh_binaries:linux",
+ "//command_line_option:platforms": "@bazel_skylib//:linux",
},
# TODO[AH] The target_under_test should be provided in the exec
# configuration to be sure that the Windows platform check considers the |
@z8v thanks to the help from @Wyverald on the Bazel Slack. Wrapping the labels in
respectively should fix the issue. |
I'm closing this now that #44 is merged. |
Describe the bug
The build and test commands fail when bzlmod is enabled.
To Reproduce
Expected behavior
The build should finish without errors.
Environment
The text was updated successfully, but these errors were encountered: