diff options
| author | ras0219 <533828+ras0219@users.noreply.github.com> | 2020-07-13 13:43:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-13 13:43:39 -0700 |
| commit | 385fb523320da4617966e34fcd586beecfcc9014 (patch) | |
| tree | c4a66d3446fa429539c05e7ba1a5f633214dc9d3 /toolsrc/src | |
| parent | 63578d09b00fb2b33ddc0d38685eadbb1a3ffa3a (diff) | |
| download | vcpkg-385fb523320da4617966e34fcd586beecfcc9014.tar.gz vcpkg-385fb523320da4617966e34fcd586beecfcc9014.zip | |
[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 <roschuma@microsoft.com>
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg/build.cpp | 16 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/vcpkgpaths.cpp | 22 |
2 files changed, 32 insertions, 6 deletions
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<std::string> 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 <vcpkg/base/expected.h> #include <vcpkg/base/files.h> +#include <vcpkg/base/hash.h> #include <vcpkg/base/system.debug.h> #include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> @@ -90,6 +91,7 @@ namespace vcpkg Lazy<std::vector<VcpkgPaths::TripletFile>> available_triplets; Lazy<std::vector<Toolset>> toolsets; + Lazy<std::map<std::string, std::string>> 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<std::string, std::string>& VcpkgPaths::get_cmake_script_hashes() const + { + return m_pimpl->cmake_script_hashes.get_lazy([this]() -> std::map<std::string, std::string> { + auto& fs = this->get_filesystem(); + std::map<std::string, std::string> 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( |
