diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-08-23 15:47:42 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-08-23 15:57:46 -0700 |
| commit | 14a99b073059d4fcae149a9085254fcb2e78e443 (patch) | |
| tree | dee1cc7132d9cbf56ce4fc775f67083034fa8b17 /toolsrc/include | |
| parent | 687ea82f89504520e2a4c60feeb5c0bf6260a4de (diff) | |
| download | vcpkg-14a99b073059d4fcae149a9085254fcb2e78e443.tar.gz vcpkg-14a99b073059d4fcae149a9085254fcb2e78e443.zip | |
[vcpkg] Deduplicate code from feature packages
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/vcpkg_Build.h | 1 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Commands.h | 12 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Dependencies.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Util.h | 19 |
4 files changed, 27 insertions, 7 deletions
diff --git a/toolsrc/include/vcpkg_Build.h b/toolsrc/include/vcpkg_Build.h index c4f3e6746..32909f4e1 100644 --- a/toolsrc/include/vcpkg_Build.h +++ b/toolsrc/include/vcpkg_Build.h @@ -52,6 +52,7 @@ namespace vcpkg::Build SUCCEEDED, BUILD_FAILED, POST_BUILD_CHECKS_FAILED, + FILE_CONFLICTS, CASCADED_DUE_TO_MISSING_DEPENDENCIES }; diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index d5f316d69..756a12f01 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -55,12 +55,18 @@ namespace vcpkg::Commands const Build::BuildPackageOptions& install_plan_options, StatusParagraphs& status_db); + enum class InstallResult + { + FILE_CONFLICTS, + SUCCESS, + }; + void install_files_and_write_listfile(Files::Filesystem& fs, const fs::path& source_dir, const InstallDir& dirs); - void install_package(const VcpkgPaths& paths, - const BinaryControlFile& binary_paragraph, - StatusParagraphs* status_db); + InstallResult install_package(const VcpkgPaths& paths, + const BinaryControlFile& binary_paragraph, + StatusParagraphs* status_db); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); } diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 93719efe9..c1f6ad9a5 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -23,7 +23,7 @@ namespace vcpkg::Dependencies std::vector<PackageSpec> dependencies(const Triplet& triplet) const; Optional<StatusParagraph> status_paragraph; - Optional<BinaryParagraph> binary_paragraph; + Optional<BinaryControlFile> binary_control_file; Optional<SourceParagraph> source_paragraph; Optional<const SourceControlFile*> source_control_file; }; diff --git a/toolsrc/include/vcpkg_Util.h b/toolsrc/include/vcpkg_Util.h index 4f45cd2c7..cfbd23020 100644 --- a/toolsrc/include/vcpkg_Util.h +++ b/toolsrc/include/vcpkg_Util.h @@ -12,9 +12,7 @@ namespace vcpkg::Util template<class Cont, class Func, class Out = FmapOut<Cont, Func>> std::vector<Out> fmap(Cont&& xs, Func&& f) { - using O = decltype(f(*begin(xs))); - - std::vector<O> ret; + std::vector<Out> ret; ret.reserve(xs.size()); for (auto&& x : xs) @@ -23,6 +21,21 @@ namespace vcpkg::Util return ret; } + template<class Cont, class Func> + using FmapFlattenOut = std::decay_t<decltype(*begin(std::declval<Func>()(*begin(std::declval<Cont>()))))>; + + template<class Cont, class Func, class Out = FmapFlattenOut<Cont, Func>> + std::vector<Out> fmap_flatten(Cont&& xs, Func&& f) + { + std::vector<Out> ret; + + for (auto&& x : xs) + for (auto&& y : f(x)) + ret.push_back(std::move(y)); + + return ret; + } + template<class Container, class Pred> void unstable_keep_if(Container& cont, Pred pred) { |
