Skip to content
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

Using rules_ros via bzlmod results in invalid label for module extension found #32

Closed
hofbi opened this issue Jul 11, 2024 · 8 comments
Closed

Comments

@hofbi
Copy link
Contributor

hofbi commented Jul 11, 2024

I am adding rules_ros via bzlmod as follows

archive_override(
    module_name = "rules_ros",
    integrity = "sha256-g6LeMe0p/Q9/JTppfPs8G2OIGfU2vwk42262pVrsN4Q=",
    strip_prefix = "rules_ros-049418ec41397080ec2fdff1e76eb7e95d9a0d57",
    urls = "https://github.com/mvukov/rules_ros/archive/049418ec41397080ec2fdff1e76eb7e95d9a0d57.tar.gz",
)

and end up with ERROR: Error computing the main repository mapping: invalid label for module extension found at @@rules_ros~//:MODULE.bazel:56:23: no repo visible as '@rules_python' here

So somehow this line seems to be a problem.

@finn-ball
Copy link
Contributor

What happens if you flip this:

bazel_dep(name = "rules_python", version = "0.33.2", dev_dependency = True)

To this:

bazel_dep(name = "rules_python", version = "0.33.2")

@hofbi
Copy link
Contributor Author

hofbi commented Jul 15, 2024

I already fail in applying the patch

diff --git a/MODULE.bazel b/MODULE.bazel
index 6279b42..28e82b5 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -14,7 +14,7 @@ bazel_dep(name = "platforms", version = "0.0.10")
 bazel_dep(name = "rules_cc", version = "0.0.9")
 bazel_dep(name = "rules_foreign_cc", version = "0.11.1")

-bazel_dep(name = "rules_python", version = "0.33.2", dev_dependency = True)
+bazel_dep(name = "rules_python", version = "0.33.2")

 non_module_ros_repositories = use_extension("//ros:extensions.bzl", "non_module_dependencies")
 use_repo(
archive_override(
    module_name = "rules_ros",
    integrity = "sha256-g6LeMe0p/Q9/JTppfPs8G2OIGfU2vwk42262pVrsN4Q=",
    strip_prefix = "rules_ros-049418ec41397080ec2fdff1e76eb7e95d9a0d57",
    urls = "https://github.com/mvukov/rules_ros/archive/049418ec41397080ec2fdff1e76eb7e95d9a0d57.tar.gz",
    patches = ["//:foo.patch"],
)

Error in patch: Error applying patch ...foo.patch: Cannot find file to patch (near line 3), old file name (a/MODULE.bazel) doesn't exist, new file name (b/MODULE.bazel) doesn't exist.

@finn-ball
Copy link
Contributor

finn-ball commented Jul 15, 2024

I've forgotten the argument off the top of my head you may need to add to the patch command so try and delete the a/ and b/ from the file names.

It may be easier if you create a small repository example.

@hofbi
Copy link
Contributor Author

hofbi commented Jul 15, 2024

Good point. I might contribute an example to https://github.com/mvukov/rules_ros/tree/main/examples which actually consumes rules_ros as module

@finn-ball
Copy link
Contributor

rules_boost has a decent workflow here where they consume their own repository as a local_override in the test/MODULE.bazel

https://github.com/nelhage/rules_boost/tree/master/test

@hofbi
Copy link
Contributor Author

hofbi commented Jul 15, 2024

Good to know. Looks like I already used that to contribute pybind/pybind11_bazel#87.

Btw, you were right. Removing dev dependency fixed the issue. I could reproduce it with the example I am contributing with #33

@hofbi
Copy link
Contributor Author

hofbi commented Jul 15, 2024

Regarding the patch failure, you can use https://github.com/hofbi/rules_ros/tree/patch-fail to reproduce.

# Checkout the branch
cd examples/bzlmod
bazel build //...
# See the patch failure

@mvukov
Copy link
Owner

mvukov commented Aug 21, 2024

Fixed via #43?

@hofbi hofbi closed this as completed Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants