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

Make library attributes visible #128

Merged
merged 6 commits into from
Mar 29, 2021

Conversation

nnmm
Copy link
Contributor

@nnmm nnmm commented Mar 22, 2021

This change was requested in ros2/rclcpp#1452 (comment): have a central place for these attributes instead of duplicating them in rclcpp.

Signed-off-by: Nikolai Morin nikolai.morin@apex.ai

Signed-off-by: Nikolai Morin <nikolai.morin@apex.ai>
@nnmm
Copy link
Contributor Author

nnmm commented Mar 22, 2021

@wjwwood Could you review?

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

I think it would be better if this were exposed via a function(s), but I don't have a strong reason why.

@clalancette @mjeronimo any feedback (as maintainers)?

Copy link
Contributor

@emersonknapp emersonknapp left a comment

Choose a reason for hiding this comment

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

This seems fine - though my personal preference would be to expose a new function find_library_in_path - and keep these implementation details hidden

@clalancette
Copy link
Contributor

This seems fine - though my personal preference would be to expose a new function find_library_in_path - and keep these implementation details hidden

Exposing these details seems pretty ugly. I have to agree with @wjwwood and @emersonknapp that a function would be much nicer here.

@nnmm
Copy link
Contributor Author

nnmm commented Mar 23, 2021

@clalancette @emersonknapp find_library_in_path() does not do what I'm interested in. What rclcpp_generic does is

auto library_path = package_prefix + dynamic_library_folder + rcpputils::kSolibPrefix +
    package_name + "__" + typesupport_identifier + rcpputils::kSolibExtension;

(dynamic_library_folder is also platform-specific, but I assume it's a ROS convention that doesn't generalize)

So the only function that we could extract into here is something like affix_library_name(), which adds the prefix and the extension. Would you prefer that?

@mjeronimo
Copy link
Contributor

It does seem that there is a function or two that wants to come out rather than exposing the platform details. I'm for encapsulating the platform-specifics in the implementation file and providing platform independent functions in the header.

Signed-off-by: Nikolai Morin <nikolai.morin@apex.ai>
@nnmm
Copy link
Contributor Author

nnmm commented Mar 23, 2021

I changed it to expose only a function.

Signed-off-by: Nikolai Morin <nikolai.morin@apex.ai>
Signed-off-by: Nikolai Morin <nikolai.morin@apex.ai>
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Oh, sorry. Can you just add one test to cover this? Should be a simple one.

@nnmm
Copy link
Contributor Author

nnmm commented Mar 23, 2021

@clalancette It is covered by the existing test since I modified find_library_path to use filename_for_library, does that count? Otherwise it's a bit tricky – for an exact test, I'd need to know which platforms this test runs on to construct an expected output, and the test would just be a reimplementation of the function.

@clalancette
Copy link
Contributor

@clalancette It is covered by the existing test since I modified find_library_path to use filename_for_library, does that count?

Oh yeah, that counts. OK, fine by me. I'll add my approval, but you should take care of @emersonknapp 's comments as well.

Signed-off-by: nnmm <nnmmgit@gmail.com>
Signed-off-by: Nikolai Morin <nikolai.morin@apex.ai>
@emersonknapp
Copy link
Contributor

Gist: https://gist.githubusercontent.com/emersonknapp/d8fce7350957a70f43a565b4f7f62c21/raw/b486b71a66a8779f7512fbdf779c11b71c4c5544/ros2.repos
BUILD args: --packages-up-to rcpputils
TEST args: --packages-select rcpputils
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/7987

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@nnmm
Copy link
Contributor Author

nnmm commented Mar 29, 2021

@emersonknapp I assume that means it's good to merge?

@wjwwood
Copy link
Member

wjwwood commented Mar 29, 2021

@emersonknapp I'm gonna merge this so we can move the other pr forward. 👍

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.

5 participants