diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2018-07-09 06:29:37 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-07-09 06:29:37 -0700 |
| commit | 802f51a142283a117bf5bfa3f456493d8a20017d (patch) | |
| tree | ff5d1dc039293ca57ec75f43c5e1a61de68f52a0 /toolsrc/include | |
| parent | 1258c413f62c96aa86af3fbdaed1ef9f7408a520 (diff) | |
| download | vcpkg-802f51a142283a117bf5bfa3f456493d8a20017d.tar.gz vcpkg-802f51a142283a117bf5bfa3f456493d8a20017d.zip | |
[vcpkg] Split vcpkg::Commands::Fetch into backend and frontend
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/vcpkg/commands.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/tools.h | 21 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkgpaths.h | 5 |
3 files changed, 25 insertions, 3 deletions
diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index c6310c340..78b4dda50 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -139,8 +139,6 @@ namespace vcpkg::Commands namespace Fetch { - fs::path get_tool_path(const VcpkgPaths& paths, const std::string& tool); - std::string get_tool_version(const VcpkgPaths& paths, const std::string& tool); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); } diff --git a/toolsrc/include/vcpkg/tools.h b/toolsrc/include/vcpkg/tools.h new file mode 100644 index 000000000..6a096c321 --- /dev/null +++ b/toolsrc/include/vcpkg/tools.h @@ -0,0 +1,21 @@ +#pragma once + +#include <vcpkg/base/files.h> + +#include <string> +#include <utility> + +namespace vcpkg +{ + struct VcpkgPaths; + + struct ToolCache + { + virtual ~ToolCache() {} + + virtual const fs::path& get_tool_path(const VcpkgPaths& paths, const std::string& tool) const = 0; + virtual const std::string& get_tool_version(const VcpkgPaths& paths, const std::string& tool) const = 0; + }; + + std::unique_ptr<ToolCache> get_tool_cache(); +} diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index a3c90fd33..42de40d9c 100644 --- a/toolsrc/include/vcpkg/vcpkgpaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -2,6 +2,7 @@ #include <vcpkg/binaryparagraph.h> #include <vcpkg/packagespec.h> +#include <vcpkg/tools.h> #include <vcpkg/base/cache.h> #include <vcpkg/base/expected.h> @@ -78,6 +79,7 @@ namespace vcpkg fs::path ports_cmake; const fs::path& get_tool_exe(const std::string& tool) const; + const std::string& get_tool_version(const std::string& tool) const; /// <summary>Retrieve a toolset matching a VS version</summary> /// <remarks> @@ -89,10 +91,11 @@ namespace vcpkg private: Lazy<std::vector<std::string>> available_triplets; - Cache<std::string, fs::path> tool_paths; Lazy<std::vector<Toolset>> toolsets; Lazy<std::vector<Toolset>> toolsets_vs2013; fs::path default_vs_path; + + mutable std::unique_ptr<ToolCache> m_tool_cache; }; } |
