diff options
-rw-r--r-- | Help/manual/cmake-variables.7.rst | 1 | ||||
-rw-r--r-- | Help/manual/ctest.1.rst | 6 | ||||
-rw-r--r-- | Help/release/dev/ctest-run-submodule-sync.rst | 9 | ||||
-rw-r--r-- | Help/release/dev/ep-tls-verify-git.rst | 5 | ||||
-rw-r--r-- | Help/variable/CTEST_GIT_INIT_SUBMODULES.rst | 5 | ||||
-rw-r--r-- | Modules/DartConfiguration.tcl.in | 1 | ||||
-rw-r--r-- | Modules/ExternalProject.cmake | 23 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestGIT.cxx | 47 | ||||
-rw-r--r-- | Source/CTest/cmCTestUpdateCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmParseCoberturaCoverage.cxx | 1 | ||||
-rw-r--r-- | Source/cmFLTKWrapUICommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmInstallCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 15 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 16 | ||||
-rw-r--r-- | Source/cmMakefile.h | 3 | ||||
-rw-r--r-- | Tests/AliasTarget/subdir/CMakeLists.txt | 5 |
19 files changed, 105 insertions, 45 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 5fd5c5c..3f73b32 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -407,6 +407,7 @@ Variables for CTest /variable/CTEST_DROP_SITE_USER /variable/CTEST_EXTRA_COVERAGE_GLOB /variable/CTEST_GIT_COMMAND + /variable/CTEST_GIT_INIT_SUBMODULES /variable/CTEST_GIT_UPDATE_CUSTOM /variable/CTEST_GIT_UPDATE_OPTIONS /variable/CTEST_HG_COMMAND diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 2fdf7f3..1179f56 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -589,6 +589,12 @@ Configuration settings to specify the version control tool include: * `CTest Script`_ variable: :variable:`CTEST_GIT_COMMAND` * :module:`CTest` module variable: ``GITCOMMAND`` +``GITInitSubmodules`` + If set, CTest will update the repository's submodules before updating. + + * `CTest Script`_ variable: :variable:`CTEST_GIT_INIT_SUBMODULES` + * :module:`CTest` module variable: ``CTEST_GIT_INIT_SUBMODULES`` + ``GITUpdateCustom`` Specify a custom command line (as a semicolon-separated list) to run in the source tree (Git work tree) to update it instead of running diff --git a/Help/release/dev/ctest-run-submodule-sync.rst b/Help/release/dev/ctest-run-submodule-sync.rst new file mode 100644 index 0000000..c41cc2f --- /dev/null +++ b/Help/release/dev/ctest-run-submodule-sync.rst @@ -0,0 +1,9 @@ +ctest-run-submodule-sync +------------------------ + +* The :command:`ctest_update` command now looks at the + :variable:`CTEST_GIT_INIT_SUBMODULES` variable to determine whether + submodules should be updated or not before updating. +* The :command:`ctest_update` command will now synchronize submodules on an + update. Updates which add submodules or change a submodule's URL will now be + pulled properly. diff --git a/Help/release/dev/ep-tls-verify-git.rst b/Help/release/dev/ep-tls-verify-git.rst new file mode 100644 index 0000000..3c727de --- /dev/null +++ b/Help/release/dev/ep-tls-verify-git.rst @@ -0,0 +1,5 @@ +ep-tls-verify-git +----------------- + +* The :module:`ExternalProject` module now uses ``TLS_VERIFY`` when fetching + from git repositories. diff --git a/Help/variable/CTEST_GIT_INIT_SUBMODULES.rst b/Help/variable/CTEST_GIT_INIT_SUBMODULES.rst new file mode 100644 index 0000000..fd27003 --- /dev/null +++ b/Help/variable/CTEST_GIT_INIT_SUBMODULES.rst @@ -0,0 +1,5 @@ +CTEST_GIT_INIT_SUBMODULES +------------------------- + +Specify the CTest ``GITInitSubmodules`` setting +in a :manual:`ctest(1)` dashboard client script. diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 2da8354..0ff2eed 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -52,6 +52,7 @@ SVNUpdateOptions: @SVN_UPDATE_OPTIONS@ # Git options GITCommand: @GITCOMMAND@ +GITInitSubmodules: @CTEST_GIT_INIT_SUBMODULES@ GITUpdateOptions: @GIT_UPDATE_OPTIONS@ GITUpdateCustom: @CTEST_GIT_UPDATE_CUSTOM@ diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 1185a81..8d8382f 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -499,7 +499,7 @@ define_property(DIRECTORY PROPERTY "EP_UPDATE_DISCONNECTED" INHERITED "ExternalProject module." ) -function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name git_submodules src_name work_dir gitclone_infofile gitclone_stampfile) +function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name git_submodules src_name work_dir gitclone_infofile gitclone_stampfile tls_verify) file(WRITE ${script_filename} "if(\"${git_tag}\" STREQUAL \"\") message(FATAL_ERROR \"Tag for git checkout should not be empty.\") @@ -524,12 +524,18 @@ if(error_code) message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\") endif() +set(git_options) +if(NOT tls_verify) + list(APPEND git_options + -c http.sslVerify=false) +endif() + # try the clone 3 times incase there is an odd git clone issue set(error_code 1) set(number_of_tries 0) while(error_code AND number_of_tries LESS 3) execute_process( - COMMAND \"${git_EXECUTABLE}\" clone --origin \"${git_remote_name}\" \"${git_repository}\" \"${src_name}\" + COMMAND \"${git_EXECUTABLE}\" \${git_options} clone --origin \"${git_remote_name}\" \"${git_repository}\" \"${src_name}\" WORKING_DIRECTORY \"${work_dir}\" RESULT_VARIABLE error_code ) @@ -544,7 +550,7 @@ if(error_code) endif() execute_process( - COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag} + COMMAND \"${git_EXECUTABLE}\" \${git_options} checkout ${git_tag} WORKING_DIRECTORY \"${work_dir}/${src_name}\" RESULT_VARIABLE error_code ) @@ -553,7 +559,7 @@ if(error_code) endif() execute_process( - COMMAND \"${git_EXECUTABLE}\" submodule init ${git_submodules} + COMMAND \"${git_EXECUTABLE}\" \${git_options} submodule init ${git_submodules} WORKING_DIRECTORY \"${work_dir}/${src_name}\" RESULT_VARIABLE error_code ) @@ -562,7 +568,7 @@ if(error_code) endif() execute_process( - COMMAND \"${git_EXECUTABLE}\" submodule update --recursive ${git_submodules} + COMMAND \"${git_EXECUTABLE}\" \${git_options} submodule update --recursive ${git_submodules} WORKING_DIRECTORY \"${work_dir}/${src_name}\" RESULT_VARIABLE error_code ) @@ -1777,6 +1783,11 @@ function(_ep_add_download_command name) set(git_remote_name "origin") endif() + get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) + if(NOT tls_verify) + set(tls_verify OFF) + endif() + # For the download step, and the git clone operation, only the repository # should be recorded in a configured RepositoryInfo file. If the repo # changes, the clone script should be run again. But if only the tag @@ -1801,7 +1812,7 @@ function(_ep_add_download_command name) # _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir} ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} "${git_submodules}" ${src_name} ${work_dir} - ${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt + ${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt ${tls_verify} ) set(comment "Performing download step (git clone) for '${name}'") set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitclone.cmake) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0214250..fdb85ac 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 5) -set(CMake_VERSION_PATCH 20160401) +set(CMake_VERSION_PATCH 20160406) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index bbb3b9d..1d6bdce 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -273,21 +273,60 @@ bool cmCTestGIT::UpdateImpl() std::string top_dir = this->FindTopDir(); const char* git = this->CommandLineTool.c_str(); const char* recursive = "--recursive"; + const char* sync_recursive = "--recursive"; - // Git < 1.6.5.0 did not support --recursive + // Git < 1.6.5 did not support submodule --recursive if(this->GetGitVersion() < cmCTestGITVersion(1,6,5,0)) { recursive = 0; - // No need to require >= 1.6.5.0 if there are no submodules. + // No need to require >= 1.6.5 if there are no submodules. if(cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) { - this->Log << "Git < 1.6.5.0 cannot update submodules recursively\n"; + this->Log << "Git < 1.6.5 cannot update submodules recursively\n"; + } + } + + // Git < 1.8.1 did not support sync --recursive + if(this->GetGitVersion() < cmCTestGITVersion(1,8,1,0)) + { + sync_recursive = 0; + // No need to require >= 1.8.1 if there are no submodules. + if(cmSystemTools::FileExists((top_dir + "/.gitmodules").c_str())) + { + this->Log << "Git < 1.8.1 cannot synchronize submodules recursively\n"; } } - char const* git_submodule[] = {git, "submodule", "update", recursive, 0}; OutputLogger submodule_out(this->Log, "submodule-out> "); OutputLogger submodule_err(this->Log, "submodule-err> "); + + bool ret; + + std::string init_submodules = + this->CTest->GetCTestConfiguration("GITInitSubmodules"); + if (cmSystemTools::IsOn(init_submodules.c_str())) + { + char const* git_submodule_init[] = {git, "submodule", "init", 0}; + ret = this->RunChild(git_submodule_init, &submodule_out, &submodule_err, + top_dir.c_str()); + + if (!ret) + { + return false; + } + } + + char const* git_submodule_sync[] = {git, "submodule", "sync", + sync_recursive, 0}; + ret = this->RunChild(git_submodule_sync, &submodule_out, &submodule_err, + top_dir.c_str()); + + if (!ret) + { + return false; + } + + char const* git_submodule[] = {git, "submodule", "update", recursive, 0}; return this->RunChild(git_submodule, &submodule_out, &submodule_err, top_dir.c_str()); } diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index dfda9f1..1bf60fc 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -55,6 +55,8 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, + "GITInitSubmodules", "CTEST_GIT_INIT_SUBMODULES", this->Quiet); + this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM", this->Quiet); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "UpdateVersionOnly", "CTEST_UPDATE_VERSION_ONLY", this->Quiet); diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index 3ed5cb0..515d041 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -125,7 +125,6 @@ protected: std::string line; FileLinesType& curFileLines = this->Coverage.TotalCoverage[this->CurFileName]; - curFileLines.push_back(-1); while(cmSystemTools::GetLineFromStream(fin, line)) { curFileLines.push_back(-1); diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index d17d664..c64e813 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -117,7 +117,7 @@ void cmFLTKWrapUICommand::FinalPass() // people should add the srcs to the target themselves, but the old command // didn't support that, so check and see if they added the files in and if // they didn;t then print a warning and add then anyhow - cmTarget* target = this->Makefile->FindTarget(this->Target); + cmTarget* target = this->Makefile->FindLocalNonAliasTarget(this->Target); if(!target) { std::string msg = diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 26a1485..f70f252 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -388,7 +388,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) return false; } // Lookup this target in the current directory. - if(cmTarget* target=this->Makefile->FindTarget(*targetIt)) + if(cmTarget* target=this->Makefile->FindLocalNonAliasTarget(*targetIt)) { // Found the target. Check its type. if(target->GetType() != cmState::EXECUTABLE && diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 3d44fe2..6a944bf 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -448,7 +448,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmGeneratorTarget const* target, void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg) { - this->Target = lg->FindGeneratorTarget(this->TargetName); + this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1be39a9..0195b9e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -485,19 +485,9 @@ private: std::string Name; }; -cmGeneratorTarget* cmLocalGenerator::FindGeneratorTarget( +cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget( const std::string& name) const { - std::map<std::string, std::string>::const_iterator i = - this->AliasTargets.find(name); - if (i != this->AliasTargets.end()) - { - std::vector<cmGeneratorTarget*>::const_iterator ai = - std::find_if(this->GeneratorTargets.begin(), - this->GeneratorTargets.end(), - NamedGeneratorTargetFinder(i->second)); - return *ai; - } std::vector<cmGeneratorTarget*>::const_iterator ti = std::find_if(this->GeneratorTargets.begin(), this->GeneratorTargets.end(), @@ -506,7 +496,6 @@ cmGeneratorTarget* cmLocalGenerator::FindGeneratorTarget( { return *ti; } - return 0; } @@ -1839,7 +1828,7 @@ cmLocalGenerator::FindGeneratorTargetToUse(const std::string& name) const return *imported; } - if(cmGeneratorTarget* t = this->FindGeneratorTarget(name)) + if(cmGeneratorTarget* t = this->FindLocalNonAliasGeneratorTarget(name)) { return t; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 68e7667..b673a85 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -129,7 +129,8 @@ public: void AddImportedGeneratorTarget(cmGeneratorTarget* gt); void AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt); - cmGeneratorTarget* FindGeneratorTarget(const std::string& name) const; + cmGeneratorTarget* + FindLocalNonAliasGeneratorTarget(const std::string& name) const; cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const; /** diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index aa6f7c8..7ca005d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4026,25 +4026,13 @@ std::vector<std::string> cmMakefile::GetPropertyKeys() const return this->StateSnapshot.GetDirectory().GetPropertyKeys(); } -cmTarget* cmMakefile::FindTarget(const std::string& name, - bool excludeAliases) const +cmTarget* cmMakefile::FindLocalNonAliasTarget(const std::string& name) const { - if (!excludeAliases) - { - std::map<std::string, std::string>::const_iterator i = - this->AliasTargets.find(name); - if (i != this->AliasTargets.end()) - { - cmTargets::iterator ai = this->Targets.find(i->second); - return &ai->second; - } - } cmTargets::iterator i = this->Targets.find( name ); if ( i != this->Targets.end() ) { return &i->second; } - return 0; } @@ -4215,7 +4203,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, } // Look for a target built in this directory. - if(cmTarget* t = this->FindTarget(name, excludeAliases)) + if(cmTarget* t = this->FindLocalNonAliasTarget(name)) { return t; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 362ea75..45f2efb 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -388,8 +388,7 @@ public: } std::vector<cmTarget*> GetImportedTargets() const; - cmTarget* FindTarget(const std::string& name, - bool excludeAliases = false) const; + cmTarget* FindLocalNonAliasTarget(const std::string& name) const; /** Find a target to use in place of the given name. The target returned may be imported or built within the project. */ diff --git a/Tests/AliasTarget/subdir/CMakeLists.txt b/Tests/AliasTarget/subdir/CMakeLists.txt index 8c84aea..05a7d86 100644 --- a/Tests/AliasTarget/subdir/CMakeLists.txt +++ b/Tests/AliasTarget/subdir/CMakeLists.txt @@ -1,3 +1,8 @@ add_library(tgt STATIC empty.cpp) add_library(Sub::tgt ALIAS tgt) + +# foo comes from the top-level CMakeLists.txt +add_library(Top::foo ALIAS foo) +get_target_property(some_prop Top::foo SOME_PROP) +target_link_libraries(tgt Top::foo) |