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.
This commit is contained in:
Billy O'Neal 2020-12-04 14:01:11 -08:00 committed by GitHub
parent 60aa143e59
commit 8b0b2671ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 6 deletions

View File

@ -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

View File

@ -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)

View File

@ -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();

View File

@ -5,14 +5,15 @@
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) { }