From 3e6bbe684dfe95cb3ca98a4ac8d04a49e86c5f15 Mon Sep 17 00:00:00 2001 From: autoantwort <41973254+autoantwort@users.noreply.github.com> Date: Wed, 29 Sep 2021 20:11:44 +0200 Subject: [PATCH] Rename SourceControlFileLocation to SourceControlFileAndLocation (#176) --- include/vcpkg-test/util.h | 4 +-- include/vcpkg/binarycaching.private.h | 2 +- include/vcpkg/build.h | 4 +-- include/vcpkg/dependencies.h | 4 +-- include/vcpkg/paragraphs.h | 10 +++--- include/vcpkg/portfileprovider.h | 24 +++++++------- include/vcpkg/sourceparagraph.h | 10 ++---- src/vcpkg-test/binarycaching.cpp | 10 +++--- src/vcpkg-test/dependencies.cpp | 38 +++++++++++----------- src/vcpkg-test/update.cpp | 16 +++++----- src/vcpkg-test/util.cpp | 4 +-- src/vcpkg/binarycaching.cpp | 2 +- src/vcpkg/build.cpp | 12 +++---- src/vcpkg/commands.check-support.cpp | 2 +- src/vcpkg/commands.ci.cpp | 2 +- src/vcpkg/commands.dependinfo.cpp | 4 +-- src/vcpkg/dependencies.cpp | 28 ++++++++--------- src/vcpkg/install.cpp | 5 +-- src/vcpkg/paragraphs.cpp | 4 +-- src/vcpkg/portfileprovider.cpp | 45 ++++++++++++++------------- 20 files changed, 113 insertions(+), 117 deletions(-) diff --git a/include/vcpkg-test/util.h b/include/vcpkg-test/util.h index 2b91c780d..649ef98cf 100644 --- a/include/vcpkg-test/util.h +++ b/include/vcpkg-test/util.h @@ -81,7 +81,7 @@ namespace vcpkg::Test /// struct PackageSpecMap { - std::unordered_map map; + std::unordered_map map; Triplet triplet; PackageSpecMap(Triplet t = X86_WINDOWS) noexcept : triplet(t) { } @@ -90,7 +90,7 @@ namespace vcpkg::Test const std::vector>& features = {}, const std::vector& default_features = {}); - PackageSpec emplace(vcpkg::SourceControlFileLocation&& scfl); + PackageSpec emplace(vcpkg::SourceControlFileAndLocation&& scfl); }; template diff --git a/include/vcpkg/binarycaching.private.h b/include/vcpkg/binarycaching.private.h index 3106e14e9..cf07f4829 100644 --- a/include/vcpkg/binarycaching.private.h +++ b/include/vcpkg/binarycaching.private.h @@ -31,7 +31,7 @@ namespace vcpkg inline NugetReference make_nugetref(const Dependencies::InstallPlanAction& action, const std::string& prefix) { return make_nugetref(action.spec, - action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO) + action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO) .source_control_file->core_paragraph->version, action.abi_info.value_or_exit(VCPKG_LINE_INFO).package_abi, prefix); diff --git a/include/vcpkg/build.h b/include/vcpkg/build.h index b91bee594..cc6cacd47 100644 --- a/include/vcpkg/build.h +++ b/include/vcpkg/build.h @@ -56,7 +56,7 @@ namespace vcpkg::Build int perform_ex(const VcpkgCmdArguments& args, const FullPackageSpec& full_spec, Triplet host_triplet, - const SourceControlFileLocation& scfl, + const SourceControlFileAndLocation& scfl, const PortFileProvider::PathsPortFileProvider& provider, BinaryCache& binary_cache, const IBuildLogsRecorder& build_logs_recorder, @@ -64,7 +64,7 @@ namespace vcpkg::Build void perform_and_exit_ex(const VcpkgCmdArguments& args, const FullPackageSpec& full_spec, Triplet host_triplet, - const SourceControlFileLocation& scfl, + const SourceControlFileAndLocation& scfl, const PortFileProvider::PathsPortFileProvider& provider, BinaryCache& binary_cache, const IBuildLogsRecorder& build_logs_recorder, diff --git a/include/vcpkg/dependencies.h b/include/vcpkg/dependencies.h index 71239ed62..4ce2fea09 100644 --- a/include/vcpkg/dependencies.h +++ b/include/vcpkg/dependencies.h @@ -64,7 +64,7 @@ namespace vcpkg::Dependencies InstallPlanAction(InstalledPackageView&& spghs, const RequestType& request_type); InstallPlanAction(const PackageSpec& spec, - const SourceControlFileLocation& scfl, + const SourceControlFileAndLocation& scfl, const RequestType& request_type, Triplet host_triplet, std::map>&& dependencies); @@ -77,7 +77,7 @@ namespace vcpkg::Dependencies PackageSpec spec; - Optional source_control_file_location; + Optional source_control_file_and_location; Optional installed_package; InstallPlanType plan_type; diff --git a/include/vcpkg/paragraphs.h b/include/vcpkg/paragraphs.h index d85a8fc44..31dc04518 100644 --- a/include/vcpkg/paragraphs.h +++ b/include/vcpkg/paragraphs.h @@ -33,7 +33,7 @@ namespace vcpkg::Paragraphs struct LoadResults { - std::vector paragraphs; + std::vector paragraphs; std::vector> errors; }; @@ -41,11 +41,11 @@ namespace vcpkg::Paragraphs // as opposed to making it a function constexpr struct { - const std::string& operator()(const SourceControlFileLocation* loc) const + const std::string& operator()(const SourceControlFileAndLocation* loc) const { return (*this)(*loc->source_control_file); } - const std::string& operator()(const SourceControlFileLocation& loc) const + const std::string& operator()(const SourceControlFileAndLocation& loc) const { return (*this)(*loc.source_control_file); } @@ -54,6 +54,6 @@ namespace vcpkg::Paragraphs LoadResults try_load_all_registry_ports(const VcpkgPaths& paths); - std::vector load_all_registry_ports(const VcpkgPaths& paths); - std::vector load_overlay_ports(const Filesystem& fs, const Path& dir); + std::vector load_all_registry_ports(const VcpkgPaths& paths); + std::vector load_overlay_ports(const Filesystem& fs, const Path& dir); } diff --git a/include/vcpkg/portfileprovider.h b/include/vcpkg/portfileprovider.h index f31ca960d..c4646ec7f 100644 --- a/include/vcpkg/portfileprovider.h +++ b/include/vcpkg/portfileprovider.h @@ -14,20 +14,20 @@ namespace vcpkg::PortFileProvider struct PortFileProvider { virtual ~PortFileProvider() = default; - virtual ExpectedS get_control_file(const std::string& src_name) const = 0; - virtual std::vector load_all_control_files() const = 0; + virtual ExpectedS get_control_file(const std::string& src_name) const = 0; + virtual std::vector load_all_control_files() const = 0; }; struct MapPortFileProvider : PortFileProvider { - explicit MapPortFileProvider(const std::unordered_map& map); + explicit MapPortFileProvider(const std::unordered_map& map); MapPortFileProvider(const MapPortFileProvider&) = delete; MapPortFileProvider& operator=(const MapPortFileProvider&) = delete; - ExpectedS get_control_file(const std::string& src_name) const override; - std::vector load_all_control_files() const override; + ExpectedS get_control_file(const std::string& src_name) const override; + std::vector load_all_control_files() const override; private: - const std::unordered_map& ports; + const std::unordered_map& ports; }; struct IVersionedPortfileProvider @@ -35,9 +35,9 @@ namespace vcpkg::PortFileProvider virtual View get_port_versions(StringView port_name) const = 0; virtual ~IVersionedPortfileProvider() = default; - virtual ExpectedS get_control_file( + virtual ExpectedS get_control_file( const Versions::VersionSpec& version_spec) const = 0; - virtual void load_all_control_files(std::map& out) const = 0; + virtual void load_all_control_files(std::map& out) const = 0; }; struct IBaselineProvider @@ -49,8 +49,8 @@ namespace vcpkg::PortFileProvider struct IOverlayProvider { virtual ~IOverlayProvider() = default; - virtual Optional get_control_file(StringView port_name) const = 0; - virtual void load_all_control_files(std::map& out) const = 0; + virtual Optional get_control_file(StringView port_name) const = 0; + virtual void load_all_control_files(std::map& out) const = 0; }; struct PathsPortFileProvider : PortFileProvider @@ -58,8 +58,8 @@ namespace vcpkg::PortFileProvider explicit PathsPortFileProvider(const vcpkg::VcpkgPaths& paths, const std::vector& overlay_ports); PathsPortFileProvider(const PathsPortFileProvider&) = delete; PathsPortFileProvider& operator=(const PathsPortFileProvider&) = delete; - ExpectedS get_control_file(const std::string& src_name) const override; - std::vector load_all_control_files() const override; + ExpectedS get_control_file(const std::string& src_name) const override; + std::vector load_all_control_files() const override; private: std::unique_ptr m_baseline; diff --git a/include/vcpkg/sourceparagraph.h b/include/vcpkg/sourceparagraph.h index 0e223ddc0..965f18c8e 100644 --- a/include/vcpkg/sourceparagraph.h +++ b/include/vcpkg/sourceparagraph.h @@ -126,16 +126,10 @@ namespace vcpkg Json::Object serialize_debug_manifest(const SourceControlFile& scf); /// - /// Full metadata of a package: core and other features, - /// as well as the port directory the SourceControlFile was loaded from + /// Named pair of a SourceControlFile and the location of this file /// - struct SourceControlFileLocation + struct SourceControlFileAndLocation { - SourceControlFileLocation clone() const - { - return {std::make_unique(source_control_file->clone()), source_location}; - } - VersionT to_versiont() const { return source_control_file->to_versiont(); } std::unique_ptr source_control_file; diff --git a/src/vcpkg-test/binarycaching.cpp b/src/vcpkg-test/binarycaching.cpp index 554207580..c29bd77b4 100644 --- a/src/vcpkg-test/binarycaching.cpp +++ b/src/vcpkg-test/binarycaching.cpp @@ -257,7 +257,7 @@ Build-Depends: bzip REQUIRE(pghs.has_value()); auto maybe_scf = SourceControlFile::parse_control_file("", std::move(*pghs.get())); REQUIRE(maybe_scf.has_value()); - SourceControlFileLocation scfl{std::move(*maybe_scf.get()), Path()}; + SourceControlFileAndLocation scfl{std::move(*maybe_scf.get()), Path()}; Dependencies::InstallPlanAction ipa(PackageSpec{"zlib2", Test::X64_WINDOWS}, scfl, @@ -430,10 +430,10 @@ Description: a spiffy compression library wrapper REQUIRE(pghs.has_value()); auto maybe_scf = SourceControlFile::parse_control_file("", std::move(*pghs.get())); REQUIRE(maybe_scf.has_value()); - SourceControlFileLocation scfl{std::move(*maybe_scf.get()), Path()}; + SourceControlFileAndLocation scfl{std::move(*maybe_scf.get()), Path()}; plan.install_actions.push_back(Dependencies::InstallPlanAction()); plan.install_actions[0].spec = PackageSpec("zlib", Test::X64_ANDROID); - plan.install_actions[0].source_control_file_location = scfl; + plan.install_actions[0].source_control_file_and_location = scfl; plan.install_actions[0].abi_info = Build::AbiInfo{}; plan.install_actions[0].abi_info.get()->package_abi = "packageabi"; @@ -453,10 +453,10 @@ Description: a spiffy compression library wrapper REQUIRE(pghs2.has_value()); auto maybe_scf2 = SourceControlFile::parse_control_file("", std::move(*pghs2.get())); REQUIRE(maybe_scf2.has_value()); - SourceControlFileLocation scfl2{std::move(*maybe_scf2.get()), Path()}; + SourceControlFileAndLocation scfl2{std::move(*maybe_scf2.get()), Path()}; plan.install_actions.push_back(Dependencies::InstallPlanAction()); plan.install_actions[1].spec = PackageSpec("zlib2", Test::X64_ANDROID); - plan.install_actions[1].source_control_file_location = scfl2; + plan.install_actions[1].source_control_file_and_location = scfl2; plan.install_actions[1].abi_info = Build::AbiInfo{}; plan.install_actions[1].abi_info.get()->package_abi = "packageabi2"; diff --git a/src/vcpkg-test/dependencies.cpp b/src/vcpkg-test/dependencies.cpp index 708c3ae51..725dd9f7a 100644 --- a/src/vcpkg-test/dependencies.cpp +++ b/src/vcpkg-test/dependencies.cpp @@ -36,16 +36,16 @@ struct MockBaselineProvider : PortFileProvider::IBaselineProvider struct MockVersionedPortfileProvider : PortFileProvider::IVersionedPortfileProvider { - mutable std::map> v; + mutable std::map> v; - ExpectedS get_control_file( + ExpectedS get_control_file( const vcpkg::Versions::VersionSpec& versionspec) const override { return get_control_file(versionspec.port_name, versionspec.version); } - ExpectedS get_control_file(const std::string& name, - const vcpkg::Versions::Version& version) const + ExpectedS get_control_file(const std::string& name, + const vcpkg::Versions::Version& version) const { auto it = v.find(name); if (it == v.end()) return std::string("Unknown port name"); @@ -56,13 +56,13 @@ struct MockVersionedPortfileProvider : PortFileProvider::IVersionedPortfileProvi virtual View get_port_versions(StringView) const override { Checks::unreachable(VCPKG_LINE_INFO); } - SourceControlFileLocation& emplace(std::string&& name, - Versions::Version&& version, - Versions::Scheme scheme = Versions::Scheme::String) + SourceControlFileAndLocation& emplace(std::string&& name, + Versions::Version&& version, + Versions::Scheme scheme = Versions::Scheme::String) { auto it = v.find(name); if (it == v.end()) - it = v.emplace(name, std::map{}).first; + it = v.emplace(name, std::map{}).first; auto it2 = it->second.find(version); if (it2 == it->second.end()) @@ -74,12 +74,12 @@ struct MockVersionedPortfileProvider : PortFileProvider::IVersionedPortfileProvi core->port_version = version.port_version(); core->version_scheme = scheme; scf->core_paragraph = std::move(core); - it2 = it->second.emplace(version, SourceControlFileLocation{std::move(scf), name}).first; + it2 = it->second.emplace(version, SourceControlFileAndLocation{std::move(scf), name}).first; } return it2->second; } - virtual void load_all_control_files(std::map&) const override + virtual void load_all_control_files(std::map&) const override { Checks::unreachable(VCPKG_LINE_INFO); } @@ -105,7 +105,7 @@ static void check_name_and_version(const Dependencies::InstallPlanAction& ipa, std::initializer_list features = {}) { CHECK(ipa.spec.name() == name); - CHECK(ipa.source_control_file_location.has_value()); + CHECK(ipa.source_control_file_and_location.has_value()); CHECK(ipa.feature_list.size() == features.size() + 1); { INFO("ipa.feature_list = [" << Strings::join(", ", ipa.feature_list) << "]"); @@ -116,7 +116,7 @@ static void check_name_and_version(const Dependencies::InstallPlanAction& ipa, } CHECK(Util::find(ipa.feature_list, "core") != ipa.feature_list.end()); } - if (auto scfl = ipa.source_control_file_location.get()) + if (auto scfl = ipa.source_control_file_and_location.get()) { CHECK(scfl->source_control_file->core_paragraph->version == v.text()); CHECK(scfl->source_control_file->core_paragraph->port_version == v.port_version()); @@ -171,7 +171,7 @@ struct MockOverlayProvider : PortFileProvider::IOverlayProvider MockOverlayProvider(const MockOverlayProvider&) = delete; MockOverlayProvider& operator=(const MockOverlayProvider&) = delete; - virtual Optional get_control_file(StringView name) const override + virtual Optional get_control_file(StringView name) const override { auto it = mappings.find(name); if (it == mappings.end()) @@ -182,9 +182,9 @@ struct MockOverlayProvider : PortFileProvider::IOverlayProvider return it->second; } - SourceControlFileLocation& emplace(const std::string& name, - Versions::Version&& version, - Versions::Scheme scheme = Versions::Scheme::String) + SourceControlFileAndLocation& emplace(const std::string& name, + Versions::Version&& version, + Versions::Scheme scheme = Versions::Scheme::String) { auto it = mappings.find(name); if (it == mappings.end()) @@ -196,18 +196,18 @@ struct MockOverlayProvider : PortFileProvider::IOverlayProvider core->port_version = version.port_version(); core->version_scheme = scheme; scf->core_paragraph = std::move(core); - it = mappings.emplace(name, SourceControlFileLocation{std::move(scf), name}).first; + it = mappings.emplace(name, SourceControlFileAndLocation{std::move(scf), name}).first; } return it->second; } - virtual void load_all_control_files(std::map&) const override + virtual void load_all_control_files(std::map&) const override { Checks::unreachable(VCPKG_LINE_INFO); } private: - std::map> mappings; + std::map> mappings; }; static const MockOverlayProvider s_empty_mock_overlay; diff --git a/src/vcpkg-test/update.cpp b/src/vcpkg-test/update.cpp index bce663d28..5db112599 100644 --- a/src/vcpkg-test/update.cpp +++ b/src/vcpkg-test/update.cpp @@ -22,9 +22,9 @@ TEST_CASE ("find outdated packages basic", "[update]") StatusParagraphs status_db(std::move(status_paragraphs)); - std::unordered_map map; + std::unordered_map map; auto scf = unwrap(test_parse_control_file({{{"Source", "a"}, {"Version", "0"}}})); - map.emplace("a", SourceControlFileLocation{std::move(scf), ""}); + map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""}); PortFileProvider::MapPortFileProvider provider(map); auto pkgs = SortedVector(Update::find_outdated_packages(provider, status_db), @@ -46,9 +46,9 @@ TEST_CASE ("find outdated packages features", "[update]") StatusParagraphs status_db(std::move(status_paragraphs)); - std::unordered_map map; + std::unordered_map map; auto scf = unwrap(test_parse_control_file({{{"Source", "a"}, {"Version", "0"}}})); - map.emplace("a", SourceControlFileLocation{std::move(scf), ""}); + map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""}); PortFileProvider::MapPortFileProvider provider(map); auto pkgs = SortedVector(Update::find_outdated_packages(provider, status_db), @@ -72,9 +72,9 @@ TEST_CASE ("find outdated packages features 2", "[update]") StatusParagraphs status_db(std::move(status_paragraphs)); - std::unordered_map map; + std::unordered_map map; auto scf = unwrap(test_parse_control_file({{{"Source", "a"}, {"Version", "0"}}})); - map.emplace("a", SourceControlFileLocation{std::move(scf), ""}); + map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""}); PortFileProvider::MapPortFileProvider provider(map); auto pkgs = SortedVector(Update::find_outdated_packages(provider, status_db), @@ -93,9 +93,9 @@ TEST_CASE ("find outdated packages none", "[update]") StatusParagraphs status_db(std::move(status_paragraphs)); - std::unordered_map map; + std::unordered_map map; auto scf = unwrap(test_parse_control_file({{{"Source", "a"}, {"Version", "2"}}})); - map.emplace("a", SourceControlFileLocation{std::move(scf), ""}); + map.emplace("a", SourceControlFileAndLocation{std::move(scf), ""}); PortFileProvider::MapPortFileProvider provider(map); auto pkgs = SortedVector(Update::find_outdated_packages(provider, status_db), diff --git a/src/vcpkg-test/util.cpp b/src/vcpkg-test/util.cpp index b4ede4880..06af64ef7 100644 --- a/src/vcpkg-test/util.cpp +++ b/src/vcpkg-test/util.cpp @@ -79,11 +79,11 @@ namespace vcpkg::Test const std::vector>& features, const std::vector& default_features) { - auto scfl = SourceControlFileLocation{make_control_file(name, depends, features, default_features), ""}; + auto scfl = SourceControlFileAndLocation{make_control_file(name, depends, features, default_features), ""}; return emplace(std::move(scfl)); } - PackageSpec PackageSpecMap::emplace(vcpkg::SourceControlFileLocation&& scfl) + PackageSpec PackageSpecMap::emplace(vcpkg::SourceControlFileAndLocation&& scfl) { const auto& name = scfl.source_control_file->core_paragraph->name; REQUIRE(map.find(name) == map.end()); diff --git a/src/vcpkg/binarycaching.cpp b/src/vcpkg/binarycaching.cpp index 1748e51ba..35bb23066 100644 --- a/src/vcpkg/binarycaching.cpp +++ b/src/vcpkg/binarycaching.cpp @@ -1998,7 +1998,7 @@ std::string vcpkg::generate_nuspec(const VcpkgPaths& paths, details::NuGetRepoInfo rinfo) { auto& spec = action.spec; - auto& scf = *action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO).source_control_file; + auto& scf = *action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO).source_control_file; auto& version = scf.core_paragraph->version; const auto& abi_info = action.abi_info.value_or_exit(VCPKG_LINE_INFO); const auto& compiler_info = abi_info.compiler_info.value_or_exit(VCPKG_LINE_INFO); diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index 510473a67..652771cef 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -60,7 +60,7 @@ namespace vcpkg::Build void Command::perform_and_exit_ex(const VcpkgCmdArguments& args, const FullPackageSpec& full_spec, Triplet host_triplet, - const SourceControlFileLocation& scfl, + const SourceControlFileAndLocation& scfl, const PathsPortFileProvider& provider, BinaryCache& binary_cache, const IBuildLogsRecorder& build_logs_recorder, @@ -90,7 +90,7 @@ namespace vcpkg::Build int Command::perform_ex(const VcpkgCmdArguments& args, const FullPackageSpec& full_spec, Triplet host_triplet, - const SourceControlFileLocation& scfl, + const SourceControlFileAndLocation& scfl, const PathsPortFileProvider& provider, BinaryCache& binary_cache, const IBuildLogsRecorder& build_logs_recorder, @@ -731,7 +731,7 @@ namespace vcpkg::Build // bootstrap should have already downloaded ninja, but making sure it is present in case it was deleted. (void)(paths.get_tool_exe(Tools::NINJA)); #endif - auto& scfl = action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO); + auto& scfl = action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO); auto& scf = *scfl.source_control_file; std::string all_features; @@ -856,7 +856,7 @@ namespace vcpkg::Build const auto& pre_build_info = action.pre_build_info(VCPKG_LINE_INFO); auto& fs = paths.get_filesystem(); - auto&& scfl = action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO); + auto&& scfl = action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO); Triplet triplet = action.spec.triplet(); const auto& triplet_file_path = paths.get_triplet_file_path(triplet); @@ -1065,7 +1065,7 @@ namespace vcpkg::Build // just mark the port as no-hash const int max_port_file_count = 100; - auto&& port_dir = action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO).source_location; + auto&& port_dir = action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO).source_location; size_t port_file_count = 0; for (auto& port_file : fs.get_regular_files_recursive(port_dir, VCPKG_LINE_INFO)) { @@ -1207,7 +1207,7 @@ namespace vcpkg::Build { auto& filesystem = paths.get_filesystem(); auto& spec = action.spec; - const std::string& name = action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO) + const std::string& name = action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO) .source_control_file->core_paragraph->name; std::vector missing_fspecs; diff --git a/src/vcpkg/commands.check-support.cpp b/src/vcpkg/commands.check-support.cpp index c97b7418f..7656b7a7d 100644 --- a/src/vcpkg/commands.check-support.cpp +++ b/src/vcpkg/commands.check-support.cpp @@ -136,7 +136,7 @@ namespace vcpkg::Commands for (const auto& action : action_plan.install_actions) { const auto& spec = action.spec; - const auto& supports_expression = action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO) + const auto& supports_expression = action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO) .source_control_file->core_paragraph->supports_expression; PlatformExpression::Context context = cmake_vars->get_tag_vars(spec).value_or_exit(VCPKG_LINE_INFO); diff --git a/src/vcpkg/commands.ci.cpp b/src/vcpkg/commands.ci.cpp index db704ce3c..c4ef81964 100644 --- a/src/vcpkg/commands.ci.cpp +++ b/src/vcpkg/commands.ci.cpp @@ -287,7 +287,7 @@ namespace vcpkg::Commands::CI static bool supported_for_triplet(const CMakeVars::CMakeVarProvider& var_provider, const InstallPlanAction* install_plan) { - auto&& scfl = install_plan->source_control_file_location.value_or_exit(VCPKG_LINE_INFO); + auto&& scfl = install_plan->source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO); const auto& supports_expression = scfl.source_control_file->core_paragraph->supports_expression; PlatformExpression::Context context = var_provider.get_tag_vars(install_plan->spec).value_or_exit(VCPKG_LINE_INFO); diff --git a/src/vcpkg/commands.dependinfo.cpp b/src/vcpkg/commands.dependinfo.cpp index f72c8747e..cb50adc71 100644 --- a/src/vcpkg/commands.dependinfo.cpp +++ b/src/vcpkg/commands.dependinfo.cpp @@ -279,8 +279,8 @@ namespace vcpkg::Commands::DependInfo { const std::vector source_control_files = Util::fmap(install_actions, [](const InstallPlanAction* install_action) { - const SourceControlFileLocation& scfl = - install_action->source_control_file_location.value_or_exit(VCPKG_LINE_INFO); + const SourceControlFileAndLocation& scfl = + install_action->source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO); return const_cast(scfl.source_control_file.get()); }); diff --git a/src/vcpkg/dependencies.cpp b/src/vcpkg/dependencies.cpp index 8b5fbf65e..df2536b8b 100644 --- a/src/vcpkg/dependencies.cpp +++ b/src/vcpkg/dependencies.cpp @@ -51,12 +51,12 @@ namespace vcpkg::Dependencies /// struct Cluster { - Cluster(const InstalledPackageView& ipv, ExpectedS&& scfl) + Cluster(const InstalledPackageView& ipv, ExpectedS&& scfl) : m_spec(ipv.spec()), m_scfl(std::move(scfl)), m_installed(ipv) { } - Cluster(const PackageSpec& spec, const SourceControlFileLocation& scfl) : m_spec(spec), m_scfl(scfl) { } + Cluster(const PackageSpec& spec, const SourceControlFileAndLocation& scfl) : m_spec(spec), m_scfl(scfl) { } Cluster(const Cluster&) = delete; Cluster(Cluster&&) = default; @@ -210,7 +210,7 @@ namespace vcpkg::Dependencies } } - const SourceControlFileLocation& get_scfl_or_exit() const + const SourceControlFileAndLocation& get_scfl_or_exit() const { #if defined(_WIN32) static auto vcpkg_remove_cmd = ".\\vcpkg"; @@ -252,7 +252,7 @@ namespace vcpkg::Dependencies } PackageSpec m_spec; - ExpectedS m_scfl; + ExpectedS m_scfl; Optional m_installed; Optional m_install_info; @@ -306,7 +306,7 @@ namespace vcpkg::Dependencies auto it = m_graph.find(spec); if (it == m_graph.end()) { - const SourceControlFileLocation* scfl = m_port_provider.get_control_file(spec.name()).get(); + const SourceControlFileAndLocation* scfl = m_port_provider.get_control_file(spec.name()).get(); Checks::check_exit(VCPKG_LINE_INFO, scfl, @@ -325,7 +325,7 @@ namespace vcpkg::Dependencies Cluster& insert(const InstalledPackageView& ipv) { - ExpectedS maybe_scfl = + ExpectedS maybe_scfl = m_port_provider.get_control_file(ipv.spec().name()); if (maybe_scfl.has_value()) @@ -367,7 +367,7 @@ namespace vcpkg::Dependencies static std::string to_output_string(RequestType request_type, const CStringView s, const Build::BuildPackageOptions& options, - const SourceControlFileLocation* scfl, + const SourceControlFileAndLocation* scfl, const InstalledPackageView* ipv, const Path& builtin_ports_dir) { @@ -420,12 +420,12 @@ namespace vcpkg::Dependencies } InstallPlanAction::InstallPlanAction(const PackageSpec& spec, - const SourceControlFileLocation& scfl, + const SourceControlFileAndLocation& scfl, const RequestType& request_type, Triplet host_triplet, std::map>&& dependencies) : spec(spec) - , source_control_file_location(scfl) + , source_control_file_and_location(scfl) , plan_type(InstallPlanType::BUILD_AND_INSTALL) , request_type(request_type) , build_options{} @@ -764,7 +764,7 @@ namespace vcpkg::Dependencies spec.package_spec.name(), maybe_scfl.error()); - const SourceControlFileLocation* scfl = maybe_scfl.get(); + const SourceControlFileAndLocation* scfl = maybe_scfl.get(); const std::vector all_features = Util::fmap(scfl->source_control_file->feature_paragraphs, @@ -1200,7 +1200,7 @@ namespace vcpkg::Dependencies return to_output_string(p->request_type, p->displayname(), p->build_options, - p->source_control_file_location.get(), + p->source_control_file_and_location.get(), p->installed_package.get(), builtin_ports_dir); }); @@ -1306,7 +1306,7 @@ namespace vcpkg::Dependencies struct VersionSchemeInfo { Versions::Scheme scheme; - const SourceControlFileLocation* scfl = nullptr; + const SourceControlFileAndLocation* scfl = nullptr; Versions::Version version; // This tracks a list of constraint sources for debugging purposes std::vector origins; @@ -1621,7 +1621,7 @@ namespace vcpkg::Dependencies const Versions::Version& version, const std::string& origin) { - ExpectedS maybe_scfl; + ExpectedS maybe_scfl; auto maybe_overlay = m_o_provider.get_control_file(ref.first.name()); if (auto p_overlay = maybe_overlay.get()) @@ -2089,7 +2089,7 @@ namespace vcpkg::Dependencies if (back.deps.empty()) { emitted[back.ipa.spec] = m_graph[back.ipa.spec].get_node( - to_version(*back.ipa.source_control_file_location.get()->source_control_file)); + to_version(*back.ipa.source_control_file_and_location.get()->source_control_file)); ret.install_actions.push_back(std::move(back.ipa)); stack.pop_back(); } diff --git a/src/vcpkg/install.cpp b/src/vcpkg/install.cpp index f5a03a357..b8cfdc42b 100644 --- a/src/vcpkg/install.cpp +++ b/src/vcpkg/install.cpp @@ -1212,8 +1212,9 @@ namespace vcpkg::Install for (auto&& install_action : plan.install_actions) { - auto&& version_as_string = - install_action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO).to_versiont().to_string(); + auto&& version_as_string = install_action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO) + .to_versiont() + .to_string(); if (!specs_string.empty()) specs_string.push_back(','); specs_string += Strings::concat(Hash::get_string_hash(install_action.spec.name(), Hash::Algorithm::Sha256), ":", diff --git a/src/vcpkg/paragraphs.cpp b/src/vcpkg/paragraphs.cpp index de7d76b7d..b071189d8 100644 --- a/src/vcpkg/paragraphs.cpp +++ b/src/vcpkg/paragraphs.cpp @@ -494,14 +494,14 @@ namespace vcpkg::Paragraphs } } - std::vector load_all_registry_ports(const VcpkgPaths& paths) + std::vector load_all_registry_ports(const VcpkgPaths& paths) { auto results = try_load_all_registry_ports(paths); load_results_print_error(results); return std::move(results.paragraphs); } - std::vector load_overlay_ports(const Filesystem& fs, const Path& directory) + std::vector load_overlay_ports(const Filesystem& fs, const Path& directory) { LoadResults ret; diff --git a/src/vcpkg/portfileprovider.cpp b/src/vcpkg/portfileprovider.cpp index 1509f299b..10abf81e9 100644 --- a/src/vcpkg/portfileprovider.cpp +++ b/src/vcpkg/portfileprovider.cpp @@ -41,21 +41,21 @@ namespace namespace vcpkg::PortFileProvider { - MapPortFileProvider::MapPortFileProvider(const std::unordered_map& map) + MapPortFileProvider::MapPortFileProvider(const std::unordered_map& map) : ports(map) { } - ExpectedS MapPortFileProvider::get_control_file(const std::string& spec) const + ExpectedS MapPortFileProvider::get_control_file(const std::string& spec) const { auto scf = ports.find(spec); if (scf == ports.end()) return std::string("does not exist in map"); return scf->second; } - std::vector MapPortFileProvider::load_all_control_files() const + std::vector MapPortFileProvider::load_all_control_files() const { - return Util::fmap(ports, [](auto&& kvpair) -> const SourceControlFileLocation* { return &kvpair.second; }); + return Util::fmap(ports, [](auto&& kvpair) -> const SourceControlFileAndLocation* { return &kvpair.second; }); } PathsPortFileProvider::PathsPortFileProvider(const VcpkgPaths& paths, const std::vector& overlay_ports) @@ -65,7 +65,8 @@ namespace vcpkg::PortFileProvider { } - ExpectedS PathsPortFileProvider::get_control_file(const std::string& spec) const + ExpectedS PathsPortFileProvider::get_control_file( + const std::string& spec) const { auto maybe_scfl = m_overlay->get_control_file(spec); if (auto scfl = maybe_scfl.get()) @@ -83,9 +84,9 @@ namespace vcpkg::PortFileProvider } } - std::vector PathsPortFileProvider::load_all_control_files() const + std::vector PathsPortFileProvider::load_all_control_files() const { - std::map m; + std::map m; m_overlay->load_all_control_files(m); m_versioned->load_all_control_files(m); return Util::fmap(m, [](const auto& p) { return p.second; }); @@ -161,7 +162,7 @@ namespace vcpkg::PortFileProvider return entry(port_name).value_or_exit(VCPKG_LINE_INFO)->get_port_versions(); } - ExpectedS> load_control_file( + ExpectedS> load_control_file( const VersionSpec& version_spec) const { const auto& maybe_ent = entry(version_spec.port_name); @@ -175,8 +176,8 @@ namespace vcpkg::PortFileProvider { if (scf->get()->core_paragraph->name == version_spec.port_name) { - return std::unique_ptr( - new SourceControlFileLocation{std::move(*scf), std::move(*path)}); + return std::unique_ptr( + new SourceControlFileAndLocation{std::move(*scf), std::move(*path)}); } else { @@ -206,7 +207,7 @@ namespace vcpkg::PortFileProvider return maybe_ent.error(); } - virtual ExpectedS get_control_file( + virtual ExpectedS get_control_file( const VersionSpec& version_spec) const override { auto it = m_control_cache.find(version_spec); @@ -214,11 +215,11 @@ namespace vcpkg::PortFileProvider { it = m_control_cache.emplace(version_spec, load_control_file(version_spec)).first; } - return it->second.map([](const auto& x) -> const SourceControlFileLocation& { return *x.get(); }); + return it->second.map([](const auto& x) -> const SourceControlFileAndLocation& { return *x.get(); }); } virtual void load_all_control_files( - std::map& out) const override + std::map& out) const override { auto all_ports = Paragraphs::load_all_registry_ports(paths); for (auto&& scfl : all_ports) @@ -227,7 +228,7 @@ namespace vcpkg::PortFileProvider auto version = scfl.source_control_file->core_paragraph->to_versiont(); auto it = m_control_cache .emplace(VersionSpec{std::move(port_name), std::move(version)}, - std::make_unique(std::move(scfl))) + std::make_unique(std::move(scfl))) .first; Checks::check_exit(VCPKG_LINE_INFO, it->second.has_value()); out.emplace(it->first.port_name, it->second.get()->get()); @@ -237,7 +238,7 @@ namespace vcpkg::PortFileProvider private: const VcpkgPaths& paths; // TODO: remove this data member mutable std:: - unordered_map>, VersionSpecHasher> + unordered_map>, VersionSpecHasher> m_control_cache; mutable std::map>, std::less<>> m_entry_cache; }; @@ -263,7 +264,7 @@ namespace vcpkg::PortFileProvider OverlayProviderImpl(const OverlayProviderImpl&) = delete; OverlayProviderImpl& operator=(const OverlayProviderImpl&) = delete; - Optional load_port(StringView port_name) const + Optional load_port(StringView port_name) const { auto s_port_name = port_name.to_string(); @@ -278,7 +279,7 @@ namespace vcpkg::PortFileProvider auto& scf = *scfp; if (scf->core_paragraph->name == port_name) { - return SourceControlFileLocation{std::move(scf), ports_dir}; + return SourceControlFileAndLocation{std::move(scf), ports_dir}; } } else @@ -300,7 +301,7 @@ namespace vcpkg::PortFileProvider auto& scf = *scfp; if (scf->core_paragraph->name == port_name) { - return SourceControlFileLocation{std::move(scf), std::move(ports_spec)}; + return SourceControlFileAndLocation{std::move(scf), std::move(ports_spec)}; } Checks::exit_maybe_upgrade( VCPKG_LINE_INFO, @@ -320,7 +321,7 @@ namespace vcpkg::PortFileProvider return nullopt; } - virtual Optional get_control_file(StringView port_name) const override + virtual Optional get_control_file(StringView port_name) const override { auto it = m_overlay_cache.find(port_name); if (it == m_overlay_cache.end()) @@ -331,7 +332,7 @@ namespace vcpkg::PortFileProvider } virtual void load_all_control_files( - std::map& out) const override + std::map& out) const override { for (auto&& ports_dir : m_overlay_ports) { @@ -341,7 +342,7 @@ namespace vcpkg::PortFileProvider auto maybe_scf = Paragraphs::try_load_port(m_fs, ports_dir); if (auto scfp = maybe_scf.get()) { - SourceControlFileLocation scfl{std::move(*scfp), ports_dir}; + SourceControlFileAndLocation scfl{std::move(*scfp), ports_dir}; auto name = scfl.source_control_file->core_paragraph->name; auto it = m_overlay_cache.emplace(std::move(name), std::move(scfl)).first; Checks::check_exit(VCPKG_LINE_INFO, it->second.get()); @@ -372,7 +373,7 @@ namespace vcpkg::PortFileProvider private: const Filesystem& m_fs; const std::vector m_overlay_ports; - mutable std::map, std::less<>> m_overlay_cache; + mutable std::map, std::less<>> m_overlay_cache; }; }