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

cpm: always_download now considers patches json entry #353

Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion docs/packages/rapids_cpm_versions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ as needed.

The default value for this field is `false` unless all of the following criteria is met.
- The projects exists in both the default and override files
- The `git_url` or `git_tag` have been overridden
- The `git_url`, `git_tag`, `patches` keys exist in the override

``patches``
An optional list of dictionary sets of git patches to apply to the project
Expand Down
3 changes: 2 additions & 1 deletion rapids-cmake/cpm/detail/package_details.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ function(rapids_cpm_package_details package_name version_var url_var tag_var sha
if(override_json_data)
string(JSON value ERROR_VARIABLE no_url_override GET "${override_json_data}" git_url)
string(JSON value ERROR_VARIABLE no_tag_override GET "${override_json_data}" git_tag)
string(JSON value ERROR_VARIABLE no_patches_override GET "${override_json_data}" patches)
set(git_details_overridden TRUE)
if(no_url_override AND no_tag_override)
if(no_url_override AND no_tag_override AND no_patches_override)
set(git_details_overridden FALSE)
endif()
endif()
Expand Down
3 changes: 2 additions & 1 deletion testing/cpm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2021-2022, NVIDIA CORPORATION.
# Copyright (c) 2021-2023, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,6 +34,7 @@ add_cmake_config_test( cpm_package_override-bad-path.cmake SHOULD_FAIL "rapids_c
add_cmake_config_test( cpm_package_override-before-init.cmake )
add_cmake_config_test( cpm_package_override-empty.cmake )
add_cmake_config_test( cpm_package_override-multiple.cmake )
add_cmake_config_test( cpm_package_override-patches.cmake )
add_cmake_config_test( cpm_package_override-simple.cmake )


Expand Down
47 changes: 47 additions & 0 deletions testing/cpm/cpm_package_override-patches.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#=============================================================================
# Copyright (c) 2023, NVIDIA CORPORATION.
#
# 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.
#=============================================================================
include(${rapids-cmake-dir}/cpm/init.cmake)
include(${rapids-cmake-dir}/cpm/package_override.cmake)

rapids_cpm_init()

# Need to write out an override file
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/override.json
[=[
{
"packages" : {
"rmm" : {
"patches" : [
{
"file" : "rmm_patch_install_rules.diff",
"issue" : "Fake install rule patch file",
"fixed_in" : "39.99.0"
}
]
}
}
}
]=])

rapids_cpm_package_override(${CMAKE_CURRENT_BINARY_DIR}/override.json)

# Verify that the override works
include("${rapids-cmake-dir}/cpm/detail/package_details.cmake")

rapids_cpm_package_details(rmm version repository tag shallow exclude)
if(NOT CPM_DOWNLOAD_ALL)
message(FATAL_ERROR "CPM_DOWNLOAD_ALL should be set to true when an override exists with a patches entry")
endif()