mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-18 20:03:02 +08:00
Use Cache class
This commit is contained in:
parent
ba432c23bc
commit
80f16f769e
@ -3,6 +3,7 @@
|
||||
#include <vcpkg/binaryparagraph.h>
|
||||
#include <vcpkg/packagespec.h>
|
||||
|
||||
#include <vcpkg/base/cache.h>
|
||||
#include <vcpkg/base/expected.h>
|
||||
#include <vcpkg/base/files.h>
|
||||
#include <vcpkg/base/lazy.h>
|
||||
@ -89,7 +90,7 @@ namespace vcpkg
|
||||
|
||||
private:
|
||||
Lazy<std::vector<std::string>> available_triplets;
|
||||
mutable std::map<std::string, fs::path> tool_paths;
|
||||
Cache<std::string, fs::path> tool_paths;
|
||||
Lazy<std::vector<Toolset>> toolsets;
|
||||
Lazy<std::vector<Toolset>> toolsets_vs2013;
|
||||
|
||||
|
@ -91,14 +91,7 @@ namespace vcpkg
|
||||
|
||||
const fs::path& VcpkgPaths::get_tool_exe(const std::string& tool) const
|
||||
{
|
||||
const auto it = this->tool_paths.find(tool);
|
||||
if (it != this->tool_paths.cend())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
|
||||
this->tool_paths[tool] = Commands::Fetch::get_tool_path(*this, tool);
|
||||
return this->tool_paths[tool];
|
||||
return this->tool_paths.get_lazy(tool, [&]() { return Commands::Fetch::get_tool_path(*this, tool); });
|
||||
}
|
||||
|
||||
const Toolset& VcpkgPaths::get_toolset(const Build::PreBuildInfo& prebuildinfo) const
|
||||
|
Loading…
Reference in New Issue
Block a user