Dynamic version in package.xml
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.
Asked by Timple86 on 2021-05-04 01:05:00 UTC
Answers
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)") else() set(extracted_version ${CMAKE_MATCH_1}) endif() 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.
Asked by gvdhoorn on 2021-05-04 04:14:07 UTC
Comments
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.
Asked by Timple86 on 2021-05-04 05:46:22 UTC
Comments