-
Notifications
You must be signed in to change notification settings - Fork 164
feat: obtain interface version from cmake variable #191
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
Conversation
Signed-off-by: Daisuke Nishimatsu <[email protected]>
@@ -119,6 +119,7 @@ foreach(dep ${target_dependencies}) | |||
endforeach() | |||
|
|||
set(generator_arguments_file "${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_rs__arguments.json") | |||
set(package_version "${${PROJECT_NAME}_VERSION}") |
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.
Instead of using a separate variable for storing the package version, you can reuse the arguments file and write the value of ${${PROJECT_NAME}_VERSION}
there.
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 appended a package version into a generator argument file in 0c78e27.
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.
sample json
{
"package_name": "action_msgs",
"output_dir": "/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_generator_rs/action_msgs",
"template_dir": "/home/daisuke/workspace/ros2_rust_ws/install/rosidl_generator_rs/share/rosidl_generator_rs/cmake/../resource",
"idl_tuples": [
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs:msg/GoalInfo.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs:msg/GoalStatus.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs:msg/GoalStatusArray.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs:srv/CancelGoal.idl"
],
"ros_interface_files": [
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/msg/GoalInfo.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/msg/GoalStatus.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/msg/GoalStatusArray.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/srv/CancelGoal.idl"
],
"ros_interface_dependencies": [
"builtin_interfaces:/home/daisuke/workspace/ros2_rust_ws/install/builtin_interfaces/share/builtin_interfaces/msg/Duration.idl",
"builtin_interfaces:/home/daisuke/workspace/ros2_rust_ws/install/builtin_interfaces/share/builtin_interfaces/msg/Time.idl",
"unique_identifier_msgs:/opt/ros/humble/share/unique_identifier_msgs/msg/UUID.idl"
],
"target_dependencies": [
"/home/daisuke/workspace/ros2_rust_ws/install/rosidl_generator_rs/share/rosidl_generator_rs/cmake/../../../lib/rosidl_generator_rs/rosidl_generator_rs",
"/home/daisuke/workspace/ros2_rust_ws/install/rosidl_generator_rs/share/rosidl_generator_rs/cmake/../../../local/lib/python3.10/dist-packages/rosidl_generator_rs/__init__.py",
"/home/daisuke/workspace/ros2_rust_ws/install/rosidl_generator_rs/share/rosidl_generator_rs/cmake/../resource/msg.rs.em",
"/home/daisuke/workspace/ros2_rust_ws/install/rosidl_generator_rs/share/rosidl_generator_rs/cmake/../resource/srv.rs.em",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/msg/GoalInfo.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/msg/GoalStatus.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/msg/GoalStatusArray.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/srv/CancelGoal.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/msg/GoalInfo.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/msg/GoalStatus.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/msg/GoalStatusArray.idl",
"/home/daisuke/workspace/ros2_rust_ws/build/action_msgs/rosidl_adapter/action_msgs/srv/CancelGoal.idl",
"/home/daisuke/workspace/ros2_rust_ws/install/builtin_interfaces/share/builtin_interfaces/msg/Duration.idl",
"/home/daisuke/workspace/ros2_rust_ws/install/builtin_interfaces/share/builtin_interfaces/msg/Time.idl",
"/opt/ros/humble/share/unique_identifier_msgs/msg/UUID.idl"
],
"package_version": "1.2.0"
}
@wep21 thanks! My only feedback is about how to pass the package version down to the generator, but apart from that, the PR looks good to me 🙂 |
Signed-off-by: Daisuke Nishimatsu <[email protected]>
@@ -130,6 +130,11 @@ rosidl_write_generator_arguments( | |||
TARGET_DEPENDENCIES ${target_dependencies} | |||
) | |||
|
|||
file(READ ${generator_arguments_file} contents) |
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 just realized that rosidl_write_generator_arguments
can't pass the package version, I'll file a ticket in the rosidl
repo, but for now this code is fine. Thanks!
@wep21 thanks! |
Closes #116