Save meson logs on failure (#25806)

* [vcpkg_configure_meson] Save log files on error

* Document SAVE_LOG_FILES option
This commit is contained in:
Kai Pastor 2022-07-18 22:21:36 +02:00 committed by GitHub
parent 56cc138c0a
commit 687f4aab11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View File

@ -13,6 +13,7 @@ vcpkg_execute_required_process(
[TIMEOUT <seconds>] [TIMEOUT <seconds>]
[OUTPUT_VARIABLE <var>] [OUTPUT_VARIABLE <var>]
[ERROR_VARIABLE <var>] [ERROR_VARIABLE <var>]
[SAVE_LOG_FILES <relative-path> [<relative-path>...]]
) )
``` ```
## Parameters ## 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. 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 ## Examples
* [ffmpeg](https://github.com/Microsoft/vcpkg/blob/master/ports/ffmpeg/portfile.cmake) * [ffmpeg](https://github.com/Microsoft/vcpkg/blob/master/ports/ffmpeg/portfile.cmake)

View File

@ -446,21 +446,12 @@ function(vcpkg_configure_meson)
COMMAND ${MESON} ${arg_OPTIONS} ${arg_OPTIONS_${buildtype}} ${arg_SOURCE_PATH} COMMAND ${MESON} ${arg_OPTIONS} ${arg_OPTIONS_${buildtype}} ${arg_SOURCE_PATH}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}" WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}"
LOGNAME config-${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") message(STATUS "Configuring ${TARGET_TRIPLET}-${suffix_${buildtype}} done")
if(NOT arg_NO_PKG_CONFIG) if(NOT arg_NO_PKG_CONFIG)