diff --git a/toolsrc/include/vcpkg-test/util.h b/toolsrc/include/vcpkg-test/util.h index 5170c846a77141..d2c512f9bf0eae 100644 --- a/toolsrc/include/vcpkg-test/util.h +++ b/toolsrc/include/vcpkg-test/util.h @@ -64,6 +64,12 @@ namespace vcpkg::Test const char* depends = "", const char* triplet = "x86-windows"); + extern const Triplet X86_WINDOWS; + extern const Triplet X64_WINDOWS; + extern const Triplet X86_UWP; + extern const Triplet ARM_UWP; + extern const Triplet X64_ANDROID; + /// /// Map of source control files by their package name. /// @@ -71,7 +77,7 @@ namespace vcpkg::Test { std::unordered_map map; Triplet triplet; - PackageSpecMap(Triplet t = Triplet::X86_WINDOWS) noexcept : triplet(t) { } + PackageSpecMap(Triplet t = X86_WINDOWS) noexcept : triplet(t) { } PackageSpec emplace(const char* name, const char* depends = "", diff --git a/toolsrc/include/vcpkg/tools.h b/toolsrc/include/vcpkg/tools.h index b57ca2918919b9..d5c0a5c23db572 100644 --- a/toolsrc/include/vcpkg/tools.h +++ b/toolsrc/include/vcpkg/tools.h @@ -9,6 +9,21 @@ namespace vcpkg { struct VcpkgPaths; + namespace Tools + { + static const std::string SEVEN_ZIP = "7zip"; + static const std::string SEVEN_ZIP_ALT = "7z"; + static const std::string MAVEN = "mvn"; + static const std::string CMAKE = "cmake"; + static const std::string GIT = "git"; + static const std::string MONO = "mono"; + static const std::string NINJA = "ninja"; + static const std::string NUGET = "nuget"; + static const std::string IFW_INSTALLER_BASE = "ifw_installerbase"; + static const std::string IFW_BINARYCREATOR = "ifw_binarycreator"; + static const std::string IFW_REPOGEN = "ifw_repogen"; + } + struct ToolCache { virtual ~ToolCache() { } diff --git a/toolsrc/include/vcpkg/triplet.h b/toolsrc/include/vcpkg/triplet.h index 736b22a2d11b14..42d99dc3e12f1c 100644 --- a/toolsrc/include/vcpkg/triplet.h +++ b/toolsrc/include/vcpkg/triplet.h @@ -3,13 +3,12 @@ #include #include -#include - #include namespace vcpkg { struct TripletInstance; + struct VcpkgCmdArguments; struct Triplet { @@ -18,20 +17,6 @@ namespace vcpkg static Triplet from_canonical_name(std::string&& triplet_as_string); - static const Triplet X86_WINDOWS; - static const Triplet X64_WINDOWS; - static const Triplet ARM_WINDOWS; - static const Triplet ARM64_WINDOWS; - static const Triplet X86_UWP; - static const Triplet X64_UWP; - static const Triplet ARM_UWP; - static const Triplet ARM64_UWP; - - static const Triplet ARM_ANDROID; - static const Triplet ARM64_ANDROID; - static const Triplet X86_ANDROID; - static const Triplet X64_ANDROID; - const std::string& canonical_name() const; const std::string& to_string() const; void to_string(std::string& out) const; diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index 594407c4b32194..721b59606943f2 100644 --- a/toolsrc/include/vcpkg/vcpkgpaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -4,30 +4,11 @@ #include #include #include +#include #include -#include -#include -#include -#include - namespace vcpkg { - namespace Tools - { - static const std::string SEVEN_ZIP = "7zip"; - static const std::string SEVEN_ZIP_ALT = "7z"; - static const std::string MAVEN = "mvn"; - static const std::string CMAKE = "cmake"; - static const std::string GIT = "git"; - static const std::string MONO = "mono"; - static const std::string NINJA = "ninja"; - static const std::string NUGET = "nuget"; - static const std::string IFW_INSTALLER_BASE = "ifw_installerbase"; - static const std::string IFW_BINARYCREATOR = "ifw_binarycreator"; - static const std::string IFW_REPOGEN = "ifw_repogen"; - } - struct ToolsetArchOption { CStringView name; @@ -61,6 +42,11 @@ namespace vcpkg struct VcpkgPathsImpl; } + struct BinaryParagraph; + struct VcpkgCmdArguments; + struct PackageSpec; + struct Triplet; + struct VcpkgPaths : Util::MoveOnlyBase { struct TripletFile diff --git a/toolsrc/src/vcpkg-test/binarycaching.cpp b/toolsrc/src/vcpkg-test/binarycaching.cpp index a8204f9c2add0e..55532d14df3409 100644 --- a/toolsrc/src/vcpkg-test/binarycaching.cpp +++ b/toolsrc/src/vcpkg-test/binarycaching.cpp @@ -11,6 +11,8 @@ #include +#include + using namespace vcpkg; TEST_CASE ("reformat_version semver-ish", "[reformat_version]") @@ -65,7 +67,7 @@ Build-Depends: bzip REQUIRE(maybe_scf.has_value()); SourceControlFileLocation scfl{std::move(*maybe_scf.get()), fs::path()}; - Dependencies::InstallPlanAction ipa(PackageSpec{"zlib2", Triplet::X64_WINDOWS}, + Dependencies::InstallPlanAction ipa(PackageSpec{"zlib2", Test::X64_WINDOWS}, scfl, Dependencies::RequestType::USER_REQUESTED, {{"a", {}}, {"b", {}}}); @@ -177,7 +179,7 @@ Description: a spiffy compression library wrapper REQUIRE(maybe_scf.has_value()); SourceControlFileLocation scfl{std::move(*maybe_scf.get()), fs::path()}; plan.install_actions.push_back(Dependencies::InstallPlanAction()); - plan.install_actions[0].spec = PackageSpec("zlib", Triplet::X64_ANDROID); + plan.install_actions[0].spec = PackageSpec("zlib", Test::X64_ANDROID); plan.install_actions[0].source_control_file_location = scfl; plan.install_actions[0].abi_info = Build::AbiInfo{}; plan.install_actions[0].abi_info.get()->package_abi = "packageabi"; @@ -200,7 +202,7 @@ Description: a spiffy compression library wrapper REQUIRE(maybe_scf2.has_value()); SourceControlFileLocation scfl2{std::move(*maybe_scf2.get()), fs::path()}; plan.install_actions.push_back(Dependencies::InstallPlanAction()); - plan.install_actions[1].spec = PackageSpec("zlib2", Triplet::X64_ANDROID); + plan.install_actions[1].spec = PackageSpec("zlib2", Test::X64_ANDROID); plan.install_actions[1].source_control_file_location = scfl2; plan.install_actions[1].abi_info = Build::AbiInfo{}; plan.install_actions[1].abi_info.get()->package_abi = "packageabi2"; diff --git a/toolsrc/src/vcpkg-test/dependencies.cpp b/toolsrc/src/vcpkg-test/dependencies.cpp index 1951a612883ece..ef39bd1efb63fb 100644 --- a/toolsrc/src/vcpkg-test/dependencies.cpp +++ b/toolsrc/src/vcpkg-test/dependencies.cpp @@ -33,12 +33,12 @@ TEST_CASE ("filter depends", "[dependencies]") auto deps_ = parse_dependencies_list("liba (!uwp), libb, libc (uwp)"); REQUIRE(deps_); auto& deps = *deps_.get(); - auto v = filter_dependencies(deps, Triplet::X64_WINDOWS, x64_win_cmake_vars); + auto v = filter_dependencies(deps, Test::X64_WINDOWS, x64_win_cmake_vars); REQUIRE(v.size() == 2); REQUIRE(v.at(0).package_spec.name() == "liba"); REQUIRE(v.at(1).package_spec.name() == "libb"); - auto v2 = filter_dependencies(deps, Triplet::ARM_UWP, arm_uwp_cmake_vars); + auto v2 = filter_dependencies(deps, Test::ARM_UWP, arm_uwp_cmake_vars); REQUIRE(v.size() == 2); REQUIRE(v2.at(0).package_spec.name() == "libb"); REQUIRE(v2.at(1).package_spec.name() == "libc"); @@ -101,7 +101,7 @@ TEST_CASE ("resolve_deps_as_top_level", "[dependencies]") var_provider.dep_info_vars[{"a", t_linux}].emplace("VCPKG_CMAKE_SYSTEM_NAME", "Linux"); { auto deps = vcpkg::Dependencies::resolve_deps_as_top_level( - *spec_map.map.at("a").source_control_file, Triplet::X86_WINDOWS, {}, var_provider); + *spec_map.map.at("a").source_control_file, Test::X86_WINDOWS, {}, var_provider); REQUIRE(deps.size() == 1); REQUIRE(deps.at(0) == spec_b); } @@ -114,7 +114,7 @@ TEST_CASE ("resolve_deps_as_top_level", "[dependencies]") { // without defaults auto deps = vcpkg::Dependencies::resolve_deps_as_top_level( - *spec_map.map.at("c").source_control_file, Triplet::X86_WINDOWS, {}, var_provider); + *spec_map.map.at("c").source_control_file, Test::X86_WINDOWS, {}, var_provider); REQUIRE(deps.size() == 1); REQUIRE(deps.at(0) == spec_b); } @@ -122,21 +122,21 @@ TEST_CASE ("resolve_deps_as_top_level", "[dependencies]") { // with defaults of c (c1) auto deps = vcpkg::Dependencies::resolve_deps_as_top_level( - *spec_map.map.at("c").source_control_file, Triplet::X86_WINDOWS, {"default"}, var_provider); + *spec_map.map.at("c").source_control_file, Test::X86_WINDOWS, {"default"}, var_provider); REQUIRE(deps.size() == 1); REQUIRE(deps.at(0) == spec_b_with_b1); } { // with c1 auto deps = vcpkg::Dependencies::resolve_deps_as_top_level( - *spec_map.map.at("c").source_control_file, Triplet::X86_WINDOWS, {"c1"}, var_provider); + *spec_map.map.at("c").source_control_file, Test::X86_WINDOWS, {"c1"}, var_provider); REQUIRE(deps.size() == 1); REQUIRE(deps.at(0) == spec_b_with_b1); } { // with c2 implying c1 auto deps = vcpkg::Dependencies::resolve_deps_as_top_level( - *spec_map.map.at("c").source_control_file, Triplet::X86_WINDOWS, {"c2"}, var_provider); + *spec_map.map.at("c").source_control_file, Test::X86_WINDOWS, {"c2"}, var_provider); REQUIRE(deps.size() == 2); REQUIRE(deps.at(0) == spec_a); REQUIRE(deps.at(1) == spec_b_with_b1); @@ -144,7 +144,7 @@ TEST_CASE ("resolve_deps_as_top_level", "[dependencies]") { // d -> c[core] auto deps = vcpkg::Dependencies::resolve_deps_as_top_level( - *spec_map.map.at("d").source_control_file, Triplet::X86_WINDOWS, {}, var_provider); + *spec_map.map.at("d").source_control_file, Test::X86_WINDOWS, {}, var_provider); REQUIRE(deps.size() == 1); REQUIRE(deps.at(0) == spec_c); } diff --git a/toolsrc/src/vcpkg-test/manifests.cpp b/toolsrc/src/vcpkg-test/manifests.cpp index 4b450b7be5614c..95a0b149b16663 100644 --- a/toolsrc/src/vcpkg-test/manifests.cpp +++ b/toolsrc/src/vcpkg-test/manifests.cpp @@ -5,6 +5,7 @@ #include #include +#include #include diff --git a/toolsrc/src/vcpkg-test/plan.cpp b/toolsrc/src/vcpkg-test/plan.cpp index 09c377ecc1da57..55c6740da40acf 100644 --- a/toolsrc/src/vcpkg-test/plan.cpp +++ b/toolsrc/src/vcpkg-test/plan.cpp @@ -28,7 +28,7 @@ using Test::PackageSpecMap; static void features_check(Dependencies::InstallPlanAction& plan, std::string pkg_name, std::vector expected_features, - Triplet triplet = Triplet::X86_WINDOWS) + Triplet triplet = Test::X86_WINDOWS) { const auto& feature_list = plan.feature_list; @@ -54,7 +54,7 @@ static void features_check(Dependencies::InstallPlanAction& plan, /// static void remove_plan_check(Dependencies::RemovePlanAction& plan, std::string pkg_name, - Triplet triplet = Triplet::X86_WINDOWS) + Triplet triplet = Test::X86_WINDOWS) { REQUIRE(plan.spec.triplet().to_string() == triplet.to_string()); REQUIRE(pkg_name == plan.spec.name()); @@ -381,14 +381,14 @@ TEST_CASE ("basic feature test 8", "[plan]") std::vector> status_paragraphs; status_paragraphs.push_back(make_status_pgh("a")); status_paragraphs.push_back(make_status_pgh("a")); - status_paragraphs.back()->package.spec = PackageSpec("a", Triplet::X64_WINDOWS); + status_paragraphs.back()->package.spec = PackageSpec("a", Test::X64_WINDOWS); - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}}; auto spec_b_64 = FullPackageSpec{spec_map.emplace("b")}; auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; - spec_map.triplet = Triplet::X86_WINDOWS; + spec_map.triplet = Test::X86_WINDOWS; auto spec_a_86 = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}}; auto spec_b_86 = FullPackageSpec{spec_map.emplace("b")}; auto spec_c_86 = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; @@ -401,14 +401,14 @@ TEST_CASE ("basic feature test 8", "[plan]") {spec_c_64, spec_a_86, spec_a_64, spec_c_86}, StatusParagraphs(std::move(status_paragraphs))); - remove_plan_check(plan.remove_actions.at(0), "a", Triplet::X64_WINDOWS); + remove_plan_check(plan.remove_actions.at(0), "a", Test::X64_WINDOWS); remove_plan_check(plan.remove_actions.at(1), "a"); auto& install_plan = plan.install_actions; - features_check(install_plan.at(0), "b", {"core"}, Triplet::X64_WINDOWS); - features_check(install_plan.at(1), "a", {"a1", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(0), "b", {"core"}, Test::X64_WINDOWS); + features_check(install_plan.at(1), "a", {"a1", "core"}, Test::X64_WINDOWS); features_check(install_plan.at(2), "b", {"core"}); features_check(install_plan.at(3), "a", {"a1", "core"}); - features_check(install_plan.at(4), "c", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.at(4), "c", {"core"}, Test::X64_WINDOWS); features_check(install_plan.at(5), "c", {"core"}); } @@ -416,10 +416,10 @@ TEST_CASE ("install all features test", "[plan]") { std::vector> status_paragraphs; - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}), {"core"}}; - auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a[*]", Test::X64_WINDOWS); REQUIRE(install_specs.has_value()); if (!install_specs.has_value()) return; @@ -432,7 +432,7 @@ TEST_CASE ("install all features test", "[plan]") StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 1); - features_check(install_plan.install_actions.at(0), "a", {"0", "1", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "a", {"0", "1", "core"}, Test::X64_WINDOWS); } TEST_CASE ("install default features test 1", "[plan]") @@ -440,11 +440,11 @@ TEST_CASE ("install default features test 1", "[plan]") std::vector> status_paragraphs; // Add a port "a" with default features "1" and features "0" and "1". - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}, {"1"}); // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -456,23 +456,23 @@ TEST_CASE ("install default features test 1", "[plan]") // Expect the default feature "1" to be installed, but not "0" REQUIRE(install_plan.size() == 1); - features_check(install_plan.install_actions.at(0), "a", {"1", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "a", {"1", "core"}, Test::X64_WINDOWS); } TEST_CASE ("install default features test 2", "[plan]") { std::vector> status_paragraphs; status_paragraphs.push_back(make_status_pgh("a")); - status_paragraphs.back()->package.spec = PackageSpec("a", Triplet::X64_WINDOWS); + status_paragraphs.back()->package.spec = PackageSpec("a", Test::X64_WINDOWS); // Add a port "a" of which "core" is already installed, but we will // install the default features "explicitly" // "a" has two features, of which "a1" is default. - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "", {{"a0", ""}, {"a1", ""}}, {"a1"}); // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -485,8 +485,8 @@ TEST_CASE ("install default features test 2", "[plan]") // Expect "a" to get removed for rebuild and then installed with default // features. REQUIRE(install_plan.size() == 2); - remove_plan_check(install_plan.remove_actions.at(0), "a", Triplet::X64_WINDOWS); - features_check(install_plan.install_actions.at(0), "a", {"a1", "core"}, Triplet::X64_WINDOWS); + remove_plan_check(install_plan.remove_actions.at(0), "a", Test::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "a", {"a1", "core"}, Test::X64_WINDOWS); } TEST_CASE ("install default features test 3", "[plan]") @@ -494,11 +494,11 @@ TEST_CASE ("install default features test 3", "[plan]") std::vector> status_paragraphs; // "a" has two features, of which "a1" is default. - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "", {{"a0", ""}, {"a1", ""}}, {"a1"}); // Explicitly install "a" without default features - auto install_specs = FullPackageSpec::from_string("a[core]", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a[core]", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -510,7 +510,7 @@ TEST_CASE ("install default features test 3", "[plan]") // Expect the default feature not to get installed. REQUIRE(install_plan.size() == 1); - features_check(install_plan.install_actions.at(0), "a", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "a", {"core"}, Test::X64_WINDOWS); } TEST_CASE ("install default features of dependency test 1", "[plan]") @@ -518,13 +518,13 @@ TEST_CASE ("install default features of dependency test 1", "[plan]") std::vector> status_paragraphs; // Add a port "a" which depends on the core of "b" - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "b[core]"); // "b" has two features, of which "b1" is default. spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -536,8 +536,8 @@ TEST_CASE ("install default features of dependency test 1", "[plan]") // Expect "a" to get installed and defaults of "b" through the dependency, // as no explicit features of "b" are installed by the user. REQUIRE(install_plan.size() == 2); - features_check(install_plan.install_actions.at(0), "b", {"b1", "core"}, Triplet::X64_WINDOWS); - features_check(install_plan.install_actions.at(1), "a", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "b", {"b1", "core"}, Test::X64_WINDOWS); + features_check(install_plan.install_actions.at(1), "a", {"core"}, Test::X64_WINDOWS); } TEST_CASE ("do not install default features of dependency test 1", "[plan]") @@ -545,14 +545,14 @@ TEST_CASE ("do not install default features of dependency test 1", "[plan]") std::vector> status_paragraphs; // Add a port "a" which depends on the core of "b" - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "b[core]"); // "b" has two features, of which "b1" is default. spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); // Install "a" (without explicit feature specification) - auto spec_a = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); - auto spec_b = FullPackageSpec::from_string("b[core]", Triplet::X64_WINDOWS); + auto spec_a = FullPackageSpec::from_string("a", Test::X64_WINDOWS); + auto spec_b = FullPackageSpec::from_string("b[core]", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -565,8 +565,8 @@ TEST_CASE ("do not install default features of dependency test 1", "[plan]") // Expect "a" to get installed and defaults of "b" through the dependency, // as no explicit features of "b" are installed by the user. REQUIRE(install_plan.size() == 2); - features_check(install_plan.install_actions.at(0), "b", {"core"}, Triplet::X64_WINDOWS); - features_check(install_plan.install_actions.at(1), "a", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "b", {"core"}, Test::X64_WINDOWS); + features_check(install_plan.install_actions.at(1), "a", {"core"}, Test::X64_WINDOWS); } TEST_CASE ("install default features of dependency test 2", "[plan]") @@ -574,14 +574,14 @@ TEST_CASE ("install default features of dependency test 2", "[plan]") std::vector> status_paragraphs; // Add a port "a" which depends on the default features of "b" - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "b"); // "b" has two features, of which "b1" is default. spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); // Install "a" (without explicit feature specification) - auto spec_a = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); - auto spec_b = FullPackageSpec::from_string("b[core]", Triplet::X64_WINDOWS); + auto spec_a = FullPackageSpec::from_string("a", Test::X64_WINDOWS); + auto spec_b = FullPackageSpec::from_string("b[core]", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -593,14 +593,14 @@ TEST_CASE ("install default features of dependency test 2", "[plan]") // Expect "a" to get installed and defaults of "b" through the dependency REQUIRE(install_plan.size() == 2); - features_check(install_plan.install_actions.at(0), "b", {"b1", "core"}, Triplet::X64_WINDOWS); - features_check(install_plan.install_actions.at(1), "a", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "b", {"b1", "core"}, Test::X64_WINDOWS); + features_check(install_plan.install_actions.at(1), "a", {"core"}, Test::X64_WINDOWS); } TEST_CASE ("do not install default features of existing dependency", "[plan]") { // Add a port "a" which depends on the core of "b" - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "b[core]"); // "b" has two features, of which "b1" is default. spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); @@ -608,10 +608,10 @@ TEST_CASE ("do not install default features of existing dependency", "[plan]") std::vector> status_paragraphs; // "b[core]" is already installed status_paragraphs.push_back(make_status_pgh("b")); - status_paragraphs.back()->package.spec = PackageSpec("b", Triplet::X64_WINDOWS); + status_paragraphs.back()->package.spec = PackageSpec("b", Test::X64_WINDOWS); // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -622,13 +622,13 @@ TEST_CASE ("do not install default features of existing dependency", "[plan]") // Expect "a" to get installed, but not require rebuilding "b" REQUIRE(install_plan.size() == 1); - features_check(install_plan.install_actions.at(0), "a", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "a", {"core"}, Test::X64_WINDOWS); } TEST_CASE ("install default features of existing dependency", "[plan]") { // Add a port "a" which depends on the default features of "b" - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "b"); // "b" has a default feature spec_map.emplace("b", "", {{"b1", ""}}, {"b1"}); @@ -636,10 +636,10 @@ TEST_CASE ("install default features of existing dependency", "[plan]") std::vector> status_paragraphs; // "b[core]" is already installed status_paragraphs.push_back(make_status_pgh("b", "", "b1")); - status_paragraphs.back()->package.spec = PackageSpec("b", Triplet::X64_WINDOWS); + status_paragraphs.back()->package.spec = PackageSpec("b", Test::X64_WINDOWS); // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -650,24 +650,24 @@ TEST_CASE ("install default features of existing dependency", "[plan]") // Expect "b" to be rebuilt REQUIRE(install_plan.install_actions.size() == 2); - features_check(install_plan.install_actions.at(0), "b", {"core", "b1"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "b", {"core", "b1"}, Test::X64_WINDOWS); } TEST_CASE ("install default features of dependency test 3", "[plan]") { std::vector> status_paragraphs; status_paragraphs.push_back(make_status_pgh("b")); - status_paragraphs.back()->package.spec = PackageSpec("b", Triplet::X64_WINDOWS); + status_paragraphs.back()->package.spec = PackageSpec("b", Test::X64_WINDOWS); // Add a port "a" which depends on the core of "b", which was already // installed explicitly - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "b[core]"); // "b" has two features, of which "b1" is default. spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -679,7 +679,7 @@ TEST_CASE ("install default features of dependency test 3", "[plan]") // Expect "a" to get installed, not the defaults of "b", as the required // dependencies are already there, installed explicitly by the user. REQUIRE(install_plan.size() == 1); - features_check(install_plan.install_actions.at(0), "a", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "a", {"core"}, Test::X64_WINDOWS); } TEST_CASE ("install plan action dependencies", "[plan]") @@ -688,13 +688,13 @@ TEST_CASE ("install plan action dependencies", "[plan]") // Add a port "a" which depends on the core of "b", which was already // installed explicitly - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); auto spec_c = spec_map.emplace("c"); auto spec_b = spec_map.emplace("b", "c"); spec_map.emplace("a", "b"); // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -704,13 +704,13 @@ TEST_CASE ("install plan action dependencies", "[plan]") StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 3); - features_check(install_plan.install_actions.at(0), "c", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "c", {"core"}, Test::X64_WINDOWS); // TODO: Figure out what to do with these tests - features_check(install_plan.install_actions.at(1), "b", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(1), "b", {"core"}, Test::X64_WINDOWS); // REQUIRE(install_plan.at(1).install_action.get()->computed_dependencies == std::vector{spec_c}); - features_check(install_plan.install_actions.at(2), "a", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(2), "a", {"core"}, Test::X64_WINDOWS); // REQUIRE(install_plan.at(2).install_action.get()->computed_dependencies == std::vector{spec_b}); } @@ -720,13 +720,13 @@ TEST_CASE ("install plan action dependencies 2", "[plan]") // Add a port "a" which depends on the core of "b", which was already // installed explicitly - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); auto spec_c = spec_map.emplace("c"); auto spec_b = spec_map.emplace("b", "c"); spec_map.emplace("a", "c, b"); // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -736,12 +736,12 @@ TEST_CASE ("install plan action dependencies 2", "[plan]") StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 3); - features_check(install_plan.install_actions.at(0), "c", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "c", {"core"}, Test::X64_WINDOWS); - features_check(install_plan.install_actions.at(1), "b", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(1), "b", {"core"}, Test::X64_WINDOWS); // REQUIRE(install_plan.at(1).install_action.get()->computed_dependencies == std::vector{spec_c}); - features_check(install_plan.install_actions.at(2), "a", {"core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(2), "a", {"core"}, Test::X64_WINDOWS); // REQUIRE(install_plan.at(2).install_action.get()->computed_dependencies == std::vector{spec_b, // spec_c}); } @@ -752,11 +752,11 @@ TEST_CASE ("install plan action dependencies 3", "[plan]") // Add a port "a" which depends on the core of "b", which was already // installed explicitly - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "", {{"0", ""}, {"1", "a[0]"}}, {"1"}); // Install "a" (without explicit feature specification) - auto install_specs = FullPackageSpec::from_string("a", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a", Test::X64_WINDOWS); PortFileProvider::MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; @@ -766,7 +766,7 @@ TEST_CASE ("install plan action dependencies 3", "[plan]") StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 1); - features_check(install_plan.install_actions.at(0), "a", {"1", "0", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "a", {"1", "0", "core"}, Test::X64_WINDOWS); // REQUIRE(install_plan.at(0).install_action.get()->computed_dependencies == std::vector{}); } @@ -827,7 +827,7 @@ TEST_CASE ("upgrade with default features 2", "[plan]") StatusParagraphs status_db(std::move(pghs)); - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); auto spec_a = spec_map.emplace("a", "b[core]"); auto spec_b = spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b0", "b1"}); @@ -837,10 +837,10 @@ TEST_CASE ("upgrade with default features 2", "[plan]") // The upgrade should install the new default feature b1 but not b0 REQUIRE(plan.size() == 4); - remove_plan_check(plan.remove_actions.at(0), "a", Triplet::X64_WINDOWS); - remove_plan_check(plan.remove_actions.at(1), "b", Triplet::X64_WINDOWS); - features_check(plan.install_actions.at(0), "b", {"core", "b1"}, Triplet::X64_WINDOWS); - features_check(plan.install_actions.at(1), "a", {"core"}, Triplet::X64_WINDOWS); + remove_plan_check(plan.remove_actions.at(0), "a", Test::X64_WINDOWS); + remove_plan_check(plan.remove_actions.at(1), "b", Test::X64_WINDOWS); + features_check(plan.install_actions.at(0), "b", {"core", "b1"}, Test::X64_WINDOWS); + features_check(plan.install_actions.at(1), "a", {"core"}, Test::X64_WINDOWS); } TEST_CASE ("upgrade with default features 3", "[plan]") @@ -852,7 +852,7 @@ TEST_CASE ("upgrade with default features 3", "[plan]") StatusParagraphs status_db(std::move(pghs)); - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); auto spec_a = spec_map.emplace("a", "b[core]"); spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b0"}); @@ -862,9 +862,9 @@ TEST_CASE ("upgrade with default features 3", "[plan]") // The upgrade should install the default feature REQUIRE(plan.size() == 3); - remove_plan_check(plan.remove_actions.at(0), "a", Triplet::X64_WINDOWS); - features_check(plan.install_actions.at(0), "b", {"b0", "core"}, Triplet::X64_WINDOWS); - features_check(plan.install_actions.at(1), "a", {"core"}, Triplet::X64_WINDOWS); + remove_plan_check(plan.remove_actions.at(0), "a", Test::X64_WINDOWS); + features_check(plan.install_actions.at(0), "b", {"b0", "core"}, Test::X64_WINDOWS); + features_check(plan.install_actions.at(1), "a", {"core"}, Test::X64_WINDOWS); } TEST_CASE ("upgrade with new default feature", "[plan]") @@ -883,20 +883,20 @@ TEST_CASE ("upgrade with new default feature", "[plan]") // The upgrade should install the new default feature but not the old default feature 0 REQUIRE(plan.size() == 2); - remove_plan_check(plan.remove_actions.at(0), "a", Triplet::X86_WINDOWS); - features_check(plan.install_actions.at(0), "a", {"core", "1"}, Triplet::X86_WINDOWS); + remove_plan_check(plan.remove_actions.at(0), "a", Test::X86_WINDOWS); + features_check(plan.install_actions.at(0), "a", {"core", "1"}, Test::X86_WINDOWS); } TEST_CASE ("transitive features test", "[plan]") { std::vector> status_paragraphs; - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "b", {{"0", "b[0]"}}), {"core"}}; auto spec_b_64 = FullPackageSpec{spec_map.emplace("b", "c", {{"0", "c[0]"}}), {"core"}}; auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "", {{"0", ""}}), {"core"}}; - auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a[*]", Test::X64_WINDOWS); REQUIRE(install_specs.has_value()); if (!install_specs.has_value()) return; @@ -908,21 +908,21 @@ TEST_CASE ("transitive features test", "[plan]") StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 3); - features_check(install_plan.install_actions.at(0), "c", {"0", "core"}, Triplet::X64_WINDOWS); - features_check(install_plan.install_actions.at(1), "b", {"0", "core"}, Triplet::X64_WINDOWS); - features_check(install_plan.install_actions.at(2), "a", {"0", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "c", {"0", "core"}, Test::X64_WINDOWS); + features_check(install_plan.install_actions.at(1), "b", {"0", "core"}, Test::X64_WINDOWS); + features_check(install_plan.install_actions.at(2), "a", {"0", "core"}, Test::X64_WINDOWS); } TEST_CASE ("no transitive features test", "[plan]") { std::vector> status_paragraphs; - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "b", {{"0", ""}}), {"core"}}; auto spec_b_64 = FullPackageSpec{spec_map.emplace("b", "c", {{"0", ""}}), {"core"}}; auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "", {{"0", ""}}), {"core"}}; - auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a[*]", Test::X64_WINDOWS); REQUIRE(install_specs.has_value()); if (!install_specs.has_value()) return; PortFileProvider::MapPortFileProvider provider(spec_map.map); @@ -933,21 +933,21 @@ TEST_CASE ("no transitive features test", "[plan]") StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 3); - features_check(install_plan.install_actions.at(0), "c", {"core"}, Triplet::X64_WINDOWS); - features_check(install_plan.install_actions.at(1), "b", {"core"}, Triplet::X64_WINDOWS); - features_check(install_plan.install_actions.at(2), "a", {"0", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "c", {"core"}, Test::X64_WINDOWS); + features_check(install_plan.install_actions.at(1), "b", {"core"}, Test::X64_WINDOWS); + features_check(install_plan.install_actions.at(2), "a", {"0", "core"}, Test::X64_WINDOWS); } TEST_CASE ("only transitive features test", "[plan]") { std::vector> status_paragraphs; - PackageSpecMap spec_map(Triplet::X64_WINDOWS); + PackageSpecMap spec_map(Test::X64_WINDOWS); auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "", {{"0", "b[0]"}}), {"core"}}; auto spec_b_64 = FullPackageSpec{spec_map.emplace("b", "", {{"0", "c[0]"}}), {"core"}}; auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "", {{"0", ""}}), {"core"}}; - auto install_specs = FullPackageSpec::from_string("a[*]", Triplet::X64_WINDOWS); + auto install_specs = FullPackageSpec::from_string("a[*]", Test::X64_WINDOWS); REQUIRE(install_specs.has_value()); if (!install_specs.has_value()) return; PortFileProvider::MapPortFileProvider provider(spec_map.map); @@ -958,9 +958,9 @@ TEST_CASE ("only transitive features test", "[plan]") StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 3); - features_check(install_plan.install_actions.at(0), "c", {"0", "core"}, Triplet::X64_WINDOWS); - features_check(install_plan.install_actions.at(1), "b", {"0", "core"}, Triplet::X64_WINDOWS); - features_check(install_plan.install_actions.at(2), "a", {"0", "core"}, Triplet::X64_WINDOWS); + features_check(install_plan.install_actions.at(0), "c", {"0", "core"}, Test::X64_WINDOWS); + features_check(install_plan.install_actions.at(1), "b", {"0", "core"}, Test::X64_WINDOWS); + features_check(install_plan.install_actions.at(2), "a", {"0", "core"}, Test::X64_WINDOWS); } TEST_CASE ("basic remove scheme", "[plan]") @@ -969,7 +969,7 @@ TEST_CASE ("basic remove scheme", "[plan]") pghs.push_back(make_status_pgh("a")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"a", Triplet::X86_WINDOWS}}, status_db); + auto remove_plan = Dependencies::create_remove_plan({{"a", Test::X86_WINDOWS}}, status_db); REQUIRE(remove_plan.size() == 1); REQUIRE(remove_plan.at(0).spec.name() == "a"); @@ -982,7 +982,7 @@ TEST_CASE ("recurse remove scheme", "[plan]") pghs.push_back(make_status_pgh("b", "a")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"a", Triplet::X86_WINDOWS}}, status_db); + auto remove_plan = Dependencies::create_remove_plan({{"a", Test::X86_WINDOWS}}, status_db); REQUIRE(remove_plan.size() == 2); REQUIRE(remove_plan.at(0).spec.name() == "b"); @@ -997,7 +997,7 @@ TEST_CASE ("features depend remove scheme", "[plan]") pghs.push_back(make_status_feature_pgh("b", "0", "a")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"a", Triplet::X86_WINDOWS}}, status_db); + auto remove_plan = Dependencies::create_remove_plan({{"a", Test::X86_WINDOWS}}, status_db); REQUIRE(remove_plan.size() == 2); REQUIRE(remove_plan.at(0).spec.name() == "b"); @@ -1013,7 +1013,7 @@ TEST_CASE ("features depend remove scheme once removed", "[plan]") pghs.push_back(make_status_feature_pgh("opencv", "vtk", "vtk")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"expat", Triplet::X86_WINDOWS}}, status_db); + auto remove_plan = Dependencies::create_remove_plan({{"expat", Test::X86_WINDOWS}}, status_db); REQUIRE(remove_plan.size() == 3); REQUIRE(remove_plan.at(0).spec.name() == "opencv"); diff --git a/toolsrc/src/vcpkg-test/specifier.cpp b/toolsrc/src/vcpkg-test/specifier.cpp index f350ff60132b41..f750f4144f28f3 100644 --- a/toolsrc/src/vcpkg-test/specifier.cpp +++ b/toolsrc/src/vcpkg-test/specifier.cpp @@ -5,6 +5,8 @@ #include +#include + using namespace vcpkg; TEST_CASE ("specifier conversion", "[specifier]") @@ -13,8 +15,8 @@ TEST_CASE ("specifier conversion", "[specifier]") { constexpr std::size_t SPEC_SIZE = 6; - PackageSpec a_spec("a", Triplet::X64_WINDOWS); - PackageSpec b_spec("b", Triplet::X64_WINDOWS); + PackageSpec a_spec("a", Test::X64_WINDOWS); + PackageSpec b_spec("b", Test::X64_WINDOWS); auto fspecs = FullPackageSpec{a_spec, {"0", "1"}}.to_feature_specs({}, {}); auto fspecs2 = FullPackageSpec{b_spec, {"2", "3"}}.to_feature_specs({}, {}); @@ -94,19 +96,18 @@ TEST_CASE ("specifier parsing", "[specifier]") SECTION ("expand wildcards") { - auto zlib = vcpkg::FullPackageSpec::from_string("zlib[0,1]", Triplet::X86_UWP).value_or_exit(VCPKG_LINE_INFO); - auto openssl = - vcpkg::FullPackageSpec::from_string("openssl[*]", Triplet::X86_UWP).value_or_exit(VCPKG_LINE_INFO); + auto zlib = vcpkg::FullPackageSpec::from_string("zlib[0,1]", Test::X86_UWP).value_or_exit(VCPKG_LINE_INFO); + auto openssl = vcpkg::FullPackageSpec::from_string("openssl[*]", Test::X86_UWP).value_or_exit(VCPKG_LINE_INFO); auto specs = zlib.to_feature_specs({}, {}); auto specs2 = openssl.to_feature_specs({}, {}); Util::Vectors::append(&specs, specs2); Util::sort(specs); std::vector spectargets{ - {{"openssl", Triplet::X86_UWP}, "core"}, - {{"zlib", Triplet::X86_UWP}, "core"}, - {{"zlib", Triplet::X86_UWP}, "0"}, - {{"zlib", Triplet::X86_UWP}, "1"}, + {{"openssl", Test::X86_UWP}, "core"}, + {{"zlib", Test::X86_UWP}, "core"}, + {{"zlib", Test::X86_UWP}, "0"}, + {{"zlib", Test::X86_UWP}, "1"}, }; Util::sort(spectargets); REQUIRE(specs.size() == spectargets.size()); diff --git a/toolsrc/src/vcpkg-test/statusparagraphs.cpp b/toolsrc/src/vcpkg-test/statusparagraphs.cpp index 382eab1a72fcdd..f647484e603062 100644 --- a/toolsrc/src/vcpkg-test/statusparagraphs.cpp +++ b/toolsrc/src/vcpkg-test/statusparagraphs.cpp @@ -28,7 +28,7 @@ Status: install ok installed StatusParagraphs status_db( Util::fmap(*pghs.get(), [](Paragraph& rpgh) { return std::make_unique(std::move(rpgh)); })); - auto it = status_db.find_installed({"ffmpeg", Triplet::X64_WINDOWS}); + auto it = status_db.find_installed({"ffmpeg", Test::X64_WINDOWS}); REQUIRE(it != status_db.end()); } @@ -49,7 +49,7 @@ Status: purge ok not-installed StatusParagraphs status_db( Util::fmap(*pghs.get(), [](Paragraph& rpgh) { return std::make_unique(std::move(rpgh)); })); - auto it = status_db.find_installed({"ffmpeg", Triplet::X64_WINDOWS}); + auto it = status_db.find_installed({"ffmpeg", Test::X64_WINDOWS}); REQUIRE(it == status_db.end()); } @@ -78,11 +78,11 @@ Status: purge ok not-installed StatusParagraphs status_db( Util::fmap(*pghs.get(), [](Paragraph& rpgh) { return std::make_unique(std::move(rpgh)); })); - auto it = status_db.find_installed({"ffmpeg", Triplet::X64_WINDOWS}); + auto it = status_db.find_installed({"ffmpeg", Test::X64_WINDOWS}); REQUIRE(it != status_db.end()); // Feature "openssl" is not installed and should not be found - auto it1 = status_db.find_installed({{"ffmpeg", Triplet::X64_WINDOWS}, "openssl"}); + auto it1 = status_db.find_installed({{"ffmpeg", Test::X64_WINDOWS}, "openssl"}); REQUIRE(it1 == status_db.end()); } @@ -111,6 +111,6 @@ Status: install ok installed Util::fmap(*pghs.get(), [](Paragraph& rpgh) { return std::make_unique(std::move(rpgh)); })); // Feature "openssl" is installed and should therefore be found - auto it = status_db.find_installed({{"ffmpeg", Triplet::X64_WINDOWS}, "openssl"}); + auto it = status_db.find_installed({{"ffmpeg", Test::X64_WINDOWS}, "openssl"}); REQUIRE(it != status_db.end()); } diff --git a/toolsrc/src/vcpkg-test/util.cpp b/toolsrc/src/vcpkg-test/util.cpp index 74ade3aeb89220..2841aefa035571 100644 --- a/toolsrc/src/vcpkg-test/util.cpp +++ b/toolsrc/src/vcpkg-test/util.cpp @@ -39,6 +39,12 @@ namespace vcpkg::Test { + const Triplet X86_WINDOWS = Triplet::from_canonical_name("x86-windows"); + const Triplet X64_WINDOWS = Triplet::from_canonical_name("x64-windows"); + const Triplet X86_UWP = Triplet::from_canonical_name("x86-uwp"); + const Triplet ARM_UWP = Triplet::from_canonical_name("arm-uwp"); + const Triplet X64_ANDROID = Triplet::from_canonical_name("x64-android"); + std::unique_ptr make_control_file( const char* name, const char* depends, diff --git a/toolsrc/src/vcpkg/archives.cpp b/toolsrc/src/vcpkg/archives.cpp index 35e6427bee9777..c90706928eeea6 100644 --- a/toolsrc/src/vcpkg/archives.cpp +++ b/toolsrc/src/vcpkg/archives.cpp @@ -2,6 +2,7 @@ #include #include +#include namespace vcpkg::Archives { diff --git a/toolsrc/src/vcpkg/binarycaching.cpp b/toolsrc/src/vcpkg/binarycaching.cpp index 743ce919a0f959..2c6f0fe989ade7 100644 --- a/toolsrc/src/vcpkg/binarycaching.cpp +++ b/toolsrc/src/vcpkg/binarycaching.cpp @@ -9,6 +9,7 @@ #include #include #include +#include using namespace vcpkg; diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 67015fba5216ef..92dedd8dba16e0 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include using namespace vcpkg; diff --git a/toolsrc/src/vcpkg/buildenvironment.cpp b/toolsrc/src/vcpkg/buildenvironment.cpp index cab2bf551180d2..09d84d0e88075b 100644 --- a/toolsrc/src/vcpkg/buildenvironment.cpp +++ b/toolsrc/src/vcpkg/buildenvironment.cpp @@ -1,4 +1,5 @@ #include +#include namespace vcpkg { diff --git a/toolsrc/src/vcpkg/commands.fetch.cpp b/toolsrc/src/vcpkg/commands.fetch.cpp index ee809bb1385cd1..e6e59a30c15c10 100644 --- a/toolsrc/src/vcpkg/commands.fetch.cpp +++ b/toolsrc/src/vcpkg/commands.fetch.cpp @@ -1,3 +1,5 @@ +#include + #include namespace vcpkg::Commands::Fetch diff --git a/toolsrc/src/vcpkg/commands.hash.cpp b/toolsrc/src/vcpkg/commands.hash.cpp index d18173335093f1..5ac5e8aa6d4f1a 100644 --- a/toolsrc/src/vcpkg/commands.hash.cpp +++ b/toolsrc/src/vcpkg/commands.hash.cpp @@ -1,4 +1,5 @@ #include +#include #include diff --git a/toolsrc/src/vcpkg/commands.integrate.cpp b/toolsrc/src/vcpkg/commands.integrate.cpp index 17f3aa350c7bfe..1aa7d58649bf57 100644 --- a/toolsrc/src/vcpkg/commands.integrate.cpp +++ b/toolsrc/src/vcpkg/commands.integrate.cpp @@ -7,6 +7,7 @@ #include #include +#include #include namespace vcpkg::Commands::Integrate diff --git a/toolsrc/src/vcpkg/commands.porthistory.cpp b/toolsrc/src/vcpkg/commands.porthistory.cpp index 6b621773299f65..6f45e26ed0f115 100644 --- a/toolsrc/src/vcpkg/commands.porthistory.cpp +++ b/toolsrc/src/vcpkg/commands.porthistory.cpp @@ -4,6 +4,7 @@ #include #include +#include namespace vcpkg::Commands::PortHistory { diff --git a/toolsrc/src/vcpkg/commands.portsdiff.cpp b/toolsrc/src/vcpkg/commands.portsdiff.cpp index 97e903769cf910..ad27599fbbeaeb 100644 --- a/toolsrc/src/vcpkg/commands.portsdiff.cpp +++ b/toolsrc/src/vcpkg/commands.portsdiff.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include namespace vcpkg::Commands::PortsDiff diff --git a/toolsrc/src/vcpkg/export.chocolatey.cpp b/toolsrc/src/vcpkg/export.chocolatey.cpp index 096c99d89bbbe4..abaea6921f874d 100644 --- a/toolsrc/src/vcpkg/export.chocolatey.cpp +++ b/toolsrc/src/vcpkg/export.chocolatey.cpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace vcpkg::Export::Chocolatey { diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp index 39cb9328fa390a..f8691aa0405780 100644 --- a/toolsrc/src/vcpkg/export.cpp +++ b/toolsrc/src/vcpkg/export.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include namespace vcpkg::Export diff --git a/toolsrc/src/vcpkg/export.ifw.cpp b/toolsrc/src/vcpkg/export.ifw.cpp index 512e119b0f7273..45b600801cc45a 100644 --- a/toolsrc/src/vcpkg/export.ifw.cpp +++ b/toolsrc/src/vcpkg/export.ifw.cpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace vcpkg::Export::IFW { diff --git a/toolsrc/src/vcpkg/export.prefab.cpp b/toolsrc/src/vcpkg/export.prefab.cpp index 630e20f72e92d7..51ac868c721068 100644 --- a/toolsrc/src/vcpkg/export.prefab.cpp +++ b/toolsrc/src/vcpkg/export.prefab.cpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace vcpkg::Export::Prefab { diff --git a/toolsrc/src/vcpkg/triplet.cpp b/toolsrc/src/vcpkg/triplet.cpp index 78994323742755..c9ae7497042625 100644 --- a/toolsrc/src/vcpkg/triplet.cpp +++ b/toolsrc/src/vcpkg/triplet.cpp @@ -1,6 +1,7 @@ #include #include +#include namespace vcpkg { @@ -27,25 +28,9 @@ namespace std namespace vcpkg { - static std::unordered_set g_triplet_instances; - - const Triplet Triplet::X86_WINDOWS = from_canonical_name("x86-windows"); - const Triplet Triplet::X64_WINDOWS = from_canonical_name("x64-windows"); - const Triplet Triplet::ARM_WINDOWS = from_canonical_name("arm-windows"); - const Triplet Triplet::ARM64_WINDOWS = from_canonical_name("arm64-windows"); - const Triplet Triplet::X86_UWP = from_canonical_name("x86-uwp"); - const Triplet Triplet::X64_UWP = from_canonical_name("x64-uwp"); - const Triplet Triplet::ARM_UWP = from_canonical_name("arm-uwp"); - const Triplet Triplet::ARM64_UWP = from_canonical_name("arm64-uwp"); - - // - const Triplet Triplet::ARM_ANDROID = from_canonical_name("arm-android"); - const Triplet Triplet::ARM64_ANDROID = from_canonical_name("arm64-android"); - const Triplet Triplet::X86_ANDROID = from_canonical_name("x86-android"); - const Triplet Triplet::X64_ANDROID = from_canonical_name("x64-android"); - Triplet Triplet::from_canonical_name(std::string&& triplet_as_string) { + static std::unordered_set g_triplet_instances; std::string s(Strings::ascii_to_lowercase(std::move(triplet_as_string))); const auto p = g_triplet_instances.emplace(std::move(s)); return &*p.first; @@ -60,19 +45,19 @@ namespace vcpkg Optional Triplet::guess_architecture() const noexcept { using System::CPUArchitecture; - if (*this == X86_WINDOWS || *this == X86_UWP || *this == X86_ANDROID) + if (Strings::starts_with(this->canonical_name(), "x86-")) { return CPUArchitecture::X86; } - else if (*this == X64_WINDOWS || *this == X64_UWP || *this == X64_ANDROID) + if (Strings::starts_with(this->canonical_name(), "x64-")) { return CPUArchitecture::X64; } - else if (*this == ARM_WINDOWS || *this == ARM_UWP || *this == ARM_ANDROID) + if (Strings::starts_with(this->canonical_name(), "arm-")) { return CPUArchitecture::ARM; } - else if (*this == ARM64_WINDOWS || *this == ARM64_UWP || *this == ARM64_ANDROID) + if (Strings::starts_with(this->canonical_name(), "arm64-")) { return CPUArchitecture::ARM64; } @@ -96,7 +81,7 @@ namespace vcpkg else { #if defined(_WIN32) - return Triplet::X86_WINDOWS; + return Triplet::from_canonical_name("x86-windows"); #elif defined(__APPLE__) return Triplet::from_canonical_name("x64-osx"); #elif defined(__FreeBSD__) diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp index 6572b44f12512a..4f7ef7141e4551 100644 --- a/toolsrc/src/vcpkg/vcpkgpaths.cpp +++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp @@ -5,11 +5,14 @@ #include #include +#include #include #include #include #include #include +#include +#include #include #include