Skip to content
Snippets Groups Projects
Commit 7d6a0b82 authored by Jean-Christophe Fillion-Robin's avatar Jean-Christophe Fillion-Robin
Browse files

vtkModuleRemote: Report download progress

This is particularly useful to provide feedback while downloading
larger project like VTKExamples.
parent aa26a814
No related merge requests found
Pipeline #
# Function to fetch remote modules.
# Helper to perform the initial git clone and checkout.
function(_git_clone git_executable git_repository git_tag module_dir)
function(_git_clone git_executable git_repository git_tag module_dir git_progress)
set(git_clone_options)
if(git_progress)
list(APPEND git_clone_options --progress)
endif()
execute_process(
COMMAND "${git_executable}" clone "${git_repository}" "${module_dir}"
COMMAND "${git_executable}" clone ${git_clone_options} "${git_repository}" "${module_dir}"
RESULT_VARIABLE error_code
OUTPUT_QUIET
ERROR_VARIABLE git_clone_error
)
if(error_code)
message(FATAL_ERROR "Failed to clone repository: '${git_repository}' Clone error is: '${git_clone_error}'")
message(FATAL_ERROR "Failed to clone repository: '${git_repository}'")
Endif()
execute_process(
......@@ -97,14 +101,14 @@ endfunction()
# Helper function to fetch a module stored in a Git repository.
# Git fetches are only performed when required.
function(_fetch_with_git git_executable git_repository git_tag module_dir)
function(_fetch_with_git git_executable git_repository git_tag module_dir git_progress)
if("${git_tag}" STREQUAL "" OR "${git_repository}" STREQUAL "")
message(FATAL_ERROR "Tag or repository for git checkout should not be empty.")
endif()
# If we don't have a clone yet.
if(NOT EXISTS "${module_dir}")
_git_clone("${git_executable}" "${git_repository}" "${git_tag}" "${module_dir}")
_git_clone("${git_executable}" "${git_repository}" "${git_tag}" "${module_dir}" "${git_progress}")
message(STATUS " The remote module: ${git_repository} is cloned into the directory ${module_dir}")
else() # We already have a clone, but we need to check that it has the right revision.
_git_update("${git_executable}" "${git_repository}" "${git_tag}" "${module_dir}")
......@@ -150,12 +154,14 @@ function(vtk_fetch_module _name _description)
if("${_version}" VERSION_LESS 1.6.6)
message(FATAL_ERROR "Git version 1.6.6 or later is required.")
endif()
set(git_progress 1)
set(_msg "Fetching remote module: ${_name}")
message(STATUS "${_msg}")
_fetch_with_git("${GIT_EXECUTABLE}"
"${_fetch_options_GIT_REPOSITORY}"
"${_fetch_options_GIT_TAG}"
"${VTK_SOURCE_DIR}/Remote/${_name}"
"${git_progress}"
)
message(STATUS "${_msg} - done")
endif()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment