Skip to content

Commit

Permalink
Add GTIRB_RELEASE_VERSION option
Browse files Browse the repository at this point in the history
This option lets us automatically generate the .dev/-SNAPSHOT suffix
used by the python and java API versions.
  • Loading branch information
bfairservice-gt committed Jan 4, 2022
1 parent 3a0f938 commit cdcff5a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .ci/gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
6 changes: 6 additions & 0 deletions java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.grammatech.gtirb</groupId>
<artifactId>gtirb_api</artifactId>
<version>
@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@
@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@@GTIRB_JAVA_SNAPSHOT_SUFFIX@
</version>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down
6 changes: 6 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/version.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand Down

0 comments on commit cdcff5a

Please sign in to comment.