From 687f4aab11df9b1a854d0d7207c558da545b4cc9 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 18 Jul 2022 22:21:36 +0200 Subject: [PATCH] Save meson logs on failure (#25806) * [vcpkg_configure_meson] Save log files on error * Document SAVE_LOG_FILES option --- .../vcpkg_execute_required_process.md | 9 +++++++++ scripts/cmake/vcpkg_configure_meson.cmake | 17 ++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/maintainers/vcpkg_execute_required_process.md b/docs/maintainers/vcpkg_execute_required_process.md index b00c97260f..7aaf5c45da 100644 --- a/docs/maintainers/vcpkg_execute_required_process.md +++ b/docs/maintainers/vcpkg_execute_required_process.md @@ -13,6 +13,7 @@ vcpkg_execute_required_process( [TIMEOUT ] [OUTPUT_VARIABLE ] [ERROR_VARIABLE ] + [SAVE_LOG_FILES [...]] ) ``` ## Parameters @@ -40,6 +41,14 @@ Optional variable to receive stderr of the command. This should be a unique name for different triplets so that the logs don't conflict when building multiple at once. +### SAVE_LOG_FILES + +Optional files to be moved from the working directory to `${CURRENT_BUILDTREES_DIR}`. +The files are copied even if the process failed. +The target file names are constructed from the `LOGNAME` parameter and the source filename. +If the target file name doesn't end in `.log`, this suffix is appended. +This helps to collect relevant log files in CI setups. + ## Examples * [ffmpeg](https://github.com/Microsoft/vcpkg/blob/master/ports/ffmpeg/portfile.cmake) diff --git a/scripts/cmake/vcpkg_configure_meson.cmake b/scripts/cmake/vcpkg_configure_meson.cmake index e98beefbb2..9056a1099f 100644 --- a/scripts/cmake/vcpkg_configure_meson.cmake +++ b/scripts/cmake/vcpkg_configure_meson.cmake @@ -446,21 +446,12 @@ function(vcpkg_configure_meson) COMMAND ${MESON} ${arg_OPTIONS} ${arg_OPTIONS_${buildtype}} ${arg_SOURCE_PATH} WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}" LOGNAME config-${TARGET_TRIPLET}-${suffix_${buildtype}} + SAVE_LOG_FILES + meson-logs/meson-log.txt + meson-info/intro-dependencies.json + meson-logs/install-log.txt ) - #Copy meson log files into buildtree for CI - if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-logs/meson-log.txt") - file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-logs/meson-log.txt" DESTINATION "${CURRENT_BUILDTREES_DIR}") - file(RENAME "${CURRENT_BUILDTREES_DIR}/meson-log.txt" "${CURRENT_BUILDTREES_DIR}/meson-log-${suffix_${buildtype}}.log") - endif() - if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-info/intro-dependencies.json") - file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-info/intro-dependencies.json" DESTINATION "${CURRENT_BUILDTREES_DIR}") - file(RENAME "${CURRENT_BUILDTREES_DIR}/intro-dependencies.json" "${CURRENT_BUILDTREES_DIR}/intro-dependencies-${suffix_${buildtype}}.log") - endif() - if(EXISTS "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-logs/install-log.txt") - file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}/meson-logs/install-log.txt" DESTINATION "${CURRENT_BUILDTREES_DIR}") - file(RENAME "${CURRENT_BUILDTREES_DIR}/install-log.txt" "${CURRENT_BUILDTREES_DIR}/install-log-${suffix_${buildtype}}.log") - endif() message(STATUS "Configuring ${TARGET_TRIPLET}-${suffix_${buildtype}} done") if(NOT arg_NO_PKG_CONFIG)