ros-infrastructure / catkin_pkg

Standalone Python library for the catkin build system.
https://github.com/ros/catkin
Other
47 stars 91 forks source link

Catkin ignores packages with COLCON_IGNORE #256

Closed romainreignier closed 5 years ago

romainreignier commented 5 years ago

Thanks to https://github.com/ros-infrastructure/catkin_pkg/pull/226 catkin also skips packages containing COLCON_IGNORE file.

I find it a bit awkward because I wanted to have a git repository with a common pure CMake library, a ROS 1 wrapper and a ROS 2 wrapper.

I thought that adding COLCON_IGNORE file in the ROS 1 wrapper and a CATKIN_INGORE file in the ROS 2 wrapper, I could use the same repository in both ROS 1 and ROS 2 workspace without having to change between branches. As the main code is in the common lib.

I do not know if my use-case is viable enough but making catkin aware of colcon mechanisms does not seem natural to me.

dirk-thomas commented 5 years ago

I find it a bit awkward because I wanted to have a git repository with a common pure CMake library, a ROS 1 wrapper and a ROS 2 wrapper.

The various ignore files are meant to all express the same thing: ignore-by-any-ROS-tools.

I thought that adding COLCON_IGNORE file in the ROS 1 wrapper and a CATKIN_INGORE file in the ROS 2 wrapper, I could use the same repository in both ROS 1 and ROS 2 workspace without having to change between branches.

Since you can easily use colcon for ROS 1 packages as well you can't assume that a specific build tool directly indicates which ROS version you are building.

If you want to make your code for ROS 1 and ROS 2 use the same branch you could instead check in your CMake package if catkin or ament_cmake is available and then do different things in either case. In the package.xml file you likely want to use condition attributes for some dependencies to only enable them in one of the ROS versions (see REP 149).

Just as a note: while this is supposed to work it is certainly something rarely used atm so you might run into problems with a single branch. Feel free to bring them up as you go and we are more than happy to resolve issues where possible.

romainreignier commented 5 years ago

Thank you for your answer @dirk-thomas

Since you can easily use colcon for ROS 1 packages as well you can't assume that a specific build tool directly indicates which ROS version you are building.

That is true and I totally forgot about colcon working on ROS 1. So I agree with you.

If you want to make your code for ROS 1 and ROS 2 use the same branch you could instead check in your CMake package if catkin or ament_cmake is available and then do different things in either case. In the package.xml file you likely want to use condition attributes for some dependencies to only enable them in one of the ROS versions (see REP 149).

This is very interesting. I was not aware of that feature. I will try it.

romainreignier commented 5 years ago

So I have tried it in my demo to use the same library in ROS 1 and ROS 2 and it works.

Thank you