ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Build only modified packages with Colcon, ROS2

asked 2018-07-29 21:04:06 -0500

Marc Testier gravatar image


I am using ROS 2 bouncy built from source on Ubuntu 18.04 and I was wondering if there was a command to only build the modified packages with colcon similar to how catkin worked (tell me if I'm wrong ??) on ROS 1 ?

I found the colcon build --packages-select <name-of-pkg> command to only build the selected package and the colcon build --packages-up-to <name-of-pkg> to build the selected package and ALL its dependencies but it will still rebuild things like rclcpp, fastrtps and co...

edit retag flag offensive close merge delete


Which catkin command are you referring to that you want an equivalent for?

Geoff gravatar image Geoff  ( 2018-07-29 21:10:11 -0500 )edit

Haven't use ros 1 in quite some time, but I remember that catkin_make would just build the modified packages ?

Marc Testier gravatar image Marc Testier  ( 2018-07-29 21:16:34 -0500 )edit

catkin_make is different because it invokes CMake only once and within CMake adds the directory of each package. This approach doesn't scale well since it might have colliding target names across packages as well as each package must declared cross packages dependencies.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-07-29 21:52:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-07-29 21:22:09 -0500

Geoff gravatar image

I'm still relatively new to colcon myself, but as I understand it, it does not know what is inside a package other than what build system it uses, and so has no way to know if a package is modified or not. That is up to each package's own build scripts. If each package can skip its own build if there is nothing to do (as most build systems do), then colcon will merely be calling a build script that does nearly nothing and returns. It's not as fast as colcon doing the skipping, but you shouldn't be seeing packages being actually rebuilt when there is nothing changed.

edit flag offensive delete link more


Indeed, I can't reproduce it, the command doesn't rebuild all the packages. I must have make a wrong manipulation at one point that made everything rebuild. Thanks for your time.

Marc Testier gravatar image Marc Testier  ( 2018-07-29 21:51:11 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-07-29 21:04:06 -0500

Seen: 4,379 times

Last updated: Jul 29 '18