[vcpkg] Add additional tests. Enable featurepackages by default.
MODIFY
src/tests.plan.cpp
src/tests.plan.cpp
@@ -434,6 +434,75 @@ namespace UnitTest1
Assert::IsTrue(install_plan.size() == 1);
features_check(&install_plan[0], "a", {"0", "1", "core"}, Triplet::X64_WINDOWS);
}
+
+ TEST_METHOD(transitive_features_test)
+ {
+ std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs;
+
+ PackageSpecMap spec_map(Triplet::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);
+ Assert::IsTrue(install_specs.has_value());
+ if (!install_specs.has_value()) return;
+ auto install_plan = Dependencies::create_feature_install_plan(
+ spec_map.map,
+ FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}),
+ StatusParagraphs(std::move(status_paragraphs)));
+
+ Assert::IsTrue(install_plan.size() == 3);
+ features_check(&install_plan[0], "c", {"0", "core"}, Triplet::X64_WINDOWS);
+ features_check(&install_plan[1], "b", {"0", "core"}, Triplet::X64_WINDOWS);
+ features_check(&install_plan[2], "a", {"0", "core"}, Triplet::X64_WINDOWS);
+ }
+
+ TEST_METHOD(no_transitive_features_test)
+ {
+ std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs;
+
+ PackageSpecMap spec_map(Triplet::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);
+ Assert::IsTrue(install_specs.has_value());
+ if (!install_specs.has_value()) return;
+ auto install_plan = Dependencies::create_feature_install_plan(
+ spec_map.map,
+ FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}),
+ StatusParagraphs(std::move(status_paragraphs)));
+
+ Assert::IsTrue(install_plan.size() == 3);
+ features_check(&install_plan[0], "c", {"core"}, Triplet::X64_WINDOWS);
+ features_check(&install_plan[1], "b", {"core"}, Triplet::X64_WINDOWS);
+ features_check(&install_plan[2], "a", {"0", "core"}, Triplet::X64_WINDOWS);
+ }
+
+ TEST_METHOD(only_transitive_features_test)
+ {
+ std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs;
+
+ PackageSpecMap spec_map(Triplet::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);
+ Assert::IsTrue(install_specs.has_value());
+ if (!install_specs.has_value()) return;
+ auto install_plan = Dependencies::create_feature_install_plan(
+ spec_map.map,
+ FullPackageSpec::to_feature_specs({install_specs.value_or_exit(VCPKG_LINE_INFO)}),
+ StatusParagraphs(std::move(status_paragraphs)));
+
+ Assert::IsTrue(install_plan.size() == 3);
+ features_check(&install_plan[0], "c", {"0", "core"}, Triplet::X64_WINDOWS);
+ features_check(&install_plan[1], "b", {"0", "core"}, Triplet::X64_WINDOWS);
+ features_check(&install_plan[2], "a", {"0", "core"}, Triplet::X64_WINDOWS);
+ }
};
static PackageSpec unsafe_pspec(std::string name, Triplet t = Triplet::X86_WINDOWS)

MODIFY
src/vcpkg/globalstate.cpp
src/vcpkg/globalstate.cpp
@@ -8,7 +8,7 @@ namespace vcpkg
Util::LockGuarded<std::string> GlobalState::g_surveydate;
std::atomic<bool> GlobalState::debugging(false);
- std::atomic<bool> GlobalState::feature_packages(false);
+ std::atomic<bool> GlobalState::feature_packages(true);
std::atomic<int> GlobalState::g_init_console_cp(0);
std::atomic<int> GlobalState::g_init_console_output_cp(0);

MODIFY
src/vcpkg/vcpkgcmdarguments.cpp
src/vcpkg/vcpkgcmdarguments.cpp
@@ -129,6 +129,11 @@ namespace vcpkg
GlobalState::feature_packages = true;
continue;
}
+ if (arg == "--no-featurepackages")
+ {
+ GlobalState::feature_packages = false;
+ continue;
+ }
const auto eq_pos = arg.find('=');
if (eq_pos != std::string::npos)

[vcpkg] Add additional tests. Enable featurepackages by default.