vcpkg/toolsrc/include/vcpkg-test/mockcmakevarprovider.h
Robert Schumacher 8db6db5dac
[vcpkg] Further parser improvements (#9895)
* [vcpkg] Consolidate several internal parsers together (packagespecs + logicexpression + control) and enhance error messages

* [vcpkg] Migrate Build-Depends parsing to new framework

* [vcpkg] Fix tests. Re-enable underscores in feature names due to libwebp[vwebp_sdl] -- todo: rename this feature and remove underscores.
2020-02-07 11:24:35 -08:00

39 lines
1.5 KiB
C++

#pragma once
#include <vcpkg/cmakevars.h>
namespace vcpkg::Test
{
struct MockCMakeVarProvider : CMakeVars::CMakeVarProvider
{
void load_generic_triplet_vars(Triplet triplet) const override { generic_triplet_vars[triplet] = {}; }
void load_dep_info_vars(Span<const PackageSpec> specs) const override
{
for (auto&& spec : specs)
dep_info_vars[spec] = {};
}
void load_tag_vars(Span<const FullPackageSpec> specs,
const PortFileProvider::PortFileProvider& port_provider) const override
{
for (auto&& spec : specs)
tag_vars[spec.package_spec] = {};
Util::unused(port_provider);
}
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;
};
}