From aab7be4fdcaffe86f4ffeb8427baf73e394299b6 Mon Sep 17 00:00:00 2001 From: Billy O'Neal Date: Tue, 12 Jul 2022 16:01:46 -0700 Subject: [PATCH] Delete more namespaces. (#581) * Delete more namespaces: PortFileProvider:: * Delete more namespaces: Build => nothing, Build::Command => Build * Delete more namespaces: Input:: * Delete more namespaces: Dependencies:: * Delete more namespaces: Install:: * Delete more namespaces: Graphs. --- include/vcpkg-test/mockcmakevarprovider.h | 2 +- include/vcpkg/base/graphs.h | 14 +- include/vcpkg/binarycaching.h | 20 +- include/vcpkg/binarycaching.private.h | 4 +- include/vcpkg/build.h | 65 ++-- include/vcpkg/ci-baseline.h | 2 +- include/vcpkg/cmakevars.h | 8 +- include/vcpkg/commands.setinstalled.h | 6 +- include/vcpkg/dependencies.h | 33 +- include/vcpkg/export.chocolatey.h | 2 +- include/vcpkg/export.ifw.h | 2 +- include/vcpkg/export.prefab.h | 2 +- include/vcpkg/fwd/build.h | 2 +- include/vcpkg/fwd/dependencies.h | 2 +- include/vcpkg/fwd/portfileprovider.h | 2 +- include/vcpkg/input.h | 2 +- include/vcpkg/install.h | 64 ++-- include/vcpkg/portfileprovider.h | 3 +- include/vcpkg/postbuildlint.buildtype.h | 6 +- include/vcpkg/postbuildlint.h | 4 +- include/vcpkg/remove.h | 2 +- include/vcpkg/spdx.h | 2 +- include/vcpkg/update.h | 2 +- include/vcpkg/vcpkgpaths.h | 17 +- include/vcpkg/xunitwriter.h | 2 +- src/vcpkg-test/binarycaching.cpp | 47 ++- src/vcpkg-test/ci-baseline.cpp | 1 - src/vcpkg-test/dependencies.cpp | 106 +++--- src/vcpkg-test/install.cpp | 232 ++++++------- src/vcpkg-test/plan.cpp | 385 +++++++++++----------- src/vcpkg-test/spdx.cpp | 12 +- src/vcpkg-test/update.cpp | 8 +- src/vcpkg-test/versionplan.cpp | 8 +- src/vcpkg-test/xunitwriter.cpp | 1 - src/vcpkg.cpp | 4 +- src/vcpkg/base/graphs.cpp | 2 +- src/vcpkg/binarycaching.cpp | 66 ++-- src/vcpkg/build.cpp | 87 +++-- src/vcpkg/ci-baseline.cpp | 14 +- src/vcpkg/cmakevars.cpp | 10 +- src/vcpkg/commands.buildexternal.cpp | 8 +- src/vcpkg/commands.check-support.cpp | 8 +- src/vcpkg/commands.ci.cpp | 53 ++- src/vcpkg/commands.cpp | 4 +- src/vcpkg/commands.dependinfo.cpp | 13 +- src/vcpkg/commands.env.cpp | 7 +- src/vcpkg/commands.find.cpp | 3 +- src/vcpkg/commands.info.cpp | 5 +- src/vcpkg/commands.setinstalled.cpp | 45 ++- src/vcpkg/commands.upgrade.cpp | 31 +- src/vcpkg/dependencies.cpp | 66 ++-- src/vcpkg/export.chocolatey.cpp | 6 +- src/vcpkg/export.cpp | 18 +- src/vcpkg/export.ifw.cpp | 6 +- src/vcpkg/export.prefab.cpp | 14 +- src/vcpkg/input.cpp | 22 +- src/vcpkg/install.cpp | 183 +++++----- src/vcpkg/portfileprovider.cpp | 2 +- src/vcpkg/postbuildlint.buildtype.cpp | 10 +- src/vcpkg/postbuildlint.cpp | 42 +-- src/vcpkg/remove.cpp | 12 +- src/vcpkg/spdx.cpp | 2 +- src/vcpkg/statusparagraphs.cpp | 2 +- src/vcpkg/update.cpp | 5 +- src/vcpkg/vcpkgpaths.cpp | 10 +- src/vcpkg/xunitwriter.cpp | 8 +- 66 files changed, 841 insertions(+), 997 deletions(-) diff --git a/include/vcpkg-test/mockcmakevarprovider.h b/include/vcpkg-test/mockcmakevarprovider.h index 9b17662066..6ee6428de8 100644 --- a/include/vcpkg-test/mockcmakevarprovider.h +++ b/include/vcpkg-test/mockcmakevarprovider.h @@ -19,7 +19,7 @@ namespace vcpkg::Test } void load_tag_vars(Span specs, - const PortFileProvider::PortFileProvider& port_provider, + const PortFileProvider& port_provider, Triplet host_triplet) const override { for (auto&& spec : specs) diff --git a/include/vcpkg/base/graphs.h b/include/vcpkg/base/graphs.h index 065055147a..94a265064f 100644 --- a/include/vcpkg/base/graphs.h +++ b/include/vcpkg/base/graphs.h @@ -8,7 +8,7 @@ #include #include -namespace vcpkg::Graphs +namespace vcpkg { DECLARE_MESSAGE(GraphCycleDetected, (msg::package_name), @@ -35,18 +35,18 @@ namespace vcpkg::Graphs virtual U load_vertex_data(const V& vertex) const = 0; }; - struct Randomizer + struct GraphRandomizer { virtual int random(int max_exclusive) = 0; protected: - ~Randomizer() { } + ~GraphRandomizer() { } }; namespace details { template - void shuffle(Container& c, Randomizer* r) + void shuffle(Container& c, GraphRandomizer* r) { if (!r) return; for (auto i = c.size(); i > 1; --i) @@ -64,7 +64,7 @@ namespace vcpkg::Graphs const AdjacencyProvider& f, std::unordered_map& exploration_status, std::vector& sorted, - Randomizer* randomizer) + GraphRandomizer* randomizer) { ExplorationStatus& status = exploration_status[vertex]; switch (status) @@ -101,7 +101,9 @@ namespace vcpkg::Graphs } template - std::vector topological_sort(Range starting_vertices, const AdjacencyProvider& f, Randomizer* randomizer) + std::vector topological_sort(Range starting_vertices, + const AdjacencyProvider& f, + GraphRandomizer* randomizer) { std::vector sorted; std::unordered_map exploration_status; diff --git a/include/vcpkg/binarycaching.h b/include/vcpkg/binarycaching.h index 8691a1ac8b..9d2e618b1f 100644 --- a/include/vcpkg/binarycaching.h +++ b/include/vcpkg/binarycaching.h @@ -48,11 +48,11 @@ namespace vcpkg /// Attempts to restore the package referenced by `action` into the packages directory. /// Prerequisite: action has a package_abi() - virtual RestoreResult try_restore(const Dependencies::InstallPlanAction& action) const = 0; + virtual RestoreResult try_restore(const InstallPlanAction& action) const = 0; /// Called upon a successful build of `action` to store those contents in the binary cache. /// Prerequisite: action has a package_abi() - virtual void push_success(const Dependencies::InstallPlanAction& action) const = 0; + virtual void push_success(const InstallPlanAction& action) const = 0; /// Gives the IBinaryProvider an opportunity to batch any downloading or server communication for /// executing `actions`. @@ -60,14 +60,14 @@ namespace vcpkg /// to the action at the same index in `actions`. The provider must mark the cache status as appropriate. /// Note: `actions` *might not* have package ABIs (for example, a --head package)! /// Prerequisite: if `actions[i]` has no package ABI, `cache_status[i]` is nullptr. - virtual void prefetch(View actions, View cache_status) const = 0; + virtual void prefetch(View actions, View cache_status) const = 0; /// Checks whether the `actions` are present in the cache, without restoring them. Used by CI to determine /// missing packages. /// `cache_status` is a view with the same number of entries of actions, where each index corresponds /// to the action at the same index in `actions`. The provider must mark the cache status as appropriate. /// Prerequisite: `actions` have package ABIs. - virtual void precheck(View actions, View cache_status) const = 0; + virtual void precheck(View actions, View cache_status) const = 0; }; struct UrlTemplate @@ -77,7 +77,7 @@ namespace vcpkg std::vector headers_for_get; LocalizedString valid(); - std::string instantiate_variables(const Dependencies::InstallPlanAction& action) const; + std::string instantiate_variables(const InstallPlanAction& action) const; }; struct BinaryConfigParserState @@ -128,19 +128,19 @@ namespace vcpkg void install_providers_for(const VcpkgCmdArguments& args, const VcpkgPaths& paths); /// Attempts to restore the package referenced by `action` into the packages directory. - RestoreResult try_restore(const Dependencies::InstallPlanAction& action); + RestoreResult try_restore(const InstallPlanAction& action); /// Called upon a successful build of `action` to store those contents in the binary cache. - void push_success(const Dependencies::InstallPlanAction& action); + void push_success(const InstallPlanAction& action); /// Gives the IBinaryProvider an opportunity to batch any downloading or server communication for /// executing `actions`. - void prefetch(View actions); + void prefetch(View actions); /// Checks whether the `actions` are present in the cache, without restoring them. Used by CI to determine /// missing packages. /// Returns a vector where each index corresponds to the matching index in `actions`. - std::vector precheck(View actions); + std::vector precheck(View actions); private: std::unordered_map m_status; @@ -149,7 +149,7 @@ namespace vcpkg ExpectedS parse_download_configuration(const Optional& arg); - std::string generate_nuget_packages_config(const Dependencies::ActionPlan& action); + std::string generate_nuget_packages_config(const ActionPlan& action); void help_topic_asset_caching(const VcpkgPaths& paths); void help_topic_binary_caching(const VcpkgPaths& paths); diff --git a/include/vcpkg/binarycaching.private.h b/include/vcpkg/binarycaching.private.h index 3aa0944592..886539fa9e 100644 --- a/include/vcpkg/binarycaching.private.h +++ b/include/vcpkg/binarycaching.private.h @@ -35,7 +35,7 @@ namespace vcpkg { return {Strings::concat(prefix, spec.dir()), format_version_for_nugetref(raw_version, abi_tag)}; } - inline NugetReference make_nugetref(const Dependencies::InstallPlanAction& action, const std::string& prefix) + inline NugetReference make_nugetref(const InstallPlanAction& action, const std::string& prefix) { return make_nugetref(action.spec, action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO) @@ -57,7 +57,7 @@ namespace vcpkg } std::string generate_nuspec(const Path& package_dir, - const Dependencies::InstallPlanAction& action, + const InstallPlanAction& action, const NugetReference& ref, details::NuGetRepoInfo rinfo = details::get_nuget_repo_info_from_env()); } diff --git a/include/vcpkg/build.h b/include/vcpkg/build.h index c37102bbd1..1caba6f305 100644 --- a/include/vcpkg/build.h +++ b/include/vcpkg/build.h @@ -28,10 +28,7 @@ namespace vcpkg struct Environment; DECLARE_MESSAGE(ElapsedForPackage, (msg::spec, msg::elapsed), "", "Elapsed time to handle {spec}: {elapsed}"); -} -namespace vcpkg::Build -{ enum class BuildResult { SUCCEEDED, @@ -54,19 +51,19 @@ namespace vcpkg::Build const IBuildLogsRecorder& null_build_logs_recorder() noexcept; - namespace Command + namespace Build { int perform_ex(const VcpkgCmdArguments& args, const FullPackageSpec& full_spec, Triplet host_triplet, - const PortFileProvider::PathsPortFileProvider& provider, + const PathsPortFileProvider& provider, BinaryCache& binary_cache, const IBuildLogsRecorder& build_logs_recorder, const VcpkgPaths& paths); void perform_and_exit_ex(const VcpkgCmdArguments& args, const FullPackageSpec& full_spec, Triplet host_triplet, - const PortFileProvider::PathsPortFileProvider& provider, + const PathsPortFileProvider& provider, BinaryCache& binary_cache, const IBuildLogsRecorder& build_logs_recorder, const VcpkgPaths& paths); @@ -79,7 +76,7 @@ namespace vcpkg::Build const VcpkgPaths& paths, Triplet default_triplet, Triplet host_triplet); - } + } // namespace vcpkg::Build enum class UseHeadVersion { @@ -169,31 +166,31 @@ namespace vcpkg::Build }; static constexpr BuildPackageOptions default_build_package_options{ - Build::BuildMissing::YES, - Build::UseHeadVersion::NO, - Build::AllowDownloads::YES, - Build::OnlyDownloads::NO, - Build::CleanBuildtrees::YES, - Build::CleanPackages::YES, - Build::CleanDownloads::NO, - Build::DownloadTool::BUILT_IN, - Build::PurgeDecompressFailure::YES, - Build::Editable::NO, - Build::BackcompatFeatures::ALLOW, + BuildMissing::YES, + UseHeadVersion::NO, + AllowDownloads::YES, + OnlyDownloads::NO, + CleanBuildtrees::YES, + CleanPackages::YES, + CleanDownloads::NO, + DownloadTool::BUILT_IN, + PurgeDecompressFailure::YES, + Editable::NO, + BackcompatFeatures::ALLOW, }; static constexpr BuildPackageOptions backcompat_prohibiting_package_options{ - Build::BuildMissing::YES, - Build::UseHeadVersion::NO, - Build::AllowDownloads::YES, - Build::OnlyDownloads::NO, - Build::CleanBuildtrees::YES, - Build::CleanPackages::YES, - Build::CleanDownloads::NO, - Build::DownloadTool::BUILT_IN, - Build::PurgeDecompressFailure::YES, - Build::Editable::NO, - Build::BackcompatFeatures::PROHIBIT, + BuildMissing::YES, + UseHeadVersion::NO, + AllowDownloads::YES, + OnlyDownloads::NO, + CleanBuildtrees::YES, + CleanPackages::YES, + CleanDownloads::NO, + DownloadTool::BUILT_IN, + PurgeDecompressFailure::YES, + Editable::NO, + BackcompatFeatures::PROHIBIT, }; struct BuildResultCounts @@ -214,7 +211,7 @@ namespace vcpkg::Build StringLiteral to_string_locale_invariant(const BuildResult build_result); LocalizedString to_string(const BuildResult build_result); - LocalizedString create_user_troubleshooting_message(const Dependencies::InstallPlanAction& action, + LocalizedString create_user_troubleshooting_message(const InstallPlanAction& action, const VcpkgPaths& paths, Optional&& issue_body = nullopt); @@ -273,11 +270,11 @@ namespace vcpkg::Build std::string create_github_issue(const VcpkgCmdArguments& args, const ExtendedBuildResult& build_result, const VcpkgPaths& paths, - const Dependencies::InstallPlanAction& action); + const InstallPlanAction& action); ExtendedBuildResult build_package(const VcpkgCmdArguments& args, const VcpkgPaths& paths, - const Dependencies::InstallPlanAction& config, + const InstallPlanAction& config, BinaryCache& binary_cache, const IBuildLogsRecorder& build_logs_recorder, const StatusParagraphs& status_db); @@ -377,7 +374,7 @@ namespace vcpkg::Build }; void compute_all_abis(const VcpkgPaths& paths, - Dependencies::ActionPlan& action_plan, + ActionPlan& action_plan, const CMakeVars::CMakeVarProvider& var_provider, const StatusParagraphs& status_db); @@ -422,4 +419,4 @@ namespace vcpkg::Build Triplet default_triplet, Triplet host_triplet) const override; }; -} +} // namespace vcpkg diff --git a/include/vcpkg/ci-baseline.h b/include/vcpkg/ci-baseline.h index e2a61469bd..39fd0b01c1 100644 --- a/include/vcpkg/ci-baseline.h +++ b/include/vcpkg/ci-baseline.h @@ -66,7 +66,7 @@ namespace vcpkg SkipFailures skip_failures); LocalizedString format_ci_result(const PackageSpec& spec, - Build::BuildResult result, + BuildResult result, const CiBaselineData& cidata, StringView cifile, bool allow_unexpected_passing); diff --git a/include/vcpkg/cmakevars.h b/include/vcpkg/cmakevars.h index f6b182a4f3..9f5665c764 100644 --- a/include/vcpkg/cmakevars.h +++ b/include/vcpkg/cmakevars.h @@ -32,13 +32,13 @@ namespace vcpkg::CMakeVars virtual void load_dep_info_vars(Span specs, Triplet host_triplet) const = 0; virtual void load_tag_vars(Span specs, - const PortFileProvider::PortFileProvider& port_provider, + const PortFileProvider& port_provider, Triplet host_triplet) const = 0; - void load_tag_vars(const vcpkg::Dependencies::ActionPlan& action_plan, - const PortFileProvider::PortFileProvider& port_provider, + void load_tag_vars(const ActionPlan& action_plan, + const PortFileProvider& port_provider, Triplet host_triplet) const; }; - std::unique_ptr make_triplet_cmake_var_provider(const vcpkg::VcpkgPaths& paths); + std::unique_ptr make_triplet_cmake_var_provider(const VcpkgPaths& paths); } diff --git a/include/vcpkg/commands.setinstalled.h b/include/vcpkg/commands.setinstalled.h index 86594bed80..b5edfafcbe 100644 --- a/include/vcpkg/commands.setinstalled.h +++ b/include/vcpkg/commands.setinstalled.h @@ -10,14 +10,14 @@ namespace vcpkg::Commands::SetInstalled extern const CommandStructure COMMAND_STRUCTURE; void perform_and_exit_ex(const VcpkgCmdArguments& args, const VcpkgPaths& paths, - const PortFileProvider::PathsPortFileProvider& provider, + const PathsPortFileProvider& provider, BinaryCache& binary_cache, const CMakeVars::CMakeVarProvider& cmake_vars, - Dependencies::ActionPlan action_plan, + ActionPlan action_plan, DryRun dry_run, const Optional& pkgsconfig_path, Triplet host_triplet, - const Install::KeepGoing keep_going); + const KeepGoing keep_going); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet, diff --git a/include/vcpkg/dependencies.h b/include/vcpkg/dependencies.h index aefdbbd68f..5f9be8cd00 100644 --- a/include/vcpkg/dependencies.h +++ b/include/vcpkg/dependencies.h @@ -13,18 +13,11 @@ #include #include -namespace vcpkg::Graphs -{ - struct Randomizer; -} - namespace vcpkg { + struct GraphRandomizer; struct StatusParagraphs; -} -namespace vcpkg::Dependencies -{ enum class UnsupportedPortAction : bool { Warn, @@ -38,9 +31,7 @@ namespace vcpkg::Dependencies AUTO_SELECTED }; - std::string to_output_string(RequestType request_type, - const ZStringView s, - const Build::BuildPackageOptions& options); + std::string to_output_string(RequestType request_type, const ZStringView s, const BuildPackageOptions& options); std::string to_output_string(RequestType request_type, const ZStringView s); enum class InstallPlanType @@ -74,7 +65,7 @@ namespace vcpkg::Dependencies const std::string& public_abi() const; bool has_package_abi() const; Optional package_abi() const; - const Build::PreBuildInfo& pre_build_info(LineInfo li) const; + const PreBuildInfo& pre_build_info(LineInfo li) const; PackageSpec spec; @@ -83,7 +74,7 @@ namespace vcpkg::Dependencies InstallPlanType plan_type; RequestType request_type; - Build::BuildPackageOptions build_options; + BuildPackageOptions build_options; std::map> feature_dependencies; std::vector package_dependencies; @@ -91,7 +82,7 @@ namespace vcpkg::Dependencies InternalFeatureSet feature_list; Triplet host_triplet; - Optional abi_info; + Optional abi_info; }; enum class RemovePlanType @@ -165,13 +156,13 @@ namespace vcpkg::Dependencies struct CreateInstallPlanOptions { - CreateInstallPlanOptions(Graphs::Randomizer* r, Triplet t) : randomizer(r), host_triplet(t) { } + CreateInstallPlanOptions(GraphRandomizer* r, Triplet t) : randomizer(r), host_triplet(t) { } CreateInstallPlanOptions(Triplet t, UnsupportedPortAction action = UnsupportedPortAction::Error) : host_triplet(t), unsupported_port_action(action) { } - Graphs::Randomizer* randomizer = nullptr; + GraphRandomizer* randomizer = nullptr; Triplet host_triplet; UnsupportedPortAction unsupported_port_action; }; @@ -186,21 +177,21 @@ namespace vcpkg::Dependencies /// Contains the ports of the current environment. /// Feature specifications to resolve dependencies for. /// Status of installed packages in the current environment. - ActionPlan create_feature_install_plan(const PortFileProvider::PortFileProvider& provider, + ActionPlan create_feature_install_plan(const PortFileProvider& provider, const CMakeVars::CMakeVarProvider& var_provider, View specs, const StatusParagraphs& status_db, const CreateInstallPlanOptions& options = {Triplet{}}); - ActionPlan create_upgrade_plan(const PortFileProvider::PortFileProvider& provider, + ActionPlan create_upgrade_plan(const PortFileProvider& provider, const CMakeVars::CMakeVarProvider& var_provider, const std::vector& specs, const StatusParagraphs& status_db, const CreateInstallPlanOptions& options = {Triplet{}}); - ExpectedS create_versioned_install_plan(const PortFileProvider::IVersionedPortfileProvider& vprovider, - const PortFileProvider::IBaselineProvider& bprovider, - const PortFileProvider::IOverlayProvider& oprovider, + ExpectedS create_versioned_install_plan(const IVersionedPortfileProvider& vprovider, + const IBaselineProvider& bprovider, + const IOverlayProvider& oprovider, const CMakeVars::CMakeVarProvider& var_provider, const std::vector& deps, const std::vector& overrides, diff --git a/include/vcpkg/export.chocolatey.h b/include/vcpkg/export.chocolatey.h index 26238cf43b..3ea31b4b50 100644 --- a/include/vcpkg/export.chocolatey.h +++ b/include/vcpkg/export.chocolatey.h @@ -14,7 +14,7 @@ namespace vcpkg::Export::Chocolatey Optional maybe_version_suffix; }; - void do_export(const std::vector& export_plan, + void do_export(const std::vector& export_plan, const VcpkgPaths& paths, const Options& chocolatey_options); } diff --git a/include/vcpkg/export.ifw.h b/include/vcpkg/export.ifw.h index 88183b7a28..3780ea1c3a 100644 --- a/include/vcpkg/export.ifw.h +++ b/include/vcpkg/export.ifw.h @@ -20,7 +20,7 @@ namespace vcpkg::Export::IFW std::string safe_rich_from_plain_text(StringView text); - void do_export(const std::vector& export_plan, + void do_export(const std::vector& export_plan, const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths); diff --git a/include/vcpkg/export.prefab.h b/include/vcpkg/export.prefab.h index fa94157617..8940843b66 100644 --- a/include/vcpkg/export.prefab.h +++ b/include/vcpkg/export.prefab.h @@ -76,7 +76,7 @@ namespace vcpkg::Export::Prefab std::string to_json(); }; - void do_export(const std::vector& export_plan, + void do_export(const std::vector& export_plan, const VcpkgPaths& paths, const Options& prefab_options, const Triplet& triplet); diff --git a/include/vcpkg/fwd/build.h b/include/vcpkg/fwd/build.h index 77b0114bf6..04e8395e30 100644 --- a/include/vcpkg/fwd/build.h +++ b/include/vcpkg/fwd/build.h @@ -1,6 +1,6 @@ #pragma once -namespace vcpkg::Build +namespace vcpkg { struct BuildInfo; struct PreBuildInfo; diff --git a/include/vcpkg/fwd/dependencies.h b/include/vcpkg/fwd/dependencies.h index 08e824b4ca..86c1d0509f 100644 --- a/include/vcpkg/fwd/dependencies.h +++ b/include/vcpkg/fwd/dependencies.h @@ -1,6 +1,6 @@ #pragma once -namespace vcpkg::Dependencies +namespace vcpkg { struct InstallPlanAction; struct ActionPlan; diff --git a/include/vcpkg/fwd/portfileprovider.h b/include/vcpkg/fwd/portfileprovider.h index a75cfc1372..22869bb90e 100644 --- a/include/vcpkg/fwd/portfileprovider.h +++ b/include/vcpkg/fwd/portfileprovider.h @@ -1,6 +1,6 @@ #pragma once -namespace vcpkg::PortFileProvider +namespace vcpkg { struct PortFileProvider; struct PathsPortFileProvider; diff --git a/include/vcpkg/input.h b/include/vcpkg/input.h index 6ab2e8a84d..e838b70a8a 100644 --- a/include/vcpkg/input.h +++ b/include/vcpkg/input.h @@ -2,7 +2,7 @@ #include -namespace vcpkg::Input +namespace vcpkg { PackageSpec check_and_get_package_spec(std::string&& spec_string, Triplet default_triplet, diff --git a/include/vcpkg/install.h b/include/vcpkg/install.h index 1952620659..3a6605457b 100644 --- a/include/vcpkg/install.h +++ b/include/vcpkg/install.h @@ -17,7 +17,7 @@ #include #include -namespace vcpkg::Install +namespace vcpkg { enum class KeepGoing { @@ -27,18 +27,18 @@ namespace vcpkg::Install struct SpecSummary { - explicit SpecSummary(const Dependencies::InstallPlanAction& action); - explicit SpecSummary(const Dependencies::RemovePlanAction& action); + explicit SpecSummary(const InstallPlanAction& action); + explicit SpecSummary(const RemovePlanAction& action); const BinaryParagraph* get_binary_paragraph() const; const PackageSpec& get_spec() const { return m_spec; } bool is_user_requested_install() const; - Optional build_result; + Optional build_result; vcpkg::ElapsedTime timing; std::chrono::system_clock::time_point start_time; private: - const Dependencies::InstallPlanAction* m_install_action; + const InstallPlanAction* m_install_action; PackageSpec m_spec; }; @@ -63,11 +63,11 @@ namespace vcpkg::Install const Path& listfile() const; }; - Build::ExtendedBuildResult perform_install_plan_action(const VcpkgCmdArguments& args, - const VcpkgPaths& paths, - Dependencies::InstallPlanAction& action, - StatusParagraphs& status_db, - const CMakeVars::CMakeVarProvider& var_provider); + ExtendedBuildResult perform_install_plan_action(const VcpkgCmdArguments& args, + const VcpkgPaths& paths, + InstallPlanAction& action, + StatusParagraphs& status_db, + const CMakeVars::CMakeVarProvider& var_provider); enum class InstallResult { @@ -86,15 +86,6 @@ namespace vcpkg::Install const BinaryControlFile& binary_paragraph, StatusParagraphs* status_db); - InstallSummary perform(const VcpkgCmdArguments& args, - Dependencies::ActionPlan& action_plan, - const KeepGoing keep_going, - const VcpkgPaths& paths, - StatusParagraphs& status_db, - BinaryCache& binary_cache, - const Build::IBuildLogsRecorder& build_logs_recorder, - const CMakeVars::CMakeVarProvider& var_provider); - struct CMakeUsageInfo { std::string message; @@ -105,17 +96,30 @@ namespace vcpkg::Install std::vector get_cmake_add_library_names(StringView cmake_file); CMakeUsageInfo get_cmake_usage(const Filesystem& fs, const InstalledPaths& installed, const BinaryParagraph& bpgh); - void print_usage_information(const BinaryParagraph& bpgh, - std::set& printed_usages, - const Filesystem& fs, - const InstalledPaths& installed); - - extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, - const VcpkgPaths& paths, - Triplet default_triplet, - Triplet host_triplet); + namespace Install + { + extern const CommandStructure COMMAND_STRUCTURE; + + void print_usage_information(const BinaryParagraph& bpgh, + std::set& printed_usages, + const Filesystem& fs, + const InstalledPaths& installed); + + InstallSummary perform(const VcpkgCmdArguments& args, + ActionPlan& action_plan, + const KeepGoing keep_going, + const VcpkgPaths& paths, + StatusParagraphs& status_db, + BinaryCache& binary_cache, + const IBuildLogsRecorder& build_logs_recorder, + const CMakeVars::CMakeVarProvider& var_provider); + + void perform_and_exit(const VcpkgCmdArguments& args, + const VcpkgPaths& paths, + Triplet default_triplet, + Triplet host_triplet); + } // namespace vcpkg::Install struct InstallCommand : Commands::TripletCommand { @@ -125,5 +129,5 @@ namespace vcpkg::Install Triplet host_triplet) const override; }; - void track_install_plan(Dependencies::ActionPlan& plan); + void track_install_plan(ActionPlan& plan); } diff --git a/include/vcpkg/portfileprovider.h b/include/vcpkg/portfileprovider.h index 1c58f8f490..78b82c301c 100644 --- a/include/vcpkg/portfileprovider.h +++ b/include/vcpkg/portfileprovider.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include @@ -9,7 +10,7 @@ #include #include -namespace vcpkg::PortFileProvider +namespace vcpkg { struct PortFileProvider { diff --git a/include/vcpkg/postbuildlint.buildtype.h b/include/vcpkg/postbuildlint.buildtype.h index b33164bea5..8404305590 100644 --- a/include/vcpkg/postbuildlint.buildtype.h +++ b/include/vcpkg/postbuildlint.buildtype.h @@ -12,13 +12,13 @@ namespace vcpkg::PostBuildLint { BuildType() = delete; - constexpr BuildType(Build::ConfigurationType c, Build::LinkageType l) : config(c), linkage(l) { } + constexpr BuildType(ConfigurationType c, LinkageType l) : config(c), linkage(l) { } bool has_crt_linker_option(StringView sv) const; StringLiteral to_string() const; - Build::ConfigurationType config; - Build::LinkageType linkage; + ConfigurationType config; + LinkageType linkage; friend bool operator==(const BuildType& lhs, const BuildType& rhs) { diff --git a/include/vcpkg/postbuildlint.h b/include/vcpkg/postbuildlint.h index a057def1da..aadec0f3a1 100644 --- a/include/vcpkg/postbuildlint.h +++ b/include/vcpkg/postbuildlint.h @@ -14,7 +14,7 @@ namespace vcpkg::PostBuildLint { size_t perform_all_checks(const PackageSpec& spec, const VcpkgPaths& paths, - const Build::PreBuildInfo& pre_build_info, - const Build::BuildInfo& build_info, + const PreBuildInfo& pre_build_info, + const BuildInfo& build_info, const Path& port_dir); } diff --git a/include/vcpkg/remove.h b/include/vcpkg/remove.h index 8ce620b0e6..ff18a09004 100644 --- a/include/vcpkg/remove.h +++ b/include/vcpkg/remove.h @@ -22,7 +22,7 @@ namespace vcpkg::Remove "Removing {action_index}/{count} {spec}"); void perform_remove_plan_action(const VcpkgPaths& paths, - const Dependencies::RemovePlanAction& action, + const RemovePlanAction& action, const Purge purge, StatusParagraphs* status_db); diff --git a/include/vcpkg/spdx.h b/include/vcpkg/spdx.h index a891736621..b9021d467c 100644 --- a/include/vcpkg/spdx.h +++ b/include/vcpkg/spdx.h @@ -17,7 +17,7 @@ namespace vcpkg /// https://spdx.github.io/spdx-spec/document-creation-information/#65-spdx-document-namespace-field /// @param resource_docs Additional documents to concatenate into the created document. These are intended to /// capture fetched resources, such as tools or source archives. - std::string create_spdx_sbom(const Dependencies::InstallPlanAction& action, + std::string create_spdx_sbom(const InstallPlanAction& action, View relative_paths, View hashes, std::string created_time, diff --git a/include/vcpkg/update.h b/include/vcpkg/update.h index 59cb939edd..2b8621fd0f 100644 --- a/include/vcpkg/update.h +++ b/include/vcpkg/update.h @@ -23,7 +23,7 @@ namespace vcpkg::Update VersionDiff version_diff; }; - std::vector find_outdated_packages(const PortFileProvider::PortFileProvider& provider, + std::vector find_outdated_packages(const PortFileProvider& provider, const StatusParagraphs& status_db); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); diff --git a/include/vcpkg/vcpkgpaths.h b/include/vcpkg/vcpkgpaths.h index 4f0c1e1474..396f1fe630 100644 --- a/include/vcpkg/vcpkgpaths.h +++ b/include/vcpkg/vcpkgpaths.h @@ -42,12 +42,9 @@ namespace vcpkg std::vector supported_architectures; }; - namespace Build - { - struct PreBuildInfo; - struct AbiInfo; - struct CompilerInfo; - } + struct PreBuildInfo; + struct AbiInfo; + struct CompilerInfo; namespace details { @@ -161,13 +158,13 @@ namespace vcpkg const RegistrySet& get_registry_set() const; // Retrieve a toolset matching the requirements in prebuildinfo - const Toolset& get_toolset(const Build::PreBuildInfo& prebuildinfo) const; + const Toolset& get_toolset(const PreBuildInfo& prebuildinfo) const; Filesystem& get_filesystem() const; - const Environment& get_action_env(const Build::AbiInfo& abi_info) const; - const std::string& get_triplet_info(const Build::AbiInfo& abi_info) const; - const Build::CompilerInfo& get_compiler_info(const Build::AbiInfo& abi_info) const; + const Environment& get_action_env(const AbiInfo& abi_info) const; + const std::string& get_triplet_info(const AbiInfo& abi_info) const; + const CompilerInfo& get_compiler_info(const AbiInfo& abi_info) const; bool manifest_mode_enabled() const { return get_manifest().has_value(); } const FeatureFlagSettings& get_feature_flags() const; diff --git a/include/vcpkg/xunitwriter.h b/include/vcpkg/xunitwriter.h index 0f96938d93..eb91cb94dc 100644 --- a/include/vcpkg/xunitwriter.h +++ b/include/vcpkg/xunitwriter.h @@ -23,7 +23,7 @@ namespace vcpkg XunitWriter(); ~XunitWriter(); void add_test_results(const PackageSpec& spec, - Build::BuildResult build_result, + BuildResult build_result, const ElapsedTime& elapsed_time, const std::chrono::system_clock::time_point& start_time, const std::string& abi_tag, diff --git a/src/vcpkg-test/binarycaching.cpp b/src/vcpkg-test/binarycaching.cpp index 664eec6bea..b06d9b9420 100644 --- a/src/vcpkg-test/binarycaching.cpp +++ b/src/vcpkg-test/binarycaching.cpp @@ -18,19 +18,15 @@ using namespace vcpkg; struct KnowNothingBinaryProvider : IBinaryProvider { - RestoreResult try_restore(const Dependencies::InstallPlanAction& action) const override + RestoreResult try_restore(const InstallPlanAction& action) const override { CHECK(action.has_package_abi()); return RestoreResult::unavailable; } - virtual void push_success(const Dependencies::InstallPlanAction& action) const override - { - CHECK(action.has_package_abi()); - } + virtual void push_success(const InstallPlanAction& action) const override { CHECK(action.has_package_abi()); } - virtual void prefetch(View actions, - View cache_status) const override + virtual void prefetch(View actions, View cache_status) const override { REQUIRE(actions.size() == cache_status.size()); for (size_t idx = 0; idx < cache_status.size(); ++idx) @@ -38,8 +34,7 @@ struct KnowNothingBinaryProvider : IBinaryProvider CHECK(actions[idx].has_package_abi() == (cache_status[idx] != nullptr)); } } - virtual void precheck(View actions, - View cache_status) const override + virtual void precheck(View actions, View cache_status) const override { REQUIRE(actions.size() == cache_status.size()); for (const auto c : cache_status) @@ -256,18 +251,18 @@ Build-Depends: bzip REQUIRE(maybe_scf.has_value()); SourceControlFileAndLocation scfl{std::move(*maybe_scf.get()), Path()}; - Dependencies::InstallPlanAction ipa(PackageSpec{"zlib2", Test::X64_WINDOWS}, - scfl, - Dependencies::RequestType::USER_REQUESTED, - Test::ARM_UWP, - {{"a", {}}, {"b", {}}}, - {}); + InstallPlanAction ipa(PackageSpec{"zlib2", Test::X64_WINDOWS}, + scfl, + RequestType::USER_REQUESTED, + Test::ARM_UWP, + {{"a", {}}, {"b", {}}}, + {}); - ipa.abi_info = Build::AbiInfo{}; + ipa.abi_info = AbiInfo{}; ipa.abi_info.get()->package_abi = "packageabi"; std::string tripletabi("tripletabi"); ipa.abi_info.get()->triplet_abi = tripletabi; - Build::CompilerInfo compiler_info; + CompilerInfo compiler_info; compiler_info.hash = "compilerhash"; compiler_info.id = "compilerid"; compiler_info.version = "compilerversion"; @@ -379,21 +374,21 @@ TEST_CASE ("Provider nullptr checks", "[BinaryCache]") auto pghs = Paragraphs::parse_paragraphs(R"( Source: someheadpackage Version: 1.5 -Description: +Description: )", ""); REQUIRE(pghs.has_value()); auto maybe_scf = SourceControlFile::parse_control_file("", std::move(*pghs.get())); REQUIRE(maybe_scf.has_value()); SourceControlFileAndLocation scfl{std::move(*maybe_scf.get()), Path()}; - std::vector install_plan; + std::vector install_plan; install_plan.emplace_back(PackageSpec{"someheadpackage", Test::X64_WINDOWS}, scfl, - Dependencies::RequestType::USER_REQUESTED, + RequestType::USER_REQUESTED, Test::ARM_UWP, std::map>{}, std::vector{}); - Dependencies::InstallPlanAction& ipa_without_abi = install_plan.back(); + InstallPlanAction& ipa_without_abi = install_plan.back(); // test that the binary cache does the right thing. See also CHECKs etc. in KnowNothingBinaryProvider uut.push_success(ipa_without_abi); // should have no effects @@ -446,7 +441,7 @@ TEST_CASE ("XmlSerializer", "[XmlSerializer]") TEST_CASE ("generate_nuget_packages_config", "[generate_nuget_packages_config]") { - Dependencies::ActionPlan plan; + ActionPlan plan; auto packageconfig = generate_nuget_packages_config(plan); REQUIRE(packageconfig == R"( @@ -463,10 +458,10 @@ Description: a spiffy compression library wrapper auto maybe_scf = SourceControlFile::parse_control_file("", std::move(*pghs.get())); REQUIRE(maybe_scf.has_value()); SourceControlFileAndLocation scfl{std::move(*maybe_scf.get()), Path()}; - plan.install_actions.push_back(Dependencies::InstallPlanAction()); + plan.install_actions.push_back(InstallPlanAction()); plan.install_actions[0].spec = PackageSpec("zlib", Test::X64_ANDROID); plan.install_actions[0].source_control_file_and_location = scfl; - plan.install_actions[0].abi_info = Build::AbiInfo{}; + plan.install_actions[0].abi_info = AbiInfo{}; plan.install_actions[0].abi_info.get()->package_abi = "packageabi"; packageconfig = generate_nuget_packages_config(plan); @@ -486,10 +481,10 @@ Description: a spiffy compression library wrapper auto maybe_scf2 = SourceControlFile::parse_control_file("", std::move(*pghs2.get())); REQUIRE(maybe_scf2.has_value()); SourceControlFileAndLocation scfl2{std::move(*maybe_scf2.get()), Path()}; - plan.install_actions.push_back(Dependencies::InstallPlanAction()); + plan.install_actions.push_back(InstallPlanAction()); plan.install_actions[1].spec = PackageSpec("zlib2", Test::X64_ANDROID); plan.install_actions[1].source_control_file_and_location = scfl2; - plan.install_actions[1].abi_info = Build::AbiInfo{}; + plan.install_actions[1].abi_info = AbiInfo{}; plan.install_actions[1].abi_info.get()->package_abi = "packageabi2"; packageconfig = generate_nuget_packages_config(plan); diff --git a/src/vcpkg-test/ci-baseline.cpp b/src/vcpkg-test/ci-baseline.cpp index ab2880d0a3..a601fc88aa 100644 --- a/src/vcpkg-test/ci-baseline.cpp +++ b/src/vcpkg-test/ci-baseline.cpp @@ -13,7 +13,6 @@ #include using namespace vcpkg; -using vcpkg::Build::BuildResult; namespace vcpkg { diff --git a/src/vcpkg-test/dependencies.cpp b/src/vcpkg-test/dependencies.cpp index e4813b0114..9d4e5fe7ac 100644 --- a/src/vcpkg-test/dependencies.cpp +++ b/src/vcpkg-test/dependencies.cpp @@ -22,7 +22,7 @@ using Test::make_status_pgh; using Test::MockCMakeVarProvider; using Test::PackageSpecMap; -struct MockBaselineProvider : PortFileProvider::IBaselineProvider +struct MockBaselineProvider : IBaselineProvider { mutable std::map> v; @@ -34,7 +34,7 @@ struct MockBaselineProvider : PortFileProvider::IBaselineProvider } }; -struct MockVersionedPortfileProvider : PortFileProvider::IVersionedPortfileProvider +struct MockVersionedPortfileProvider : IVersionedPortfileProvider { mutable std::map> v; @@ -92,7 +92,7 @@ struct MockVersionedPortfileProvider : PortFileProvider::IVersionedPortfileProvi } }; -static void check_name_and_features(const Dependencies::InstallPlanAction& ipa, +static void check_name_and_features(const InstallPlanAction& ipa, StringLiteral name, std::initializer_list features) { @@ -111,7 +111,7 @@ static void check_name_and_features(const Dependencies::InstallPlanAction& ipa, } } -static void check_name_and_version(const Dependencies::InstallPlanAction& ipa, +static void check_name_and_version(const InstallPlanAction& ipa, StringLiteral name, Version v, std::initializer_list features = {}) @@ -166,7 +166,7 @@ static const PackageSpec& toplevel_spec() return ret; } -struct MockOverlayProvider : PortFileProvider::IOverlayProvider +struct MockOverlayProvider : IOverlayProvider { MockOverlayProvider() = default; MockOverlayProvider(const MockOverlayProvider&) = delete; @@ -215,43 +215,41 @@ struct MockOverlayProvider : PortFileProvider::IOverlayProvider static const MockOverlayProvider s_empty_mock_overlay; -static ExpectedS create_versioned_install_plan( - const PortFileProvider::IVersionedPortfileProvider& provider, - const PortFileProvider::IBaselineProvider& bprovider, - const CMakeVars::CMakeVarProvider& var_provider, - const std::vector& deps, - const std::vector& overrides, - const PackageSpec& toplevel) -{ - return Dependencies::create_versioned_install_plan(provider, - bprovider, - s_empty_mock_overlay, - var_provider, - deps, - overrides, - toplevel, - Test::ARM_UWP, - Dependencies::UnsupportedPortAction::Error); -} - -static ExpectedS create_versioned_install_plan( - const PortFileProvider::IVersionedPortfileProvider& provider, - const PortFileProvider::IBaselineProvider& bprovider, - const PortFileProvider::IOverlayProvider& oprovider, - const CMakeVars::CMakeVarProvider& var_provider, - const std::vector& deps, - const std::vector& overrides, - const PackageSpec& toplevel) -{ - return vcpkg::Dependencies::create_versioned_install_plan(provider, - bprovider, - oprovider, - var_provider, - deps, - overrides, - toplevel, - Test::ARM_UWP, - Dependencies::UnsupportedPortAction::Error); +static ExpectedS create_versioned_install_plan(const IVersionedPortfileProvider& provider, + const IBaselineProvider& bprovider, + const CMakeVars::CMakeVarProvider& var_provider, + const std::vector& deps, + const std::vector& overrides, + const PackageSpec& toplevel) +{ + return create_versioned_install_plan(provider, + bprovider, + s_empty_mock_overlay, + var_provider, + deps, + overrides, + toplevel, + Test::ARM_UWP, + UnsupportedPortAction::Error); +} + +static ExpectedS create_versioned_install_plan(const IVersionedPortfileProvider& provider, + const IBaselineProvider& bprovider, + const IOverlayProvider& oprovider, + const CMakeVars::CMakeVarProvider& var_provider, + const std::vector& deps, + const std::vector& overrides, + const PackageSpec& toplevel) +{ + return create_versioned_install_plan(provider, + bprovider, + oprovider, + var_provider, + deps, + overrides, + toplevel, + Test::ARM_UWP, + UnsupportedPortAction::Error); } TEST_CASE ("basic version install single", "[versionplan]") @@ -508,7 +506,7 @@ TEST_CASE ("version install string port version 2", "[versionplan]") REQUIRE(install_plan.size() == 1); check_name_and_version(install_plan.install_actions[0], "a", {"2", 1}); - CHECK(install_plan.install_actions[0].request_type == Dependencies::RequestType::USER_REQUESTED); + CHECK(install_plan.install_actions[0].request_type == RequestType::USER_REQUESTED); } TEST_CASE ("version install transitive string", "[versionplan]") @@ -541,9 +539,9 @@ TEST_CASE ("version install transitive string", "[versionplan]") REQUIRE(install_plan.size() == 2); check_name_and_version(install_plan.install_actions[0], "b", {"2", 0}); - CHECK(install_plan.install_actions[0].request_type == Dependencies::RequestType::AUTO_SELECTED); + CHECK(install_plan.install_actions[0].request_type == RequestType::AUTO_SELECTED); check_name_and_version(install_plan.install_actions[1], "a", {"2", 1}); - CHECK(install_plan.install_actions[1].request_type == Dependencies::RequestType::USER_REQUESTED); + CHECK(install_plan.install_actions[1].request_type == RequestType::USER_REQUESTED); } TEST_CASE ("version install simple relaxed", "[versionplan]") @@ -1409,11 +1407,11 @@ TEST_CASE ("version install transitive feature versioned", "[versionplan]") REQUIRE(install_plan.size() == 3); check_name_and_version(install_plan.install_actions[0], "c", {"1", 0}); - CHECK(install_plan.install_actions[0].request_type == Dependencies::RequestType::AUTO_SELECTED); + CHECK(install_plan.install_actions[0].request_type == RequestType::AUTO_SELECTED); check_name_and_version(install_plan.install_actions[1], "b", {"2", 0}, {"y"}); - CHECK(install_plan.install_actions[1].request_type == Dependencies::RequestType::AUTO_SELECTED); + CHECK(install_plan.install_actions[1].request_type == RequestType::AUTO_SELECTED); check_name_and_version(install_plan.install_actions[2], "a", {"1", 0}, {"x"}); - CHECK(install_plan.install_actions[2].request_type == Dependencies::RequestType::USER_REQUESTED); + CHECK(install_plan.install_actions[2].request_type == RequestType::USER_REQUESTED); } TEST_CASE ("version install constraint-reduction", "[versionplan]") @@ -1983,10 +1981,10 @@ TEST_CASE ("version install host tool", "[versionplan]") REQUIRE(install_plan.size() == 2); check_name_and_version(install_plan.install_actions[0], "a", {"1", 0}); REQUIRE(install_plan.install_actions[0].spec.triplet() == Test::ARM_UWP); - CHECK(install_plan.install_actions[0].request_type == Dependencies::RequestType::AUTO_SELECTED); + CHECK(install_plan.install_actions[0].request_type == RequestType::AUTO_SELECTED); check_name_and_version(install_plan.install_actions[1], "b", {"1", 0}); REQUIRE(install_plan.install_actions[1].spec.triplet() == Test::X86_WINDOWS); - CHECK(install_plan.install_actions[1].request_type == Dependencies::RequestType::USER_REQUESTED); + CHECK(install_plan.install_actions[1].request_type == RequestType::USER_REQUESTED); } SECTION ("transitive 2") { @@ -1998,10 +1996,10 @@ TEST_CASE ("version install host tool", "[versionplan]") REQUIRE(install_plan.size() == 2); check_name_and_version(install_plan.install_actions[0], "a", {"1", 0}); REQUIRE(install_plan.install_actions[0].spec.triplet() == Test::ARM_UWP); - CHECK(install_plan.install_actions[0].request_type == Dependencies::RequestType::AUTO_SELECTED); + CHECK(install_plan.install_actions[0].request_type == RequestType::AUTO_SELECTED); check_name_and_version(install_plan.install_actions[1], "c", {"1", 0}); REQUIRE(install_plan.install_actions[1].spec.triplet() == Test::ARM_UWP); - CHECK(install_plan.install_actions[1].request_type == Dependencies::RequestType::USER_REQUESTED); + CHECK(install_plan.install_actions[1].request_type == RequestType::USER_REQUESTED); } SECTION ("self-reference") { @@ -2010,10 +2008,10 @@ TEST_CASE ("version install host tool", "[versionplan]") REQUIRE(install_plan.size() == 2); check_name_and_version(install_plan.install_actions[0], "d", {"1", 0}); REQUIRE(install_plan.install_actions[0].spec.triplet() == Test::ARM_UWP); - CHECK(install_plan.install_actions[0].request_type == Dependencies::RequestType::AUTO_SELECTED); + CHECK(install_plan.install_actions[0].request_type == RequestType::AUTO_SELECTED); check_name_and_version(install_plan.install_actions[1], "d", {"1", 0}); REQUIRE(install_plan.install_actions[1].spec.triplet() == Test::X86_WINDOWS); - CHECK(install_plan.install_actions[1].request_type == Dependencies::RequestType::USER_REQUESTED); + CHECK(install_plan.install_actions[1].request_type == RequestType::USER_REQUESTED); } } TEST_CASE ("version overlay ports", "[versionplan]") diff --git a/src/vcpkg-test/install.cpp b/src/vcpkg-test/install.cpp index 8e15ec8638..15ad4b9ece 100644 --- a/src/vcpkg-test/install.cpp +++ b/src/vcpkg-test/install.cpp @@ -6,135 +6,135 @@ using namespace vcpkg; TEST_CASE ("get_cmake_add_library_names", "[install]") { - constexpr static StringLiteral fmt_targets = R"cmake( -# Generated by CMake - -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6) - message(FATAL_ERROR "CMake >= 2.6.0 required") -endif() -cmake_policy(PUSH) -cmake_policy(VERSION 2.6...3.20) -#---------------------------------------------------------------- -# Generated CMake target import file. -#---------------------------------------------------------------- - -# Commands may need to know the format version. -set(CMAKE_IMPORT_FILE_VERSION 1) - -# Protect against multiple inclusion, which would fail when already imported targets are added once more. -set(_targetsDefined) -set(_targetsNotDefined) -set(_expectedTargets) -foreach(_expectedTarget fmt::fmt fmt::fmt-header-only) - list(APPEND _expectedTargets ${_expectedTarget}) - if(NOT TARGET ${_expectedTarget}) - list(APPEND _targetsNotDefined ${_expectedTarget}) - endif() - if(TARGET ${_expectedTarget}) - list(APPEND _targetsDefined ${_expectedTarget}) - endif() -endforeach() -if("${_targetsDefined}" STREQUAL "${_expectedTargets}") - unset(_targetsDefined) - unset(_targetsNotDefined) - unset(_expectedTargets) - set(CMAKE_IMPORT_FILE_VERSION) - cmake_policy(POP) - return() -endif() -if(NOT "${_targetsDefined}" STREQUAL "") - message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") -endif() -unset(_targetsDefined) -unset(_targetsNotDefined) -unset(_expectedTargets) - - -# Compute the installation prefix relative to this file. -get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) -get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -if(_IMPORT_PREFIX STREQUAL "/") - set(_IMPORT_PREFIX "") -endif() - -# Create imported target fmt::fmt -add_library(fmt::fmt SHARED IMPORTED) - -set_target_properties(fmt::fmt PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "FMT_LOCALE;FMT_SHARED" - INTERFACE_COMPILE_FEATURES "cxx_variadic_templates" - INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" -) - -# Create imported target fmt::fmt-header-only -add_library(fmt::fmt-header-only INTERFACE IMPORTED) - -set_target_properties(fmt::fmt-header-only PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "FMT_HEADER_ONLY=1" - INTERFACE_COMPILE_FEATURES "cxx_variadic_templates" - INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" -) - -if(CMAKE_VERSION VERSION_LESS 3.0.0) - message(FATAL_ERROR "This file relies on consumers using CMake 3.0.0 or greater.") -endif() - -# Load information for each installed configuration. -get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -file(GLOB CONFIG_FILES "${_DIR}/fmt-targets-*.cmake") -foreach(f ${CONFIG_FILES}) - include(${f}) -endforeach() - -# Cleanup temporary variables. -set(_IMPORT_PREFIX) - -# Loop over all imported files and verify that they actually exist -foreach(target ${_IMPORT_CHECK_TARGETS} ) - foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) - if(NOT EXISTS "${file}" ) - message(FATAL_ERROR "The imported target \"${target}\" references the file - \"${file}\" -but this file does not exist. Possible reasons include: -* The file was deleted, renamed, or moved to another location. -* An install or uninstall procedure did not complete successfully. -* The installation package was faulty and contained - \"${CMAKE_CURRENT_LIST_FILE}\" -but not all the files it references. -") - endif() - endforeach() - unset(_IMPORT_CHECK_FILES_FOR_${target}) -endforeach() -unset(_IMPORT_CHECK_TARGETS) - -# This file does not depend on other imported targets which have -# been exported from the same project but in a separate export set. - -# Commands beyond this point should not need to know the version. -set(CMAKE_IMPORT_FILE_VERSION) -cmake_policy(POP) + constexpr static StringLiteral fmt_targets = R"cmake( +# Generated by CMake + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6) + message(FATAL_ERROR "CMake >= 2.6.0 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.6...3.20) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget fmt::fmt fmt::fmt-header-only) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + endif() +endforeach() +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + unset(_targetsDefined) + unset(_targetsNotDefined) + unset(_expectedTargets) + set(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +# Create imported target fmt::fmt +add_library(fmt::fmt SHARED IMPORTED) + +set_target_properties(fmt::fmt PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "FMT_LOCALE;FMT_SHARED" + INTERFACE_COMPILE_FEATURES "cxx_variadic_templates" + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" +) + +# Create imported target fmt::fmt-header-only +add_library(fmt::fmt-header-only INTERFACE IMPORTED) + +set_target_properties(fmt::fmt-header-only PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "FMT_HEADER_ONLY=1" + INTERFACE_COMPILE_FEATURES "cxx_variadic_templates" + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" +) + +if(CMAKE_VERSION VERSION_LESS 3.0.0) + message(FATAL_ERROR "This file relies on consumers using CMake 3.0.0 or greater.") +endif() + +# Load information for each installed configuration. +get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(GLOB CONFIG_FILES "${_DIR}/fmt-targets-*.cmake") +foreach(f ${CONFIG_FILES}) + include(${f}) +endforeach() + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) +endforeach() +unset(_IMPORT_CHECK_TARGETS) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) )cmake"; - auto res = Install::get_cmake_add_library_names(""); + auto res = get_cmake_add_library_names(""); CHECK(res.empty()); - res = Install::get_cmake_add_library_names(fmt_targets); + res = get_cmake_add_library_names(fmt_targets); CHECK(res == std::vector{"fmt::fmt", "fmt::fmt-header-only"}); - res = Install::get_cmake_add_library_names("add_library(bar) foo_add_library(baz)"); + res = get_cmake_add_library_names("add_library(bar) foo_add_library(baz)"); CHECK(res == std::vector{"bar"}); - res = Install::get_cmake_add_library_names("add_library(bar) add_library(baz-bar) add_library(baz_%_bar)"); + res = get_cmake_add_library_names("add_library(bar) add_library(baz-bar) add_library(baz_%_bar)"); CHECK(res == std::vector{"bar", "baz-bar", "baz_%_bar"}); - res = Install::get_cmake_add_library_names("add_library(bar${foo})"); + res = get_cmake_add_library_names("add_library(bar${foo})"); CHECK(res == std::vector{"bar"}); - res = Install::get_cmake_add_library_names("add_library() add_library(foo) add_library( \nbar)"); + res = get_cmake_add_library_names("add_library() add_library(foo) add_library( \nbar)"); CHECK(res == std::vector{"foo", "bar"}); - res = Install::get_cmake_add_library_names("add_library(foo) add_library(foo) add_library(foo)"); + res = get_cmake_add_library_names("add_library(foo) add_library(foo) add_library(foo)"); CHECK(res == std::vector{"foo", "foo", "foo"}); } diff --git a/src/vcpkg-test/plan.cpp b/src/vcpkg-test/plan.cpp index bf1d3b4b15..b9561afbe6 100644 --- a/src/vcpkg-test/plan.cpp +++ b/src/vcpkg-test/plan.cpp @@ -25,7 +25,7 @@ using Test::PackageSpecMap; /// /// Assert that the given action an install of given features from given package. /// -static void features_check(Dependencies::InstallPlanAction& plan, +static void features_check(InstallPlanAction& plan, std::string pkg_name, std::vector expected_features, Triplet triplet = Test::X86_WINDOWS) @@ -52,9 +52,7 @@ static void features_check(Dependencies::InstallPlanAction& plan, /// /// Assert that the given action is a remove of given package. /// -static void remove_plan_check(Dependencies::RemovePlanAction& plan, - std::string pkg_name, - Triplet triplet = Test::X86_WINDOWS) +static void remove_plan_check(RemovePlanAction& plan, std::string pkg_name, Triplet triplet = Test::X86_WINDOWS) { REQUIRE(plan.spec.triplet().to_string() == triplet.to_string()); REQUIRE(pkg_name == plan.spec.name()); @@ -69,10 +67,10 @@ TEST_CASE ("basic install scheme", "[plan]") auto spec_b = spec_map.emplace("b", "c"); auto spec_c = spec_map.emplace("c"); - PortFileProvider::MapPortFileProvider map_port(spec_map.map); + MapPortFileProvider map_port(spec_map.map); MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan( + auto install_plan = create_feature_install_plan( map_port, var_provider, Test::parse_test_fspecs("a[core]"), StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 3); @@ -95,11 +93,11 @@ TEST_CASE ("multiple install scheme", "[plan]") auto spec_g = spec_map.emplace("g"); auto spec_h = spec_map.emplace("h"); - PortFileProvider::MapPortFileProvider map_port(spec_map.map); + MapPortFileProvider map_port(spec_map.map); MockCMakeVarProvider var_provider; const auto full_package_specs = Test::parse_test_fspecs("a b c"); - auto install_plan = Dependencies::create_feature_install_plan( + auto install_plan = create_feature_install_plan( map_port, var_provider, full_package_specs, StatusParagraphs(std::move(status_paragraphs))); auto iterator_pos = [&](const PackageSpec& spec) { @@ -138,17 +136,17 @@ TEST_CASE ("existing package scheme", "[plan]") PackageSpecMap spec_map; spec_map.emplace("a"); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan( + auto install_plan = create_feature_install_plan( map_port, var_provider, Test::parse_test_fspecs("a"), StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 1); const auto p = &install_plan.already_installed.at(0); REQUIRE(p->spec.name() == "a"); - REQUIRE(p->plan_type == Dependencies::InstallPlanType::ALREADY_INSTALLED); - REQUIRE(p->request_type == Dependencies::RequestType::USER_REQUESTED); + REQUIRE(p->plan_type == InstallPlanType::ALREADY_INSTALLED); + REQUIRE(p->request_type == RequestType::USER_REQUESTED); } TEST_CASE ("user requested package scheme", "[plan]") @@ -159,22 +157,22 @@ TEST_CASE ("user requested package scheme", "[plan]") spec_map.emplace("a", "b"); spec_map.emplace("b"); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - const auto install_plan = Dependencies::create_feature_install_plan( + const auto install_plan = create_feature_install_plan( map_port, var_provider, Test::parse_test_fspecs("a"), StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 2); const auto p = &install_plan.install_actions.at(0); REQUIRE(p->spec.name() == "b"); - REQUIRE(p->plan_type == Dependencies::InstallPlanType::BUILD_AND_INSTALL); - REQUIRE(p->request_type == Dependencies::RequestType::AUTO_SELECTED); + REQUIRE(p->plan_type == InstallPlanType::BUILD_AND_INSTALL); + REQUIRE(p->request_type == RequestType::AUTO_SELECTED); const auto p2 = &install_plan.install_actions.at(1); REQUIRE(p2->spec.name() == "a"); - REQUIRE(p2->plan_type == Dependencies::InstallPlanType::BUILD_AND_INSTALL); - REQUIRE(p2->request_type == Dependencies::RequestType::USER_REQUESTED); + REQUIRE(p2->plan_type == InstallPlanType::BUILD_AND_INSTALL); + REQUIRE(p2->request_type == RequestType::USER_REQUESTED); } TEST_CASE ("long install scheme", "[plan]") @@ -196,10 +194,10 @@ TEST_CASE ("long install scheme", "[plan]") auto spec_j = spec_map.emplace("j", "k"); auto spec_k = spec_map.emplace("k"); - PortFileProvider::MapPortFileProvider map_port(spec_map.map); + MapPortFileProvider map_port(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_feature_install_plan( + auto plan = create_feature_install_plan( map_port, var_provider, Test::parse_test_fspecs("a"), StatusParagraphs(std::move(status_paragraphs))); auto& install_plan = plan.install_actions; @@ -222,7 +220,7 @@ TEST_CASE ("basic feature test 1", "[plan]") const auto fspecs = Test::parse_test_fspecs("a[a1]"); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; SECTION ("1") @@ -232,8 +230,8 @@ TEST_CASE ("basic feature test 1", "[plan]") status_paragraphs.push_back(make_status_pgh("b")); status_paragraphs.push_back(make_status_feature_pgh("b", "b1")); - auto plan = Dependencies::create_feature_install_plan( - map_port, var_provider, fspecs, StatusParagraphs(std::move(status_paragraphs))); + auto plan = + create_feature_install_plan(map_port, var_provider, fspecs, StatusParagraphs(std::move(status_paragraphs))); REQUIRE(plan.size() == 4); remove_plan_check(plan.remove_actions.at(0), "a"); @@ -244,7 +242,7 @@ TEST_CASE ("basic feature test 1", "[plan]") SECTION ("2") { - auto plan = Dependencies::create_feature_install_plan(map_port, var_provider, fspecs, StatusParagraphs()); + auto plan = create_feature_install_plan(map_port, var_provider, fspecs, StatusParagraphs()); auto& install_plan = plan.install_actions; REQUIRE(install_plan.size() == 2); @@ -264,13 +262,13 @@ TEST_CASE ("basic feature test 3", "[plan]") spec_map.emplace("b"); spec_map.emplace("c", "a[a1]"); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("c[core] a[core]"), - StatusParagraphs(std::move(status_paragraphs))); + auto plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("c[core] a[core]"), + StatusParagraphs(std::move(status_paragraphs))); REQUIRE(plan.size() == 4); remove_plan_check(plan.remove_actions.at(0), "a"); @@ -292,10 +290,10 @@ TEST_CASE ("basic feature test 4", "[plan]") spec_map.emplace("b"); spec_map.emplace("c", "a[a1]"); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan( + auto install_plan = create_feature_install_plan( map_port, var_provider, Test::parse_test_fspecs("c[core]"), StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 1); @@ -311,10 +309,10 @@ TEST_CASE ("basic feature test 5", "[plan]") spec_map.emplace("a", "", {{"a1", "b[b1]"}, {"a2", "b[b2]"}, {"a3", "a[a2]"}}); spec_map.emplace("b", "", {{"b1", ""}, {"b2", ""}}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan( + auto install_plan = create_feature_install_plan( map_port, var_provider, Test::parse_test_fspecs("a[a3]"), StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 2); @@ -331,13 +329,13 @@ TEST_CASE ("basic feature test 6", "[plan]") spec_map.emplace("a", "b[core]"); spec_map.emplace("b", "", {{"b1", ""}}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a[core] b[b1]"), - StatusParagraphs(std::move(status_paragraphs))); + auto plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a[core] b[b1]"), + StatusParagraphs(std::move(status_paragraphs))); REQUIRE(plan.size() == 3); remove_plan_check(plan.remove_actions.at(0), "b"); @@ -357,10 +355,10 @@ TEST_CASE ("basic feature test 7", "[plan]") spec_map.emplace("x", "a"); spec_map.emplace("b", "", {{"b1", ""}}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_feature_install_plan( + auto plan = create_feature_install_plan( map_port, var_provider, Test::parse_test_fspecs("b[b1]"), StatusParagraphs(std::move(status_paragraphs))); REQUIRE(plan.size() == 5); @@ -384,14 +382,13 @@ TEST_CASE ("basic feature test 8", "[plan]") spec_map.emplace("b"); spec_map.emplace("c", "a[a1]"); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_feature_install_plan( - map_port, - var_provider, - Test::parse_test_fspecs("c[core]:x64-windows a a[core]:x64-windows c"), - StatusParagraphs(std::move(status_paragraphs))); + auto plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("c[core]:x64-windows a a[core]:x64-windows c"), + StatusParagraphs(std::move(status_paragraphs))); remove_plan_check(plan.remove_actions.at(0), "a", Test::X64_WINDOWS); remove_plan_check(plan.remove_actions.at(1), "a"); @@ -411,13 +408,13 @@ TEST_CASE ("install all features test", "[plan]") PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a[*]:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a[*]:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 1); features_check(install_plan.install_actions.at(0), "a", {"0", "1", "core"}, Test::X64_WINDOWS); @@ -431,14 +428,14 @@ TEST_CASE ("install default features test 1", "[plan]") PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}, {"1"}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; // Install "a" (without explicit feature specification) - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); // Expect the default feature "1" to be installed, but not "0" REQUIRE(install_plan.size() == 1); @@ -457,14 +454,14 @@ TEST_CASE ("install default features test 2", "[plan]") PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "", {{"a0", ""}, {"a1", ""}}, {"a1"}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; // Install "a" (without explicit feature specification) - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); // Expect "a" to get removed for rebuild and then installed with default // features. @@ -481,14 +478,14 @@ TEST_CASE ("install default features test 3", "[plan]") PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "", {{"a0", ""}, {"a1", ""}}, {"a1"}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; // Explicitly install "a" without default features - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a[core]:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a[core]:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); // Expect the default feature not to get installed. REQUIRE(install_plan.size() == 1); @@ -505,14 +502,14 @@ TEST_CASE ("install default features of dependency test 1", "[plan]") // "b" has two features, of which "b1" is default. spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; // Install "a" (without explicit feature specification) - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); // Expect "a" to get installed and defaults of "b" through the dependency, // as no explicit features of "b" are installed by the user. @@ -531,14 +528,13 @@ TEST_CASE ("do not install default features of dependency test 1", "[plan]") // "b" has two features, of which "b1" is default. spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = - Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a:x64-windows b[core]:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a:x64-windows b[core]:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); // Expect "a" to get installed and defaults of "b" through the dependency, // as no explicit features of "b" are installed by the user. @@ -557,14 +553,13 @@ TEST_CASE ("install default features of dependency test 2", "[plan]") // "b" has two features, of which "b1" is default. spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = - Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a:x64-windows b[core]:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a:x64-windows b[core]:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); // Expect "a" to get installed and defaults of "b" through the dependency REQUIRE(install_plan.size() == 2); @@ -585,13 +580,13 @@ TEST_CASE ("do not install default features of existing dependency", "[plan]") status_paragraphs.push_back(make_status_pgh("b")); status_paragraphs.back()->package.spec = PackageSpec("b", Test::X64_WINDOWS); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); // Expect "a" to get installed, but not require rebuilding "b" REQUIRE(install_plan.size() == 1); @@ -611,13 +606,13 @@ TEST_CASE ("install default features of existing dependency", "[plan]") status_paragraphs.push_back(make_status_pgh("b", "", "b1")); status_paragraphs.back()->package.spec = PackageSpec("b", Test::X64_WINDOWS); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); // Expect "b" to be rebuilt REQUIRE(install_plan.install_actions.size() == 2); @@ -637,13 +632,13 @@ TEST_CASE ("install default features of dependency test 3", "[plan]") // "b" has two features, of which "b1" is default. spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b1"}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); // Expect "a" to get installed, not the defaults of "b", as the required // dependencies are already there, installed explicitly by the user. @@ -662,13 +657,13 @@ TEST_CASE ("install plan action dependencies", "[plan]") auto spec_b = spec_map.emplace("b", "c"); spec_map.emplace("a", "b"); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 3); features_check(install_plan.install_actions.at(0), "c", {"core"}, Test::X64_WINDOWS); @@ -692,13 +687,13 @@ TEST_CASE ("install plan action dependencies 2", "[plan]") auto spec_b = spec_map.emplace("b", "c"); spec_map.emplace("a", "c, b"); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 3); features_check(install_plan.install_actions.at(0), "c", {"core"}, Test::X64_WINDOWS); @@ -720,13 +715,13 @@ TEST_CASE ("install plan action dependencies 3", "[plan]") PackageSpecMap spec_map(Test::X64_WINDOWS); spec_map.emplace("a", "", {{"0", ""}, {"1", "a[0]"}}, {"1"}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 1); features_check(install_plan.install_actions.at(0), "a", {"1", "0", "core"}, Test::X64_WINDOWS); @@ -743,11 +738,11 @@ TEST_CASE ("install with default features", "[plan]") auto b_spec = spec_map.emplace("b", "", {{"0", ""}}, {"0"}); auto a_spec = spec_map.emplace("a", "b[core]", {{"0", ""}}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan( - map_port, var_provider, Test::parse_test_fspecs("a[0] b[core]"), status_db); + auto install_plan = + create_feature_install_plan(map_port, var_provider, Test::parse_test_fspecs("a[0] b[core]"), status_db); // Install "a" and indicate that "b" should not install default features REQUIRE(install_plan.size() == 3); @@ -767,9 +762,9 @@ TEST_CASE ("upgrade with default features 1", "[plan]") PackageSpecMap spec_map; auto spec_a = spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}, {"1"}); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_upgrade_plan(provider, var_provider, {spec_a}, status_db); + auto plan = create_upgrade_plan(provider, var_provider, {spec_a}, status_db); // The upgrade should not install the default feature REQUIRE(plan.size() == 2); @@ -791,9 +786,9 @@ TEST_CASE ("upgrade with default features 2", "[plan]") auto spec_a = spec_map.emplace("a", "b[core]"); auto spec_b = spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b0", "b1"}); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_upgrade_plan(provider, var_provider, {spec_a, spec_b}, status_db); + auto plan = create_upgrade_plan(provider, var_provider, {spec_a, spec_b}, status_db); // The upgrade should install the new default feature b1 but not b0 REQUIRE(plan.size() == 4); @@ -816,9 +811,9 @@ TEST_CASE ("upgrade with default features 3", "[plan]") auto spec_a = spec_map.emplace("a", "b[core]"); spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b0"}); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_upgrade_plan(provider, var_provider, {spec_a}, status_db); + auto plan = create_upgrade_plan(provider, var_provider, {spec_a}, status_db); // The upgrade should install the default feature REQUIRE(plan.size() == 3); @@ -837,9 +832,9 @@ TEST_CASE ("upgrade with new default feature", "[plan]") PackageSpecMap spec_map; auto spec_a = spec_map.emplace("a", "", {{"0", ""}, {"1", ""}, {"2", ""}}, {"0", "1"}); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_upgrade_plan(provider, var_provider, {spec_a}, status_db); + auto plan = create_upgrade_plan(provider, var_provider, {spec_a}, status_db); // The upgrade should install the new default feature but not the old default feature 0 REQUIRE(plan.size() == 2); @@ -856,12 +851,12 @@ TEST_CASE ("transitive features test", "[plan]") spec_map.emplace("b", "c", {{"0", "c[0]"}}); spec_map.emplace("c", "", {{"0", ""}}); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan(provider, - var_provider, - Test::parse_test_fspecs("a[*]:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(provider, + var_provider, + Test::parse_test_fspecs("a[*]:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 3); features_check(install_plan.install_actions.at(0), "c", {"0", "core"}, Test::X64_WINDOWS); @@ -878,12 +873,12 @@ TEST_CASE ("no transitive features test", "[plan]") spec_map.emplace("b", "c", {{"0", ""}}); spec_map.emplace("c", "", {{"0", ""}}); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan(provider, - var_provider, - Test::parse_test_fspecs("a[*]:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(provider, + var_provider, + Test::parse_test_fspecs("a[*]:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 3); features_check(install_plan.install_actions.at(0), "c", {"core"}, Test::X64_WINDOWS); @@ -900,12 +895,12 @@ TEST_CASE ("only transitive features test", "[plan]") spec_map.emplace("b", "", {{"0", "c[0]"}}); spec_map.emplace("c", "", {{"0", ""}}); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan(provider, - var_provider, - Test::parse_test_fspecs("a[*]:x64-windows"), - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = create_feature_install_plan(provider, + var_provider, + Test::parse_test_fspecs("a[*]:x64-windows"), + StatusParagraphs(std::move(status_paragraphs))); REQUIRE(install_plan.size() == 3); features_check(install_plan.install_actions.at(0), "c", {"0", "core"}, Test::X64_WINDOWS); @@ -919,7 +914,7 @@ TEST_CASE ("basic remove scheme", "[plan]") pghs.push_back(make_status_pgh("a")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"a", Test::X86_WINDOWS}}, status_db); + auto remove_plan = create_remove_plan({{"a", Test::X86_WINDOWS}}, status_db); REQUIRE(remove_plan.size() == 1); REQUIRE(remove_plan.at(0).spec.name() == "a"); @@ -932,7 +927,7 @@ TEST_CASE ("recurse remove scheme", "[plan]") pghs.push_back(make_status_pgh("b", "a")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"a", Test::X86_WINDOWS}}, status_db); + auto remove_plan = create_remove_plan({{"a", Test::X86_WINDOWS}}, status_db); REQUIRE(remove_plan.size() == 2); REQUIRE(remove_plan.at(0).spec.name() == "b"); @@ -947,7 +942,7 @@ TEST_CASE ("features depend remove scheme", "[plan]") pghs.push_back(make_status_feature_pgh("b", "0", "a")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"a", Test::X86_WINDOWS}}, status_db); + auto remove_plan = create_remove_plan({{"a", Test::X86_WINDOWS}}, status_db); REQUIRE(remove_plan.size() == 2); REQUIRE(remove_plan.at(0).spec.name() == "b"); @@ -963,7 +958,7 @@ TEST_CASE ("features depend remove scheme once removed", "[plan]") pghs.push_back(make_status_feature_pgh("opencv", "vtk", "vtk")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"expat", Test::X86_WINDOWS}}, status_db); + auto remove_plan = create_remove_plan({{"expat", Test::X86_WINDOWS}}, status_db); REQUIRE(remove_plan.size() == 3); REQUIRE(remove_plan.at(0).spec.name() == "opencv"); @@ -980,7 +975,7 @@ TEST_CASE ("features depend remove scheme once removed x64", "[plan]") pghs.push_back(make_status_feature_pgh("opencv", "vtk", "vtk", "x64")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"expat", Triplet::from_canonical_name("x64")}}, status_db); + auto remove_plan = create_remove_plan({{"expat", Triplet::from_canonical_name("x64")}}, status_db); REQUIRE(remove_plan.size() == 3); REQUIRE(remove_plan.at(0).spec.name() == "opencv"); @@ -995,7 +990,7 @@ TEST_CASE ("features depend core remove scheme", "[plan]") pghs.push_back(make_status_pgh("cpr", "curl[core]", "", "x64")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"curl", Triplet::from_canonical_name("x64")}}, status_db); + auto remove_plan = create_remove_plan({{"curl", Triplet::from_canonical_name("x64")}}, status_db); REQUIRE(remove_plan.size() == 2); REQUIRE(remove_plan.at(0).spec.name() == "cpr"); @@ -1010,7 +1005,7 @@ TEST_CASE ("features depend core remove scheme 2", "[plan]") pghs.push_back(make_status_feature_pgh("curl", "b", "curl[a]", "x64")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"curl", Triplet::from_canonical_name("x64")}}, status_db); + auto remove_plan = create_remove_plan({{"curl", Triplet::from_canonical_name("x64")}}, status_db); REQUIRE(remove_plan.size() == 1); REQUIRE(remove_plan.at(0).spec.name() == "curl"); @@ -1022,12 +1017,12 @@ TEST_CASE ("self-referencing scheme", "[plan]") auto spec_a = spec_map.emplace("a", "a"); auto spec_b = spec_map.emplace("b", "b, b (x64)"); - PortFileProvider::MapPortFileProvider map_port(spec_map.map); + MapPortFileProvider map_port(spec_map.map); MockCMakeVarProvider var_provider; SECTION ("basic") { - auto install_plan = Dependencies::create_feature_install_plan( + auto install_plan = create_feature_install_plan( map_port, var_provider, Test::parse_test_fspecs("a"), {}, {{}, Test::X64_WINDOWS}); REQUIRE(install_plan.size() == 1); @@ -1035,7 +1030,7 @@ TEST_CASE ("self-referencing scheme", "[plan]") } SECTION ("qualified") { - auto install_plan = Dependencies::create_feature_install_plan( + auto install_plan = create_feature_install_plan( map_port, var_provider, Test::parse_test_fspecs("b"), {}, {{}, Test::X64_WINDOWS}); REQUIRE(install_plan.size() == 1); @@ -1054,14 +1049,14 @@ TEST_CASE ("basic tool port scheme", "[plan]") spec_map.map.at("a").source_control_file->core_paragraph->dependencies[0].host = true; - PortFileProvider::MapPortFileProvider map_port(spec_map.map); + MapPortFileProvider map_port(spec_map.map); MockCMakeVarProvider var_provider; - auto install_plan = Dependencies::create_feature_install_plan(map_port, - var_provider, - Test::parse_test_fspecs("a"), - StatusParagraphs(std::move(status_paragraphs)), - {{}, Test::X64_WINDOWS}); + auto install_plan = create_feature_install_plan(map_port, + var_provider, + Test::parse_test_fspecs("a"), + StatusParagraphs(std::move(status_paragraphs)), + {{}, Test::X64_WINDOWS}); REQUIRE(install_plan.size() == 3); REQUIRE(install_plan.install_actions.at(0).spec.name() == "c"); @@ -1088,10 +1083,10 @@ TEST_CASE ("basic existing tool port scheme", "[plan]") spec_map.map.at("a").source_control_file->core_paragraph->dependencies[0].host = true; - PortFileProvider::MapPortFileProvider map_port(spec_map.map); + MapPortFileProvider map_port(spec_map.map); - auto install_plan = Dependencies::create_feature_install_plan( - map_port, var_provider, fspecs_a, status_db, {{}, Test::X64_WINDOWS}); + auto install_plan = + create_feature_install_plan(map_port, var_provider, fspecs_a, status_db, {{}, Test::X64_WINDOWS}); REQUIRE(install_plan.size() == 1); REQUIRE(install_plan.install_actions.at(0).spec == spec_a); @@ -1104,18 +1099,18 @@ TEST_CASE ("basic existing tool port scheme", "[plan]") spec_map.map.at("a").source_control_file->core_paragraph->dependencies[0].host = true; - PortFileProvider::MapPortFileProvider map_port(spec_map.map); + MapPortFileProvider map_port(spec_map.map); - auto install_plan = Dependencies::create_feature_install_plan( - map_port, var_provider, fspecs_a, status_db, {{}, Test::X64_WINDOWS}); + auto install_plan = + create_feature_install_plan(map_port, var_provider, fspecs_a, status_db, {{}, Test::X64_WINDOWS}); REQUIRE(install_plan.size() == 2); REQUIRE(install_plan.install_actions.at(0).spec.name() == "a"); REQUIRE(install_plan.install_actions.at(0).spec.triplet() == Test::X64_WINDOWS); REQUIRE(install_plan.install_actions.at(1).spec == spec_a); - install_plan = Dependencies::create_feature_install_plan( - map_port, var_provider, fspecs_a, status_db, {{}, Test::X86_WINDOWS}); + install_plan = + create_feature_install_plan(map_port, var_provider, fspecs_a, status_db, {{}, Test::X86_WINDOWS}); REQUIRE(install_plan.size() == 1); REQUIRE(install_plan.install_actions.at(0).spec == spec_a); @@ -1129,10 +1124,10 @@ TEST_CASE ("basic existing tool port scheme", "[plan]") spec_map.map.at("a").source_control_file->core_paragraph->dependencies[0].host = true; - PortFileProvider::MapPortFileProvider map_port(spec_map.map); + MapPortFileProvider map_port(spec_map.map); auto install_plan = - Dependencies::create_feature_install_plan(map_port, var_provider, fspecs_a, status_db, {{}, Test::ARM_UWP}); + create_feature_install_plan(map_port, var_provider, fspecs_a, status_db, {{}, Test::ARM_UWP}); REQUIRE(install_plan.size() == 2); REQUIRE(install_plan.install_actions.at(0).spec.name() == "b"); @@ -1149,10 +1144,10 @@ TEST_CASE ("basic existing tool port scheme", "[plan]") spec_map.map.at("a").source_control_file->core_paragraph->dependencies[0].host = true; - PortFileProvider::MapPortFileProvider map_port(spec_map.map); + MapPortFileProvider map_port(spec_map.map); - auto install_plan = Dependencies::create_feature_install_plan( - map_port, var_provider, fspecs_a, status_db, {{}, Test::X64_WINDOWS}); + auto install_plan = + create_feature_install_plan(map_port, var_provider, fspecs_a, status_db, {{}, Test::X64_WINDOWS}); REQUIRE(install_plan.size() == 1); REQUIRE(install_plan.install_actions.at(0).spec == spec_a); @@ -1165,7 +1160,7 @@ TEST_CASE ("remove tool port scheme", "[plan]") pghs.push_back(make_status_pgh("a")); StatusParagraphs status_db(std::move(pghs)); - auto remove_plan = Dependencies::create_remove_plan({{"a", Test::X86_WINDOWS}}, status_db); + auto remove_plan = create_remove_plan({{"a", Test::X86_WINDOWS}}, status_db); REQUIRE(remove_plan.size() == 1); REQUIRE(remove_plan.at(0).spec.name() == "a"); @@ -1180,9 +1175,9 @@ TEST_CASE ("basic upgrade scheme", "[plan]") PackageSpecMap spec_map; auto spec_a = spec_map.emplace("a"); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_upgrade_plan(provider, var_provider, {spec_a}, status_db); + auto plan = create_upgrade_plan(provider, var_provider, {spec_a}, status_db); REQUIRE(plan.size() == 2); remove_plan_check(plan.remove_actions.at(0), "a"); @@ -1200,9 +1195,9 @@ TEST_CASE ("basic upgrade scheme with recurse", "[plan]") auto spec_a = spec_map.emplace("a"); spec_map.emplace("b", "a"); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_upgrade_plan(provider, var_provider, {spec_a}, status_db); + auto plan = create_upgrade_plan(provider, var_provider, {spec_a}, status_db); REQUIRE(plan.size() == 4); remove_plan_check(plan.remove_actions.at(0), "b"); @@ -1222,9 +1217,9 @@ TEST_CASE ("basic upgrade scheme with bystander", "[plan]") auto spec_a = spec_map.emplace("a"); spec_map.emplace("b", "a"); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_upgrade_plan(provider, var_provider, {spec_a}, status_db); + auto plan = create_upgrade_plan(provider, var_provider, {spec_a}, status_db); REQUIRE(plan.size() == 2); remove_plan_check(plan.remove_actions.at(0), "a"); @@ -1241,9 +1236,9 @@ TEST_CASE ("basic upgrade scheme with new dep", "[plan]") auto spec_a = spec_map.emplace("a", "b"); spec_map.emplace("b"); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_upgrade_plan(provider, var_provider, {spec_a}, status_db); + auto plan = create_upgrade_plan(provider, var_provider, {spec_a}, status_db); REQUIRE(plan.size() == 3); remove_plan_check(plan.remove_actions.at(0), "a"); @@ -1261,9 +1256,9 @@ TEST_CASE ("basic upgrade scheme with features", "[plan]") PackageSpecMap spec_map; auto spec_a = spec_map.emplace("a", "", {{"a1", ""}}); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_upgrade_plan(provider, var_provider, {spec_a}, status_db); + auto plan = create_upgrade_plan(provider, var_provider, {spec_a}, status_db); REQUIRE(plan.size() == 2); remove_plan_check(plan.remove_actions.at(0), "a"); @@ -1281,9 +1276,9 @@ TEST_CASE ("basic upgrade scheme with new default feature", "[plan]") PackageSpecMap spec_map; auto spec_a = spec_map.emplace("a", "", {{"a1", ""}}, {"a1"}); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_upgrade_plan(provider, var_provider, {spec_a}, status_db); + auto plan = create_upgrade_plan(provider, var_provider, {spec_a}, status_db); REQUIRE(plan.size() == 2); remove_plan_check(plan.remove_actions.at(0), "a"); @@ -1301,9 +1296,9 @@ TEST_CASE ("basic upgrade scheme with self features", "[plan]") PackageSpecMap spec_map; auto spec_a = spec_map.emplace("a", "", {{"a1", ""}, {"a2", "a[a1]"}}); - PortFileProvider::MapPortFileProvider provider(spec_map.map); + MapPortFileProvider provider(spec_map.map); MockCMakeVarProvider var_provider; - auto plan = Dependencies::create_upgrade_plan(provider, var_provider, {spec_a}, status_db); + auto plan = create_upgrade_plan(provider, var_provider, {spec_a}, status_db); REQUIRE(plan.size() == 2); remove_plan_check(plan.remove_actions.at(0), "a"); @@ -1319,11 +1314,11 @@ TEST_CASE ("basic export scheme", "[plan]") PackageSpecMap spec_map; auto spec_a = spec_map.emplace("a"); - auto plan = Dependencies::create_export_plan({spec_a}, status_db); + auto plan = create_export_plan({spec_a}, status_db); REQUIRE(plan.size() == 1); REQUIRE(plan.at(0).spec.name() == "a"); - REQUIRE(plan.at(0).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); + REQUIRE(plan.at(0).plan_type == ExportPlanType::ALREADY_BUILT); } TEST_CASE ("basic export scheme with recurse", "[plan]") @@ -1337,14 +1332,14 @@ TEST_CASE ("basic export scheme with recurse", "[plan]") auto spec_a = spec_map.emplace("a"); auto spec_b = spec_map.emplace("b", "a"); - auto plan = Dependencies::create_export_plan({spec_b}, status_db); + auto plan = create_export_plan({spec_b}, status_db); REQUIRE(plan.size() == 2); REQUIRE(plan.at(0).spec.name() == "a"); - REQUIRE(plan.at(0).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); + REQUIRE(plan.at(0).plan_type == ExportPlanType::ALREADY_BUILT); REQUIRE(plan.at(1).spec.name() == "b"); - REQUIRE(plan.at(1).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); + REQUIRE(plan.at(1).plan_type == ExportPlanType::ALREADY_BUILT); } TEST_CASE ("basic export scheme with bystander", "[plan]") @@ -1358,11 +1353,11 @@ TEST_CASE ("basic export scheme with bystander", "[plan]") auto spec_a = spec_map.emplace("a"); auto spec_b = spec_map.emplace("b", "a"); - auto plan = Dependencies::create_export_plan({spec_a}, status_db); + auto plan = create_export_plan({spec_a}, status_db); REQUIRE(plan.size() == 1); REQUIRE(plan.at(0).spec.name() == "a"); - REQUIRE(plan.at(0).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); + REQUIRE(plan.at(0).plan_type == ExportPlanType::ALREADY_BUILT); } TEST_CASE ("basic export scheme with missing", "[plan]") @@ -1372,11 +1367,11 @@ TEST_CASE ("basic export scheme with missing", "[plan]") PackageSpecMap spec_map; auto spec_a = spec_map.emplace("a"); - auto plan = Dependencies::create_export_plan({spec_a}, status_db); + auto plan = create_export_plan({spec_a}, status_db); REQUIRE(plan.size() == 1); REQUIRE(plan.at(0).spec.name() == "a"); - REQUIRE(plan.at(0).plan_type == Dependencies::ExportPlanType::NOT_BUILT); + REQUIRE(plan.at(0).plan_type == ExportPlanType::NOT_BUILT); } TEST_CASE ("basic export scheme with features", "[plan]") @@ -1390,13 +1385,13 @@ TEST_CASE ("basic export scheme with features", "[plan]") PackageSpecMap spec_map; auto spec_a = spec_map.emplace("a", "", {{"a1", ""}}); - auto plan = Dependencies::create_export_plan({spec_a}, status_db); + auto plan = create_export_plan({spec_a}, status_db); REQUIRE(plan.size() == 2); REQUIRE(plan.at(0).spec.name() == "b"); - REQUIRE(plan.at(0).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); + REQUIRE(plan.at(0).plan_type == ExportPlanType::ALREADY_BUILT); REQUIRE(plan.at(1).spec.name() == "a"); - REQUIRE(plan.at(1).plan_type == Dependencies::ExportPlanType::ALREADY_BUILT); + REQUIRE(plan.at(1).plan_type == ExportPlanType::ALREADY_BUILT); } diff --git a/src/vcpkg-test/spdx.cpp b/src/vcpkg-test/spdx.cpp index caedd79c8b..e88246f0bf 100644 --- a/src/vcpkg-test/spdx.cpp +++ b/src/vcpkg-test/spdx.cpp @@ -6,8 +6,6 @@ using namespace vcpkg; TEST_CASE ("spdx maximum serialization", "[spdx]") { - using namespace Dependencies; - PackageSpec spec{"zlib", Test::ARM_UWP}; SourceControlFileAndLocation scfl; scfl.registry_location = "git://some-vcs-url"; @@ -23,7 +21,7 @@ TEST_CASE ("spdx maximum serialization", "[spdx]") cpgh.version_scheme = VersionScheme::Relaxed; InstallPlanAction ipa(spec, scfl, RequestType::USER_REQUESTED, Test::X86_WINDOWS, {}, {}); - auto& abi = *(ipa.abi_info = Build::AbiInfo{}).get(); + auto& abi = *(ipa.abi_info = AbiInfo{}).get(); abi.package_abi = "ABIHASH"; const auto sbom = @@ -167,8 +165,6 @@ TEST_CASE ("spdx maximum serialization", "[spdx]") TEST_CASE ("spdx minimum serialization", "[spdx]") { - using namespace Dependencies; - PackageSpec spec{"zlib", Test::ARM_UWP}; SourceControlFileAndLocation scfl; auto& scf = *(scfl.source_control_file = std::make_unique()); @@ -179,7 +175,7 @@ TEST_CASE ("spdx minimum serialization", "[spdx]") cpgh.version_scheme = VersionScheme::String; InstallPlanAction ipa(spec, scfl, RequestType::USER_REQUESTED, Test::X86_WINDOWS, {}, {}); - auto& abi = *(ipa.abi_info = Build::AbiInfo{}).get(); + auto& abi = *(ipa.abi_info = AbiInfo{}).get(); abi.package_abi = "deadbeef"; const auto sbom = create_spdx_sbom(ipa, @@ -297,8 +293,6 @@ TEST_CASE ("spdx minimum serialization", "[spdx]") TEST_CASE ("spdx concat resources", "[spdx]") { - using namespace Dependencies; - PackageSpec spec{"zlib", Test::ARM_UWP}; SourceControlFileAndLocation scfl; auto& scf = *(scfl.source_control_file = std::make_unique()); @@ -309,7 +303,7 @@ TEST_CASE ("spdx concat resources", "[spdx]") cpgh.version_scheme = VersionScheme::String; InstallPlanAction ipa(spec, scfl, RequestType::USER_REQUESTED, Test::X86_WINDOWS, {}, {}); - auto& abi = *(ipa.abi_info = Build::AbiInfo{}).get(); + auto& abi = *(ipa.abi_info = AbiInfo{}).get(); abi.package_abi = "deadbeef"; auto doc1 = Json::parse(R"json( diff --git a/src/vcpkg-test/update.cpp b/src/vcpkg-test/update.cpp index fbaf0d27c7..37372ef833 100644 --- a/src/vcpkg-test/update.cpp +++ b/src/vcpkg-test/update.cpp @@ -25,7 +25,7 @@ TEST_CASE ("find outdated packages basic", "[update]") std::unordered_map map; auto scf = test_parse_control_file({{{"Source", "a"}, {"Version", "0"}}}).value_or_exit(VCPKG_LINE_INFO); map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""}); - PortFileProvider::MapPortFileProvider provider(map); + MapPortFileProvider provider(map); auto pkgs = SortedVector( Update::find_outdated_packages(provider, status_db), &OutdatedPackage::compare_by_name); @@ -49,7 +49,7 @@ TEST_CASE ("find outdated packages features", "[update]") std::unordered_map map; auto scf = test_parse_control_file({{{"Source", "a"}, {"Version", "0"}}}).value_or_exit(VCPKG_LINE_INFO); map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""}); - PortFileProvider::MapPortFileProvider provider(map); + MapPortFileProvider provider(map); auto pkgs = SortedVector( Update::find_outdated_packages(provider, status_db), &OutdatedPackage::compare_by_name); @@ -75,7 +75,7 @@ TEST_CASE ("find outdated packages features 2", "[update]") std::unordered_map map; auto scf = test_parse_control_file({{{"Source", "a"}, {"Version", "0"}}}).value_or_exit(VCPKG_LINE_INFO); map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""}); - PortFileProvider::MapPortFileProvider provider(map); + MapPortFileProvider provider(map); auto pkgs = SortedVector( Update::find_outdated_packages(provider, status_db), &OutdatedPackage::compare_by_name); @@ -96,7 +96,7 @@ TEST_CASE ("find outdated packages none", "[update]") std::unordered_map map; auto scf = test_parse_control_file({{{"Source", "a"}, {"Version", "2"}}}).value_or_exit(VCPKG_LINE_INFO); map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""}); - PortFileProvider::MapPortFileProvider provider(map); + MapPortFileProvider provider(map); auto pkgs = SortedVector( Update::find_outdated_packages(provider, status_db), &OutdatedPackage::compare_by_name); diff --git a/src/vcpkg-test/versionplan.cpp b/src/vcpkg-test/versionplan.cpp index 2665530a7e..747bcd3829 100644 --- a/src/vcpkg-test/versionplan.cpp +++ b/src/vcpkg-test/versionplan.cpp @@ -86,18 +86,16 @@ TEST_CASE ("qualified dependency", "[dependencies]") spec_map.emplace("a", "b, b[b1] (linux)"); spec_map.emplace("b", "", {{"b1", ""}}); - PortFileProvider::MapPortFileProvider map_port{spec_map.map}; + MapPortFileProvider map_port{spec_map.map}; MockCMakeVarProvider var_provider; var_provider.dep_info_vars[{"a", Triplet::from_canonical_name("x64-linux")}].emplace("VCPKG_CMAKE_SYSTEM_NAME", "Linux"); - auto plan = - vcpkg::Dependencies::create_feature_install_plan(map_port, var_provider, Test::parse_test_fspecs("a"), {}); + auto plan = vcpkg::create_feature_install_plan(map_port, var_provider, Test::parse_test_fspecs("a"), {}); REQUIRE(plan.install_actions.size() == 2); REQUIRE(plan.install_actions.at(0).feature_list == std::vector{"core"}); - auto plan2 = vcpkg::Dependencies::create_feature_install_plan( - map_port, var_provider, Test::parse_test_fspecs("a:x64-linux"), {}); + auto plan2 = vcpkg::create_feature_install_plan(map_port, var_provider, Test::parse_test_fspecs("a:x64-linux"), {}); REQUIRE(plan2.install_actions.size() == 2); REQUIRE(plan2.install_actions.at(0).feature_list == std::vector{"b1", "core"}); } diff --git a/src/vcpkg-test/xunitwriter.cpp b/src/vcpkg-test/xunitwriter.cpp index ceab190879..c80933188b 100644 --- a/src/vcpkg-test/xunitwriter.cpp +++ b/src/vcpkg-test/xunitwriter.cpp @@ -7,7 +7,6 @@ #include using namespace vcpkg; -using Build::BuildResult; TEST_CASE ("Simple XunitWriter", "[xunitwriter]") { diff --git a/src/vcpkg.cpp b/src/vcpkg.cpp index 8f77ed91ac..51573a67ae 100644 --- a/src/vcpkg.cpp +++ b/src/vcpkg.cpp @@ -87,9 +87,9 @@ static void inner(vcpkg::Filesystem& fs, const VcpkgCmdArguments& args) } Triplet default_triplet = vcpkg::default_triplet(args); - Input::check_triplet(default_triplet, paths); + check_triplet(default_triplet, paths); Triplet host_triplet = vcpkg::default_host_triplet(args); - Input::check_triplet(host_triplet, paths); + check_triplet(host_triplet, paths); if (const auto command_function = find_command(Commands::get_available_triplet_commands())) { diff --git a/src/vcpkg/base/graphs.cpp b/src/vcpkg/base/graphs.cpp index 9983c61499..509d4a635e 100644 --- a/src/vcpkg/base/graphs.cpp +++ b/src/vcpkg/base/graphs.cpp @@ -1,6 +1,6 @@ #include -namespace vcpkg::Graphs +namespace vcpkg { REGISTER_MESSAGE(GraphCycleDetected); } diff --git a/src/vcpkg/binarycaching.cpp b/src/vcpkg/binarycaching.cpp index 550970e92d..d6c012804c 100644 --- a/src/vcpkg/binarycaching.cpp +++ b/src/vcpkg/binarycaching.cpp @@ -192,10 +192,10 @@ namespace static Path make_archive_subpath(const std::string& abi) { return Path(abi.substr(0, 2)) / (abi + ".zip"); } - void prefetch(View actions, View cache_status) const override + void prefetch(View actions, View cache_status) const override { std::vector to_try_restore_idxs; - std::vector to_try_restore; + std::vector to_try_restore; for (const auto& archives_root_dir : m_read_dirs) { @@ -229,7 +229,7 @@ namespace } } - std::vector try_restore_n(View actions, + std::vector try_restore_n(View actions, const Path& archives_root_dir) const { auto& fs = paths.get_filesystem(); @@ -268,7 +268,7 @@ namespace } else { - if (actions[i]->build_options.purge_decompress_failure == Build::PurgeDecompressFailure::YES) + if (actions[i]->build_options.purge_decompress_failure == PurgeDecompressFailure::YES) { Debug::print( "Failed to decompress archive package; purging: ", archive_paths[j].native(), '\n'); @@ -283,7 +283,7 @@ namespace return results; } - RestoreResult try_restore(const Dependencies::InstallPlanAction& action) const override + RestoreResult try_restore(const InstallPlanAction& action) const override { // Note: this method is almost never called -- it will only be called if another provider promised to // restore a package but then failed at runtime @@ -299,7 +299,7 @@ namespace return RestoreResult::unavailable; } - void push_success(const Dependencies::InstallPlanAction& action) const override + void push_success(const InstallPlanAction& action) const override { if (m_write_dirs.empty() && m_put_url_templates.empty()) { @@ -374,7 +374,7 @@ namespace } } - void precheck(View actions, View cache_status) const override + void precheck(View actions, View cache_status) const override { auto& fs = paths.get_filesystem(); for (size_t idx = 0; idx < actions.size(); ++idx) @@ -424,14 +424,11 @@ namespace { } - RestoreResult try_restore(const Dependencies::InstallPlanAction&) const override - { - return RestoreResult::unavailable; - } + RestoreResult try_restore(const InstallPlanAction&) const override { return RestoreResult::unavailable; } - void push_success(const Dependencies::InstallPlanAction&) const override { } + void push_success(const InstallPlanAction&) const override { } - void prefetch(View actions, View cache_status) const override + void prefetch(View actions, View cache_status) const override { const auto timer = ElapsedTimer::create_started(); auto& fs = paths.get_filesystem(); @@ -500,7 +497,7 @@ namespace msg::value = "HTTP servers"); } - void precheck(View actions, View cache_status) const override + void precheck(View actions, View cache_status) const override { std::vector actions_present{actions.size()}; std::vector urls; @@ -668,7 +665,7 @@ namespace fs.write_contents(packages_config, xml.buf, VCPKG_LINE_INFO); } - void prefetch(View actions, View cache_status) const override + void prefetch(View actions, View cache_status) const override { if (m_read_sources.empty() && m_read_configs.empty()) { @@ -812,12 +809,9 @@ namespace msg::value = "NuGet"); } - RestoreResult try_restore(const Dependencies::InstallPlanAction&) const override - { - return RestoreResult::unavailable; - } + RestoreResult try_restore(const InstallPlanAction&) const override { return RestoreResult::unavailable; } - void push_success(const Dependencies::InstallPlanAction& action) const override + void push_success(const InstallPlanAction& action) const override { if (m_write_sources.empty() && m_write_configs.empty()) { @@ -915,7 +909,7 @@ namespace fs.remove(nupkg_path, IgnoreErrors{}); } - void precheck(View, View) const override { } + void precheck(View, View) const override { } private: const VcpkgPaths& paths; @@ -945,7 +939,7 @@ namespace return Strings::concat(prefix, abi, ".zip"); } - void prefetch(View actions, View cache_status) const override + void prefetch(View actions, View cache_status) const override { auto& fs = paths.get_filesystem(); @@ -1015,12 +1009,9 @@ namespace msg::value = vendor()); } - RestoreResult try_restore(const Dependencies::InstallPlanAction&) const override - { - return RestoreResult::unavailable; - } + RestoreResult try_restore(const InstallPlanAction&) const override { return RestoreResult::unavailable; } - void push_success(const Dependencies::InstallPlanAction& action) const override + void push_success(const InstallPlanAction& action) const override { if (m_write_prefixes.empty()) return; const auto timer = ElapsedTimer::create_started(); @@ -1053,7 +1044,7 @@ namespace msg::vendor = vendor()); } - void precheck(View actions, View cache_status) const override + void precheck(View actions, View cache_status) const override { std::vector actions_availability{actions.size()}; for (const auto& prefix : m_read_prefixes) @@ -1286,7 +1277,7 @@ namespace vcpkg return {}; } - std::string UrlTemplate::instantiate_variables(const Dependencies::InstallPlanAction& action) const + std::string UrlTemplate::instantiate_variables(const InstallPlanAction& action) const { return api_stable_format(url_template, [&](std::string& out, StringView key) { @@ -1347,7 +1338,7 @@ namespace vcpkg } } - RestoreResult BinaryCache::try_restore(const Dependencies::InstallPlanAction& action) + RestoreResult BinaryCache::try_restore(const InstallPlanAction& action) { const auto abi = action.package_abi().get(); if (!abi) @@ -1400,7 +1391,7 @@ namespace vcpkg return RestoreResult::unavailable; } - void BinaryCache::push_success(const Dependencies::InstallPlanAction& action) + void BinaryCache::push_success(const InstallPlanAction& action) { const auto abi = action.package_abi().get(); if (abi) @@ -1414,7 +1405,7 @@ namespace vcpkg } } - void BinaryCache::prefetch(View actions) + void BinaryCache::prefetch(View actions) { std::vector cache_status{actions.size()}; for (size_t idx = 0; idx < actions.size(); ++idx) @@ -1439,7 +1430,7 @@ namespace vcpkg } } - std::vector BinaryCache::precheck(View actions) + std::vector BinaryCache::precheck(View actions) { std::vector cache_status{actions.size()}; for (size_t idx = 0; idx < actions.size(); ++idx) @@ -2363,7 +2354,7 @@ details::NuGetRepoInfo details::get_nuget_repo_info_from_env() } std::string vcpkg::generate_nuspec(const Path& package_dir, - const Dependencies::InstallPlanAction& action, + const InstallPlanAction& action, const vcpkg::NugetReference& ref, details::NuGetRepoInfo rinfo) { @@ -2559,11 +2550,10 @@ void vcpkg::help_topic_binary_caching(const VcpkgPaths&) msg::println(msgExtendedDocumenationAtUrl, msg::url = docs::binarycaching_url); } -std::string vcpkg::generate_nuget_packages_config(const Dependencies::ActionPlan& action) +std::string vcpkg::generate_nuget_packages_config(const ActionPlan& action) { - auto refs = Util::fmap(action.install_actions, [&](const Dependencies::InstallPlanAction& ipa) { - return make_nugetref(ipa, get_nuget_prefix()); - }); + auto refs = Util::fmap(action.install_actions, + [&](const InstallPlanAction& ipa) { return make_nugetref(ipa, get_nuget_prefix()); }); XmlSerializer xml; xml.emit_declaration().line_break(); xml.open_tag("packages").line_break(); diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index c5413fba01..b3b6efb6c3 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -36,12 +36,9 @@ #include using namespace vcpkg; -using vcpkg::Build::BuildResult; -using vcpkg::PortFileProvider::PathsPortFileProvider; namespace { - using vcpkg::Build::IBuildLogsRecorder; struct NullBuildLogsRecorder final : IBuildLogsRecorder { void record_build_result(const VcpkgPaths& paths, const PackageSpec& spec, BuildResult result) const override @@ -62,16 +59,13 @@ namespace vcpkg namespace vcpkg::Build { - using Dependencies::InstallPlanAction; - using Dependencies::InstallPlanType; - - void Command::perform_and_exit_ex(const VcpkgCmdArguments& args, - const FullPackageSpec& full_spec, - Triplet host_triplet, - const PathsPortFileProvider& provider, - BinaryCache& binary_cache, - const IBuildLogsRecorder& build_logs_recorder, - const VcpkgPaths& paths) + void perform_and_exit_ex(const VcpkgCmdArguments& args, + const FullPackageSpec& full_spec, + Triplet host_triplet, + const PathsPortFileProvider& provider, + BinaryCache& binary_cache, + const IBuildLogsRecorder& build_logs_recorder, + const VcpkgPaths& paths) { Checks::exit_with_code( VCPKG_LINE_INFO, @@ -86,21 +80,21 @@ namespace vcpkg::Build nullptr, }; - void Command::perform_and_exit(const VcpkgCmdArguments& args, - const VcpkgPaths& paths, - Triplet default_triplet, - Triplet host_triplet) + void perform_and_exit(const VcpkgCmdArguments& args, + const VcpkgPaths& paths, + Triplet default_triplet, + Triplet host_triplet) { Checks::exit_with_code(VCPKG_LINE_INFO, perform(args, paths, default_triplet, host_triplet)); } - int Command::perform_ex(const VcpkgCmdArguments& args, - const FullPackageSpec& full_spec, - Triplet host_triplet, - const PathsPortFileProvider& provider, - BinaryCache& binary_cache, - const IBuildLogsRecorder& build_logs_recorder, - const VcpkgPaths& paths) + int perform_ex(const VcpkgCmdArguments& args, + const FullPackageSpec& full_spec, + Triplet host_triplet, + const PathsPortFileProvider& provider, + BinaryCache& binary_cache, + const IBuildLogsRecorder& build_logs_recorder, + const VcpkgPaths& paths) { const PackageSpec& spec = full_spec.package_spec; auto var_provider_storage = CMakeVars::make_triplet_cmake_var_provider(paths); @@ -108,8 +102,8 @@ namespace vcpkg::Build var_provider.load_dep_info_vars({{spec}}, host_triplet); StatusParagraphs status_db = database_load_check(paths.get_filesystem(), paths.installed()); - auto action_plan = Dependencies::create_feature_install_plan( - provider, var_provider, {&full_spec, 1}, status_db, {host_triplet}); + auto action_plan = + create_feature_install_plan(provider, var_provider, {&full_spec, 1}, status_db, {host_triplet}); var_provider.load_tag_vars(action_plan, provider, host_triplet); @@ -151,7 +145,7 @@ namespace vcpkg::Build action->build_options.clean_packages = CleanPackages::NO; const auto build_timer = ElapsedTimer::create_started(); - const auto result = Build::build_package(args, paths, *action, binary_cache, build_logs_recorder, status_db); + const auto result = build_package(args, paths, *action, binary_cache, build_logs_recorder, status_db); msg::print(msgElapsedForPackage, msg::spec = spec, msg::elapsed = build_timer); if (result.code == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES) { @@ -177,43 +171,39 @@ namespace vcpkg::Build { msg::print(Color::warning, warnings); } - msg::println_error(Build::create_error_message(result, spec)); - msg::print(Build::create_user_troubleshooting_message(*action, paths)); + msg::println_error(create_error_message(result, spec)); + msg::print(create_user_troubleshooting_message(*action, paths)); return 1; } return 0; } - int Command::perform(const VcpkgCmdArguments& args, - const VcpkgPaths& paths, - Triplet default_triplet, - Triplet host_triplet) + int perform(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet, Triplet host_triplet) { // Build only takes a single package and all dependencies must already be installed const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); std::string first_arg = args.command_arguments[0]; BinaryCache binary_cache{args, paths}; - const FullPackageSpec spec = Input::check_and_get_full_package_spec( + const FullPackageSpec spec = check_and_get_full_package_spec( std::move(first_arg), default_triplet, COMMAND_STRUCTURE.example_text, paths); - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); - return perform_ex(args, spec, host_triplet, provider, binary_cache, Build::null_build_logs_recorder(), paths); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); + return perform_ex(args, spec, host_triplet, provider, binary_cache, null_build_logs_recorder(), paths); } +} // namespace vcpkg::Build +namespace vcpkg +{ void BuildCommand::perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet, Triplet host_triplet) const { - Build::Command::perform_and_exit(args, paths, default_triplet, host_triplet); + Build::perform_and_exit(args, paths, default_triplet, host_triplet); } -} -namespace vcpkg::Build -{ static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; static const std::string NAME_DLLS_WITHOUT_EXPORTS = "PolicyDLLsWithoutExports"; @@ -713,7 +703,7 @@ namespace vcpkg::Build static std::vector get_cmake_build_args(const VcpkgCmdArguments& args, const VcpkgPaths& paths, - const Dependencies::InstallPlanAction& action) + const InstallPlanAction& action) { auto& scfl = action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO); auto& scf = *scfl.source_control_file; @@ -882,7 +872,7 @@ namespace vcpkg::Build static ExtendedBuildResult do_build_package(const VcpkgCmdArguments& args, const VcpkgPaths& paths, - const Dependencies::InstallPlanAction& action) + const InstallPlanAction& action) { const auto& pre_build_info = action.pre_build_info(VCPKG_LINE_INFO); @@ -935,7 +925,7 @@ namespace vcpkg::Build } // close out_file // With the exception of empty packages, builds in "Download Mode" always result in failure. - if (action.build_options.only_downloads == Build::OnlyDownloads::YES) + if (action.build_options.only_downloads == OnlyDownloads::YES) { // TODO: Capture executed command output and evaluate whether the failure was intended. // If an unintended error occurs then return a BuildResult::DOWNLOAD_FAILURE status. @@ -1008,7 +998,7 @@ namespace vcpkg::Build static ExtendedBuildResult do_build_package_and_clean_buildtrees(const VcpkgCmdArguments& args, const VcpkgPaths& paths, - const Dependencies::InstallPlanAction& action) + const InstallPlanAction& action) { auto result = do_build_package(args, paths, action); @@ -1059,7 +1049,7 @@ namespace vcpkg::Build }; static Optional compute_abi_tag(const VcpkgPaths& paths, - const Dependencies::InstallPlanAction& action, + const InstallPlanAction& action, Span dependency_abis) { auto& fs = paths.get_filesystem(); @@ -1213,11 +1203,10 @@ namespace vcpkg::Build } void compute_all_abis(const VcpkgPaths& paths, - Dependencies::ActionPlan& action_plan, + ActionPlan& action_plan, const CMakeVars::CMakeVarProvider& var_provider, const StatusParagraphs& status_db) { - using Dependencies::InstallPlanAction; for (auto it = action_plan.install_actions.begin(); it != action_plan.install_actions.end(); ++it) { auto& action = *it; @@ -1274,7 +1263,7 @@ namespace vcpkg::Build ExtendedBuildResult build_package(const VcpkgCmdArguments& args, const VcpkgPaths& paths, - const Dependencies::InstallPlanAction& action, + const InstallPlanAction& action, BinaryCache& binary_cache, const IBuildLogsRecorder& build_logs_recorder, const StatusParagraphs& status_db) diff --git a/src/vcpkg/ci-baseline.cpp b/src/vcpkg/ci-baseline.cpp index 073af95239..324e91d2d1 100644 --- a/src/vcpkg/ci-baseline.cpp +++ b/src/vcpkg/ci-baseline.cpp @@ -201,31 +201,31 @@ namespace vcpkg } LocalizedString format_ci_result(const PackageSpec& spec, - Build::BuildResult result, + BuildResult result, const CiBaselineData& cidata, StringView cifile, bool allow_unexpected_passing) { switch (result) { - case Build::BuildResult::BUILD_FAILED: - case Build::BuildResult::POST_BUILD_CHECKS_FAILED: - case Build::BuildResult::FILE_CONFLICTS: + case BuildResult::BUILD_FAILED: + case BuildResult::POST_BUILD_CHECKS_FAILED: + case BuildResult::FILE_CONFLICTS: if (!cidata.expected_failures.contains(spec)) { return msg::format(msgCiBaselineRegression, msg::spec = spec, - msg::build_result = Build::to_string_locale_invariant(result), + msg::build_result = to_string_locale_invariant(result), msg::path = cifile); } break; - case Build::BuildResult::SUCCEEDED: + case BuildResult::SUCCEEDED: if (!allow_unexpected_passing && cidata.expected_failures.contains(spec)) { return msg::format(msgCiBaselineUnexpectedPass, msg::spec = spec, msg::path = cifile); } break; - case Build::BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES: + case BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES: if (cidata.required_success.contains(spec)) { return msg::format(msgCiBaselineDisallowedCascade, msg::spec = spec, msg::path = cifile); diff --git a/src/vcpkg/cmakevars.cpp b/src/vcpkg/cmakevars.cpp index a4b354217a..2c9b66b8a5 100644 --- a/src/vcpkg/cmakevars.cpp +++ b/src/vcpkg/cmakevars.cpp @@ -12,12 +12,10 @@ #include using namespace vcpkg; -using vcpkg::Optional; - namespace vcpkg::CMakeVars { - void CMakeVarProvider::load_tag_vars(const vcpkg::Dependencies::ActionPlan& action_plan, - const PortFileProvider::PortFileProvider& port_provider, + void CMakeVarProvider::load_tag_vars(const ActionPlan& action_plan, + const PortFileProvider& port_provider, Triplet host_triplet) const { std::vector install_package_specs; @@ -54,7 +52,7 @@ namespace vcpkg::CMakeVars void load_dep_info_vars(View specs, Triplet host_triplet) const override; void load_tag_vars(View specs, - const PortFileProvider::PortFileProvider& port_provider, + const PortFileProvider& port_provider, Triplet host_triplet) const override; Optional&> get_generic_triplet_vars( @@ -374,7 +372,7 @@ endfunction() } void TripletCMakeVarProvider::load_tag_vars(View specs, - const PortFileProvider::PortFileProvider& port_provider, + const PortFileProvider& port_provider, Triplet host_triplet) const { if (specs.size() == 0) return; diff --git a/src/vcpkg/commands.buildexternal.cpp b/src/vcpkg/commands.buildexternal.cpp index ca02e04bb7..d7438648f0 100644 --- a/src/vcpkg/commands.buildexternal.cpp +++ b/src/vcpkg/commands.buildexternal.cpp @@ -26,16 +26,14 @@ namespace vcpkg::Commands::BuildExternal BinaryCache binary_cache{args, paths}; - const FullPackageSpec spec = Input::check_and_get_full_package_spec( + const FullPackageSpec spec = check_and_get_full_package_spec( std::string(args.command_arguments.at(0)), default_triplet, COMMAND_STRUCTURE.example_text, paths); auto overlays = args.overlay_ports; overlays.insert(overlays.begin(), args.command_arguments.at(1)); - PortFileProvider::PathsPortFileProvider provider(paths, - PortFileProvider::make_overlay_provider(paths, overlays)); - Build::Command::perform_and_exit_ex( - args, spec, host_triplet, provider, binary_cache, Build::null_build_logs_recorder(), paths); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, overlays)); + Build::perform_and_exit_ex(args, spec, host_triplet, provider, binary_cache, null_build_logs_recorder(), paths); } void BuildExternalCommand::perform_and_exit(const VcpkgCmdArguments& args, diff --git a/src/vcpkg/commands.check-support.cpp b/src/vcpkg/commands.check-support.cpp index 0e6c86462d..e55b2629b7 100644 --- a/src/vcpkg/commands.check-support.cpp +++ b/src/vcpkg/commands.check-support.cpp @@ -107,19 +107,17 @@ namespace vcpkg::Commands Json::Array json_to_print; // only used when `use_json` const std::vector specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_full_package_spec( + return check_and_get_full_package_spec( std::string(arg), default_triplet, COMMAND_STRUCTURE.example_text, paths); }); - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); auto cmake_vars = CMakeVars::make_triplet_cmake_var_provider(paths); // for each spec in the user-requested specs, check all dependencies for (const auto& user_spec : specs) { - auto action_plan = - Dependencies::create_feature_install_plan(provider, *cmake_vars, {&user_spec, 1}, {}, {host_triplet}); + auto action_plan = create_feature_install_plan(provider, *cmake_vars, {&user_spec, 1}, {}, {host_triplet}); cmake_vars->load_tag_vars(action_plan, provider, host_triplet); diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index 734e190057..051eaac2f6 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -36,8 +36,6 @@ using namespace vcpkg; namespace { - using namespace vcpkg::Build; - const Path readme_dot_log = "readme.log"; struct CiBuildLogsRecorder final : IBuildLogsRecorder @@ -85,14 +83,10 @@ namespace namespace vcpkg::Commands::CI { - using Build::BuildResult; - using Dependencies::InstallPlanAction; - using Dependencies::InstallPlanType; - struct TripletAndSummary { Triplet triplet; - Install::InstallSummary summary; + InstallSummary summary; }; static constexpr StringLiteral OPTION_DRY_RUN = "dry-run"; @@ -140,7 +134,7 @@ namespace vcpkg::Commands::CI struct UnknownCIPortsResults { - std::map known; + std::map known; std::map> features; std::map abi_map; // action_state_string.size() will equal install_actions.size() @@ -159,11 +153,11 @@ namespace vcpkg::Commands::CI return supports_expression.evaluate(context); } - static Dependencies::ActionPlan compute_full_plan(const VcpkgPaths& paths, - const PortFileProvider::PortFileProvider& provider, - const CMakeVars::CMakeVarProvider& var_provider, - const std::vector& specs, - const Dependencies::CreateInstallPlanOptions& serialize_options) + static ActionPlan compute_full_plan(const VcpkgPaths& paths, + const PortFileProvider& provider, + const CMakeVars::CMakeVarProvider& var_provider, + const std::vector& specs, + const CreateInstallPlanOptions& serialize_options) { std::vector packages_with_qualified_deps; for (auto&& spec : specs) @@ -176,15 +170,14 @@ namespace vcpkg::Commands::CI } var_provider.load_dep_info_vars(packages_with_qualified_deps, serialize_options.host_triplet); - auto action_plan = - Dependencies::create_feature_install_plan(provider, var_provider, specs, {}, serialize_options); + auto action_plan = create_feature_install_plan(provider, var_provider, specs, {}, serialize_options); var_provider.load_tag_vars(action_plan, provider, serialize_options.host_triplet); Checks::check_exit(VCPKG_LINE_INFO, action_plan.already_installed.empty()); Checks::check_exit(VCPKG_LINE_INFO, action_plan.remove_actions.empty()); - Build::compute_all_abis(paths, action_plan, var_provider, {}); + compute_all_abis(paths, action_plan, var_provider, {}); return action_plan; } @@ -192,7 +185,7 @@ namespace vcpkg::Commands::CI ExclusionPredicate is_excluded, const CMakeVars::CMakeVarProvider& var_provider, const std::vector& precheck_results, - const Dependencies::ActionPlan& action_plan) + const ActionPlan& action_plan) { auto ret = std::make_unique(); @@ -244,8 +237,8 @@ namespace vcpkg::Commands::CI } // This algorithm reduces an action plan to only unknown actions and their dependencies - static void reduce_action_plan(Dependencies::ActionPlan& action_plan, - const std::map& known, + static void reduce_action_plan(ActionPlan& action_plan, + const std::map& known, View parent_hashes) { std::set to_keep; @@ -267,7 +260,7 @@ namespace vcpkg::Commands::CI } else { - it->build_options = vcpkg::Build::backcompat_prohibiting_package_options; + it->build_options = backcompat_prohibiting_package_options; to_keep.insert(it->package_dependencies.begin(), it->package_dependencies.end()); } } @@ -392,8 +385,7 @@ namespace vcpkg::Commands::CI const IBuildLogsRecorder& build_logs_recorder = build_logs_recorder_storage ? *(build_logs_recorder_storage.get()) : null_build_logs_recorder(); - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); auto var_provider_storage = CMakeVars::make_triplet_cmake_var_provider(paths); auto& var_provider = *var_provider_storage; @@ -411,10 +403,9 @@ namespace vcpkg::Commands::CI InternalFeatureSet{"core", "default"}); } - Dependencies::CreateInstallPlanOptions serialize_options(host_triplet, - Dependencies::UnsupportedPortAction::Warn); + CreateInstallPlanOptions serialize_options(host_triplet, UnsupportedPortAction::Warn); - struct RandomizerInstance : Graphs::Randomizer + struct RandomizerInstance : GraphRandomizer { virtual int random(int i) override { @@ -499,19 +490,13 @@ namespace vcpkg::Commands::CI if (is_dry_run) { - Dependencies::print_plan(action_plan, true, paths.builtin_ports_directory()); + print_plan(action_plan, true, paths.builtin_ports_directory()); } else { StatusParagraphs status_db = database_load_check(paths.get_filesystem(), paths.installed()); - auto summary = Install::perform(args, - action_plan, - Install::KeepGoing::YES, - paths, - status_db, - binary_cache, - build_logs_recorder, - var_provider); + auto summary = Install::perform( + args, action_plan, KeepGoing::YES, paths, status_db, binary_cache, build_logs_recorder, var_provider); std::map full_results; diff --git a/src/vcpkg/commands.cpp b/src/vcpkg/commands.cpp index 56145fbbdc..ce725c2485 100644 --- a/src/vcpkg/commands.cpp +++ b/src/vcpkg/commands.cpp @@ -144,12 +144,12 @@ namespace vcpkg::Commands Span> get_available_triplet_commands() { - static const Install::InstallCommand install{}; + static const InstallCommand install{}; static const SetInstalled::SetInstalledCommand set_installed{}; static const CI::CICommand ci{}; static const Remove::RemoveCommand remove{}; static const Upgrade::UpgradeCommand upgrade{}; - static const Build::BuildCommand build{}; + static const BuildCommand build{}; static const Env::EnvCommand env{}; static const BuildExternal::BuildExternalCommand build_external{}; static const Export::ExportCommand export_command{}; diff --git a/src/vcpkg/commands.dependinfo.cpp b/src/vcpkg/commands.dependinfo.cpp index 32a88fd596..23bd287fdc 100644 --- a/src/vcpkg/commands.dependinfo.cpp +++ b/src/vcpkg/commands.dependinfo.cpp @@ -14,10 +14,6 @@ #include -using vcpkg::Dependencies::ActionPlan; -using vcpkg::Dependencies::InstallPlanAction; -using vcpkg::PortFileProvider::PathsPortFileProvider; - namespace vcpkg::Commands::DependInfo { namespace @@ -309,20 +305,19 @@ namespace vcpkg::Commands::DependInfo const bool show_depth = Util::Sets::contains(options.switches, OPTION_SHOW_DEPTH); const std::vector specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_full_package_spec( + return check_and_get_full_package_spec( std::string{arg}, default_triplet, COMMAND_STRUCTURE.example_text, paths); }); - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); auto var_provider_storage = CMakeVars::make_triplet_cmake_var_provider(paths); auto& var_provider = *var_provider_storage; // By passing an empty status_db, we should get a plan containing all dependencies. // All actions in the plan should be install actions, as there's no installed packages to remove. StatusParagraphs status_db; - auto action_plan = Dependencies::create_feature_install_plan( - provider, var_provider, specs, status_db, {host_triplet, Dependencies::UnsupportedPortAction::Warn}); + auto action_plan = create_feature_install_plan( + provider, var_provider, specs, status_db, {host_triplet, UnsupportedPortAction::Warn}); for (const auto& warning : action_plan.warnings) { print2(Color::warning, warning, '\n'); diff --git a/src/vcpkg/commands.env.cpp b/src/vcpkg/commands.env.cpp index 48229f4031..040732c334 100644 --- a/src/vcpkg/commands.env.cpp +++ b/src/vcpkg/commands.env.cpp @@ -44,17 +44,16 @@ namespace vcpkg::Commands::Env const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); auto var_provider_storage = CMakeVars::make_triplet_cmake_var_provider(paths); auto& var_provider = *var_provider_storage; var_provider.load_generic_triplet_vars(triplet); - const Build::PreBuildInfo pre_build_info( + const PreBuildInfo pre_build_info( paths, triplet, var_provider.get_generic_triplet_vars(triplet).value_or_exit(VCPKG_LINE_INFO)); const Toolset& toolset = paths.get_toolset(pre_build_info); - auto build_env_cmd = Build::make_build_env_cmd(pre_build_info, toolset); + auto build_env_cmd = make_build_env_cmd(pre_build_info, toolset); std::unordered_map extra_env = {}; const bool add_bin = Util::Sets::contains(options.switches, OPTION_BIN); diff --git a/src/vcpkg/commands.find.cpp b/src/vcpkg/commands.find.cpp index 674f51c27d..58a3a8f87f 100644 --- a/src/vcpkg/commands.find.cpp +++ b/src/vcpkg/commands.find.cpp @@ -115,8 +115,7 @@ namespace vcpkg::Commands Optional filter, View overlay_ports) { - PortFileProvider::PathsPortFileProvider provider(paths, - PortFileProvider::make_overlay_provider(paths, overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, overlay_ports)); auto source_paragraphs = Util::fmap(provider.load_all_control_files(), [](auto&& port) -> const SourceControlFile* { return port->source_control_file.get(); }); diff --git a/src/vcpkg/commands.info.cpp b/src/vcpkg/commands.info.cpp index 7a34a19c15..459d5d7ad3 100644 --- a/src/vcpkg/commands.info.cpp +++ b/src/vcpkg/commands.info.cpp @@ -82,7 +82,7 @@ namespace vcpkg::Commands::Info auto& qpkg = *maybe_qpkg.get(); auto t = Triplet::from_canonical_name(std::string(*qpkg.triplet.get())); - Input::check_triplet(t, paths); + check_triplet(t, paths); specs_to_write.emplace_back(qpkg.name, t); } Json::Object response; @@ -112,8 +112,7 @@ namespace vcpkg::Commands::Info { Json::Object response; Json::Object results; - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); for (auto&& arg : args.command_arguments) { diff --git a/src/vcpkg/commands.setinstalled.cpp b/src/vcpkg/commands.setinstalled.cpp index b4e8a1117d..ea9ad58529 100644 --- a/src/vcpkg/commands.setinstalled.cpp +++ b/src/vcpkg/commands.setinstalled.cpp @@ -39,19 +39,19 @@ namespace vcpkg::Commands::SetInstalled void perform_and_exit_ex(const VcpkgCmdArguments& args, const VcpkgPaths& paths, - const PortFileProvider::PathsPortFileProvider& provider, + const PathsPortFileProvider& provider, BinaryCache& binary_cache, const CMakeVars::CMakeVarProvider& cmake_vars, - Dependencies::ActionPlan action_plan, + ActionPlan action_plan, DryRun dry_run, const Optional& maybe_pkgsconfig, Triplet host_triplet, - const Install::KeepGoing keep_going) + const KeepGoing keep_going) { auto& fs = paths.get_filesystem(); cmake_vars.load_tag_vars(action_plan, provider, host_triplet); - Build::compute_all_abis(paths, action_plan, cmake_vars, {}); + compute_all_abis(paths, action_plan, cmake_vars, {}); std::set all_abis; @@ -59,7 +59,7 @@ namespace vcpkg::Commands::SetInstalled for (const auto& action : action_plan.install_actions) { all_abis.insert(action.abi_info.value_or_exit(VCPKG_LINE_INFO).package_abi); - if (action.request_type == Dependencies::RequestType::USER_REQUESTED) + if (action.request_type == RequestType::USER_REQUESTED) { // save for reporting usage later user_requested_specs.push_back(action.spec); @@ -86,7 +86,7 @@ namespace vcpkg::Commands::SetInstalled } } - action_plan.remove_actions = Dependencies::create_remove_plan(specs_to_remove, status_db); + action_plan.remove_actions = create_remove_plan(specs_to_remove, status_db); for (const auto& action : action_plan.remove_actions) { @@ -95,15 +95,15 @@ namespace vcpkg::Commands::SetInstalled specs_installed.erase(action.spec); } - Util::erase_remove_if(action_plan.install_actions, [&](const Dependencies::InstallPlanAction& ipa) { + Util::erase_remove_if(action_plan.install_actions, [&](const InstallPlanAction& ipa) { return Util::Sets::contains(specs_installed, ipa.spec); }); - Dependencies::print_plan(action_plan, true, paths.builtin_ports_directory()); + print_plan(action_plan, true, paths.builtin_ports_directory()); if (auto p_pkgsconfig = maybe_pkgsconfig.get()) { - Build::compute_all_abis(paths, action_plan, cmake_vars, status_db); + compute_all_abis(paths, action_plan, cmake_vars, status_db); auto pkgsconfig_path = paths.original_cwd / *p_pkgsconfig; auto pkgsconfig_contents = generate_nuget_packages_config(action_plan); fs.write_contents(pkgsconfig_path, pkgsconfig_contents, VCPKG_LINE_INFO); @@ -117,16 +117,10 @@ namespace vcpkg::Commands::SetInstalled paths.flush_lockfile(); - Install::track_install_plan(action_plan); + track_install_plan(action_plan); - const auto summary = Install::perform(args, - action_plan, - keep_going, - paths, - status_db, - binary_cache, - Build::null_build_logs_recorder(), - cmake_vars); + const auto summary = Install::perform( + args, action_plan, keep_going, paths, status_db, binary_cache, null_build_logs_recorder(), cmake_vars); print2("\nTotal elapsed time: ", GlobalState::timer.to_string(), "\n\n"); @@ -152,7 +146,7 @@ namespace vcpkg::Commands::SetInstalled const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); const std::vector specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_full_package_spec( + return check_and_get_full_package_spec( std::string(arg), default_triplet, COMMAND_STRUCTURE.example_text, paths); }); @@ -160,12 +154,11 @@ namespace vcpkg::Commands::SetInstalled const bool dry_run = Util::Sets::contains(options.switches, OPTION_DRY_RUN); const bool only_downloads = Util::Sets::contains(options.switches, OPTION_ONLY_DOWNLOADS); - const Install::KeepGoing keep_going = - Util::Sets::contains(options.switches, OPTION_KEEP_GOING) || only_downloads ? Install::KeepGoing::YES - : Install::KeepGoing::NO; + const KeepGoing keep_going = Util::Sets::contains(options.switches, OPTION_KEEP_GOING) || only_downloads + ? KeepGoing::YES + : KeepGoing::NO; - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); auto cmake_vars = CMakeVars::make_triplet_cmake_var_provider(paths); Optional pkgsconfig; @@ -179,11 +172,11 @@ namespace vcpkg::Commands::SetInstalled // We have a set of user-requested specs. // We need to know all the specs which are required to fulfill dependencies for those specs. // Therefore, we see what we would install into an empty installed tree, so we can use the existing code. - auto action_plan = Dependencies::create_feature_install_plan(provider, *cmake_vars, specs, {}, {host_triplet}); + auto action_plan = create_feature_install_plan(provider, *cmake_vars, specs, {}, {host_triplet}); for (auto&& action : action_plan.install_actions) { - action.build_options = Build::default_build_package_options; + action.build_options = default_build_package_options; } perform_and_exit_ex(args, diff --git a/src/vcpkg/commands.upgrade.cpp b/src/vcpkg/commands.upgrade.cpp index 1253cb5be6..55cad714bd 100644 --- a/src/vcpkg/commands.upgrade.cpp +++ b/src/vcpkg/commands.upgrade.cpp @@ -19,7 +19,6 @@ #include using namespace vcpkg; -using Install::KeepGoing; namespace vcpkg::Commands::Upgrade { @@ -81,25 +80,23 @@ namespace vcpkg::Commands::Upgrade const KeepGoing keep_going = determine_keep_going(Util::Sets::contains(options.switches, OPTION_KEEP_GOING), Util::Sets::contains(options.switches, OPTION_NO_KEEP_GOING)); const auto unsupported_port_action = Util::Sets::contains(options.switches, OPTION_ALLOW_UNSUPPORTED_PORT) - ? Dependencies::UnsupportedPortAction::Warn - : Dependencies::UnsupportedPortAction::Error; + ? UnsupportedPortAction::Warn + : UnsupportedPortAction::Error; BinaryCache binary_cache{args, paths}; StatusParagraphs status_db = database_load_check(paths.get_filesystem(), paths.installed()); // Load ports from ports dirs - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); auto var_provider_storage = CMakeVars::make_triplet_cmake_var_provider(paths); auto& var_provider = *var_provider_storage; // input sanitization const std::vector specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_package_spec( - std::string(arg), default_triplet, COMMAND_STRUCTURE.example_text, paths); + return check_and_get_package_spec(std::string(arg), default_triplet, COMMAND_STRUCTURE.example_text, paths); }); - Dependencies::ActionPlan action_plan; + ActionPlan action_plan; if (specs.empty()) { // If no packages specified, upgrade all outdated packages. @@ -111,7 +108,7 @@ namespace vcpkg::Commands::Upgrade Checks::exit_success(VCPKG_LINE_INFO); } - action_plan = Dependencies::create_upgrade_plan( + action_plan = create_upgrade_plan( provider, var_provider, Util::fmap(outdated_packages, [](const Update::OutdatedPackage& package) { return package.spec; }), @@ -193,7 +190,7 @@ namespace vcpkg::Commands::Upgrade if (to_upgrade.empty()) Checks::exit_success(VCPKG_LINE_INFO); - action_plan = Dependencies::create_upgrade_plan( + action_plan = create_upgrade_plan( provider, var_provider, to_upgrade, status_db, {host_triplet, unsupported_port_action}); } @@ -205,10 +202,10 @@ namespace vcpkg::Commands::Upgrade // Set build settings for all install actions for (auto&& action : action_plan.install_actions) { - action.build_options = vcpkg::Build::default_build_package_options; + action.build_options = default_build_package_options; } - Dependencies::print_plan(action_plan, true, paths.builtin_ports_directory()); + print_plan(action_plan, true, paths.builtin_ports_directory()); if (!no_dry_run) { @@ -220,14 +217,8 @@ namespace vcpkg::Commands::Upgrade var_provider.load_tag_vars(action_plan, provider, host_triplet); - const Install::InstallSummary summary = Install::perform(args, - action_plan, - keep_going, - paths, - status_db, - binary_cache, - Build::null_build_logs_recorder(), - var_provider); + const InstallSummary summary = Install::perform( + args, action_plan, keep_going, paths, status_db, binary_cache, null_build_logs_recorder(), var_provider); print2("\nTotal elapsed time: ", GlobalState::timer.to_string(), "\n\n"); diff --git a/src/vcpkg/dependencies.cpp b/src/vcpkg/dependencies.cpp index f1c6ebe9ef..1738e769f6 100644 --- a/src/vcpkg/dependencies.cpp +++ b/src/vcpkg/dependencies.cpp @@ -14,9 +14,7 @@ #include #include -using namespace vcpkg; - -namespace vcpkg::Dependencies +namespace vcpkg { namespace { @@ -290,7 +288,7 @@ namespace vcpkg::Dependencies struct PackageGraph { - PackageGraph(const PortFileProvider::PortFileProvider& provider, + PackageGraph(const PortFileProvider& provider, const CMakeVars::CMakeVarProvider& var_provider, const StatusParagraphs& status_db, Triplet host_triplet); @@ -300,7 +298,7 @@ namespace vcpkg::Dependencies void upgrade(Span specs, UnsupportedPortAction unsupported_port_action); void mark_user_requested(const PackageSpec& spec); - ActionPlan serialize(Graphs::Randomizer* randomizer) const; + ActionPlan serialize(GraphRandomizer* randomizer) const; void mark_for_reinstall(const PackageSpec& spec, std::vector& out_reinstall_requirements); const CMakeVars::CMakeVarProvider& m_var_provider; @@ -314,7 +312,7 @@ namespace vcpkg::Dependencies /// struct ClusterGraph { - explicit ClusterGraph(const PortFileProvider::PortFileProvider& port_provider, Triplet host_triplet) + explicit ClusterGraph(const PortFileProvider& port_provider, Triplet host_triplet) : m_port_provider(port_provider), m_host_triplet(host_triplet) { } @@ -386,7 +384,7 @@ namespace vcpkg::Dependencies private: std::map m_graph; - const PortFileProvider::PortFileProvider& m_port_provider; + const PortFileProvider& m_port_provider; public: const Triplet m_host_triplet; @@ -395,7 +393,7 @@ namespace vcpkg::Dependencies static std::string to_output_string(RequestType request_type, const ZStringView s, - const Build::BuildPackageOptions& options, + const BuildPackageOptions& options, const SourceControlFileAndLocation* scfl, const InstalledPackageView* ipv, const Path& builtin_ports_dir) @@ -416,7 +414,7 @@ namespace vcpkg::Dependencies { Strings::append(ret, " -> ", Version{ipv->core->package.version, ipv->core->package.port_version}); } - if (options.use_head_version == Build::UseHeadVersion::YES) + if (options.use_head_version == UseHeadVersion::YES) { Strings::append(ret, " (+HEAD)"); } @@ -431,9 +429,7 @@ namespace vcpkg::Dependencies return ret; } - std::string to_output_string(RequestType request_type, - const ZStringView s, - const Build::BuildPackageOptions& options) + std::string to_output_string(RequestType request_type, const ZStringView s, const BuildPackageOptions& options) { return to_output_string(request_type, s, options, {}, {}, {}); } @@ -532,7 +528,7 @@ namespace vcpkg::Dependencies if (!p || p->package_abi.empty()) return nullopt; return p->package_abi; } - const Build::PreBuildInfo& InstallPlanAction::pre_build_info(LineInfo li) const + const PreBuildInfo& InstallPlanAction::pre_build_info(LineInfo li) const { return *abi_info.value_or_exit(li).pre_build_info.get(); } @@ -604,7 +600,7 @@ namespace vcpkg::Dependencies std::vector create_remove_plan(const std::vector& specs, const StatusParagraphs& status_db) { - struct RemoveAdjacencyProvider final : Graphs::AdjacencyProvider + struct RemoveAdjacencyProvider final : AdjacencyProvider { const StatusParagraphs& status_db; const std::vector& installed_ports; @@ -656,14 +652,14 @@ namespace vcpkg::Dependencies auto installed_ports = get_installed_ports(status_db); const std::unordered_set specs_as_set(specs.cbegin(), specs.cend()); - return Graphs::topological_sort( + return topological_sort( std::move(specs), RemoveAdjacencyProvider{status_db, installed_ports, specs_as_set}, {}); } std::vector create_export_plan(const std::vector& specs, const StatusParagraphs& status_db) { - struct ExportAdjacencyProvider final : Graphs::AdjacencyProvider + struct ExportAdjacencyProvider final : AdjacencyProvider { const StatusParagraphs& status_db; const std::unordered_set& specs_as_set; @@ -699,7 +695,7 @@ namespace vcpkg::Dependencies const std::unordered_set specs_as_set(specs.cbegin(), specs.cend()); std::vector toposort = - Graphs::topological_sort(specs, ExportAdjacencyProvider{status_db, specs_as_set}, {}); + topological_sort(specs, ExportAdjacencyProvider{status_db, specs_as_set}, {}); return toposort; } @@ -708,7 +704,7 @@ namespace vcpkg::Dependencies m_graph->get(spec).request_type = RequestType::USER_REQUESTED; } - ActionPlan create_feature_install_plan(const PortFileProvider::PortFileProvider& port_provider, + ActionPlan create_feature_install_plan(const PortFileProvider& port_provider, const CMakeVars::CMakeVarProvider& var_provider, View specs, const StatusParagraphs& status_db, @@ -919,7 +915,7 @@ namespace vcpkg::Dependencies install(reinstall_reqs, unsupported_port_action); } - ActionPlan create_upgrade_plan(const PortFileProvider::PortFileProvider& port_provider, + ActionPlan create_upgrade_plan(const PortFileProvider& port_provider, const CMakeVars::CMakeVarProvider& var_provider, const std::vector& specs, const StatusParagraphs& status_db, @@ -932,9 +928,9 @@ namespace vcpkg::Dependencies return pgraph.serialize(options.randomizer); } - ActionPlan PackageGraph::serialize(Graphs::Randomizer* randomizer) const + ActionPlan PackageGraph::serialize(GraphRandomizer* randomizer) const { - struct BaseEdgeProvider : Graphs::AdjacencyProvider + struct BaseEdgeProvider : AdjacencyProvider { BaseEdgeProvider(const ClusterGraph& parent) : m_parent(parent) { } @@ -992,8 +988,8 @@ namespace vcpkg::Dependencies installed_vertices.push_back(kv.first); } } - auto remove_toposort = Graphs::topological_sort(removed_vertices, removeedgeprovider, randomizer); - auto insert_toposort = Graphs::topological_sort(installed_vertices, installedgeprovider, randomizer); + auto remove_toposort = topological_sort(removed_vertices, removeedgeprovider, randomizer); + auto insert_toposort = topological_sort(installed_vertices, installedgeprovider, randomizer); ActionPlan plan; @@ -1070,10 +1066,9 @@ namespace vcpkg::Dependencies return plan; } - static std::unique_ptr create_feature_install_graph( - const PortFileProvider::PortFileProvider& port_provider, - const StatusParagraphs& status_db, - Triplet host_triplet) + static std::unique_ptr create_feature_install_graph(const PortFileProvider& port_provider, + const StatusParagraphs& status_db, + Triplet host_triplet) { std::unique_ptr graph = std::make_unique(port_provider, host_triplet); @@ -1104,7 +1099,7 @@ namespace vcpkg::Dependencies return graph; } - PackageGraph::PackageGraph(const PortFileProvider::PortFileProvider& port_provider, + PackageGraph::PackageGraph(const PortFileProvider& port_provider, const CMakeVars::CMakeVarProvider& var_provider, const StatusParagraphs& status_db, Triplet host_triplet) @@ -1235,14 +1230,9 @@ namespace vcpkg::Dependencies { struct VersionedPackageGraph { - private: - using IVersionedPortfileProvider = PortFileProvider::IVersionedPortfileProvider; - using IBaselineProvider = PortFileProvider::IBaselineProvider; - - public: VersionedPackageGraph(const IVersionedPortfileProvider& ver_provider, const IBaselineProvider& base_provider, - const PortFileProvider::IOverlayProvider& oprovider, + const IOverlayProvider& oprovider, const CMakeVars::CMakeVarProvider& var_provider, Triplet host_triplet) : m_ver_provider(ver_provider) @@ -1263,7 +1253,7 @@ namespace vcpkg::Dependencies private: const IVersionedPortfileProvider& m_ver_provider; const IBaselineProvider& m_base_provider; - const PortFileProvider::IOverlayProvider& m_o_provider; + const IOverlayProvider& m_o_provider; const CMakeVars::CMakeVarProvider& m_var_provider; const Triplet m_host_triplet; @@ -2065,9 +2055,9 @@ namespace vcpkg::Dependencies } } - ExpectedS create_versioned_install_plan(const PortFileProvider::IVersionedPortfileProvider& provider, - const PortFileProvider::IBaselineProvider& bprovider, - const PortFileProvider::IOverlayProvider& oprovider, + ExpectedS create_versioned_install_plan(const IVersionedPortfileProvider& provider, + const IBaselineProvider& bprovider, + const IOverlayProvider& oprovider, const CMakeVars::CMakeVarProvider& var_provider, const std::vector& deps, const std::vector& overrides, diff --git a/src/vcpkg/export.chocolatey.cpp b/src/vcpkg/export.chocolatey.cpp index c8febecbca..a73caaaebe 100644 --- a/src/vcpkg/export.chocolatey.cpp +++ b/src/vcpkg/export.chocolatey.cpp @@ -11,10 +11,6 @@ namespace vcpkg::Export::Chocolatey { - using Dependencies::ExportPlanAction; - using Dependencies::ExportPlanType; - using Install::InstallDir; - static std::string create_nuspec_dependencies(const BinaryParagraph& binary_paragraph, const std::map& packages_version) { @@ -200,7 +196,7 @@ if (Test-Path $installedDir) const InstallDir dirs = InstallDir::from_destination_root(installed, action.spec.triplet(), binary_paragraph); - Install::install_package_and_write_listfile(fs, paths.package_dir(action.spec), dirs); + install_package_and_write_listfile(fs, paths.package_dir(action.spec), dirs); const std::string nuspec_file_content = create_nuspec_file_contents( per_package_dir_path, binary_paragraph, packages_version, chocolatey_options); diff --git a/src/vcpkg/export.cpp b/src/vcpkg/export.cpp index aa1c2577c5..9b969b7e48 100644 --- a/src/vcpkg/export.cpp +++ b/src/vcpkg/export.cpp @@ -22,11 +22,6 @@ namespace vcpkg::Export { - using Dependencies::ExportPlanAction; - using Dependencies::ExportPlanType; - using Dependencies::RequestType; - using Install::InstallDir; - static std::string create_nuspec_file_contents(const Path& raw_exported_dir, const Path& targets_redirect_path, const Path& props_redirect_path, @@ -105,8 +100,7 @@ namespace vcpkg::Export std::vector cont = it->second; std::sort(cont.begin(), cont.end(), &ExportPlanAction::compare_by_name); const std::string as_string = Strings::join("\n", cont, [](const ExportPlanAction* p) { - return Dependencies::to_output_string( - p->request_type, p->spec.to_string(), vcpkg::Build::default_build_package_options); + return to_output_string(p->request_type, p->spec.to_string(), default_build_package_options); }); switch (plan_type) @@ -412,7 +406,7 @@ namespace vcpkg::Export { // input sanitization ret.specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_package_spec( + return check_and_get_package_spec( std::string(arg), default_triplet, COMMAND_STRUCTURE.example_text, paths); }); } @@ -540,8 +534,7 @@ namespace vcpkg::Export files.push_back(paths.installed().root() / suffix); } - Install::install_files_and_write_listfile( - fs, paths.installed().triplet_dir(action.spec.triplet()), files, dirs); + install_files_and_write_listfile(fs, paths.installed().triplet_dir(action.spec.triplet()), files, dirs); } } @@ -614,11 +607,10 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console const auto opts = handle_export_command_arguments(paths, args, default_triplet, status_db); // Load ports from ports dirs - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); // create the plan - std::vector export_plan = Dependencies::create_export_plan(opts.specs, status_db); + std::vector export_plan = create_export_plan(opts.specs, status_db); Checks::check_exit(VCPKG_LINE_INFO, !export_plan.empty(), "Export plan cannot be empty"); std::map> group_by_plan_type; diff --git a/src/vcpkg/export.ifw.cpp b/src/vcpkg/export.ifw.cpp index 5d2d5ac5e3..d7629119b7 100644 --- a/src/vcpkg/export.ifw.cpp +++ b/src/vcpkg/export.ifw.cpp @@ -11,10 +11,6 @@ namespace vcpkg::Export::IFW { - using Dependencies::ExportPlanAction; - using Dependencies::ExportPlanType; - using Install::InstallDir; - // requires: after_prefix <= semi // requires: *semi == ';' static bool is_character_ref(const char* after_prefix, const char* semi) @@ -466,7 +462,7 @@ namespace vcpkg::Export::IFW const InstallDir dirs = InstallDir::from_destination_root(installed, action.spec.triplet(), binary_paragraph); - Install::install_package_and_write_listfile(fs, paths.package_dir(action.spec), dirs); + install_package_and_write_listfile(fs, paths.package_dir(action.spec), dirs); } vcpkg::printf("Exporting packages %s... done\n", ifw_packages_dir_path); diff --git a/src/vcpkg/export.prefab.cpp b/src/vcpkg/export.prefab.cpp index 9880b6a206..3fa2715c8e 100644 --- a/src/vcpkg/export.prefab.cpp +++ b/src/vcpkg/export.prefab.cpp @@ -16,10 +16,6 @@ namespace vcpkg::Export::Prefab { - using Dependencies::ExportPlanAction; - using Dependencies::ExportPlanType; - using Install::InstallDir; - static std::vector find_modules(const VcpkgPaths& system, const Path& root, const std::string& ext) { Filesystem& fs = system.get_filesystem(); @@ -231,15 +227,15 @@ namespace vcpkg::Export::Prefab Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: %s installing maven file", aar); } - static std::unique_ptr build_info_from_triplet( + static std::unique_ptr build_info_from_triplet( const VcpkgPaths& paths, const std::unique_ptr& provider, const Triplet& triplet) { provider->load_generic_triplet_vars(triplet); - return std::make_unique( + return std::make_unique( paths, triplet, provider->get_generic_triplet_vars(triplet).value_or_exit(VCPKG_LINE_INFO)); } - static bool is_supported(const Build::PreBuildInfo& info) + static bool is_supported(const PreBuildInfo& info) { return Strings::case_insensitive_ascii_equals(info.cmake_system_name, "android"); } @@ -372,8 +368,8 @@ namespace vcpkg::Export::Prefab const std::string name = action.spec.name(); auto dependencies = action.dependencies(); - const auto action_build_info = Build::read_build_info(utils, paths.build_info_file_path(action.spec)); - const bool is_empty_package = action_build_info.policies.is_enabled(Build::BuildPolicy::EMPTY_PACKAGE); + const auto action_build_info = read_build_info(utils, paths.build_info_file_path(action.spec)); + const bool is_empty_package = action_build_info.policies.is_enabled(BuildPolicy::EMPTY_PACKAGE); if (is_empty_package) { diff --git a/src/vcpkg/input.cpp b/src/vcpkg/input.cpp index 7203218cd3..91b8fb1bb0 100644 --- a/src/vcpkg/input.cpp +++ b/src/vcpkg/input.cpp @@ -9,10 +9,10 @@ namespace vcpkg { - PackageSpec Input::check_and_get_package_spec(std::string&& spec_string, - Triplet default_triplet, - ZStringView example_text, - const VcpkgPaths& paths) + PackageSpec check_and_get_package_spec(std::string&& spec_string, + Triplet default_triplet, + ZStringView example_text, + const VcpkgPaths& paths) { const std::string as_lowercase = Strings::ascii_to_lowercase(std::move(spec_string)); @@ -20,7 +20,7 @@ namespace vcpkg parse_qualified_specifier(as_lowercase).then(&ParsedQualifiedSpecifier::to_package_spec, default_triplet); if (auto spec = expected_spec.get()) { - Input::check_triplet(spec->triplet(), paths); + check_triplet(spec->triplet(), paths); return std::move(*spec); } @@ -30,7 +30,7 @@ namespace vcpkg Checks::exit_fail(VCPKG_LINE_INFO); } - void Input::check_triplet(Triplet t, const VcpkgPaths& paths) + void check_triplet(Triplet t, const VcpkgPaths& paths) { if (!paths.is_valid_triplet(t)) { @@ -41,17 +41,17 @@ namespace vcpkg } } - FullPackageSpec Input::check_and_get_full_package_spec(std::string&& full_package_spec_as_string, - Triplet default_triplet, - ZStringView example_text, - const VcpkgPaths& paths) + FullPackageSpec check_and_get_full_package_spec(std::string&& full_package_spec_as_string, + Triplet default_triplet, + ZStringView example_text, + const VcpkgPaths& paths) { const std::string as_lowercase = Strings::ascii_to_lowercase(std::move(full_package_spec_as_string)); auto expected_spec = parse_qualified_specifier(as_lowercase) .then(&ParsedQualifiedSpecifier::to_full_spec, default_triplet, ImplicitDefault::YES); if (const auto spec = expected_spec.get()) { - Input::check_triplet(spec->package_spec.triplet(), paths); + check_triplet(spec->package_spec.triplet(), paths); return *spec; } diff --git a/src/vcpkg/install.cpp b/src/vcpkg/install.cpp index 8f02d240c8..16d5b14780 100644 --- a/src/vcpkg/install.cpp +++ b/src/vcpkg/install.cpp @@ -27,11 +27,8 @@ #include -namespace vcpkg::Install +namespace vcpkg { - using namespace vcpkg; - using namespace Dependencies; - using file_pack = std::pair; InstallDir InstallDir::from_destination_root(const InstalledPaths& ip, Triplet t, const BinaryParagraph& pgh) @@ -301,15 +298,12 @@ namespace vcpkg::Install return InstallResult::SUCCESS; } - using Build::BuildResult; - using Build::ExtendedBuildResult; - static ExtendedBuildResult perform_install_plan_action(const VcpkgCmdArguments& args, const VcpkgPaths& paths, InstallPlanAction& action, StatusParagraphs& status_db, BinaryCache& binary_cache, - const Build::IBuildLogsRecorder& build_logs_recorder) + const IBuildLogsRecorder& build_logs_recorder) { auto& fs = paths.get_filesystem(); const InstallPlanType& plan_type = action.plan_type; @@ -335,7 +329,7 @@ namespace vcpkg::Install auto maybe_bcf = Paragraphs::try_load_cached_package(fs, paths.package_dir(action.spec), action.spec); bcf = std::make_unique(std::move(maybe_bcf).value_or_exit(VCPKG_LINE_INFO)); } - else if (action.build_options.build_missing == Build::BuildMissing::NO) + else if (action.build_options.build_missing == BuildMissing::NO) { return ExtendedBuildResult{BuildResult::CACHE_MISSING}; } @@ -346,7 +340,7 @@ namespace vcpkg::Install else msg::println(msgBuildingPackage, msg::spec = action.displayname()); - auto result = Build::build_package(args, paths, action, binary_cache, build_logs_recorder, status_db); + auto result = build_package(args, paths, action, binary_cache, build_logs_recorder, status_db); if (BuildResult::DOWNLOADED == result.code) { @@ -354,7 +348,7 @@ namespace vcpkg::Install return result; } - if (result.code != Build::BuildResult::SUCCEEDED) + if (result.code != BuildResult::SUCCEEDED) { LocalizedString warnings; for (auto&& msg : action.build_failure_messages) @@ -367,7 +361,7 @@ namespace vcpkg::Install msg::print(Color::warning, warnings); } - msg::println_error(Build::create_error_message(result, action.spec)); + msg::println_error(create_error_message(result, action.spec)); return result; } @@ -385,12 +379,12 @@ namespace vcpkg::Install default: Checks::unreachable(VCPKG_LINE_INFO); } - if (action.build_options.clean_packages == Build::CleanPackages::YES) + if (action.build_options.clean_packages == CleanPackages::YES) { fs.remove_all(paths.package_dir(action.spec), VCPKG_LINE_INFO); } - if (action.build_options.clean_downloads == Build::CleanDownloads::YES) + if (action.build_options.clean_downloads == CleanDownloads::YES) { for (auto& p : fs.get_regular_files_non_recursive(paths.downloads, IgnoreErrors{})) { @@ -419,11 +413,11 @@ namespace vcpkg::Install msg::println(LocalizedString().append_indent().append_fmt_raw( "{}: {}: {}", result.get_spec(), - Build::to_string(result.build_result.value_or_exit(VCPKG_LINE_INFO).code), + to_string(result.build_result.value_or_exit(VCPKG_LINE_INFO).code), result.timing)); } - std::map summary; + std::map summary; for (const SpecSummary& r : this->results) { summary[r.get_spec().triplet()].increment(r.build_result.value_or_exit(VCPKG_LINE_INFO).code); @@ -445,7 +439,7 @@ namespace vcpkg::Install TrackedPackageInstallGuard(const size_t action_index, const size_t action_count, std::vector& results, - const Dependencies::InstallPlanAction& action) + const InstallPlanAction& action) { results.emplace_back(action); current_summary = &results.back(); @@ -459,7 +453,7 @@ namespace vcpkg::Install TrackedPackageInstallGuard(const size_t action_index, const size_t action_count, std::vector& results, - const Dependencies::RemovePlanAction& action) + const RemovePlanAction& action) { results.emplace_back(action); current_summary = &results.back(); @@ -480,14 +474,14 @@ namespace vcpkg::Install TrackedPackageInstallGuard& operator=(const TrackedPackageInstallGuard&) = delete; }; - InstallSummary perform(const VcpkgCmdArguments& args, - ActionPlan& action_plan, - const KeepGoing keep_going, - const VcpkgPaths& paths, - StatusParagraphs& status_db, - BinaryCache& binary_cache, - const Build::IBuildLogsRecorder& build_logs_recorder, - const CMakeVars::CMakeVarProvider& var_provider) + InstallSummary Install::perform(const VcpkgCmdArguments& args, + ActionPlan& action_plan, + const KeepGoing keep_going, + const VcpkgPaths& paths, + StatusParagraphs& status_db, + BinaryCache& binary_cache, + const IBuildLogsRecorder& build_logs_recorder, + const CMakeVars::CMakeVarProvider& var_provider) { std::vector results; const size_t action_count = action_plan.remove_actions.size() + action_plan.install_actions.size(); @@ -507,7 +501,7 @@ namespace vcpkg::Install perform_install_plan_action(args, paths, action, status_db, binary_cache, build_logs_recorder)); } - Build::compute_all_abis(paths, action_plan, var_provider, status_db); + compute_all_abis(paths, action_plan, var_provider, status_db); binary_cache.prefetch(action_plan.install_actions); for (auto&& action : action_plan.install_actions) { @@ -516,17 +510,15 @@ namespace vcpkg::Install perform_install_plan_action(args, paths, action, status_db, binary_cache, build_logs_recorder); if (result.code != BuildResult::SUCCEEDED && keep_going == KeepGoing::NO) { - Checks::msg_exit_with_message(VCPKG_LINE_INFO, - Build::create_user_troubleshooting_message( - action, paths, result.stdoutlog.then([&](auto&) -> Optional { - const auto issue_body_path = - paths.installed().root() / "vcpkg" / "issue_body.md"; - paths.get_filesystem().write_contents( - issue_body_path, - Build::create_github_issue(args, result, paths, action), - VCPKG_LINE_INFO); - return issue_body_path; - }))); + Checks::msg_exit_with_message( + VCPKG_LINE_INFO, + create_user_troubleshooting_message( + action, paths, result.stdoutlog.then([&](auto&) -> Optional { + const auto issue_body_path = paths.installed().root() / "vcpkg" / "issue_body.md"; + paths.get_filesystem().write_contents( + issue_body_path, create_github_issue(args, result, paths, action), VCPKG_LINE_INFO); + return issue_body_path; + }))); } this_install.current_summary->build_result.emplace(std::move(result)); @@ -611,7 +603,7 @@ namespace vcpkg::Install return ret; } - const CommandStructure COMMAND_STRUCTURE = { + const CommandStructure Install::COMMAND_STRUCTURE = { create_example_string("install zlib zlib:x64-windows curl boost"), 0, SIZE_MAX, @@ -628,10 +620,10 @@ namespace vcpkg::Install {INSTALL_SWITCHES, INSTALL_SETTINGS, INSTALL_MULTISETTINGS}, nullptr, }; - void print_usage_information(const BinaryParagraph& bpgh, - std::set& printed_usages, - const Filesystem& fs, - const InstalledPaths& installed) + void Install::print_usage_information(const BinaryParagraph& bpgh, + std::set& printed_usages, + const Filesystem& fs, + const InstalledPaths& installed) { auto message = get_cmake_usage(fs, installed, bpgh).message; if (!message.empty()) @@ -836,10 +828,10 @@ namespace vcpkg::Install return ret; } - void perform_and_exit(const VcpkgCmdArguments& args, - const VcpkgPaths& paths, - Triplet default_triplet, - Triplet host_triplet) + void Install::perform_and_exit(const VcpkgCmdArguments& args, + const VcpkgPaths& paths, + Triplet default_triplet, + Triplet host_triplet) { const ParsedArguments options = args.parse_arguments(paths.manifest_mode_enabled() ? MANIFEST_COMMAND_STRUCTURE : COMMAND_STRUCTURE); @@ -866,8 +858,8 @@ namespace vcpkg::Install Util::Sets::contains(options.switches, (OPTION_PROHIBIT_BACKCOMPAT_FEATURES)) || Util::Sets::contains(options.switches, (OPTION_ENFORCE_PORT_CHECKS)); const auto unsupported_port_action = Util::Sets::contains(options.switches, OPTION_ALLOW_UNSUPPORTED_PORT) - ? Dependencies::UnsupportedPortAction::Warn - : Dependencies::UnsupportedPortAction::Error; + ? UnsupportedPortAction::Warn + : UnsupportedPortAction::Error; LockGuardPtr(g_metrics)->track_property("install_manifest_mode", paths.manifest_mode_enabled()); @@ -932,21 +924,21 @@ namespace vcpkg::Install auto& fs = paths.get_filesystem(); - Build::DownloadTool download_tool = Build::DownloadTool::BUILT_IN; - if (use_aria2) download_tool = Build::DownloadTool::ARIA2; - - const Build::BuildPackageOptions install_plan_options = { - Util::Enum::to_enum(!no_build_missing), - Util::Enum::to_enum(use_head_version), - Util::Enum::to_enum(!no_downloads), - Util::Enum::to_enum(only_downloads), - Util::Enum::to_enum(clean_after_build || clean_buildtrees_after_build), - Util::Enum::to_enum(clean_after_build || clean_packages_after_build), - Util::Enum::to_enum(clean_after_build || clean_downloads_after_build), + DownloadTool download_tool = DownloadTool::BUILT_IN; + if (use_aria2) download_tool = DownloadTool::ARIA2; + + const BuildPackageOptions install_plan_options = { + Util::Enum::to_enum(!no_build_missing), + Util::Enum::to_enum(use_head_version), + Util::Enum::to_enum(!no_downloads), + Util::Enum::to_enum(only_downloads), + Util::Enum::to_enum(clean_after_build || clean_buildtrees_after_build), + Util::Enum::to_enum(clean_after_build || clean_packages_after_build), + Util::Enum::to_enum(clean_after_build || clean_downloads_after_build), download_tool, - Build::PurgeDecompressFailure::NO, - Util::Enum::to_enum(is_editable), - prohibit_backcompat_features ? Build::BackcompatFeatures::PROHIBIT : Build::BackcompatFeatures::ALLOW, + PurgeDecompressFailure::NO, + Util::Enum::to_enum(is_editable), + prohibit_backcompat_features ? BackcompatFeatures::PROHIBIT : BackcompatFeatures::ALLOW, }; auto var_provider_storage = CMakeVars::make_triplet_cmake_var_provider(paths); @@ -1034,8 +1026,8 @@ namespace vcpkg::Install LockGuardPtr(g_metrics)->track_property("manifest_overrides", "defined"); } - auto verprovider = PortFileProvider::make_versioned_portfile_provider(paths); - auto baseprovider = PortFileProvider::make_baseline_provider(paths); + auto verprovider = make_versioned_portfile_provider(paths); + auto baseprovider = make_baseline_provider(paths); std::vector extended_overlay_ports; const bool add_builtin_ports_directory_as_overlay = @@ -1047,18 +1039,18 @@ namespace vcpkg::Install extended_overlay_ports.emplace_back(paths.builtin_ports_directory().native()); } - auto oprovider = PortFileProvider::make_manifest_provider( - paths, extended_overlay_ports, manifest->path, std::move(manifest_scf)); + auto oprovider = + make_manifest_provider(paths, extended_overlay_ports, manifest->path, std::move(manifest_scf)); PackageSpec toplevel{manifest_core.name, default_triplet}; - auto install_plan = Dependencies::create_versioned_install_plan(*verprovider, - *baseprovider, - *oprovider, - var_provider, - dependencies, - manifest_core.overrides, - toplevel, - host_triplet, - unsupported_port_action) + auto install_plan = create_versioned_install_plan(*verprovider, + *baseprovider, + *oprovider, + var_provider, + dependencies, + manifest_core.overrides, + toplevel, + host_triplet, + unsupported_port_action) .value_or_exit(VCPKG_LINE_INFO); for (const auto& warning : install_plan.warnings) @@ -1068,15 +1060,15 @@ namespace vcpkg::Install for (InstallPlanAction& action : install_plan.install_actions) { action.build_options = install_plan_options; - action.build_options.use_head_version = Build::UseHeadVersion::NO; - action.build_options.editable = Build::Editable::NO; + action.build_options.use_head_version = UseHeadVersion::NO; + action.build_options.editable = Editable::NO; } // If the manifest refers to itself, it will be added to the install plan. Util::erase_remove_if(install_plan.install_actions, [&toplevel](auto&& action) { return action.spec == toplevel; }); - PortFileProvider::PathsPortFileProvider provider(paths, std::move(oprovider)); + PathsPortFileProvider provider(paths, std::move(oprovider)); Commands::SetInstalled::perform_and_exit_ex(args, paths, provider, @@ -1089,11 +1081,10 @@ namespace vcpkg::Install keep_going); } - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); const std::vector specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_full_package_spec( + return check_and_get_full_package_spec( std::string(arg), default_triplet, COMMAND_STRUCTURE.example_text, paths); }); @@ -1102,7 +1093,7 @@ namespace vcpkg::Install StatusParagraphs status_db = database_load_check(fs, paths.installed()); // Note: action_plan will hold raw pointers to SourceControlFileLocations from this map - auto action_plan = Dependencies::create_feature_install_plan( + auto action_plan = create_feature_install_plan( provider, var_provider, specs, status_db, {host_triplet, unsupported_port_action}); for (const auto& warning : action_plan.warnings) @@ -1114,8 +1105,8 @@ namespace vcpkg::Install action.build_options = install_plan_options; if (action.request_type != RequestType::USER_REQUESTED) { - action.build_options.use_head_version = Build::UseHeadVersion::NO; - action.build_options.editable = Build::Editable::NO; + action.build_options.use_head_version = UseHeadVersion::NO; + action.build_options.editable = Editable::NO; } } @@ -1157,13 +1148,13 @@ namespace vcpkg::Install } #endif // defined(_WIN32) - Dependencies::print_plan(action_plan, is_recursive, paths.builtin_ports_directory()); + print_plan(action_plan, is_recursive, paths.builtin_ports_directory()); auto it_pkgsconfig = options.settings.find(OPTION_WRITE_PACKAGES_CONFIG); if (it_pkgsconfig != options.settings.end()) { LockGuardPtr(g_metrics)->track_property("x-write-nuget-packages-config", "defined"); - Build::compute_all_abis(paths, action_plan, var_provider, status_db); + compute_all_abis(paths, action_plan, var_provider, status_db); auto pkgsconfig_path = paths.original_cwd / it_pkgsconfig->second; auto pkgsconfig_contents = generate_nuget_packages_config(action_plan); @@ -1180,14 +1171,8 @@ namespace vcpkg::Install track_install_plan(action_plan); - const InstallSummary summary = perform(args, - action_plan, - keep_going, - paths, - status_db, - binary_cache, - Build::null_build_logs_recorder(), - var_provider); + const InstallSummary summary = Install::perform( + args, action_plan, keep_going, paths, status_db, binary_cache, null_build_logs_recorder(), var_provider); print2("\nTotal elapsed time: ", GlobalState::timer.to_string(), "\n\n"); @@ -1221,7 +1206,7 @@ namespace vcpkg::Install auto bpgh = result.get_binary_paragraph(); assert(bpgh); if (!bpgh) continue; - print_usage_information(*bpgh, printed_usages, fs, paths.installed()); + Install::print_usage_information(*bpgh, printed_usages, fs, paths.installed()); } Checks::exit_success(VCPKG_LINE_INFO); @@ -1235,7 +1220,7 @@ namespace vcpkg::Install Install::perform_and_exit(args, paths, default_triplet, host_triplet); } - SpecSummary::SpecSummary(const Dependencies::InstallPlanAction& action) + SpecSummary::SpecSummary(const InstallPlanAction& action) : build_result() , timing() , start_time(std::chrono::system_clock::now()) @@ -1244,7 +1229,7 @@ namespace vcpkg::Install { } - SpecSummary::SpecSummary(const Dependencies::RemovePlanAction& action) + SpecSummary::SpecSummary(const RemovePlanAction& action) : build_result() , timing() , start_time(std::chrono::system_clock::now()) @@ -1282,7 +1267,7 @@ namespace vcpkg::Install return m_install_action && m_install_action->request_type == RequestType::USER_REQUESTED; } - void track_install_plan(Dependencies::ActionPlan& plan) + void track_install_plan(ActionPlan& plan) { Cache triplet_hashes; diff --git a/src/vcpkg/portfileprovider.cpp b/src/vcpkg/portfileprovider.cpp index 17029ed472..d4c956f314 100644 --- a/src/vcpkg/portfileprovider.cpp +++ b/src/vcpkg/portfileprovider.cpp @@ -35,7 +35,7 @@ namespace }; } -namespace vcpkg::PortFileProvider +namespace vcpkg { MapPortFileProvider::MapPortFileProvider(const std::unordered_map& map) : ports(map) diff --git a/src/vcpkg/postbuildlint.buildtype.cpp b/src/vcpkg/postbuildlint.buildtype.cpp index 9fc7dcfef5..c4507e69d3 100644 --- a/src/vcpkg/postbuildlint.buildtype.cpp +++ b/src/vcpkg/postbuildlint.buildtype.cpp @@ -14,7 +14,7 @@ namespace vcpkg::PostBuildLint constexpr static const StringLiteral static_crt = "/DEFAULTLIB:LIBCMT"; constexpr static const StringLiteral dynamic_crt = "/DEFAULTLIB:MSVCRT"; - StringView option = linkage == Build::LinkageType::STATIC ? static_crt : dynamic_crt; + StringView option = linkage == LinkageType::STATIC ? static_crt : dynamic_crt; auto found = Strings::case_insensitive_ascii_search(sv, option); if (found == sv.end()) @@ -23,7 +23,7 @@ namespace vcpkg::PostBuildLint } auto option_end = found + option.size(); - if (config == Build::ConfigurationType::DEBUG) + if (config == ConfigurationType::DEBUG) { if (option_end == sv.end() || !Strings::icase_eq(*option_end, 'd')) { @@ -37,9 +37,9 @@ namespace vcpkg::PostBuildLint StringLiteral BuildType::to_string() const { - if (config == Build::ConfigurationType::DEBUG) + if (config == ConfigurationType::DEBUG) { - if (linkage == Build::LinkageType::STATIC) + if (linkage == LinkageType::STATIC) { return "Debug,Static"; } @@ -50,7 +50,7 @@ namespace vcpkg::PostBuildLint } else { - if (linkage == Build::LinkageType::STATIC) + if (linkage == LinkageType::STATIC) { return "Release,Static"; } diff --git a/src/vcpkg/postbuildlint.cpp b/src/vcpkg/postbuildlint.cpp index 64105de109..e74190036b 100644 --- a/src/vcpkg/postbuildlint.cpp +++ b/src/vcpkg/postbuildlint.cpp @@ -10,10 +10,6 @@ #include #include -using vcpkg::Build::BuildInfo; -using vcpkg::Build::BuildPolicy; -using vcpkg::Build::PreBuildInfo; - namespace vcpkg::PostBuildLint { constexpr static const StringLiteral windows_system_names[] = { @@ -73,7 +69,7 @@ namespace vcpkg::PostBuildLint } static LintStatus check_for_files_in_include_directory(const Filesystem& fs, - const Build::BuildPolicies& policies, + const BuildPolicies& policies, const Path& package_dir) { if (policies.is_enabled(BuildPolicy::EMPTY_INCLUDE_FOLDER)) @@ -110,7 +106,7 @@ namespace vcpkg::PostBuildLint } static LintStatus check_for_restricted_include_files(const Filesystem& fs, - const Build::BuildPolicies& policies, + const BuildPolicies& policies, const Path& package_dir) { if (policies.is_enabled(BuildPolicy::ALLOW_RESTRICTED_HEADERS)) @@ -192,7 +188,7 @@ namespace vcpkg::PostBuildLint "other packages from compiling correctly:\n"); print_paths(violations); print2("In exceptional circumstances, this policy can be disabled via ", - Build::to_cmake_variable(BuildPolicy::ALLOW_RESTRICTED_HEADERS), + to_cmake_variable(BuildPolicy::ALLOW_RESTRICTED_HEADERS), "\n"); return LintStatus::PROBLEM_DETECTED; } @@ -235,7 +231,7 @@ namespace vcpkg::PostBuildLint } static LintStatus check_for_vcpkg_port_config(const Filesystem& fs, - const Build::BuildPolicies& policies, + const BuildPolicies& policies, const Path& package_dir, const PackageSpec& spec) { @@ -411,7 +407,7 @@ namespace vcpkg::PostBuildLint return LintStatus::SUCCESS; } - static LintStatus check_exports_of_dlls(const Build::BuildPolicies& policies, + static LintStatus check_exports_of_dlls(const BuildPolicies& policies, const std::vector& dlls, const Path& dumpbin_exe) { @@ -625,7 +621,7 @@ namespace vcpkg::PostBuildLint return LintStatus::SUCCESS; } - static LintStatus check_no_dlls_present(const Build::BuildPolicies& policies, const std::vector& dlls) + static LintStatus check_no_dlls_present(const BuildPolicies& policies, const std::vector& dlls) { if (dlls.empty() || policies.is_enabled(BuildPolicy::DLLS_IN_STATIC_LIBRARY)) { @@ -671,7 +667,7 @@ namespace vcpkg::PostBuildLint return LintStatus::PROBLEM_DETECTED; } - static LintStatus check_lib_files_are_available_if_dlls_are_available(const Build::BuildPolicies& policies, + static LintStatus check_lib_files_are_available_if_dlls_are_available(const BuildPolicies& policies, const size_t lib_count, const size_t dll_count, const Path& lib_dir) @@ -691,7 +687,7 @@ namespace vcpkg::PostBuildLint return LintStatus::SUCCESS; } - static LintStatus check_bin_folders_are_not_present_in_static_build(const Build::BuildPolicies& policies, + static LintStatus check_bin_folders_are_not_present_in_static_build(const BuildPolicies& policies, const Filesystem& fs, const Path& package_dir) { @@ -899,10 +895,10 @@ namespace vcpkg::PostBuildLint const Path& dumpbin_exe) { auto bad_build_types = std::vector({ - {Build::ConfigurationType::DEBUG, Build::LinkageType::STATIC}, - {Build::ConfigurationType::DEBUG, Build::LinkageType::DYNAMIC}, - {Build::ConfigurationType::RELEASE, Build::LinkageType::STATIC}, - {Build::ConfigurationType::RELEASE, Build::LinkageType::DYNAMIC}, + {ConfigurationType::DEBUG, LinkageType::STATIC}, + {ConfigurationType::DEBUG, LinkageType::DYNAMIC}, + {ConfigurationType::RELEASE, LinkageType::STATIC}, + {ConfigurationType::RELEASE, LinkageType::DYNAMIC}, }); Util::erase_remove(bad_build_types, expected_build_type); @@ -1098,7 +1094,7 @@ namespace vcpkg::PostBuildLint switch (build_info.library_linkage) { - case Build::LinkageType::DYNAMIC: + case LinkageType::DYNAMIC: { if (!pre_build_info.build_type && !build_info.policies.is_enabled(BuildPolicy::MISMATCHED_NUMBER_OF_BINARIES)) @@ -1126,7 +1122,7 @@ namespace vcpkg::PostBuildLint #endif break; } - case Build::LinkageType::STATIC: + case LinkageType::STATIC: { auto dlls = release_dlls; dlls.insert(dlls.end(), debug_dlls.begin(), debug_dlls.end()); @@ -1139,14 +1135,10 @@ namespace vcpkg::PostBuildLint if (!build_info.policies.is_enabled(BuildPolicy::ONLY_RELEASE_CRT)) { error_count += check_crt_linkage_of_libs( - BuildType(Build::ConfigurationType::DEBUG, build_info.crt_linkage), - debug_libs, - toolset.dumpbin); + BuildType(ConfigurationType::DEBUG, build_info.crt_linkage), debug_libs, toolset.dumpbin); } - error_count += - check_crt_linkage_of_libs(BuildType(Build::ConfigurationType::RELEASE, build_info.crt_linkage), - release_libs, - toolset.dumpbin); + error_count += check_crt_linkage_of_libs( + BuildType(ConfigurationType::RELEASE, build_info.crt_linkage), release_libs, toolset.dumpbin); } break; } diff --git a/src/vcpkg/remove.cpp b/src/vcpkg/remove.cpp index 8fb42f8894..2a483d4fbd 100644 --- a/src/vcpkg/remove.cpp +++ b/src/vcpkg/remove.cpp @@ -15,9 +15,6 @@ namespace vcpkg::Remove { - using Dependencies::RemovePlanAction; - using Dependencies::RemovePlanType; - using Dependencies::RequestType; using Update::OutdatedPackage; REGISTER_MESSAGE(RemovingPackage); @@ -122,7 +119,7 @@ namespace vcpkg::Remove std::vector cont = it->second; std::sort(cont.begin(), cont.end(), &RemovePlanAction::compare_by_name); const std::string as_string = Strings::join("\n", cont, [](const RemovePlanAction* p) { - return Dependencies::to_output_string(p->request_type, p->spec.to_string()); + return to_output_string(p->request_type, p->spec.to_string()); }); switch (plan_type) @@ -212,8 +209,7 @@ namespace vcpkg::Remove } // Load ports from ports dirs - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); specs = Util::fmap(Update::find_outdated_packages(provider, status_db), [](auto&& outdated) { return outdated.spec; }); @@ -232,7 +228,7 @@ namespace vcpkg::Remove Checks::exit_fail(VCPKG_LINE_INFO); } specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_package_spec( + return check_and_get_package_spec( std::string(arg), default_triplet, COMMAND_STRUCTURE.example_text, paths); }); } @@ -249,7 +245,7 @@ namespace vcpkg::Remove const bool is_recursive = Util::Sets::contains(options.switches, OPTION_RECURSE); const bool dry_run = Util::Sets::contains(options.switches, OPTION_DRY_RUN); - const std::vector remove_plan = Dependencies::create_remove_plan(specs, status_db); + const std::vector remove_plan = create_remove_plan(specs, status_db); Checks::check_exit(VCPKG_LINE_INFO, !remove_plan.empty(), "Remove plan cannot be empty"); std::map> group_by_plan_type; diff --git a/src/vcpkg/spdx.cpp b/src/vcpkg/spdx.cpp index 3e0a386b6e..1fab7b904e 100644 --- a/src/vcpkg/spdx.cpp +++ b/src/vcpkg/spdx.cpp @@ -124,7 +124,7 @@ Json::Value vcpkg::run_resource_heuristics(StringView contents) return Json::Value::object(std::move(ret)); } -std::string vcpkg::create_spdx_sbom(const Dependencies::InstallPlanAction& action, +std::string vcpkg::create_spdx_sbom(const InstallPlanAction& action, View relative_paths, View hashes, std::string created_time, diff --git a/src/vcpkg/statusparagraphs.cpp b/src/vcpkg/statusparagraphs.cpp index 05f4115703..366fd96c31 100644 --- a/src/vcpkg/statusparagraphs.cpp +++ b/src/vcpkg/statusparagraphs.cpp @@ -170,7 +170,7 @@ namespace vcpkg { iobj.insert("features", std::move(features)); } - auto usage = Install::get_cmake_usage(fs, installed, ipv.core->package); + auto usage = get_cmake_usage(fs, installed, ipv.core->package); if (!usage.message.empty()) { iobj.insert("usage", Json::Value::string(std::move(usage.message))); diff --git a/src/vcpkg/update.cpp b/src/vcpkg/update.cpp index e973a14843..a1f8c3b225 100644 --- a/src/vcpkg/update.cpp +++ b/src/vcpkg/update.cpp @@ -16,7 +16,7 @@ namespace vcpkg::Update return left.spec.name() < right.spec.name(); } - std::vector find_outdated_packages(const PortFileProvider::PortFileProvider& provider, + std::vector find_outdated_packages(const PortFileProvider& provider, const StatusParagraphs& status_db) { auto installed_packages = get_installed_ports(status_db); @@ -68,8 +68,7 @@ namespace vcpkg::Update const StatusParagraphs status_db = database_load_check(paths.get_filesystem(), paths.installed()); - PortFileProvider::PathsPortFileProvider provider( - paths, PortFileProvider::make_overlay_provider(paths, args.overlay_ports)); + PathsPortFileProvider provider(paths, make_overlay_provider(paths, args.overlay_ports)); const auto outdated_packages = SortedVector( find_outdated_packages(provider, status_db), &OutdatedPackage::compare_by_name); diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp index 4d70155359..35e473400c 100644 --- a/src/vcpkg/vcpkgpaths.cpp +++ b/src/vcpkg/vcpkgpaths.cpp @@ -546,7 +546,7 @@ namespace vcpkg const Optional buildtrees; const Optional packages; const std::unique_ptr m_tool_cache; - Build::EnvCache m_env_cache; + EnvCache m_env_cache; std::vector triplets_dirs; std::unique_ptr file_lock_handle; @@ -1316,7 +1316,7 @@ namespace vcpkg } #endif - const Toolset& VcpkgPaths::get_toolset(const Build::PreBuildInfo& prebuildinfo) const + const Toolset& VcpkgPaths::get_toolset(const PreBuildInfo& prebuildinfo) const { if (!prebuildinfo.using_vcvars()) { @@ -1375,17 +1375,17 @@ namespace vcpkg #endif } - const Environment& VcpkgPaths::get_action_env(const Build::AbiInfo& abi_info) const + const Environment& VcpkgPaths::get_action_env(const AbiInfo& abi_info) const { return m_pimpl->m_env_cache.get_action_env(*this, abi_info); } - const std::string& VcpkgPaths::get_triplet_info(const Build::AbiInfo& abi_info) const + const std::string& VcpkgPaths::get_triplet_info(const AbiInfo& abi_info) const { return m_pimpl->m_env_cache.get_triplet_info(*this, abi_info); } - const Build::CompilerInfo& VcpkgPaths::get_compiler_info(const Build::AbiInfo& abi_info) const + const CompilerInfo& VcpkgPaths::get_compiler_info(const AbiInfo& abi_info) const { return m_pimpl->m_env_cache.get_compiler_info(*this, abi_info); } diff --git a/src/vcpkg/xunitwriter.cpp b/src/vcpkg/xunitwriter.cpp index 4632ba6216..cbef99c5e8 100644 --- a/src/vcpkg/xunitwriter.cpp +++ b/src/vcpkg/xunitwriter.cpp @@ -11,8 +11,8 @@ struct vcpkg::XunitTest std::string name; std::string method; std::string owner; - vcpkg::Build::BuildResult result; - vcpkg::ElapsedTime time; + BuildResult result; + ElapsedTime time; std::chrono::system_clock::time_point start_time; std::string abi_tag; std::vector features; @@ -20,8 +20,6 @@ struct vcpkg::XunitTest namespace { - using vcpkg::Build::BuildResult; - static void xml_test(XmlSerializer& xml, const XunitTest& test) { StringLiteral result_string = ""; @@ -95,7 +93,7 @@ XunitWriter::XunitWriter() { } XunitWriter::~XunitWriter() { } void XunitWriter::add_test_results(const PackageSpec& spec, - Build::BuildResult build_result, + BuildResult build_result, const ElapsedTime& elapsed_time, const std::chrono::system_clock::time_point& start_time, const std::string& abi_tag,