aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorras0219 <533828+ras0219@users.noreply.github.com>2020-08-12 12:35:26 -0700
committerGitHub <noreply@github.com>2020-08-12 12:35:26 -0700
commitc771e7bd07c3137d43cdca96efcb954439133532 (patch)
tree191b7d6e9a28072c1ffa592c8008664ff462c6c2 /toolsrc/include
parentf3b96f339c3179f8f1c46b412d192e0c8a84eb5e (diff)
downloadvcpkg-c771e7bd07c3137d43cdca96efcb954439133532.tar.gz
vcpkg-c771e7bd07c3137d43cdca96efcb954439133532.zip
[vcpkg] Fix resolution of default features when using Manifest mode (#12829)
* [vcpkg] Fix resolution of default features when using Manifest mode During manifest mode, the dependencies in the manifest should be treated as explicitly specified -- curl[core] should not install curl's default features. * [vcpkg] Improve error message when failed to parse manifest file Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg-test/util.h16
-rw-r--r--toolsrc/include/vcpkg/dependencies.h6
-rw-r--r--toolsrc/include/vcpkg/packagespec.h14
-rw-r--r--toolsrc/include/vcpkg/portfileprovider.h3
-rw-r--r--toolsrc/include/vcpkg/sourceparagraph.h1
5 files changed, 31 insertions, 9 deletions
diff --git a/toolsrc/include/vcpkg-test/util.h b/toolsrc/include/vcpkg-test/util.h
index ce403c308..5170c846a 100644
--- a/toolsrc/include/vcpkg-test/util.h
+++ b/toolsrc/include/vcpkg-test/util.h
@@ -18,6 +18,22 @@
} \
} while (0)
+namespace Catch
+{
+ template<>
+ struct StringMaker<vcpkg::FullPackageSpec>
+ {
+ static std::string convert(vcpkg::FullPackageSpec const& value)
+ {
+ return vcpkg::Strings::concat(value.package_spec.name(),
+ '[',
+ vcpkg::Strings::join(",", value.features),
+ "]:",
+ value.package_spec.triplet());
+ }
+ };
+}
+
namespace vcpkg::Test
{
std::unique_ptr<SourceControlFile> make_control_file(
diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h
index a9021355f..76ff89e7a 100644
--- a/toolsrc/include/vcpkg/dependencies.h
+++ b/toolsrc/include/vcpkg/dependencies.h
@@ -161,6 +161,12 @@ namespace vcpkg::Dependencies
const StatusParagraphs& status_db,
const CreateInstallPlanOptions& options = {});
+ // `features` should have "default" instead of missing "core". This is only exposed for testing purposes.
+ std::vector<FullPackageSpec> resolve_deps_as_top_level(const SourceControlFile& scf,
+ Triplet triplet,
+ std::vector<std::string> features,
+ CMakeVars::CMakeVarProvider& var_provider);
+
void print_plan(const ActionPlan& action_plan,
const bool is_recursive = true,
const fs::path& default_ports_dir = {});
diff --git a/toolsrc/include/vcpkg/packagespec.h b/toolsrc/include/vcpkg/packagespec.h
index 7601127d5..a362d8068 100644
--- a/toolsrc/include/vcpkg/packagespec.h
+++ b/toolsrc/include/vcpkg/packagespec.h
@@ -22,8 +22,6 @@ namespace vcpkg
///
struct PackageSpec
{
- constexpr static StringLiteral MANIFEST_NAME = "default";
-
PackageSpec() = default;
PackageSpec(std::string name, Triplet triplet) : m_name(std::move(name)), m_triplet(triplet) { }
@@ -50,6 +48,9 @@ namespace vcpkg
Triplet m_triplet;
};
+ bool operator==(const PackageSpec& left, const PackageSpec& right);
+ inline bool operator!=(const PackageSpec& left, const PackageSpec& right) { return !(left == right); }
+
///
/// <summary>
/// Full specification of a feature. Contains all information to reference
@@ -111,6 +112,12 @@ namespace vcpkg
const std::vector<std::string>& all_features) const;
static ExpectedS<FullPackageSpec> from_string(const std::string& spec_as_string, Triplet default_triplet);
+
+ bool operator==(const FullPackageSpec& o) const
+ {
+ return package_spec == o.package_spec && features == o.features;
+ }
+ bool operator!=(const FullPackageSpec& o) const { return !(*this == o); }
};
///
@@ -150,9 +157,6 @@ namespace vcpkg
Optional<std::string> parse_package_name(Parse::ParserBase& parser);
ExpectedS<ParsedQualifiedSpecifier> parse_qualified_specifier(StringView input);
Optional<ParsedQualifiedSpecifier> parse_qualified_specifier(Parse::ParserBase& parser);
-
- bool operator==(const PackageSpec& left, const PackageSpec& right);
- inline bool operator!=(const PackageSpec& left, const PackageSpec& right) { return !(left == right); }
}
namespace std
diff --git a/toolsrc/include/vcpkg/portfileprovider.h b/toolsrc/include/vcpkg/portfileprovider.h
index e26580729..e4b5d9cb5 100644
--- a/toolsrc/include/vcpkg/portfileprovider.h
+++ b/toolsrc/include/vcpkg/portfileprovider.h
@@ -32,10 +32,7 @@ namespace vcpkg::PortFileProvider
std::vector<const SourceControlFileLocation*> load_all_control_files() const override;
private:
- const SourceControlFileLocation* load_manifest_file() const;
-
Files::Filesystem& filesystem;
- fs::path manifest;
std::vector<fs::path> ports_dirs;
mutable std::unordered_map<std::string, SourceControlFileLocation> cache;
};
diff --git a/toolsrc/include/vcpkg/sourceparagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h
index 2ce4c7bca..ac3699ca9 100644
--- a/toolsrc/include/vcpkg/sourceparagraph.h
+++ b/toolsrc/include/vcpkg/sourceparagraph.h
@@ -133,7 +133,6 @@ namespace vcpkg
fs::path source_location;
};
- std::string get_error_message(Span<const std::unique_ptr<Parse::ParseControlErrorInfo>> error_info_list);
void print_error_message(Span<const std::unique_ptr<Parse::ParseControlErrorInfo>> error_info_list);
inline void print_error_message(const std::unique_ptr<Parse::ParseControlErrorInfo>& error_info_list)
{