From c05219ff0b3e4fb61be65fbe584a9fafaac6e695 Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Mon, 6 Nov 2023 16:06:10 -0500 Subject: [PATCH] handle stripping of alpha from VERSION string in CMake to simplify CI scripts --- CMakeLists.txt | 4 +++- VERSION | 2 +- VERSION_CPP | 1 - ci/build_python.sh | 9 +++------ ci/build_wheel.sh | 6 ------ ci/release/update-version.sh | 1 - cpp/plugins/cucim.kit.cumed/CMakeLists.txt | 4 +++- cpp/plugins/cucim.kit.cuslide/CMakeLists.txt | 4 +++- python/CMakeLists.txt | 4 +++- 9 files changed, 16 insertions(+), 19 deletions(-) delete mode 100644 VERSION_CPP diff --git a/CMakeLists.txt b/CMakeLists.txt index 837ec0945..ac1aff40e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,9 @@ cmake_minimum_required(VERSION 3.18) # Set VERSION and BUILD unset(VERSION CACHE) -file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/VERSION_CPP VERSION) +file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/VERSION VERSION) +# strip alpha version info +string(REGEX REPLACE "a.*$" "" VERSION ${VERSION}) set(PROJECT_VERSION_BUILD dev) # Append local cmake module path diff --git a/VERSION b/VERSION index a193fff41..bb94af9dd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -23.12.00 +23.12.00a56 diff --git a/VERSION_CPP b/VERSION_CPP deleted file mode 100644 index a193fff41..000000000 --- a/VERSION_CPP +++ /dev/null @@ -1 +0,0 @@ -23.12.00 diff --git a/ci/build_python.sh b/ci/build_python.sh index 52bee7c9e..58d8a8e00 100755 --- a/ci/build_python.sh +++ b/ci/build_python.sh @@ -10,18 +10,15 @@ export CMAKE_GENERATOR=Ninja rapids-print-env package_name="cucim" -package_dir="python/cucim/src" +package_dir="python/cucim" +package_src_dir="${package_dir}/src/${package_name}" version=$(rapids-generate-version) -# for CMake VERSION need to truncate any trailing 'a' -version_cpp=${version%a*} commit=$(git rev-parse HEAD) echo "${version}" > VERSION -echo "${version_cpp}" > "${package_dir}/VERSION" -echo "${version_cpp}" > VERSION_CPP -sed -i "/^__git_commit__/ s/= .*/= \"${commit}\"/g" "${package_dir}/${package_name}/_version.py" +sed -i "/^__git_commit__/ s/= .*/= \"${commit}\"/g" "${package_src_dir}/_version.py" rapids-logger "Begin py build" diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh index 650318d46..a39ebf502 100755 --- a/ci/build_wheel.sh +++ b/ci/build_wheel.sh @@ -15,9 +15,6 @@ source rapids-date-string version=$(rapids-generate-version) commit=$(git rev-parse HEAD) -# for CMake VERSION_CPP need to truncate any trailing 'a' -version_cpp=${version%a*} - RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" # Patch project metadata files to include the CUDA version suffix and version override. @@ -27,8 +24,6 @@ PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}" # update package name to have the cuda suffix sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file} echo "${version}" > VERSION -echo "${version_cpp}" > VERSION_CPP -echo "${version_cpp}" > "${package_dir}/VERSION" sed -i "/^__git_commit__/ s/= .*/= \"${commit}\"/g" "${package_src_dir}/_version.py" if [[ ${PACKAGE_CUDA_SUFFIX} == "-cu12" ]]; then @@ -44,7 +39,6 @@ rapids-dependency-file-generator \ pip install -r build_requirements.txt # First build the C++ lib using CMake via the run script -echo "libcucim version: `cat VERSION_CPP`" ./run build_local all ${CMAKE_BUILD_TYPE} cd "${package_dir}" diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index a4351fb9e..3669c2dda 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -36,7 +36,6 @@ sed_runner 's/release = .*/release = '"'${NEXT_FULL_TAG}'"'/g' docs/source/conf. # Centralized version file update echo "${NEXT_FULL_TAG}" > VERSION -echo "${NEXT_FULL_TAG}" > VERSION_CPP sed_runner "s#\[Version ${CURRENT_LONG_TAG}\](release_notes/v${CURRENT_LONG_TAG}.md)#\[Version ${NEXT_FULL_TAG}\](release_notes/v${NEXT_FULL_TAG}.md)#g" python/cucim/docs/index.md sed_runner "s/v${CURRENT_LONG_TAG}/v${NEXT_FULL_TAG}/g" python/cucim/docs/getting_started/index.md diff --git a/cpp/plugins/cucim.kit.cumed/CMakeLists.txt b/cpp/plugins/cucim.kit.cumed/CMakeLists.txt index 46f61a34d..dc775742d 100644 --- a/cpp/plugins/cucim.kit.cumed/CMakeLists.txt +++ b/cpp/plugins/cucim.kit.cumed/CMakeLists.txt @@ -23,7 +23,9 @@ cmake_minimum_required(VERSION 3.18) # Set VERSION unset(VERSION CACHE) -file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/../../../VERSION_CPP VERSION) +file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/../../../VERSION VERSION) +# strip alpha version info +string(REGEX REPLACE "a.*$" "" VERSION ${VERSION}) # Append local cmake module path list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules") diff --git a/cpp/plugins/cucim.kit.cuslide/CMakeLists.txt b/cpp/plugins/cucim.kit.cuslide/CMakeLists.txt index 4e89df64d..047b5ee61 100644 --- a/cpp/plugins/cucim.kit.cuslide/CMakeLists.txt +++ b/cpp/plugins/cucim.kit.cuslide/CMakeLists.txt @@ -23,7 +23,9 @@ cmake_minimum_required(VERSION 3.18) # Set VERSION unset(VERSION CACHE) -file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/../../../VERSION_CPP VERSION) +file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/../../../VERSION VERSION) +# strip alpha version info +string(REGEX REPLACE "a.*$" "" VERSION ${VERSION}) # Append local cmake module path list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules") diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 502b70241..adbbde7e9 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -23,7 +23,9 @@ cmake_minimum_required(VERSION 3.18) # Set VERSION unset(VERSION CACHE) -file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/../VERSION_CPP VERSION) +file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/../VERSION VERSION) +# strip alpha version info +string(REGEX REPLACE "a.*$" "" VERSION ${VERSION}) # Append local cmake module path list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")