From 802f51a142283a117bf5bfa3f456493d8a20017d Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 9 Jul 2018 06:29:37 -0700 Subject: [vcpkg] Split vcpkg::Commands::Fetch into backend and frontend --- toolsrc/include/vcpkg/commands.h | 2 -- toolsrc/include/vcpkg/tools.h | 21 +++++++++++++++++++++ toolsrc/include/vcpkg/vcpkgpaths.h | 5 ++++- 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 toolsrc/include/vcpkg/tools.h (limited to 'toolsrc/include') 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 + +#include +#include + +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 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 #include +#include #include #include @@ -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; /// Retrieve a toolset matching a VS version /// @@ -89,10 +91,11 @@ namespace vcpkg private: Lazy> available_triplets; - Cache tool_paths; Lazy> toolsets; Lazy> toolsets_vs2013; fs::path default_vs_path; + + mutable std::unique_ptr m_tool_cache; }; } -- cgit v1.2.3