aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake/vcpkg_build_cmake.cmake
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2019-04-03 02:16:30 -0700
committerRobert Schumacher <roschuma@microsoft.com>2019-04-03 04:15:00 -0700
commitd788ada4e97ce5b36fc397a94da453814342ec43 (patch)
tree158c36dcfd2cf8514b409a9074e2d526c963458b /scripts/cmake/vcpkg_build_cmake.cmake
parent641e1cd53db09305530130c78ef2b473a52682a1 (diff)
downloadvcpkg-d788ada4e97ce5b36fc397a94da453814342ec43.tar.gz
vcpkg-d788ada4e97ce5b36fc397a94da453814342ec43.zip
[vtk] Fix flakiness by relying on vcpkg-provided dependencies
[libharu] Add patches required for vtk [vcpkg-build-cmake] Add retry logic for mt.exe failures
Diffstat (limited to 'scripts/cmake/vcpkg_build_cmake.cmake')
-rw-r--r--scripts/cmake/vcpkg_build_cmake.cmake29
1 files changed, 28 insertions, 1 deletions
diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake
index 2f0da07f9..e86632c7e 100644
--- a/scripts/cmake/vcpkg_build_cmake.cmake
+++ b/scripts/cmake/vcpkg_build_cmake.cmake
@@ -162,6 +162,33 @@ function(vcpkg_build_cmake)
endif()
endwhile()
endif()
+ elseif(out_contents MATCHES "mt : general error c101008d: ")
+ # Antivirus workaround - occasionally files are locked and cause mt.exe to fail
+ set(ITERATION 0)
+ while (ITERATION LESS 3 AND out_contents MATCHES "mt : general error c101008d: ")
+ MATH(EXPR ITERATION "${ITERATION}+1")
+ message(STATUS "Restarting Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} because of mt.exe file locking issue. Iteration: ${ITERATION}")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS}
+ OUTPUT_FILE "${LOGPREFIX}-out-${ITERATION}.log"
+ ERROR_FILE "${LOGPREFIX}-err-${ITERATION}.log"
+ RESULT_VARIABLE error_code
+ WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE})
+
+ if(error_code)
+ file(READ "${LOGPREFIX}-out-${ITERATION}.log" out_contents)
+ file(READ "${LOGPREFIX}-err-${ITERATION}.log" err_contents)
+
+ if(out_contents)
+ list(APPEND LOGS "${LOGPREFIX}-out-${ITERATION}.log")
+ endif()
+ if(err_contents)
+ list(APPEND LOGS "${LOGPREFIX}-err-${ITERATION}.log")
+ endif()
+ else()
+ break()
+ endif()
+ endwhile()
endif()
if(error_code)
@@ -170,7 +197,7 @@ function(vcpkg_build_cmake)
file(TO_NATIVE_PATH "${LOG}" NATIVE_LOG)
list(APPEND STRINGIFIED_LOGS " ${NATIVE_LOG}\n")
endforeach()
- set(_eb_COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG})
+ set(_eb_COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${PARALLEL_ARG})
set(_eb_WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE})
message(FATAL_ERROR
" Command failed: ${_eb_COMMAND}\n"