Skip to content

Commit

Permalink
handle stripping of alpha from VERSION string in CMake to simplify CI…
Browse files Browse the repository at this point in the history
… scripts
  • Loading branch information
grlee77 committed Nov 6, 2023
1 parent c8f0968 commit c05219f
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 19 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23.12.00
23.12.00a56
1 change: 0 additions & 1 deletion VERSION_CPP

This file was deleted.

9 changes: 3 additions & 6 deletions ci/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 0 additions & 6 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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}"
Expand Down
1 change: 0 additions & 1 deletion ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion cpp/plugins/cucim.kit.cumed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion cpp/plugins/cucim.kit.cuslide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit c05219f

Please sign in to comment.