mvukov / rules_ros2

Build ROS 2 with Bazel
Apache License 2.0
85 stars 47 forks source link

How to build a new plugin using this bazel setup? #114

Closed Naraharirahul closed 1 year ago

Naraharirahul commented 1 year ago

Hi,

I wanted to know which bazel rule I have to use if I want to build a nav2_behaviors plugin developed by myself (not the one provided from upstream). I'm using ros2_plugin() bu I'm getting errors. The wait, backup builds fine with the same rule but somehow if I build something different, it fails.

I want to know if my setup is wrong or I'm not using the right rule or missing something.

Thanks.

mvukov commented 1 year ago

Hello hello, can you create a simple repo where I can reproduce this? And/or post the build log here?

The gist is, as you can see e.g. https://github.com/mvukov/rules_ros2/blob/main/ros2/test/pluginlib/BUILD.bazel#L74-L75 that you add the plugins as data deps of a binary/test/library. Then Bazel machinery can collect it and include it in an ament file tree.

Naraharirahul commented 1 year ago

My bad. I made a silly mistake. That works. Thanks a lot.

mvukov commented 1 year ago

BTW, if you managed to port nav2 to Bazel, feel free to contribute the build files to this repo.