Skip to content

Commit 1490759

Browse files
committed
fix: add missing buildtool_depends and depend in package.xml
Signed-off-by: Parth Patel <[email protected]>
1 parent 485f77a commit 1490759

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

ros2pkg/ros2pkg/resource/ament_cargo/Cargo.toml.em

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ path = "src/main.rs"
1010

1111
[dependencies]
1212
anyhow = {version = "1", features = ["backtrace"]}
13-
rclrs = "0.5"
1413
rosidl_runtime_rs = "0.4"
1514

1615
# This specific version is compatible with Rust 1.75
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
use anyhow::{Error, Result};
2-
use rclrs::*;
1+
use anyhow::Result;
2+
use rclrs::{Context, CreateBasicExecutor, RclrsErrorFilter, SpinOptions};
33

4-
fn main() -> Result<(), Error> {
5-
println!("Hello world @(package_name) package\n");
4+
/// Creates a ROS 2 context and node, prints a hello message,
5+
/// then spins until shutdown.
6+
fn main() -> Result<()> {
7+
let context: Context = Context::default_from_env()?;
8+
let mut executor = context.create_basic_executor();
9+
let _node = executor.create_node("@(node_name)")?;
10+
println!("Hello from @(package_name) package!");
11+
executor.spin(SpinOptions::default()).first_error()?;
612
Ok(())
713
}
814

15+

ros2pkg/ros2pkg/verb/create.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ def get_git_config(key: str) -> Optional[str]:
143143
else:
144144
buildtool_depends = ['ament_cmake']
145145

146+
if args.build_type == 'ament_cargo':
147+
buildtool_depends = ['ament_cargo']
148+
args.dependencies.append('rclrs')
149+
146150
test_dependencies = []
147151
if args.build_type == 'ament_cmake':
148152
test_dependencies = ['ament_lint_auto', 'ament_lint_common']

0 commit comments

Comments
 (0)