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

Dynamic version in package.xml

asked 2021-05-04 01:05:00 -0600

I am trying to release third-party package. Building the package only requires a package.xml file.

This will increase the maintenance burden of those developers because they have to bump the version in the package.xml file on every release. While the remainder of the project uses (parses) three files version.major, version.minor and version.patch.

How can I uses these files in the package.xml?

Considerations: bloom can use the <version>:{version}</version> notation. But I am not sure this only works when it's a patch. Also this means people cannot clone and build from source using catkin.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-05-04 04:14:07 -0600

gvdhoorn gravatar image

updated 2021-05-04 04:16:51 -0600

No, I don't believe this is supported.

And generating the manifest (or updating it) as part of the build would also not be possible, as it's used before a build is even started.

What I've done in the past is to handle this "in the other direction": see ros-industrial/abb_robot_driver/abb_egm_hardware_interface/CMakeLists.txt for an example:

file(READ "${CMAKE_CURRENT_SOURCE_DIR}/package.xml" package_xml_str)

# Extract project version.
if(NOT package_xml_str MATCHES "<version>([0-9]+.[0-9]+.[0-9]+)</version>")
  message(FATAL_ERROR "Could not parse project version from package manifest (aborting)")
  set(extracted_version ${CMAKE_MATCH_1})

project(... VERSION ${extracted_version} ...)

Probably not acceptable in your case, but it works pretty well and avoids having to update a version nr in multiple places.

edit flag offensive delete link more


That's a neat trick for the other way around. But indeed I don't think that's acceptable in a non-ROS related project.

If catkin wouldn't care about the version tag during crawling (or accept some form of :{version} we might be able to fill it later.

Timple86 gravatar image Timple86  ( 2021-05-04 05:46:22 -0600 )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: 2021-05-04 01:05:00 -0600

Seen: 149 times

Last updated: May 04 '21