Fix failures when parsing the default options for binary caching not being emitted.
* Fix failures when parsing the default options for binary caching not beging emitted.
Resolves
MODIFY
include/vcpkg/base/parse.h
include/vcpkg/base/parse.h
@@ -16,6 +16,7 @@ namespace vcpkg::Parse
{
virtual ~IParseError() = default;
virtual std::string format() const = 0;
+ virtual const std::string& get_message() const = 0;
};
struct ParseError : IParseError
@@ -38,6 +39,7 @@ namespace vcpkg::Parse
const std::string message;
virtual std::string format() const override;
+ virtual const std::string& get_message() const override;
};
struct ParserBase

MODIFY
src/vcpkg/base/parse.cpp
src/vcpkg/base/parse.cpp
@@ -50,6 +50,8 @@ namespace vcpkg::Parse
"^\n");
}
+ const std::string& ParseError::get_message() const { return this->message; }
+
ParserBase::ParserBase(StringView text, StringView origin, TextRowCol init_rowcol)
: m_it(text.begin(), text.end())
, m_start_of_line(m_it)

MODIFY
src/vcpkg/binarycaching.cpp
src/vcpkg/binarycaching.cpp
@@ -1131,6 +1131,7 @@ ExpectedS<std::unique_ptr<IBinaryProvider>> vcpkg::create_binary_provider_from_c
BinaryConfigParser default_parser("default,readwrite", "<defaults>", &s);
default_parser.parse();
+ if (auto err = default_parser.get_error()) return err->get_message();
BinaryConfigParser env_parser(env_string, "VCPKG_BINARY_SOURCES", &s);
env_parser.parse();

MODIFY
src/vcpkg/versiondeserializers.cpp
src/vcpkg/versiondeserializers.cpp
using namespace vcpkg;
using namespace vcpkg::Versions;
-static constexpr StringLiteral VERSION_RELAXED = "version";
-static constexpr StringLiteral VERSION_SEMVER = "version-semver";
-static constexpr StringLiteral VERSION_STRING = "version-string";
-static constexpr StringLiteral VERSION_DATE = "version-date";
-static constexpr StringLiteral PORT_VERSION = "port-version";
-
namespace
{
+ constexpr StringLiteral VERSION_RELAXED = "version";
+ constexpr StringLiteral VERSION_SEMVER = "version-semver";
+ constexpr StringLiteral VERSION_STRING = "version-string";
+ constexpr StringLiteral VERSION_DATE = "version-date";
+ constexpr StringLiteral PORT_VERSION = "port-version";
+ constexpr StringLiteral GIT_TREE = "git-tree";
+
struct VersionDeserializer final : Json::IDeserializer<std::string>
{
VersionDeserializer(StringLiteral type) : m_type(type) { }

Fix failures when parsing the default options for binary caching not being emitted. (#14945)

* Fix failures when parsing the default options for binary caching not beging emitted.

Resolves #14922.