From b9942d07441934c40869b16184455a7fef2024f5 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 11 Feb 2020 18:41:03 -0800 Subject: [vcpkg] Extract binary caching functionality into separate interface --- toolsrc/include/vcpkg/binarycaching.h | 43 +++++++++++++++++++++++++++++++++++ toolsrc/include/vcpkg/build.h | 7 +++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 toolsrc/include/vcpkg/binarycaching.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/binarycaching.h b/toolsrc/include/vcpkg/binarycaching.h new file mode 100644 index 000000000..ff2be6eac --- /dev/null +++ b/toolsrc/include/vcpkg/binarycaching.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include +#include + +namespace vcpkg::Dependencies +{ + struct InstallPlanAction; +} +namespace vcpkg::Build +{ + struct AbiTagAndFile; + struct BuildPackageOptions; +} + +namespace vcpkg +{ + enum RestoreResult + { + MISSING, + SUCCESS, + BUILD_FAILED, + }; + + struct IBinaryProvider + { + virtual ~IBinaryProvider() = default; + virtual void prefetch() = 0; + virtual RestoreResult try_restore(const VcpkgPaths& paths, + const PackageSpec& spec, + const Build::AbiTagAndFile& abi_tag_and_file, + const Build::BuildPackageOptions& build_options) = 0; + virtual void push_success(const VcpkgPaths& paths, + const Build::AbiTagAndFile& abi_tag_and_file, + const Dependencies::InstallPlanAction& action) = 0; + virtual void push_failure(const VcpkgPaths& paths, + const Build::AbiTagAndFile& abi_tag_and_file, + const PackageSpec& spec) = 0; + }; + + std::unique_ptr create_archives_provider(); +} diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h index 67505d8f2..58a807776 100644 --- a/toolsrc/include/vcpkg/build.h +++ b/toolsrc/include/vcpkg/build.h @@ -16,6 +16,11 @@ #include #include +namespace vcpkg +{ + struct IBinaryProvider; +} + namespace vcpkg::Dependencies { struct InstallPlanAction; @@ -28,7 +33,6 @@ namespace vcpkg::Build void perform_and_exit_ex(const FullPackageSpec& full_spec, const SourceControlFileLocation& scfl, const PortFileProvider::PathsPortFileProvider& provider, - const ParsedArguments& options, const VcpkgPaths& paths); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); @@ -202,6 +206,7 @@ namespace vcpkg::Build ExtendedBuildResult build_package(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& config, const CMakeVars::CMakeVarProvider& var_provider, + IBinaryProvider* binaries_provider, const StatusParagraphs& status_db); enum class BuildPolicy -- cgit v1.2.3 From 3d841c9b6a67edf2126c68698a9f05b5d1b5fbcd Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 11 Feb 2020 23:52:56 -0800 Subject: [vcpkg] Compute all ABIs upfront instead of during build_package() --- toolsrc/include/vcpkg/binarycaching.h | 16 ++++++---------- toolsrc/include/vcpkg/build.h | 8 ++++++-- toolsrc/include/vcpkg/dependencies.h | 6 +++++- 3 files changed, 17 insertions(+), 13 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/binarycaching.h b/toolsrc/include/vcpkg/binarycaching.h index ff2be6eac..60b2eeab7 100644 --- a/toolsrc/include/vcpkg/binarycaching.h +++ b/toolsrc/include/vcpkg/binarycaching.h @@ -27,16 +27,12 @@ namespace vcpkg { virtual ~IBinaryProvider() = default; virtual void prefetch() = 0; - virtual RestoreResult try_restore(const VcpkgPaths& paths, - const PackageSpec& spec, - const Build::AbiTagAndFile& abi_tag_and_file, - const Build::BuildPackageOptions& build_options) = 0; - virtual void push_success(const VcpkgPaths& paths, - const Build::AbiTagAndFile& abi_tag_and_file, - const Dependencies::InstallPlanAction& action) = 0; - virtual void push_failure(const VcpkgPaths& paths, - const Build::AbiTagAndFile& abi_tag_and_file, - const PackageSpec& spec) = 0; + virtual RestoreResult try_restore(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) = 0; + virtual void push_success(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) = 0; + virtual void push_failure(const VcpkgPaths& paths, const std::string& abi_tag, const PackageSpec& spec) = 0; + virtual RestoreResult precheck(const VcpkgPaths& paths, + const Dependencies::InstallPlanAction& action, + bool purge_tombstones) = 0; }; std::unique_ptr create_archives_provider(); diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h index 58a807776..d36b64143 100644 --- a/toolsrc/include/vcpkg/build.h +++ b/toolsrc/include/vcpkg/build.h @@ -24,6 +24,7 @@ namespace vcpkg namespace vcpkg::Dependencies { struct InstallPlanAction; + struct ActionPlan; } namespace vcpkg::Build @@ -205,7 +206,6 @@ namespace vcpkg::Build ExtendedBuildResult build_package(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& config, - const CMakeVars::CMakeVarProvider& var_provider, IBinaryProvider* binaries_provider, const StatusParagraphs& status_db); @@ -293,8 +293,12 @@ namespace vcpkg::Build fs::path tag_file; }; + void compute_all_abis(const VcpkgPaths& paths, + Dependencies::ActionPlan& action_plan, + const CMakeVars::CMakeVarProvider& var_provider, + const StatusParagraphs& status_db); + Optional compute_abi_tag(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& config, - const PreBuildInfo& pre_build_info, Span dependency_abis); } diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h index 1f92ee63c..26ba9a67c 100644 --- a/toolsrc/include/vcpkg/dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -53,6 +53,7 @@ namespace vcpkg::Dependencies std::unordered_map>&& dependencies); std::string displayname() const; + const std::string& public_abi() const; PackageSpec spec; @@ -65,8 +66,11 @@ namespace vcpkg::Dependencies std::unordered_map> feature_dependencies; std::vector package_dependencies; - std::vector feature_list; + + Optional> pre_build_info; + Optional package_abi; + Optional abi_tag_file; }; enum class RemovePlanType -- cgit v1.2.3 From e21400c7cae2c2df3a9dce6ef8e3c4bf7109aaac Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 12 Feb 2020 15:50:39 -0800 Subject: [vcpkg] Fix VS2015 compile --- toolsrc/include/vcpkg/textrowcol.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/textrowcol.h b/toolsrc/include/vcpkg/textrowcol.h index 5bbf6a899..cd2b223e2 100644 --- a/toolsrc/include/vcpkg/textrowcol.h +++ b/toolsrc/include/vcpkg/textrowcol.h @@ -4,6 +4,8 @@ namespace vcpkg::Parse { struct TextRowCol { + TextRowCol() = default; + TextRowCol(int row, int column) : row(row), column(column) {} /// '0' indicates uninitialized; '1' is the first row. int row = 0; /// '0' indicates uninitialized; '1' is the first column. -- cgit v1.2.3 From ebf8213945060c646e8074bcdf2b9463bcd44216 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 18 Mar 2020 11:19:25 -0700 Subject: [vcpkg] Use enum class for RestoreResult --- toolsrc/include/vcpkg/binarycaching.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/binarycaching.h b/toolsrc/include/vcpkg/binarycaching.h index 60b2eeab7..199b01acc 100644 --- a/toolsrc/include/vcpkg/binarycaching.h +++ b/toolsrc/include/vcpkg/binarycaching.h @@ -16,11 +16,11 @@ namespace vcpkg::Build namespace vcpkg { - enum RestoreResult + enum class RestoreResult { - MISSING, - SUCCESS, - BUILD_FAILED, + missing, + success, + build_failed, }; struct IBinaryProvider -- cgit v1.2.3