diff --git a/src/vcpkg-test/dependencies.cpp b/src/vcpkg-test/dependencies.cpp index d1ae9e2102..86f2bfb498 100644 --- a/src/vcpkg-test/dependencies.cpp +++ b/src/vcpkg-test/dependencies.cpp @@ -162,6 +162,8 @@ static const PackageSpec& toplevel_spec() return ret; } +static PackageSpec toplevel_spec(const std::string& name) { return {name, Test::X86_WINDOWS}; } + struct MockOverlayProvider : IOverlayProvider { MockOverlayProvider() = default; @@ -1618,7 +1620,7 @@ TEST_CASE ("version install default features", "[versionplan]") bp.v["a"] = {"1", 0}; WITH_EXPECTED(install_plan, - create_versioned_install_plan(vp, bp, var_provider, {Dependency{"a"}}, {}, toplevel_spec())); + create_versioned_install_plan(vp, bp, var_provider, {Dependency{"a"}}, {}, toplevel_spec("a"))); REQUIRE(install_plan.size() == 1); check_name_and_version(install_plan.install_actions[0], "a", {"1", 0}, {"x"}); @@ -1638,8 +1640,9 @@ TEST_CASE ("version dont install default features", "[versionplan]") MockBaselineProvider bp; bp.v["a"] = {"1", 0}; - auto install_plan = create_versioned_install_plan(vp, bp, var_provider, {CoreDependency{"a"}}, {}, toplevel_spec()) - .value_or_exit(VCPKG_LINE_INFO); + auto install_plan = + create_versioned_install_plan(vp, bp, var_provider, {CoreDependency{"a"}}, {}, toplevel_spec("a")) + .value_or_exit(VCPKG_LINE_INFO); REQUIRE(install_plan.size() == 1); check_name_and_version(install_plan.install_actions[0], "a", {"1", 0}); diff --git a/src/vcpkg/dependencies.cpp b/src/vcpkg/dependencies.cpp index 336fcffb77..02237f38bd 100644 --- a/src/vcpkg/dependencies.cpp +++ b/src/vcpkg/dependencies.cpp @@ -1649,9 +1649,9 @@ namespace vcpkg } } - // Implicit defaults are disabled if spec has been mentioned at top-level. + // Implicit defaults are disabled if spec is requested from top-level spec. // Note that if top-level doesn't also mark that reference as `[core]`, defaults will be re-engaged. - it->second.default_features = !Util::Maps::contains(m_user_requested, spec); + it->second.default_features = origin != m_toplevel.name(); it->second.requested_features.insert("core"); require_scfl(*it, it->second.scfl, origin);