Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish "Implement depend-defaults" #538

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c8da40f
Implement depend-defaults
ras0219-msft Dec 3, 2021
5c47307
Merge branch 'main' of https://github.com/Microsoft/vcpkg-tool into HEAD
ras0219-msft Feb 17, 2022
02a2133
Fixup after merge
ras0219-msft Feb 17, 2022
4542303
Fix serialization error
ras0219-msft Feb 18, 2022
e337036
Fix e2e test break
ras0219-msft Feb 18, 2022
a06f544
Merge branch 'main' into dev/roschuma/depends-defaults
autoantwort May 10, 2022
8fea981
Fix tests
autoantwort May 11, 2022
4de6b91
Format
autoantwort May 12, 2022
d041774
Merge branch 'main' into dev/roschuma/depends-defaults
autoantwort Oct 1, 2022
53bcd53
Merge branch 'main' into dev/roschuma/depends-defaults
autoantwort Nov 13, 2022
5d786d3
Fix null pointer access
autoantwort Nov 13, 2022
17f4abd
Ignore default feature when checking if it is installed
autoantwort Nov 14, 2022
fcb6fa2
WIP: Merge branch 'main' into dev/roschuma/depends-defaults
autoantwort Aug 3, 2023
63c4074
Fix build after Merge with main
autoantwort Aug 3, 2023
d40fcb0
Fix tests
autoantwort Aug 5, 2023
5114b65
Remove unnecessary change
autoantwort Aug 5, 2023
fe3b612
Adapt schema.
autoantwort Aug 5, 2023
95e132c
Merge branch 'main' into dev/roschuma/depends-defaults
autoantwort Oct 17, 2023
e045dd1
Merge branch 'main' into dev/roschuma/depends-defaults
autoantwort Nov 12, 2023
0080184
Fix merge bug
autoantwort Nov 12, 2023
712c126
Merge branch 'main' into dev/roschuma/depends-defaults
autoantwort Dec 13, 2023
d71b3e4
Merge branch 'main' into dev/roschuma/depends-defaults
autoantwort Apr 17, 2024
9befbe2
More merge conflicts
autoantwort Apr 17, 2024
4cf4f3a
Merge branch 'main' into dev/roschuma/depends-defaults
autoantwort May 22, 2024
5f2ad54
Merge branch 'main' into dev/roschuma/depends-defaults
autoantwort Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vcpkg-test/manifests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ TEST_CASE ("manifest construct maximum", "[manifests]")
REQUIRE(pgh.feature_paragraphs[0]->dependencies[0].name == "firebending");

REQUIRE(pgh.feature_paragraphs[0]->dependencies[1].name == "order.white-lotus");
REQUIRE(pgh.feature_paragraphs[0]->dependencies[1].features.size() == 1);
REQUIRE(pgh.feature_paragraphs[0]->dependencies[1].features.size() == 2); // "core" and "default"
REQUIRE(pgh.feature_paragraphs[0]->dependencies[1].features[0] == "the-ancient-ways");
REQUIRE_FALSE(pgh.feature_paragraphs[0]->dependencies[1].platform.evaluate(
{{"VCPKG_CMAKE_SYSTEM_NAME", ""}, {"VCPKG_TARGET_ARCHITECTURE", "arm"}}));
Expand Down
26 changes: 16 additions & 10 deletions src/vcpkg/sourceparagraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,18 @@ namespace vcpkg

static bool is_dependency_trivial(const Dependency& dep)
{
return dep.features.empty() && dep.platform.is_empty() && dep.extra_info.is_empty() &&
if (Util::Vectors::contains(dep.features, "default"))
autoantwort marked this conversation as resolved.
Show resolved Hide resolved
{
if (dep.features.size() > 2)
{
return false;
}
}
else if (dep.features.size() > 1)
{
return false;
}
return dep.platform.is_empty() && dep.extra_info.is_empty() &&
dep.constraint.type == VersionConstraintKind::None && !dep.host && !dep.default_features.has_value();
}

Expand Down Expand Up @@ -1607,19 +1618,14 @@ namespace vcpkg
dep_obj.insert(DependencyDeserializer::NAME, dep.name);
if (dep.host) dep_obj.insert(DependencyDeserializer::HOST, Json::Value::boolean(true));

auto features_copy = dep.features;
auto core_it = std::find(features_copy.begin(), features_copy.end(), "core");
auto default_features = dep.default_features;
if (core_it != features_copy.end())
{
default_features = false;
features_copy.erase(core_it);
}
if (auto b = default_features.get())
if (auto b = dep.default_features.get())
{
dep_obj.insert(DependencyDeserializer::DEFAULT_FEATURES, Json::Value::boolean(*b));
}

auto features_copy = dep.features;
Util::erase_remove(features_copy, "core");
Util::erase_remove(features_copy, "default");
serialize_optional_array(dep_obj, DependencyDeserializer::FEATURES, features_copy);
serialize_optional_string(dep_obj, DependencyDeserializer::PLATFORM, to_string(dep.platform));
if (dep.constraint.type == VersionConstraintKind::Minimum)
Expand Down