cmake: Allow failing to download small suppress files

This commit is contained in:
ZyX 2017-03-31 11:49:18 +03:00
parent 8204eaea7f
commit 24fd125893
2 changed files with 15 additions and 9 deletions

View File

@ -8,9 +8,11 @@ list(GET status 0 status_code)
list(GET status 1 status_string)
if(NOT status_code EQUAL 0)
message(FATAL_ERROR "error: downloading '${URL}' failed
status_code: ${status_code}
status_string: ${status_string}
log: ${log}
")
if(NOT ALLOW_FAILURE)
message(FATAL_ERROR "error: downloading '${URL}' failed
status_code: ${status_code}
status_string: ${status_string}
log: ${log}
")
endif()
endif()

View File

@ -491,21 +491,25 @@ foreach(hfile ${NVIM_HEADERS})
endforeach()
add_custom_target(check-single-includes DEPENDS ${HEADER_CHECK_TARGETS})
function(add_download output url)
function(add_download output url allow_failure)
add_custom_command(
OUTPUT "${output}"
COMMAND ${CMAKE_COMMAND} -DURL=${url} -DFILE=${output} -P ${DOWNLOAD_SCRIPT}
COMMAND
${CMAKE_COMMAND}
-DURL=${url} -DFILE=${output}
-DALLOW_FAILURE=${allow_failure}
-P ${DOWNLOAD_SCRIPT}
DEPENDS ${DOWNLOAD_SCRIPT}
)
endfunction()
add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL})
add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL} off)
foreach(sfile ${LINT_NVIM_SOURCES})
get_test_target("" "${sfile}" r suffix)
set(suppress_file ${LINT_SUPPRESSES_ROOT}/${suffix}.json)
set(suppress_url "${LINT_SUPPRESS_URL_BASE}/${suffix}.json")
add_download(${suppress_file} ${suppress_url})
add_download(${suppress_file} ${suppress_url} on)
set(touch_file "${TOUCHES_DIR}/ran-clint-${suffix}")
add_custom_command(
OUTPUT ${touch_file}