Rename SourceControlFileLocation to SourceControlFileAndLocation (#176)
This commit is contained in:
Родитель
baf0eecbb5
Коммит
3e6bbe684d
|
@ -81,7 +81,7 @@ namespace vcpkg::Test
|
|||
/// </summary>
|
||||
struct PackageSpecMap
|
||||
{
|
||||
std::unordered_map<std::string, SourceControlFileLocation> map;
|
||||
std::unordered_map<std::string, SourceControlFileAndLocation> map;
|
||||
Triplet triplet;
|
||||
PackageSpecMap(Triplet t = X86_WINDOWS) noexcept : triplet(t) { }
|
||||
|
||||
|
@ -90,7 +90,7 @@ namespace vcpkg::Test
|
|||
const std::vector<std::pair<const char*, const char*>>& features = {},
|
||||
const std::vector<const char*>& default_features = {});
|
||||
|
||||
PackageSpec emplace(vcpkg::SourceControlFileLocation&& scfl);
|
||||
PackageSpec emplace(vcpkg::SourceControlFileAndLocation&& scfl);
|
||||
};
|
||||
|
||||
template<class T, class S>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<std::string, std::vector<FeatureSpec>>&& dependencies);
|
||||
|
@ -77,7 +77,7 @@ namespace vcpkg::Dependencies
|
|||
|
||||
PackageSpec spec;
|
||||
|
||||
Optional<const SourceControlFileLocation&> source_control_file_location;
|
||||
Optional<const SourceControlFileAndLocation&> source_control_file_and_location;
|
||||
Optional<InstalledPackageView> installed_package;
|
||||
|
||||
InstallPlanType plan_type;
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace vcpkg::Paragraphs
|
|||
|
||||
struct LoadResults
|
||||
{
|
||||
std::vector<SourceControlFileLocation> paragraphs;
|
||||
std::vector<SourceControlFileAndLocation> paragraphs;
|
||||
std::vector<std::unique_ptr<Parse::ParseControlErrorInfo>> 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<SourceControlFileLocation> load_all_registry_ports(const VcpkgPaths& paths);
|
||||
std::vector<SourceControlFileLocation> load_overlay_ports(const Filesystem& fs, const Path& dir);
|
||||
std::vector<SourceControlFileAndLocation> load_all_registry_ports(const VcpkgPaths& paths);
|
||||
std::vector<SourceControlFileAndLocation> load_overlay_ports(const Filesystem& fs, const Path& dir);
|
||||
}
|
||||
|
|
|
@ -14,20 +14,20 @@ namespace vcpkg::PortFileProvider
|
|||
struct PortFileProvider
|
||||
{
|
||||
virtual ~PortFileProvider() = default;
|
||||
virtual ExpectedS<const SourceControlFileLocation&> get_control_file(const std::string& src_name) const = 0;
|
||||
virtual std::vector<const SourceControlFileLocation*> load_all_control_files() const = 0;
|
||||
virtual ExpectedS<const SourceControlFileAndLocation&> get_control_file(const std::string& src_name) const = 0;
|
||||
virtual std::vector<const SourceControlFileAndLocation*> load_all_control_files() const = 0;
|
||||
};
|
||||
|
||||
struct MapPortFileProvider : PortFileProvider
|
||||
{
|
||||
explicit MapPortFileProvider(const std::unordered_map<std::string, SourceControlFileLocation>& map);
|
||||
explicit MapPortFileProvider(const std::unordered_map<std::string, SourceControlFileAndLocation>& map);
|
||||
MapPortFileProvider(const MapPortFileProvider&) = delete;
|
||||
MapPortFileProvider& operator=(const MapPortFileProvider&) = delete;
|
||||
ExpectedS<const SourceControlFileLocation&> get_control_file(const std::string& src_name) const override;
|
||||
std::vector<const SourceControlFileLocation*> load_all_control_files() const override;
|
||||
ExpectedS<const SourceControlFileAndLocation&> get_control_file(const std::string& src_name) const override;
|
||||
std::vector<const SourceControlFileAndLocation*> load_all_control_files() const override;
|
||||
|
||||
private:
|
||||
const std::unordered_map<std::string, SourceControlFileLocation>& ports;
|
||||
const std::unordered_map<std::string, SourceControlFileAndLocation>& ports;
|
||||
};
|
||||
|
||||
struct IVersionedPortfileProvider
|
||||
|
@ -35,9 +35,9 @@ namespace vcpkg::PortFileProvider
|
|||
virtual View<VersionT> get_port_versions(StringView port_name) const = 0;
|
||||
virtual ~IVersionedPortfileProvider() = default;
|
||||
|
||||
virtual ExpectedS<const SourceControlFileLocation&> get_control_file(
|
||||
virtual ExpectedS<const SourceControlFileAndLocation&> get_control_file(
|
||||
const Versions::VersionSpec& version_spec) const = 0;
|
||||
virtual void load_all_control_files(std::map<std::string, const SourceControlFileLocation*>& out) const = 0;
|
||||
virtual void load_all_control_files(std::map<std::string, const SourceControlFileAndLocation*>& out) const = 0;
|
||||
};
|
||||
|
||||
struct IBaselineProvider
|
||||
|
@ -49,8 +49,8 @@ namespace vcpkg::PortFileProvider
|
|||
struct IOverlayProvider
|
||||
{
|
||||
virtual ~IOverlayProvider() = default;
|
||||
virtual Optional<const SourceControlFileLocation&> get_control_file(StringView port_name) const = 0;
|
||||
virtual void load_all_control_files(std::map<std::string, const SourceControlFileLocation*>& out) const = 0;
|
||||
virtual Optional<const SourceControlFileAndLocation&> get_control_file(StringView port_name) const = 0;
|
||||
virtual void load_all_control_files(std::map<std::string, const SourceControlFileAndLocation*>& out) const = 0;
|
||||
};
|
||||
|
||||
struct PathsPortFileProvider : PortFileProvider
|
||||
|
@ -58,8 +58,8 @@ namespace vcpkg::PortFileProvider
|
|||
explicit PathsPortFileProvider(const vcpkg::VcpkgPaths& paths, const std::vector<std::string>& overlay_ports);
|
||||
PathsPortFileProvider(const PathsPortFileProvider&) = delete;
|
||||
PathsPortFileProvider& operator=(const PathsPortFileProvider&) = delete;
|
||||
ExpectedS<const SourceControlFileLocation&> get_control_file(const std::string& src_name) const override;
|
||||
std::vector<const SourceControlFileLocation*> load_all_control_files() const override;
|
||||
ExpectedS<const SourceControlFileAndLocation&> get_control_file(const std::string& src_name) const override;
|
||||
std::vector<const SourceControlFileAndLocation*> load_all_control_files() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<IBaselineProvider> m_baseline;
|
||||
|
|
|
@ -126,16 +126,10 @@ namespace vcpkg
|
|||
Json::Object serialize_debug_manifest(const SourceControlFile& scf);
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
struct SourceControlFileLocation
|
||||
struct SourceControlFileAndLocation
|
||||
{
|
||||
SourceControlFileLocation clone() const
|
||||
{
|
||||
return {std::make_unique<SourceControlFile>(source_control_file->clone()), source_location};
|
||||
}
|
||||
|
||||
VersionT to_versiont() const { return source_control_file->to_versiont(); }
|
||||
|
||||
std::unique_ptr<SourceControlFile> source_control_file;
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -36,16 +36,16 @@ struct MockBaselineProvider : PortFileProvider::IBaselineProvider
|
|||
|
||||
struct MockVersionedPortfileProvider : PortFileProvider::IVersionedPortfileProvider
|
||||
{
|
||||
mutable std::map<std::string, std::map<Versions::Version, SourceControlFileLocation, VersionTMapLess>> v;
|
||||
mutable std::map<std::string, std::map<Versions::Version, SourceControlFileAndLocation, VersionTMapLess>> v;
|
||||
|
||||
ExpectedS<const SourceControlFileLocation&> get_control_file(
|
||||
ExpectedS<const SourceControlFileAndLocation&> get_control_file(
|
||||
const vcpkg::Versions::VersionSpec& versionspec) const override
|
||||
{
|
||||
return get_control_file(versionspec.port_name, versionspec.version);
|
||||
}
|
||||
|
||||
ExpectedS<const SourceControlFileLocation&> get_control_file(const std::string& name,
|
||||
const vcpkg::Versions::Version& version) const
|
||||
ExpectedS<const SourceControlFileAndLocation&> 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<vcpkg::VersionT> 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<Versions::Version, SourceControlFileLocation, VersionTMapLess>{}).first;
|
||||
it = v.emplace(name, std::map<Versions::Version, SourceControlFileAndLocation, VersionTMapLess>{}).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<std::string, const SourceControlFileLocation*>&) const override
|
||||
virtual void load_all_control_files(std::map<std::string, const SourceControlFileAndLocation*>&) const override
|
||||
{
|
||||
Checks::unreachable(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ static void check_name_and_version(const Dependencies::InstallPlanAction& ipa,
|
|||
std::initializer_list<StringLiteral> 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<const SourceControlFileLocation&> get_control_file(StringView name) const override
|
||||
virtual Optional<const SourceControlFileAndLocation&> 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<std::string, const SourceControlFileLocation*>&) const override
|
||||
virtual void load_all_control_files(std::map<std::string, const SourceControlFileAndLocation*>&) const override
|
||||
{
|
||||
Checks::unreachable(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
private:
|
||||
std::map<std::string, SourceControlFileLocation, std::less<>> mappings;
|
||||
std::map<std::string, SourceControlFileAndLocation, std::less<>> mappings;
|
||||
};
|
||||
|
||||
static const MockOverlayProvider s_empty_mock_overlay;
|
||||
|
|
|
@ -22,9 +22,9 @@ TEST_CASE ("find outdated packages basic", "[update]")
|
|||
|
||||
StatusParagraphs status_db(std::move(status_paragraphs));
|
||||
|
||||
std::unordered_map<std::string, SourceControlFileLocation> map;
|
||||
std::unordered_map<std::string, SourceControlFileAndLocation> 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<OutdatedPackage>(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<std::string, SourceControlFileLocation> map;
|
||||
std::unordered_map<std::string, SourceControlFileAndLocation> 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<OutdatedPackage>(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<std::string, SourceControlFileLocation> map;
|
||||
std::unordered_map<std::string, SourceControlFileAndLocation> 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<OutdatedPackage>(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<std::string, SourceControlFileLocation> map;
|
||||
std::unordered_map<std::string, SourceControlFileAndLocation> 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<OutdatedPackage>(Update::find_outdated_packages(provider, status_db),
|
||||
|
|
|
@ -79,11 +79,11 @@ namespace vcpkg::Test
|
|||
const std::vector<std::pair<const char*, const char*>>& features,
|
||||
const std::vector<const char*>& 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());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<FeatureSpec> missing_fspecs;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -279,8 +279,8 @@ namespace vcpkg::Commands::DependInfo
|
|||
{
|
||||
const std::vector<const SourceControlFile*> 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<const SourceControlFile*>(scfl.source_control_file.get());
|
||||
});
|
||||
|
||||
|
|
|
@ -51,12 +51,12 @@ namespace vcpkg::Dependencies
|
|||
/// </summary>
|
||||
struct Cluster
|
||||
{
|
||||
Cluster(const InstalledPackageView& ipv, ExpectedS<const SourceControlFileLocation&>&& scfl)
|
||||
Cluster(const InstalledPackageView& ipv, ExpectedS<const SourceControlFileAndLocation&>&& 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<const SourceControlFileLocation&> m_scfl;
|
||||
ExpectedS<const SourceControlFileAndLocation&> m_scfl;
|
||||
|
||||
Optional<ClusterInstalled> m_installed;
|
||||
Optional<ClusterInstallInfo> 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<const SourceControlFileLocation&> maybe_scfl =
|
||||
ExpectedS<const SourceControlFileAndLocation&> 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<std::string, std::vector<FeatureSpec>>&& 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<std::string> 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<std::string> origins;
|
||||
|
@ -1621,7 +1621,7 @@ namespace vcpkg::Dependencies
|
|||
const Versions::Version& version,
|
||||
const std::string& origin)
|
||||
{
|
||||
ExpectedS<const vcpkg::SourceControlFileLocation&> maybe_scfl;
|
||||
ExpectedS<const vcpkg::SourceControlFileAndLocation&> 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();
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
":",
|
||||
|
|
|
@ -494,14 +494,14 @@ namespace vcpkg::Paragraphs
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<SourceControlFileLocation> load_all_registry_ports(const VcpkgPaths& paths)
|
||||
std::vector<SourceControlFileAndLocation> 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<SourceControlFileLocation> load_overlay_ports(const Filesystem& fs, const Path& directory)
|
||||
std::vector<SourceControlFileAndLocation> load_overlay_ports(const Filesystem& fs, const Path& directory)
|
||||
{
|
||||
LoadResults ret;
|
||||
|
||||
|
|
|
@ -41,21 +41,21 @@ namespace
|
|||
|
||||
namespace vcpkg::PortFileProvider
|
||||
{
|
||||
MapPortFileProvider::MapPortFileProvider(const std::unordered_map<std::string, SourceControlFileLocation>& map)
|
||||
MapPortFileProvider::MapPortFileProvider(const std::unordered_map<std::string, SourceControlFileAndLocation>& map)
|
||||
: ports(map)
|
||||
{
|
||||
}
|
||||
|
||||
ExpectedS<const SourceControlFileLocation&> MapPortFileProvider::get_control_file(const std::string& spec) const
|
||||
ExpectedS<const SourceControlFileAndLocation&> 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<const SourceControlFileLocation*> MapPortFileProvider::load_all_control_files() const
|
||||
std::vector<const SourceControlFileAndLocation*> 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<std::string>& overlay_ports)
|
||||
|
@ -65,7 +65,8 @@ namespace vcpkg::PortFileProvider
|
|||
{
|
||||
}
|
||||
|
||||
ExpectedS<const SourceControlFileLocation&> PathsPortFileProvider::get_control_file(const std::string& spec) const
|
||||
ExpectedS<const SourceControlFileAndLocation&> 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<const SourceControlFileLocation*> PathsPortFileProvider::load_all_control_files() const
|
||||
std::vector<const SourceControlFileAndLocation*> PathsPortFileProvider::load_all_control_files() const
|
||||
{
|
||||
std::map<std::string, const SourceControlFileLocation*> m;
|
||||
std::map<std::string, const SourceControlFileAndLocation*> 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<std::unique_ptr<SourceControlFileLocation>> load_control_file(
|
||||
ExpectedS<std::unique_ptr<SourceControlFileAndLocation>> 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<SourceControlFileLocation>(
|
||||
new SourceControlFileLocation{std::move(*scf), std::move(*path)});
|
||||
return std::unique_ptr<SourceControlFileAndLocation>(
|
||||
new SourceControlFileAndLocation{std::move(*scf), std::move(*path)});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -206,7 +207,7 @@ namespace vcpkg::PortFileProvider
|
|||
return maybe_ent.error();
|
||||
}
|
||||
|
||||
virtual ExpectedS<const SourceControlFileLocation&> get_control_file(
|
||||
virtual ExpectedS<const SourceControlFileAndLocation&> 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<std::string, const SourceControlFileLocation*>& out) const override
|
||||
std::map<std::string, const SourceControlFileAndLocation*>& 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<SourceControlFileLocation>(std::move(scfl)))
|
||||
std::make_unique<SourceControlFileAndLocation>(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<VersionSpec, ExpectedS<std::unique_ptr<SourceControlFileLocation>>, VersionSpecHasher>
|
||||
unordered_map<VersionSpec, ExpectedS<std::unique_ptr<SourceControlFileAndLocation>>, VersionSpecHasher>
|
||||
m_control_cache;
|
||||
mutable std::map<std::string, ExpectedS<std::unique_ptr<RegistryEntry>>, std::less<>> m_entry_cache;
|
||||
};
|
||||
|
@ -263,7 +264,7 @@ namespace vcpkg::PortFileProvider
|
|||
OverlayProviderImpl(const OverlayProviderImpl&) = delete;
|
||||
OverlayProviderImpl& operator=(const OverlayProviderImpl&) = delete;
|
||||
|
||||
Optional<SourceControlFileLocation> load_port(StringView port_name) const
|
||||
Optional<SourceControlFileAndLocation> 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<const SourceControlFileLocation&> get_control_file(StringView port_name) const override
|
||||
virtual Optional<const SourceControlFileAndLocation&> 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<std::string, const SourceControlFileLocation*>& out) const override
|
||||
std::map<std::string, const SourceControlFileAndLocation*>& 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<Path> m_overlay_ports;
|
||||
mutable std::map<std::string, Optional<SourceControlFileLocation>, std::less<>> m_overlay_cache;
|
||||
mutable std::map<std::string, Optional<SourceControlFileAndLocation>, std::less<>> m_overlay_cache;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче