2020-07-14 23:50:19 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vcpkg/cmakevars.h>
|
|
|
|
|
|
|
|
namespace vcpkg::Test
|
|
|
|
{
|
|
|
|
struct MockCMakeVarProvider : CMakeVars::CMakeVarProvider
|
|
|
|
{
|
2020-11-28 11:05:47 +08:00
|
|
|
using SMap = std::unordered_map<std::string, std::string>;
|
|
|
|
void load_generic_triplet_vars(Triplet triplet) const override
|
|
|
|
{
|
|
|
|
generic_triplet_vars.emplace(triplet, SMap{});
|
|
|
|
}
|
2020-07-14 23:50:19 +08:00
|
|
|
|
|
|
|
void load_dep_info_vars(Span<const PackageSpec> specs) const override
|
|
|
|
{
|
|
|
|
for (auto&& spec : specs)
|
2020-11-28 11:05:47 +08:00
|
|
|
dep_info_vars.emplace(spec, SMap{});
|
2020-07-14 23:50:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void load_tag_vars(Span<const FullPackageSpec> specs,
|
|
|
|
const PortFileProvider::PortFileProvider& port_provider) const override
|
|
|
|
{
|
|
|
|
for (auto&& spec : specs)
|
2020-11-28 11:05:47 +08:00
|
|
|
tag_vars.emplace(spec.package_spec, SMap{});
|
2020-08-20 06:33:15 +08:00
|
|
|
(void)(port_provider);
|
2020-07-14 23:50:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Optional<const std::unordered_map<std::string, std::string>&> get_generic_triplet_vars(
|
|
|
|
Triplet triplet) const override;
|
|
|
|
|
|
|
|
Optional<const std::unordered_map<std::string, std::string>&> get_dep_info_vars(
|
|
|
|
const PackageSpec& spec) const override;
|
|
|
|
|
|
|
|
Optional<const std::unordered_map<std::string, std::string>&> get_tag_vars(
|
|
|
|
const PackageSpec& spec) const override;
|
|
|
|
|
|
|
|
mutable std::unordered_map<PackageSpec, std::unordered_map<std::string, std::string>> dep_info_vars;
|
|
|
|
mutable std::unordered_map<PackageSpec, std::unordered_map<std::string, std::string>> tag_vars;
|
|
|
|
mutable std::unordered_map<Triplet, std::unordered_map<std::string, std::string>> generic_triplet_vars;
|
|
|
|
};
|
|
|
|
}
|