Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/vcpkg/base/message-args.inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ DECLARE_MSG_ARG(version, "1.3.8")
DECLARE_MSG_ARG(package_name, "zlib")
DECLARE_MSG_ARG(spec, "zlib:x64-windows")
DECLARE_MSG_ARG(feature_spec, "zlib[featurea,featureb]")
DECLARE_MSG_ARG(version_spec, "zlib:x64-windows@1.0.0")
DECLARE_MSG_ARG(constraint_origin, "zlib:x64-windows@1.0.0")
37 changes: 16 additions & 21 deletions include/vcpkg/base/message-data.inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2339,8 +2339,7 @@ DECLARE_MESSAGE(UndeterminedToolChainForTriplet,
(msg::triplet, msg::system_name),
"",
"Unable to determine toolchain use for {triplet} with with CMAKE_SYSTEM_NAME {system_name}. Did "
"you mean to use "
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE?")
"you mean to use VCPKG_CHAINLOAD_TOOLCHAIN_FILE?")
DECLARE_MESSAGE(UnexpectedArgument,
(msg::option),
"Argument is literally what the user passed on the command line.",
Expand Down Expand Up @@ -2655,16 +2654,21 @@ DECLARE_MESSAGE(VersionGitEntryMissing,
"A list of versions, 1 per line, are printed after this message.",
"no version database entry for {package_name} at {version}.\nAvailable versions:")
DECLARE_MESSAGE(VersionIncomparable1,
(msg::spec, msg::package_name, msg::expected, msg::actual),
(msg::spec, msg::constraint_origin, msg::expected, msg::actual),
"{expected} and {actual} are versions like 1.0",
"version conflict on {spec}: {package_name} required {expected} but vcpkg could not compare it to "
"{actual}.\nThe two versions used incomparable schemes:")
DECLARE_MESSAGE(VersionIncomparable2, (msg::version, msg::new_scheme), "", "\"{version}\" was of scheme {new_scheme}")
"version conflict on {spec}: {constraint_origin} required {expected}, which cannot be compared with "
"the baseline version {actual}.")
DECLARE_MESSAGE(VersionIncomparableSchemeString, (), "", "Both versions have scheme string but different primary text.")
DECLARE_MESSAGE(VersionIncomparableSchemes, (), "", "The versions have incomparable schemes:")
DECLARE_MESSAGE(VersionIncomparable2,
(msg::version_spec, msg::new_scheme),
"",
"{version_spec} has scheme {new_scheme}")
DECLARE_MESSAGE(VersionIncomparable3,
(),
"This precedes a JSON document describing the fix",
"This can be resolved by adding an explicit override to the preferred version, for example:")
DECLARE_MESSAGE(VersionIncomparable4, (), "", "See `vcpkg help versioning` for more information.")
"This can be resolved by adding an explicit override to the preferred version. For example:")
DECLARE_MESSAGE(VersionIncomparable4, (msg::url), "", "See `vcpkg help versioning` or {url} for more information.")
DECLARE_MESSAGE(VersionInDeclarationDoesNotMatch,
(msg::version),
"",
Expand All @@ -2689,23 +2693,17 @@ DECLARE_MESSAGE(
"The names version, version-date, version-semver, and version-string are code and must not be localized",
"expected a versioning field (one of version, version-date, version-semver, or version-string)")
DECLARE_MESSAGE(VersionMissingRequiredFeature,
(msg::spec, msg::version, msg::feature),
(msg::version_spec, msg::feature, msg::constraint_origin),
"",
"{spec}@{version} does not have required feature {feature}")
"{version_spec} does not have required feature {feature} needed by {constraint_origin}")
DECLARE_MESSAGE(VersionNotFound,
(msg::expected, msg::actual),
"{expected} and {actual} are versions",
"{expected} not available, only {actual} is available")
DECLARE_MESSAGE(
VersionNotFoundDuringDiscovery,
(msg::spec, msg::version),
"",
"version was not found during discovery: {spec}@{version}\nThis is an internal vcpkg error. Please open "
"an issue on https://github.com/Microsoft/vcpkg with detailed steps to reproduce the problem.")
DECLARE_MESSAGE(VersionNotFoundInVersionsFile,
(msg::version, msg::package_name),
"",
"Version {version} was not found in versions file.\n"
"Version {version} was not found in versions file for {package_name}.\n"
"Run:\n"
"vcpkg x-add-version {package_name}\n"
"to add the new port version.")
Expand Down Expand Up @@ -2763,10 +2761,7 @@ DECLARE_MESSAGE(VersionSpecMismatch,
"Failed to load port because versions are inconsistent. The file \"{path}\" contains the version "
"{actual_version}, but the version database indicates that it should be {expected_version}.")
DECLARE_MESSAGE(VersionTableHeader, (), "", "Version")
DECLARE_MESSAGE(VersionVerifiedOK,
(msg::package_name, msg::version, msg::commit_sha),
"",
"OK: {package_name}@{version} -> {commit_sha}")
DECLARE_MESSAGE(VersionVerifiedOK, (msg::version_spec, msg::commit_sha), "", "OK: {version_spec} -> {commit_sha}")
DECLARE_MESSAGE(VSExaminedInstances, (), "", "The following Visual Studio instances were considered:")
DECLARE_MESSAGE(VSExaminedPaths, (), "", "The following paths were examined for Visual Studio instances:")
DECLARE_MESSAGE(VSNoInstances, (), "", "Could not locate a complete Visual Studio instance")
Expand Down
2 changes: 2 additions & 0 deletions include/vcpkg/base/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ namespace vcpkg::Strings

[[nodiscard]] std::vector<std::string> split(StringView s, const char delimiter);

[[nodiscard]] std::vector<std::string> split_keep_empty(StringView s, const char delimiter);

[[nodiscard]] std::vector<std::string> split_paths(StringView s);

const char* find_first_of(StringView searched, StringView candidates);
Expand Down
11 changes: 5 additions & 6 deletions include/vcpkg/base/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
namespace vcpkg::Util
{
template<class Container>
using ElementT =
std::remove_reference_t<decltype(*std::declval<typename std::remove_reference_t<Container>::iterator>())>;
using ElementT = std::decay_t<decltype(*std::declval<Container&>().begin())>;

namespace Vectors
{
template<class Container, class T = ElementT<Container>>
template<class Container, class T>
void append(std::vector<T>* augend, const Container& addend)
{
augend->insert(augend->end(), addend.begin(), addend.end());
Expand Down Expand Up @@ -107,10 +106,10 @@ namespace vcpkg::Util
}
}

template<class Range, class Pred, class E = ElementT<Range>>
std::vector<E> filter(const Range& xs, Pred&& f)
template<class Range, class Pred>
std::vector<ElementT<const Range&>> filter(const Range& xs, Pred f)
{
std::vector<E> ret;
std::vector<ElementT<const Range&>> ret;

for (auto&& x : xs)
{
Expand Down
14 changes: 6 additions & 8 deletions include/vcpkg/cmakevars.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@

namespace vcpkg::CMakeVars
{
using CMakeVars = std::unordered_map<std::string, std::string>;

struct CMakeVarProvider
{
virtual ~CMakeVarProvider() = default;

virtual Optional<const std::unordered_map<std::string, std::string>&> get_generic_triplet_vars(
Triplet triplet) const = 0;
virtual Optional<const CMakeVars&> get_generic_triplet_vars(Triplet triplet) const = 0;

virtual Optional<const std::unordered_map<std::string, std::string>&> get_dep_info_vars(
const PackageSpec& spec) const = 0;
virtual Optional<const CMakeVars&> get_dep_info_vars(const PackageSpec& spec) const = 0;

const std::unordered_map<std::string, std::string>& get_or_load_dep_info_vars(const PackageSpec& spec,
Triplet host_triplet) const;
const CMakeVars& get_or_load_dep_info_vars(const PackageSpec& spec, Triplet host_triplet) const;

virtual Optional<const std::unordered_map<std::string, std::string>&> get_tag_vars(
const PackageSpec& spec) const = 0;
virtual Optional<const CMakeVars&> get_tag_vars(const PackageSpec& spec) const = 0;

virtual void load_generic_triplet_vars(Triplet triplet) const = 0;

Expand Down
2 changes: 2 additions & 0 deletions include/vcpkg/sourceparagraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ namespace vcpkg
struct SourceControlFileAndLocation
{
Version to_version() const { return source_control_file->to_version(); }
VersionScheme scheme() const { return source_control_file->core_paragraph->version_scheme; }
SchemedVersion schemed_version() const { return {scheme(), to_version()}; }

std::unique_ptr<SourceControlFile> source_control_file;
Path source_location;
Expand Down
1 change: 1 addition & 0 deletions include/vcpkg/versions.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ namespace vcpkg
// Try parsing with all version schemas and return 'unk' if none match
VerComp compare_any(const Version& a, const Version& b);

VerComp compare_versions(const SchemedVersion& a, const SchemedVersion& b);
VerComp compare_versions(VersionScheme sa, const Version& a, VersionScheme sb, const Version& b);

enum class VersionConstraintKind
Expand Down
27 changes: 14 additions & 13 deletions locales/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1475,13 +1475,16 @@
"_VersionGitEntryMissing.comment": "A list of versions, 1 per line, are printed after this message. An example of {package_name} is zlib. An example of {version} is 1.3.8.",
"VersionInDeclarationDoesNotMatch": "The version declared in file does not match checked-out version: {version}",
"_VersionInDeclarationDoesNotMatch.comment": "An example of {version} is 1.3.8.",
"VersionIncomparable1": "version conflict on {spec}: {package_name} required {expected} but vcpkg could not compare it to {actual}.\nThe two versions used incomparable schemes:",
"_VersionIncomparable1.comment": "{expected} and {actual} are versions like 1.0 An example of {spec} is zlib:x64-windows. An example of {package_name} is zlib.",
"VersionIncomparable2": "\"{version}\" was of scheme {new_scheme}",
"_VersionIncomparable2.comment": "An example of {version} is 1.3.8. An example of {new_scheme} is version.",
"VersionIncomparable3": "This can be resolved by adding an explicit override to the preferred version, for example:",
"VersionIncomparable1": "version conflict on {spec}: {constraint_origin} required {expected}, which cannot be compared with the baseline version {actual}.",
"_VersionIncomparable1.comment": "{expected} and {actual} are versions like 1.0 An example of {spec} is zlib:x64-windows. An example of {constraint_origin} is zlib:x64-windows@1.0.0.",
"VersionIncomparable2": "{version_spec} has scheme {new_scheme}",
"_VersionIncomparable2.comment": "An example of {version_spec} is zlib:x64-windows@1.0.0. An example of {new_scheme} is version.",
"VersionIncomparable3": "This can be resolved by adding an explicit override to the preferred version. For example:",
"_VersionIncomparable3.comment": "This precedes a JSON document describing the fix",
"VersionIncomparable4": "See `vcpkg help versioning` for more information.",
"VersionIncomparable4": "See `vcpkg help versioning` or {url} for more information.",
"_VersionIncomparable4.comment": "An example of {url} is https://github.com/microsoft/vcpkg.",
"VersionIncomparableSchemeString": "Both versions have scheme string but different primary text.",
"VersionIncomparableSchemes": "The versions have incomparable schemes:",
"VersionInvalidDate": "`{version}` is not a valid date version. Dates must follow the format YYYY-MM-DD and disambiguators must be dot-separated positive integer values without leading zeroes.",
"_VersionInvalidDate.comment": "An example of {version} is 1.3.8.",
"VersionInvalidRelaxed": "`{version}` is not a valid relaxed version (semver with arbitrary numeric element count).",
Expand All @@ -1490,13 +1493,11 @@
"_VersionInvalidSemver.comment": "An example of {version} is 1.3.8.",
"VersionMissing": "expected a versioning field (one of version, version-date, version-semver, or version-string)",
"_VersionMissing.comment": "The names version, version-date, version-semver, and version-string are code and must not be localized",
"VersionMissingRequiredFeature": "{spec}@{version} does not have required feature {feature}",
"_VersionMissingRequiredFeature.comment": "An example of {spec} is zlib:x64-windows. An example of {version} is 1.3.8. An example of {feature} is avisynthplus.",
"VersionMissingRequiredFeature": "{version_spec} does not have required feature {feature} needed by {constraint_origin}",
"_VersionMissingRequiredFeature.comment": "An example of {version_spec} is zlib:x64-windows@1.0.0. An example of {feature} is avisynthplus. An example of {constraint_origin} is zlib:x64-windows@1.0.0.",
"VersionNotFound": "{expected} not available, only {actual} is available",
"_VersionNotFound.comment": "{expected} and {actual} are versions",
"VersionNotFoundDuringDiscovery": "version was not found during discovery: {spec}@{version}\nThis is an internal vcpkg error. Please open an issue on https://github.com/Microsoft/vcpkg with detailed steps to reproduce the problem.",
"_VersionNotFoundDuringDiscovery.comment": "An example of {spec} is zlib:x64-windows. An example of {version} is 1.3.8.",
"VersionNotFoundInVersionsFile": "Version {version} was not found in versions file.\nRun:\nvcpkg x-add-version {package_name}\nto add the new port version.",
"VersionNotFoundInVersionsFile": "Version {version} was not found in versions file for {package_name}.\nRun:\nvcpkg x-add-version {package_name}\nto add the new port version.",
"_VersionNotFoundInVersionsFile.comment": "An example of {version} is 1.3.8. An example of {package_name} is zlib.",
"VersionRejectedDueToBaselineMissing": "{path} was rejected because it uses \"{json_field}\" and does not have a \"builtin-baseline\". This can be fixed by removing the uses of \"{json_field}\" or adding a \"builtin-baseline\".\nSee `vcpkg help versioning` for more information.",
"_VersionRejectedDueToBaselineMissing.comment": "An example of {path} is /foo/bar. An example of {json_field} is identifer.",
Expand All @@ -1513,8 +1514,8 @@
"VersionSpecMismatch": "Failed to load port because versions are inconsistent. The file \"{path}\" contains the version {actual_version}, but the version database indicates that it should be {expected_version}.",
"_VersionSpecMismatch.comment": "An example of {path} is /foo/bar. An example of {expected_version} is 1.3.8. An example of {actual_version} is 1.3.8.",
"VersionTableHeader": "Version",
"VersionVerifiedOK": "OK: {package_name}@{version} -> {commit_sha}",
"_VersionVerifiedOK.comment": "An example of {package_name} is zlib. An example of {version} is 1.3.8. An example of {commit_sha} is 7cfad47ae9f68b183983090afd6337cd60fd4949.",
"VersionVerifiedOK": "OK: {version_spec} -> {commit_sha}",
"_VersionVerifiedOK.comment": "An example of {version_spec} is zlib:x64-windows@1.0.0. An example of {commit_sha} is 7cfad47ae9f68b183983090afd6337cd60fd4949.",
"WaitingForChildrenToExit": "Waiting for child processes to exit...",
"WaitingToTakeFilesystemLock": "waiting to take filesystem lock on {path}...",
"_WaitingToTakeFilesystemLock.comment": "An example of {path} is /foo/bar.",
Expand Down
Loading