Skip to content

build(vendor): gate test interfaces to tests and doctests - #625

Draft
esteve wants to merge 2 commits into
ros2-rust:mainfrom
esteve:vendored-messages-only-for-tests
Draft

build(vendor): gate test interfaces to tests and doctests#625
esteve wants to merge 2 commits into
ros2-rust:mainfrom
esteve:vendored-messages-only-for-tests

Conversation

@esteve

@esteve esteve commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

This PR avoids including the test_msgs and example_interfaces packages when not building rclrs for testing.

@esteve

esteve commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator Author

This should fix #550 and maybe #616

@esteve
esteve requested review from maspe36 and mxgrey April 13, 2026 21:07
@esteve
esteve force-pushed the vendored-messages-only-for-tests branch 2 times, most recently from 666bf77 to 7ec5352 Compare April 13, 2026 21:09
@esteve
esteve marked this pull request as draft April 13, 2026 21:35
@esteve
esteve removed request for maspe36 and mxgrey April 13, 2026 21:35
@esteve

esteve commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator Author

Back to draft to figure out a better solution.

@esteve
esteve force-pushed the vendored-messages-only-for-tests branch 5 times, most recently from 59f43d6 to d58d085 Compare April 15, 2026 15:52
@esteve
esteve force-pushed the vendored-messages-only-for-tests branch from d58d085 to 373a352 Compare May 16, 2026 17:18
@esteve esteve changed the title build(vendor): add test-only gating metadata for vendored messages fix: cfg-gate message-dependent doctests May 16, 2026
@esteve
esteve force-pushed the vendored-messages-only-for-tests branch 3 times, most recently from e6bf879 to fc89c9f Compare May 17, 2026 17:00
@esteve
esteve force-pushed the vendored-messages-only-for-tests branch from fc89c9f to 04f0e53 Compare June 14, 2026 13:03
@esteve esteve changed the title fix: cfg-gate message-dependent doctests build(vendor): gate test interfaces to tests and doctests Jun 14, 2026
Signed-off-by: Esteve Fernandez <esteve@apache.org>
Signed-off-by: Esteve Fernandez <esteve@apache.org>
@esteve
esteve force-pushed the vendored-messages-only-for-tests branch from 8961be5 to 053a9ad Compare June 14, 2026 15:35
@maspe36

maspe36 commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Any chance someone can provide me with a minimal workspace where this occurs?

I did this

mkdir -p ~/test_ws/src && cd ~/test_ws/
ros2 pkg create --build-type ament_cargo foobin  --destination-directory src
colcon build
ldd build/foobin/debug/foobin | grep -i -E "test_msgs|example_interfaces|test_interface_files"

But there is no linkage to test_msgs or any of the other aforementioned packages. I also then tried to have rclrs in the workspace as a cargo path dependency for foobin

git clone git@github.com:ros2-rust/ros2_rust.git src/ros2_rust
rm -rf build/ log/ install/ .cargo/
sed -i 's|rclrs = "\*"|rclrs = { path = "../ros2_rust/rclrs" }|' src/foobin/Cargo.toml
colcon build
ldd build/foobin/debug/foobin | grep -i -E "test_msgs|example_interfaces|test_interface_files"

And finally I tried making sure rclrs was being patched in by colcon-ros-cargo in .cargo/config.toml

rm -rf build/ log/ install/ .cargo/

# Go back to the default "*" import from the package template
sed -i 's|rclrs = { path = "../ros2_rust/rclrs" }|rclrs = "*"|' src/foobin/Cargo.toml

sed -i '/<\/license>/a\  <depend>rclrs</depend>' src/foobin/package.xml
colcon build
ldd build/foobin/debug/foobin | grep -i -E "test_msgs|example_interfaces|test_interface_files"

But still, I am not seeing any linkage to these debug packages. Maybe I'm missing something but for now I'm not seeing the issue

Comment thread rclrs/src/lib.rs
pub use vendor::*;
pub use vendor::*;
} else {
pub use ros_env::{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that these symbols now live under rclrs:: instead of ros_env::, that goes against the intent of the ros_env crate as the source for all ROS 2 message code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants