-
Notifications
You must be signed in to change notification settings - Fork 60
Added support for parameter generator library #537
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
base: main
Are you sure you want to change the base?
Conversation
cb37edf
to
43158e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
url = "https://github.com/ros/urdfdom_headers/archive/refs/tags/1.0.6.tar.gz", | ||
) | ||
|
||
maybe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an autogenerated file, please move this to e.g. within https://github.com/mvukov/rules_ros2/blob/main/repositories/repositories.bzl#L237.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't realise this was autogenerated. I'll move it over
requirement("Jinja2"), | ||
requirement("typeguard"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to update the req inputs and to regenerate the python lock file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops... What I get for not checking from my test
ros2/parameters.bzl
Outdated
load("@rules_cc//cc:defs.bzl", "cc_library") | ||
load("@rules_python//python:defs.bzl", "py_library") | ||
|
||
def parameter_library(name, parameter_file, cpp_header_name = None, python_file_name = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it's just fine to omit cpp_header_name and python_file_name and have them fixed.
Besides this, please split this macro to cc_ros2_parameter_library and py_ros2_parameter_library.
How is C++ namespace assigned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good question about the namespace! I'm not too sure, but let me see if that's configurable.
I put them together because of how I was using them, but splitting them into two makes a ton more sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I've checked through and the namespace is based on the contents of the parameter file, so if you put the parameters in a my_parameters
dictionary in the yaml file, it will put everything in the my_parameters
namespace. I think you can nest to get more nested namespaces.
ros2/parameters.bzl
Outdated
py = "{}.py".format(name) | ||
else: | ||
py = python_file_name | ||
native.genrule( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also create a python library that has this one as srcs.
I've added some fixes but they're incomplete, I'll re-request a review once I've gotten everything working |
a74cbd2
to
92a2ffd
Compare
Took me a bit of work, but managed to get it working 😄 |
A lot of ROS libraries use
generate_parameter_library
to create parameter definitions with type information. This PR adds a bazel helper to use it and generate corresponding C++ and python libraries.