From 00c4ab01b9a359c9c55f9e0b4f7b2505af3a4e06 Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Wed, 11 Mar 2020 08:50:20 -0700 Subject: [PATCH] When CMake fails to download a file, display the error message (#6511) Summary: This helps to diagnose errors in the CMake build where it tries to retrieve dependencies. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6511 Differential Revision: D20387392 Pulled By: pdillinger fbshipit-source-id: 7028dfd62704bcc747f39ff864ea9c9bf51cd1be --- java/CMakeLists.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index b9ab8177f..8c20b34f3 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -327,8 +327,9 @@ if(NOT EXISTS ${JAVA_JUNIT_JAR}) message("Downloading ${JAVA_JUNIT_JAR}") file(DOWNLOAD ${DEPS_URL}/junit-4.12.jar ${JAVA_TMP_JAR} STATUS downloadStatus) list(GET downloadStatus 0 error_code) + list(GET downloadStatus 1 error_message) if(NOT error_code EQUAL 0) - message(FATAL_ERROR "Failed downloading ${JAVA_JUNIT_JAR}") + message(FATAL_ERROR "Failed downloading ${JAVA_JUNIT_JAR}: ${error_message}") endif() file(RENAME ${JAVA_TMP_JAR} ${JAVA_JUNIT_JAR}) endif() @@ -336,8 +337,9 @@ if(NOT EXISTS ${JAVA_HAMCR_JAR}) message("Downloading ${JAVA_HAMCR_JAR}") file(DOWNLOAD ${DEPS_URL}/hamcrest-core-1.3.jar ${JAVA_TMP_JAR} STATUS downloadStatus) list(GET downloadStatus 0 error_code) + list(GET downloadStatus 1 error_message) if(NOT error_code EQUAL 0) - message(FATAL_ERROR "Failed downloading ${JAVA_HAMCR_JAR}") + message(FATAL_ERROR "Failed downloading ${JAVA_HAMCR_JAR}: ${error_message}") endif() file(RENAME ${JAVA_TMP_JAR} ${JAVA_HAMCR_JAR}) endif() @@ -345,8 +347,9 @@ if(NOT EXISTS ${JAVA_MOCKITO_JAR}) message("Downloading ${JAVA_MOCKITO_JAR}") file(DOWNLOAD ${DEPS_URL}/mockito-all-1.10.19.jar ${JAVA_TMP_JAR} STATUS downloadStatus) list(GET downloadStatus 0 error_code) + list(GET downloadStatus 1 error_message) if(NOT error_code EQUAL 0) - message(FATAL_ERROR "Failed downloading ${JAVA_MOCKITO_JAR}") + message(FATAL_ERROR "Failed downloading ${JAVA_MOCKITO_JAR}: ${error_message}") endif() file(RENAME ${JAVA_TMP_JAR} ${JAVA_MOCKITO_JAR}) endif() @@ -354,8 +357,9 @@ if(NOT EXISTS ${JAVA_CGLIB_JAR}) message("Downloading ${JAVA_CGLIB_JAR}") file(DOWNLOAD ${DEPS_URL}/cglib-2.2.2.jar ${JAVA_TMP_JAR} STATUS downloadStatus) list(GET downloadStatus 0 error_code) + list(GET downloadStatus 1 error_message) if(NOT error_code EQUAL 0) - message(FATAL_ERROR "Failed downloading ${JAVA_CGLIB_JAR}") + message(FATAL_ERROR "Failed downloading ${JAVA_CGLIB_JAR}: ${error_message}") endif() file(RENAME ${JAVA_TMP_JAR} ${JAVA_CGLIB_JAR}) endif() @@ -363,8 +367,9 @@ if(NOT EXISTS ${JAVA_ASSERTJ_JAR}) message("Downloading ${JAVA_ASSERTJ_JAR}") file(DOWNLOAD ${DEPS_URL}/assertj-core-1.7.1.jar ${JAVA_TMP_JAR} STATUS downloadStatus) list(GET downloadStatus 0 error_code) + list(GET downloadStatus 1 error_message) if(NOT error_code EQUAL 0) - message(FATAL_ERROR "Failed downloading ${JAVA_ASSERTJ_JAR}") + message(FATAL_ERROR "Failed downloading ${JAVA_ASSERTJ_JAR}: ${error_message}") endif() file(RENAME ${JAVA_TMP_JAR} ${JAVA_ASSERTJ_JAR}) endif()