aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-08-21 17:16:14 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-08-21 17:16:14 -0700
commit27be8b5c7489ea52156669f8e556ad3db1fd11d1 (patch)
tree619c675091612dcd4be5dbaa9208e229ab1004da /toolsrc/include
parentc7de717cbc2b6ab89dc8056984c0a4685e9cf56e (diff)
downloadvcpkg-27be8b5c7489ea52156669f8e556ad3db1fd11d1.tar.gz
vcpkg-27be8b5c7489ea52156669f8e556ad3db1fd11d1.zip
[vcpkg] Fix feature packages for non-default triplets. Reduce duplication between normal installs and feature installs.
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/VcpkgPaths.h1
-rw-r--r--toolsrc/include/vcpkg_Dependencies.h17
-rw-r--r--toolsrc/include/vcpkg_Util.h6
3 files changed, 14 insertions, 10 deletions
diff --git a/toolsrc/include/VcpkgPaths.h b/toolsrc/include/VcpkgPaths.h
index 95cd4bc28..e4e7ba83d 100644
--- a/toolsrc/include/VcpkgPaths.h
+++ b/toolsrc/include/VcpkgPaths.h
@@ -21,6 +21,7 @@ namespace vcpkg
fs::path package_dir(const PackageSpec& spec) const;
fs::path port_dir(const PackageSpec& spec) const;
+ fs::path port_dir(const std::string& name) const;
fs::path build_info_file_path(const PackageSpec& spec) const;
fs::path listfile_path(const BinaryParagraph& pgh) const;
diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h
index 9ac52490e..e6c3c55c9 100644
--- a/toolsrc/include/vcpkg_Dependencies.h
+++ b/toolsrc/include/vcpkg_Dependencies.h
@@ -86,6 +86,9 @@ namespace vcpkg::Dependencies
struct AnyAction
{
+ AnyAction(InstallPlanAction&& iplan) : install_plan(std::move(iplan)) {}
+ AnyAction(RemovePlanAction&& rplan) : remove_plan(std::move(rplan)) {}
+
Optional<InstallPlanAction> install_plan;
Optional<RemovePlanAction> remove_plan;
};
@@ -114,21 +117,21 @@ namespace vcpkg::Dependencies
RequestType request_type;
};
- __interface PortFileProvider { virtual const SourceControlFile& get_control_file(const PackageSpec& spec) const; };
+ __interface PortFileProvider { virtual const SourceControlFile& get_control_file(const std::string& spec) const; };
struct MapPortFile : PortFileProvider
{
- const std::unordered_map<PackageSpec, SourceControlFile>& ports;
- explicit MapPortFile(const std::unordered_map<PackageSpec, SourceControlFile>& map);
- const SourceControlFile& get_control_file(const PackageSpec& spec) const override;
+ const std::unordered_map<std::string, SourceControlFile>& ports;
+ explicit MapPortFile(const std::unordered_map<std::string, SourceControlFile>& map);
+ const SourceControlFile& get_control_file(const std::string& spec) const override;
};
struct PathsPortFile : PortFileProvider
{
const VcpkgPaths& ports;
- mutable std::unordered_map<PackageSpec, SourceControlFile> cache;
+ mutable std::unordered_map<std::string, SourceControlFile> cache;
explicit PathsPortFile(const VcpkgPaths& paths);
- const SourceControlFile& get_control_file(const PackageSpec& spec) const override;
+ const SourceControlFile& get_control_file(const std::string& spec) const override;
private:
PathsPortFile(const PathsPortFile&) = delete;
@@ -146,7 +149,7 @@ namespace vcpkg::Dependencies
const std::vector<PackageSpec>& specs,
const StatusParagraphs& status_db);
- std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<PackageSpec, SourceControlFile>& map,
+ std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFile>& map,
const std::vector<FeatureSpec>& specs,
const StatusParagraphs& status_db);
}
diff --git a/toolsrc/include/vcpkg_Util.h b/toolsrc/include/vcpkg_Util.h
index 671997e7e..a62b48d54 100644
--- a/toolsrc/include/vcpkg_Util.h
+++ b/toolsrc/include/vcpkg_Util.h
@@ -7,12 +7,12 @@
namespace vcpkg::Util
{
template<class Cont, class Func>
- using FmapOut = decltype(std::declval<Func>()(std::declval<Cont>()[0]));
+ using FmapOut = decltype(std::declval<Func>()(*begin(std::declval<Cont>())));
template<class Cont, class Func, class Out = FmapOut<Cont, Func>>
- std::vector<Out> fmap(const Cont& xs, Func&& f)
+ std::vector<Out> fmap(Cont&& xs, Func&& f)
{
- using O = decltype(f(xs[0]));
+ using O = decltype(f(*begin(xs)));
std::vector<O> ret;
ret.reserve(xs.size());