aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-08-20 19:09:39 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-08-20 19:09:39 -0700
commitbd222504abea410d77487e176649ae9b6989c4e0 (patch)
tree11eaca74aa69437ca4ac652bf2799d1d39b6d67e /toolsrc/include
parentf219ce0b8c3e84e5fc1df21ad2f2c8b13f0fe413 (diff)
downloadvcpkg-bd222504abea410d77487e176649ae9b6989c4e0.tar.gz
vcpkg-bd222504abea410d77487e176649ae9b6989c4e0.zip
[vcpkg] Refactor parsing together and flatten featurespec usages
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/PackageSpec.h20
-rw-r--r--toolsrc/include/vcpkg_Dependencies.h9
2 files changed, 21 insertions, 8 deletions
diff --git a/toolsrc/include/PackageSpec.h b/toolsrc/include/PackageSpec.h
index 8e986b4d6..8b485316f 100644
--- a/toolsrc/include/PackageSpec.h
+++ b/toolsrc/include/PackageSpec.h
@@ -33,11 +33,31 @@ namespace vcpkg
Triplet m_triplet;
};
+ struct FeatureSpec
+ {
+ FeatureSpec(const PackageSpec& spec, const std::string& feature) : m_spec(spec), m_feature(feature) {}
+
+ const std::string& name() const { return m_spec.name(); }
+ const std::string& feature() const { return m_feature; }
+ const Triplet& triplet() const { return m_spec.triplet(); }
+
+ const PackageSpec& spec() const { return m_spec; }
+
+ static std::vector<FeatureSpec> from_strings_and_triplet(const std::vector<std::string>& depends,
+ const Triplet& t);
+
+ private:
+ PackageSpec m_spec;
+ std::string m_feature;
+ };
+
struct FullPackageSpec
{
PackageSpec package_spec;
std::vector<std::string> features;
+ static std::vector<FeatureSpec> to_feature_specs(const std::vector<FullPackageSpec>& specs);
+
static ExpectedT<FullPackageSpec, PackageSpecParseResult> from_string(const std::string& spec_as_string,
const Triplet& default_triplet);
};
diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h
index 3fee8ef33..37d3a59e5 100644
--- a/toolsrc/include/vcpkg_Dependencies.h
+++ b/toolsrc/include/vcpkg_Dependencies.h
@@ -30,19 +30,12 @@ namespace vcpkg::Dependencies
namespace vcpkg::Dependencies
{
- struct FeatureSpec
- {
- PackageSpec spec;
- std::string feature_name;
- };
-
struct FeatureNodeEdges
{
std::vector<FeatureSpec> remove_edges;
std::vector<FeatureSpec> build_edges;
bool plus = false;
};
- std::vector<FeatureSpec> to_feature_specs(const std::vector<std::string>& depends, const Triplet& t);
struct Cluster
{
@@ -210,6 +203,6 @@ namespace vcpkg::Dependencies
std::unordered_map<PackageSpec, Cluster>& pkg_to_cluster,
GraphPlan& graph_plan);
std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<PackageSpec, SourceControlFile>& map,
- const std::vector<FullPackageSpec>& specs,
+ const std::vector<FeatureSpec>& specs,
const StatusParagraphs& status_db);
}