Skip to content

Account for features when trying to install binaries#26

Merged
esteve merged 2 commits intoros2-rust:mainfrom
mxgrey:account_for_features
Oct 27, 2025
Merged

Account for features when trying to install binaries#26
esteve merged 2 commits intoros2-rust:mainfrom
mxgrey:account_for_features

Conversation

@mxgrey
Copy link
Contributor

@mxgrey mxgrey commented Oct 9, 2025

While using colcon-ros-cargo with a package that has some feature flags and conditionally compiled binaries, I found that cargo-ament-build was attempting to install every possible binary no matter what and erroring out if that installation fails for any reason. This was causing colcon failures when a binary doesn't get built because its required feature flags weren't active in the colcon build.

This PR fixes the problem by introducing an argument to list the feature flags, defaulting to no features. Before trying to install each binary, we now check whether all of its required feature flags are set. Any binary with required features that are missing simply gets skipped in the installation process.

This immediately fixes the current problem while maintaining a path to support conditionally compiled binaries in the future. Full support for feature flags would need to be introduced in https://github.com/colcon/colcon-ros-cargo

Signed-off-by: Michael X. Grey <greyxmike@gmail.com>
Copy link
Collaborator

@luca-della-vedova luca-della-vedova left a comment

Choose a reason for hiding this comment

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

Makes sense to me, just a small nit, after this is merged we should ticket an issue in colcon-ros-cargo for followup for feature support

src/lib.rs Outdated
Comment on lines 263 to 264
.find(|feature| !features.contains(*feature))
.is_some();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit, I think clippy would say that find([...]).is_some() can be changed into any([...]).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The CI seemed to need a bump, so I went ahead with the suggestion: 00fc7e5

Signed-off-by: Michael X. Grey <greyxmike@gmail.com>
@luca-della-vedova
Copy link
Collaborator

LGTM, will let this sit a few days in case anyone else (i.e. @esteve) wants to have a look before merging

Copy link
Contributor

@esteve esteve left a comment

Choose a reason for hiding this comment

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

@mxgrey thanks for the PR and @luca-della-vedova thanks for the review.

@esteve esteve merged commit cf75194 into ros2-rust:main Oct 27, 2025
20 of 21 checks passed
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.

3 participants