From 425d07ef7f82541e50cc8cb1e2716fc33bba7b12 Mon Sep 17 00:00:00 2001 From: Jonathan Hale Date: Thu, 15 Feb 2018 01:18:25 +0100 Subject: [vcpkg] Implement Default-Features (#2697) * [vcpkg] Add Default-Feature to make_status_pgh utility function Signed-off-by: Squareys * [vcpkg] Parse "Default-Features" as dependencies and add test for parsing Signed-off-by: Squareys * [vcpkg] Document some methods and structures Signed-off-by: Squareys * [vcpkg] Add install_default_features_test Signed-off-by: Squareys * [vcpkg] Change install_default_features_test to not have preinstalled package * [vcpkg] Test install behaviour of default features Signed-off-by: Squareys * [vcpkg] Implement default features Signed-off-by: Squareys * [vcpkg] Test default features upgrade behavior Signed-off-by: Squareys * [vcpkg] Implement upgrade with default features Signed-off-by: Squareys * [vcpkg] Test behaviour of upgrade with default features in dependencies Signed-off-by: Squareys * [vcpkg] Make upgrade install new default features Signed-off-by: Squareys * [vcpkg] Move collecting of packages for which to prevent defaults Further down the line to create_feature_install_plan. Signed-off-by: Squareys * [vcpkg] Fix core missing from default features and potential inf loop Signed-off-by: Squareys * [vcpkg] Rename, fix and move some tests Signed-off-by: Squareys --- toolsrc/include/tests.utils.h | 1 + toolsrc/include/vcpkg/dependencies.h | 3 ++- toolsrc/include/vcpkg/packagespec.h | 23 +++++++++++++++++++++++ toolsrc/include/vcpkg/sourceparagraph.h | 9 ++++++++- toolsrc/include/vcpkg/statusparagraphs.h | 5 +++++ 5 files changed, 39 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/tests.utils.h b/toolsrc/include/tests.utils.h index b23abe4eb..970506663 100644 --- a/toolsrc/include/tests.utils.h +++ b/toolsrc/include/tests.utils.h @@ -20,6 +20,7 @@ namespace Microsoft::VisualStudio::CppUnitTestFramework std::unique_ptr make_status_pgh(const char* name, const char* depends = "", + const char* default_features = "", const char* triplet = "x86-windows"); std::unique_ptr make_status_feature_pgh(const char* name, const char* feature, diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h index 014f004a2..4abeb678e 100644 --- a/toolsrc/include/vcpkg/dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -151,7 +151,8 @@ namespace vcpkg::Dependencies PackageGraph(const PortFileProvider& provider, const StatusParagraphs& status_db); ~PackageGraph(); - void install(const FeatureSpec& spec) const; + void install(const FeatureSpec& spec, + const std::unordered_set& prevent_default_features = {}) const; void upgrade(const PackageSpec& spec) const; std::vector serialize() const; diff --git a/toolsrc/include/vcpkg/packagespec.h b/toolsrc/include/vcpkg/packagespec.h index f1119e2f3..0a4347639 100644 --- a/toolsrc/include/vcpkg/packagespec.h +++ b/toolsrc/include/vcpkg/packagespec.h @@ -15,6 +15,12 @@ namespace vcpkg static ExpectedT from_string(const std::string& input); }; + /// + /// + /// Full specification of a package. Contains all information to reference + /// a specific package. + /// + /// struct PackageSpec { static ExpectedT from_name_and_triplet(const std::string& name, @@ -46,6 +52,12 @@ namespace vcpkg Triplet m_triplet; }; + /// + /// + /// Full specification of a feature. Contains all information to reference + /// a single feature in a specific package. + /// + /// struct FeatureSpec { FeatureSpec(const PackageSpec& spec, const std::string& feature) : m_spec(spec), m_feature(feature) {} @@ -82,6 +94,12 @@ namespace vcpkg std::string m_feature; }; + /// + /// + /// Full specification of a package. Contains all information to reference + /// a collection of features in a single package. + /// + /// struct FullPackageSpec { PackageSpec package_spec; @@ -93,6 +111,11 @@ namespace vcpkg const Triplet& default_triplet); }; + /// + /// + /// Contains all information to reference a collection of features in a single package by their names. + /// + /// struct Features { std::string name; diff --git a/toolsrc/include/vcpkg/sourceparagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h index dcbbc1c3b..ea8e27a94 100644 --- a/toolsrc/include/vcpkg/sourceparagraph.h +++ b/toolsrc/include/vcpkg/sourceparagraph.h @@ -29,6 +29,9 @@ namespace vcpkg std::string to_string(const Dependency& dep); + /// + /// Port metadata of additional feature in a package (part of CONTROL file) + /// struct FeatureParagraph { std::string name; @@ -37,7 +40,7 @@ namespace vcpkg }; /// - /// Port metadata (CONTROL file) + /// Port metadata of the core feature of a package (part of CONTROL file) /// struct SourceParagraph { @@ -49,6 +52,10 @@ namespace vcpkg std::vector depends; std::vector default_features; }; + + /// + /// Full metadata of a package: core and other features. + /// struct SourceControlFile { static Parse::ParseExpected parse_control_file( diff --git a/toolsrc/include/vcpkg/statusparagraphs.h b/toolsrc/include/vcpkg/statusparagraphs.h index fd33f8094..b3eec266a 100644 --- a/toolsrc/include/vcpkg/statusparagraphs.h +++ b/toolsrc/include/vcpkg/statusparagraphs.h @@ -6,6 +6,11 @@ namespace vcpkg { + /// Status paragraphs + /// + /// Collection of , e.g. contains the information + /// about whether a package is installed or not. + /// struct StatusParagraphs { StatusParagraphs(); -- cgit v1.2.3