-
Notifications
You must be signed in to change notification settings - Fork 200
Re-Export Generated Messages in rclrs #556
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
Open
maspe36
wants to merge
22
commits into
ros2-rust:main
Choose a base branch
from
maspe36:feature/reexport_interface_crates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f95f294
Working example of re-exporting of the generated interface crates fou…
maspe36 bb22553
Swap humble to custom rosidl branch
maspe36 846197d
Swap jazzy to custom rosidl branch
maspe36 8a4d20b
Swap kilted to custom rosidl branch
maspe36 1e3cd47
Swap rolling to custom rosidl branch
maspe36 879c126
- Streamline parts of the build script to get closer to docs.rs builds.
maspe36 116d006
Lets use https instead of ssh?
maspe36 12ce745
Make sure we can build rclrs for rust 1.75!
maspe36 1123657
Be more specific about the pin
maspe36 c5c2917
Make sure we pass `cargo fmt`
maspe36 3d81a99
Refresh the build script to use ament_rs
maspe36 2fefa45
Okay, that was a bad idea, lets go back and make it slightly more ref…
maspe36 5916204
Make sure the changes are formatted with the nightly formatter. Also …
maspe36 a94da35
Turn off some lints locally for unused imports and missing docs.
maspe36 2eae32e
Enable building docs with use_ros_shim feature!
maspe36 79642ac
cargo_toml 0.14 has been yanked. Let's try going to 0.22 now that we'…
maspe36 77830f3
Try to fix the unit tests
maspe36 389d7c8
Fix cargo fmt
maspe36 a9cca62
Use the latest rosidl_rust!
maspe36 e4e9d2c
Move re-export logic from rclrs, to the new ros-env crate.
maspe36 d33186b
Update rosidl_rust version to main
maspe36 642e7f6
Merge branch 'ros2-rust:main' into feature/reexport_interface_crates
maspe36 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,63 +1,52 @@ | ||
| use std::{env, path::Path}; | ||
| const AMENT_PREFIX_PATH: &str = "AMENT_PREFIX_PATH"; | ||
| use ament_rs::search_paths::get_search_paths; | ||
| use std::{env, path::PathBuf}; | ||
|
|
||
| const ROS_DISTRO: &str = "ROS_DISTRO"; | ||
| const KNOWN_DISTROS: &[&str] = &["humble", "jazzy", "kilted", "rolling"]; | ||
|
|
||
| fn get_env_var_or_abort(env_var: &'static str) -> String { | ||
| if let Ok(value) = env::var(env_var) { | ||
| value | ||
| } else { | ||
| panic!( | ||
| "{} environment variable not set - please source ROS 2 installation first.", | ||
| env_var | ||
| ); | ||
| } | ||
| fn get_ros_distro() -> String { | ||
| env::var(ROS_DISTRO) | ||
| .or_else(|_| { | ||
| if env::var("CARGO_FEATURE_USE_ROS_SHIM").is_ok() { | ||
| rustflags::from_env() | ||
| .find_map(|f| match f { | ||
| rustflags::Flag::Cfg { name, value } if name.as_str() == "ros_distro" => { | ||
| value | ||
| } | ||
| _ => None, | ||
| }) | ||
| .ok_or_else(|| "Missing --cfg ros_distro in RUSTFLAGS".to_string()) | ||
| } else { | ||
| Err(format!("Set {ROS_DISTRO} or use ROS shim")) | ||
| } | ||
| }) | ||
| .expect("Failed to determine ROS distro") | ||
| } | ||
|
|
||
| fn main() { | ||
| println!( | ||
| "cargo:rustc-check-cfg=cfg(ros_distro, values(\"{}\"))", | ||
| ["humble", "jazzy", "kilted", "rolling"].join("\", \"") | ||
| KNOWN_DISTROS.join("\", \"") | ||
| ); | ||
| let ros_distro = if let Ok(value) = env::var(ROS_DISTRO) { | ||
| value | ||
| } else { | ||
| cfg_if::cfg_if! { | ||
| if #[cfg(feature="use_ros_shim")] { | ||
| use rustflags; | ||
| // // Look for --cfg ros_distro=<ros_distro> | ||
| for flag in rustflags::from_env() { | ||
| if matches!(flag, rustflags::Flag::Cfg { ref name, value : _ } if name == "ros_distro") { | ||
| if let rustflags::Flag::Cfg {name:_, value: flag_value} = flag { | ||
| println!("cargo:rustc-cfg=ros_distro=\"{}\"", flag_value.unwrap()); | ||
| return; | ||
| } else { | ||
| continue; | ||
| } | ||
| } | ||
| } | ||
| let error_msg = | ||
| "When using the use_ros_shim feature, you must pass the ROS distribution you are targeting as a compiler flag with --cfg ros_distro=\"<ros_distro>\""; | ||
| panic!("{}", error_msg); | ||
| } else { | ||
| let error_msg = | ||
| "ROS_DISTRO environment variable not set - please source ROS 2 installation first."; | ||
| panic!("{}", error_msg); | ||
| } | ||
| } | ||
| }; | ||
| println!("cargo:rustc-cfg=ros_distro=\"{ros_distro}\""); | ||
| println!("cargo:rustc-cfg=ros_distro=\"{}\"", get_ros_distro()); | ||
| println!("cargo:rerun-if-env-changed={ROS_DISTRO}"); | ||
|
|
||
| let ament_prefix_paths = get_search_paths().unwrap_or_default(); | ||
|
|
||
| let ament_prefix_paths = get_env_var_or_abort(AMENT_PREFIX_PATH); | ||
| for ament_prefix_path in ament_prefix_paths.split(':').map(Path::new) { | ||
| for ament_prefix_path in &ament_prefix_paths { | ||
| // Link the native libraries | ||
| let library_path = ament_prefix_path.join("lib"); | ||
| let library_path = PathBuf::from(ament_prefix_path).join("lib"); | ||
| println!("cargo:rustc-link-search=native={}", library_path.display()); | ||
| } | ||
|
|
||
| println!("cargo:rustc-link-lib=dylib=rcl"); | ||
| println!("cargo:rustc-link-lib=dylib=rcl_action"); | ||
| println!("cargo:rustc-link-lib=dylib=rcl_yaml_param_parser"); | ||
| println!("cargo:rustc-link-lib=dylib=rcutils"); | ||
| println!("cargo:rustc-link-lib=dylib=rmw"); | ||
| println!("cargo:rustc-link-lib=dylib=rmw_implementation"); | ||
| [ | ||
| "rcl", | ||
| "rcl_action", | ||
| "rcl_yaml_param_parser", | ||
| "rcutils", | ||
| "rmw", | ||
| "rmw_implementation", | ||
| ] | ||
| .iter() | ||
| .for_each(|lib| println!("cargo:rustc-link-lib=dylib={lib}")); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 will need to be removed before merging. Unfortunately a new release of
cargo-ament-builddepends on ros2-rust/cargo-ament-build#37There 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.
There's a new release of the
cargo-ament-buildplugin (https://crates.io/crates/cargo-ament-build). We now also have Debian packages (https://github.com/ros2-rust/cargo-ament-build/releases/tag/v0.1.11)