From 8c7eb6a5eb53152c8c072dd3a652f53ab59713ba Mon Sep 17 00:00:00 2001 From: Leander Schulten Date: Tue, 11 Apr 2023 16:48:48 +0200 Subject: [PATCH 1/2] Add new ways to report build failures and giving hint messages from portfile.cmake --- .../cmake/vcpkg_fail_with_user_interaction_required.cmake | 4 ++++ scripts/cmake/vcpkg_user_hint_on_failure.cmake | 3 +++ scripts/ports.cmake | 8 ++++++++ 3 files changed, 15 insertions(+) create mode 100644 scripts/cmake/vcpkg_fail_with_user_interaction_required.cmake create mode 100644 scripts/cmake/vcpkg_user_hint_on_failure.cmake diff --git a/scripts/cmake/vcpkg_fail_with_user_interaction_required.cmake b/scripts/cmake/vcpkg_fail_with_user_interaction_required.cmake new file mode 100644 index 00000000000000..25e1ee960ff31c --- /dev/null +++ b/scripts/cmake/vcpkg_fail_with_user_interaction_required.cmake @@ -0,0 +1,4 @@ +function(vcpkg_fail_with_user_interaction_required message) + file(APPEND "${Z_VCPKG_REQUIRED_USER_INTERACTION_ON_BUILD_FAILURE_FILE}" "${message}") + message(FATAL_ERROR "${message}") +endfunction() diff --git a/scripts/cmake/vcpkg_user_hint_on_failure.cmake b/scripts/cmake/vcpkg_user_hint_on_failure.cmake new file mode 100644 index 00000000000000..813ab7b5858759 --- /dev/null +++ b/scripts/cmake/vcpkg_user_hint_on_failure.cmake @@ -0,0 +1,3 @@ +function(vcpkg_user_hint_on_failure message) + file(APPEND "${Z_VCPKG_USER_HINTS_ON_BUILD_FAILURE_FILE}" "${message}\n") +endfunction() diff --git a/scripts/ports.cmake b/scripts/ports.cmake index c9bb4eda089954..34c3347d359274 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -32,6 +32,7 @@ include("${SCRIPTS}/cmake/vcpkg_execute_required_process.cmake") include("${SCRIPTS}/cmake/vcpkg_execute_required_process_repeat.cmake") include("${SCRIPTS}/cmake/vcpkg_extract_source_archive.cmake") include("${SCRIPTS}/cmake/vcpkg_extract_source_archive_ex.cmake") +include("${SCRIPTS}/cmake/vcpkg_fail_with_user_interaction_required.cmake") include("${SCRIPTS}/cmake/vcpkg_fail_port_install.cmake") include("${SCRIPTS}/cmake/vcpkg_find_acquire_program.cmake") include("${SCRIPTS}/cmake/vcpkg_fixup_cmake_targets.cmake") @@ -56,6 +57,7 @@ include("${SCRIPTS}/cmake/vcpkg_list.cmake") include("${SCRIPTS}/cmake/vcpkg_minimum_required.cmake") include("${SCRIPTS}/cmake/vcpkg_replace_string.cmake") include("${SCRIPTS}/cmake/vcpkg_test_cmake.cmake") +include("${SCRIPTS}/cmake/vcpkg_user_hint_on_failure.cmake") include("${SCRIPTS}/cmake/z_vcpkg_apply_patches.cmake") include("${SCRIPTS}/cmake/z_vcpkg_forward_output_variable.cmake") @@ -144,6 +146,12 @@ if(CMD STREQUAL "BUILD") set(Z_VCPKG_ERROR_LOG_COLLECTION_FILE "${CURRENT_BUILDTREES_DIR}/error-logs-${TARGET_TRIPLET}.txt") file(REMOVE "${Z_VCPKG_ERROR_LOG_COLLECTION_FILE}") + set(Z_VCPKG_USER_HINTS_ON_BUILD_FAILURE_FILE "${CURRENT_BUILDTREES_DIR}/user-hints-${TARGET_TRIPLET}.txt") + file(REMOVE "${Z_VCPKG_USER_HINTS_ON_BUILD_FAILURE_FILE}") + + set(Z_VCPKG_REQUIRED_USER_INTERACTION_ON_BUILD_FAILURE_FILE "${CURRENT_BUILDTREES_DIR}/required-user-interaction-${TARGET_TRIPLET}.txt") + file(REMOVE "${Z_VCPKG_REQUIRED_USER_INTERACTION_ON_BUILD_FAILURE_FILE}") + include("${CURRENT_PORT_DIR}/portfile.cmake") if(DEFINED PORT) if(VCPKG_FIXUP_ELF_RPATH) From 2b68116ba4cc33d9edf4a4d8ce6468b34cbff0bc Mon Sep 17 00:00:00 2001 From: Leander Schulten Date: Sun, 23 Apr 2023 02:08:02 +0200 Subject: [PATCH 2/2] use env variable --- scripts/ports.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 34c3347d359274..be10e00d13e84d 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -146,10 +146,7 @@ if(CMD STREQUAL "BUILD") set(Z_VCPKG_ERROR_LOG_COLLECTION_FILE "${CURRENT_BUILDTREES_DIR}/error-logs-${TARGET_TRIPLET}.txt") file(REMOVE "${Z_VCPKG_ERROR_LOG_COLLECTION_FILE}") - set(Z_VCPKG_USER_HINTS_ON_BUILD_FAILURE_FILE "${CURRENT_BUILDTREES_DIR}/user-hints-${TARGET_TRIPLET}.txt") file(REMOVE "${Z_VCPKG_USER_HINTS_ON_BUILD_FAILURE_FILE}") - - set(Z_VCPKG_REQUIRED_USER_INTERACTION_ON_BUILD_FAILURE_FILE "${CURRENT_BUILDTREES_DIR}/required-user-interaction-${TARGET_TRIPLET}.txt") file(REMOVE "${Z_VCPKG_REQUIRED_USER_INTERACTION_ON_BUILD_FAILURE_FILE}") include("${CURRENT_PORT_DIR}/portfile.cmake")