From 385fb523320da4617966e34fcd586beecfcc9014 Mon Sep 17 00:00:00 2001 From: ras0219 <533828+ras0219@users.noreply.github.com> Date: Mon, 13 Jul 2020 13:43:39 -0700 Subject: [vcpkg] Track hashes of cmake script helpers in consuming portfiles (#12254) * [vcpkg] Track hashes of cmake script helpers in consuming portfiles * [vcpkg] Format * [vcpkg_find_acquire_program] Use cpkg_from_sourceforge for FLEX and BISON Co-authored-by: Robert Schumacher --- toolsrc/src/vcpkg/build.cpp | 16 ++++++++++------ toolsrc/src/vcpkg/vcpkgpaths.cpp | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) (limited to 'toolsrc/src') diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index be8004875..a0e138339 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -836,12 +836,16 @@ namespace vcpkg::Build abi_tag_entries.emplace_back("powershell", paths.get_tool_version("powershell-core")); #endif - abi_tag_entries.emplace_back( - "vcpkg_fixup_cmake_targets", - vcpkg::Hash::get_file_hash(VCPKG_LINE_INFO, - fs, - paths.scripts / "cmake" / "vcpkg_fixup_cmake_targets.cmake", - Hash::Algorithm::Sha1)); + auto& helpers = paths.get_cmake_script_hashes(); + auto portfile_contents = + fs.read_contents(port_dir / fs::u8path("portfile.cmake")).value_or_exit(VCPKG_LINE_INFO); + for (auto&& helper : helpers) + { + if (Strings::case_insensitive_ascii_contains(portfile_contents, helper.first)) + { + abi_tag_entries.emplace_back(helper.first, helper.second); + } + } abi_tag_entries.emplace_back("post_build_checks", "2"); std::vector sorted_feature_list = action.feature_list; diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp index 4a9fd7a82..4837c4b71 100644 --- a/toolsrc/src/vcpkg/vcpkgpaths.cpp +++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -90,6 +91,7 @@ namespace vcpkg Lazy> available_triplets; Lazy> toolsets; + Lazy> cmake_script_hashes; Files::Filesystem* fs_ptr; @@ -286,6 +288,26 @@ If you wish to silence this error and use classic mode, you can: }); } + const std::map& VcpkgPaths::get_cmake_script_hashes() const + { + return m_pimpl->cmake_script_hashes.get_lazy([this]() -> std::map { + auto& fs = this->get_filesystem(); + std::map helpers; + auto files = fs.get_files_non_recursive(this->scripts / fs::u8path("cmake")); + auto common_functions = fs::u8path("vcpkg_common_functions"); + for (auto&& file : files) + { + auto stem = file.stem(); + if (stem != common_functions) + { + helpers.emplace(stem.u8string(), + Hash::get_file_hash(VCPKG_LINE_INFO, fs, file, Hash::Algorithm::Sha1)); + } + } + return helpers; + }); + } + const fs::path VcpkgPaths::get_triplet_file_path(Triplet triplet) const { return m_pimpl->m_triplets_cache.get_lazy( -- cgit v1.2.3