diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-11-20 15:23:25 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-11-21 04:20:17 +0100 |
commit | 302548040c48963a24f71c8a4f00e4ed8f470e64 (patch) | |
tree | 073aa5a0c2f6d0e9b9f512f98aeba9d5ff98d3fa /cmake | |
parent | 6b46bc3b7bf77a3bcf3794ec42d72bd4089be196 (diff) |
Be less quiet when cloning or adding worktrees
Since doing either for qtbase and qtdeclarative can take a long time,
and since it's a relevant change to the local file system, log what's
going on.
Swallow output from most git commands unless cmake runs in VERBOSE
mode.
Pick-to: 6.0
Change-Id: I984915689247d6372240744b5bc9183660046084
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtTopLevelHelpers.cmake | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/cmake/QtTopLevelHelpers.cmake b/cmake/QtTopLevelHelpers.cmake index 42f01a14..7de96cdb 100644 --- a/cmake/QtTopLevelHelpers.cmake +++ b/cmake/QtTopLevelHelpers.cmake @@ -120,20 +120,19 @@ endfunction() # does what it says, but also updates submodules function(qt_internal_checkout module revision) + set(swallow_output "") # unless VERBOSE, eat git output, show it in case of error + if (NOT VERBOSE) + list(APPEND swallow_output "OUTPUT_VARIABLE" "git_output" "ERROR_VARIABLE" "git_output") + endif() message(NOTICE "Checking '${module}' out to revision '${revision}'") execute_process( COMMAND "git" "checkout" "${revision}" WORKING_DIRECTORY "./${module}" RESULT_VARIABLE git_result - OUTPUT_VARIABLE git_stdout - ERROR_VARIABLE git_stderr + ${swallow_output} ) - if (VERBOSE) - message(NOTICE ${git_stdout}) - endif() if (git_result) - message(WARNING "${git_stdout}") - message(FATAL_ERROR "Failed to check '${module}' out to '${revision}': ${git_stderr}") + message(FATAL_ERROR "Failed to check '${module}' out to '${revision}': ${git_output}") endif() execute_process( COMMAND "git" "submodule" "update" @@ -146,6 +145,11 @@ endfunction() # clones or creates a worktree for $dependency, using the source of $dependent function(qt_internal_get_dependency dependent dependency) + set(swallow_output "") # unless VERBOSE, eat git output, show it in case of error + if (NOT VERBOSE) + list(APPEND swallow_output "OUTPUT_VARIABLE" "git_output" "ERROR_VARIABLE" "git_output") + endif() + set(gitdir "") set(remote "") @@ -176,31 +180,27 @@ function(qt_internal_get_dependency dependent dependency) if(EXISTS "${gitdir}${dependency}") # for the module we want, there seems to be a clone parallel to what we have - message(DEBUG "Adding worktree for ${dependency} from ${gitdir}${dependency}") + message(NOTICE "Adding worktree for ${dependency} from ${gitdir}${dependency}") execute_process( COMMAND "git" "worktree" "add" "${CMAKE_CURRENT_SOURCE_DIR}/${dependency}" WORKING_DIRECTORY "${gitdir}/${dependency}" RESULT_VARIABLE git_result - OUTPUT_VARIABLE git_stdout - ERROR_VARIABLE git_stderr + ${swallow_output} ) if (git_result) - message(WARNING "${git_stdout}") - message(FATAL_ERROR "Failed to create worktree for '${dependency}': ${git_stderr}") + message(FATAL_ERROR "Failed to check '${module}' out to '${revision}': ${git_output}") endif() else() # we don't find the existing clone, so clone from the saame remote - message(DEBUG "Cloning ${dependency} from ${remote}${dependency}.git") + message(NOTICE "Cloning ${dependency} from ${remote}${dependency}.git") execute_process( COMMAND "git" "clone" "${remote}${dependency}.git" WORKING_DIRECTORY "." RESULT_VARIABLE git_result - OUTPUT_VARIABLE git_stdout - ERROR_VARIABLE git_stderr + ${swallow_output} ) if (git_result) - message(WARNING "${git_stdout}") - message(FATAL_ERROR "Failed to clone '${dependency}': ${git_stderr}") + message(FATAL_ERROR "Failed to check '${module}' out to '${revision}': ${git_output}") endif() endif() endfunction() |