diff --git a/.ci/gitlab-ci.yml b/.ci/gitlab-ci.yml index d0042d263..f1ebcb325 100644 --- a/.ci/gitlab-ci.yml +++ b/.ci/gitlab-ci.yml @@ -78,7 +78,9 @@ build-docs: script: - mkdir build - cd build - - cmake ../ -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCPACK_DEBIAN_PACKAGE_RELEASE="$(lsb_release -sc)" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DGTIRB_STRIP_DEBUG_SYMBOLS=On + - RELEASE_VERSION=OFF + - '[[ ! $CI_COMMIT_REF_NAME =~ ^release-.* ]] || RELEASE_VERSION=ON' + - cmake ../ -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCPACK_DEBIAN_PACKAGE_RELEASE="$(lsb_release -sc)" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DGTIRB_STRIP_DEBUG_SYMBOLS=On -DGTIRB_RELEASE_VERSION=$RELEASE_VERSION - make -j - ctest -V diff --git a/CMakeLists.txt b/CMakeLists.txt index 33c826fc8..91c75841d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,12 @@ option(GTIRB_STRIP_DEBUG_SYMBOLS "Whether or not to strip debug symbols and set the build-id." OFF ) +option( + GTIRB_RELEASE_VERSION + "Whether or not to build package versions without dev/SNAPSHOT suffixes. Applies to the python and java APIs." + OFF +) + # Determine whether or not the APIs are REALLY built or not. # === C++ === set(CXX_API ${GTIRB_CXX_API}) diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index c7fed6b0a..7502d40d4 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -42,6 +42,12 @@ endforeach() # --------------------------------------------------------------------------- # Building the gtirb java API # --------------------------------------------------------------------------- +if(GTIRB_RELEASE_VERSION) + set(GTIRB_JAVA_SNAPSHOT_SUFFIX "") +else() + set(GTIRB_JAVA_SNAPSHOT_SUFFIX "-SNAPSHOT") +endif() + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml.in ${CMAKE_CURRENT_BINARY_DIR}/pom.xml @ONLY diff --git a/java/pom.xml.in b/java/pom.xml.in index 9017c9ced..d2783c8b2 100644 --- a/java/pom.xml.in +++ b/java/pom.xml.in @@ -4,7 +4,7 @@ com.grammatech.gtirb gtirb_api - @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@ + @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@@GTIRB_JAVA_SNAPSHOT_SUFFIX@ ${project.groupId}:${project.artifactId} diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 9c7ea9ec1..17ed329d8 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -75,6 +75,12 @@ add_custom_command( "${CMAKE_CURRENT_BINARY_DIR}/tests" ) +if(GTIRB_RELEASE_VERSION) + set(GTIRB_PYTHON_DEV_SUFFIX "") +else() + set(GTIRB_PYTHON_DEV_SUFFIX ".dev") +endif() + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/version.py.in ${CMAKE_CURRENT_BINARY_DIR}/gtirb/version.py @ONLY diff --git a/python/version.py.in b/python/version.py.in index 9f404ac78..d82674c50 100644 --- a/python/version.py.in +++ b/python/version.py.in @@ -4,7 +4,7 @@ API_VERSION = ( "@PROJECT_VERSION_MAJOR@." "@PROJECT_VERSION_MINOR@." "@PROJECT_VERSION_PATCH@" - ".dev" + "@GTIRB_PYTHON_DEV_SUFFIX@" ) # type: str """The semantic version of this API."""