Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add CMake macro ament_bump_development_version_if_necessary #204

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ament_cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ament_export_dependencies(
"ament_cmake_python"
"ament_cmake_target_dependencies"
"ament_cmake_test"
"ament_cmake_version"
)

ament_package()
1 change: 1 addition & 0 deletions ament_cmake/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<build_export_depend>ament_cmake_python</build_export_depend>
<build_export_depend>ament_cmake_target_dependencies</build_export_depend>
<build_export_depend>ament_cmake_test</build_export_depend>
<build_export_depend>ament_cmake_version</build_export_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
14 changes: 14 additions & 0 deletions ament_cmake_version/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.5)

project(ament_cmake_version NONE)

find_package(ament_cmake_core REQUIRED)

ament_package(
CONFIG_EXTRAS "ament_cmake_version-extras.cmake"
)

install(
DIRECTORY cmake
DESTINATION share/${PROJECT_NAME}
)
21 changes: 21 additions & 0 deletions ament_cmake_version/ament_cmake_version-extras.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2019 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# copied from
# ament_cmake_version/ament_cmake_version-extras.cmake

find_package(ament_cmake_core QUIET REQUIRED)

include(
"${ament_cmake_version_DIR}/ament_bump_development_version_if_necessary.cmake")
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2019 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# Bump the exported package version to the passed version if the package
# version in the manifest is lower.
#
# It is recommended to append the suffix ``-dev`` to the passed upcoming
# version number.
# If the package version in the manifest is equal or newer than the passed
# development version this function call becomes a no op.
dirk-thomas marked this conversation as resolved.
Show resolved Hide resolved
#
# .. note:: It is indirectly calling``ament_package_xml()`` if that hasn't
# happened already.
#
# :param target: development_version
# :type target: string
#
# @public
#
macro(ament_bump_development_version_if_necessary development_version)
wjwwood marked this conversation as resolved.
Show resolved Hide resolved
if(ARGN)
message(FATAL_ERROR
"ament_generate_environment() called with unused arguments: ${ARGN}")
dirk-thomas marked this conversation as resolved.
Show resolved Hide resolved
endif()

if(DEFINED _${PROJECT_NAME}_AMENT_PACKAGE)
message(FATAL_ERROR
"ament_bump_development_version_if_necessary() must be called before "
"ament_package()")
endif()

# call ament_package_xml() if it has not been called before
if(NOT _AMENT_PACKAGE_NAME)
ament_package_xml()
endif()

if("${${PROJECT_NAME}_VERSION}" VERSION_LESS "${development_version}")
message(STATUS
"Override exported package version ${${PROJECT_NAME}_VERSION} with "
dirk-thomas marked this conversation as resolved.
Show resolved Hide resolved
"development version ${development_version}")
set(${PROJECT_NAME}_VERSION "${development_version}")
endif()
endmacro()
17 changes: 17 additions & 0 deletions ament_cmake_version/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>ament_cmake_version</name>
<version>0.8.0</version>
<description>The ability to override the exported package version in the ament buildsystem.</description>
<maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_core</buildtool_depend>

<buildtool_export_depend>ament_cmake_core</buildtool_export_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>