aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilly O'Neal <bion@microsoft.com>2020-12-04 14:01:11 -0800
committerGitHub <noreply@github.com>2020-12-04 14:01:11 -0800
commit8b0b2671ce67a2425c66c47fff8117737abbb055 (patch)
tree16d0b9aceeb3c1c0c89e6717d4660775086dee46
parent60aa143e59687ed4b689d24d80a6f93ae123da86 (diff)
downloadvcpkg-8b0b2671ce67a2425c66c47fff8117737abbb055.tar.gz
vcpkg-8b0b2671ce67a2425c66c47fff8117737abbb055.zip
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.
-rw-r--r--toolsrc/include/vcpkg/base/parse.h2
-rw-r--r--toolsrc/src/vcpkg/base/parse.cpp2
-rw-r--r--toolsrc/src/vcpkg/binarycaching.cpp1
-rw-r--r--toolsrc/src/vcpkg/versiondeserializers.cpp13
4 files changed, 12 insertions, 6 deletions
diff --git a/toolsrc/include/vcpkg/base/parse.h b/toolsrc/include/vcpkg/base/parse.h
index cc5db02d3..b3577e821 100644
--- a/toolsrc/include/vcpkg/base/parse.h
+++ b/toolsrc/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
diff --git a/toolsrc/src/vcpkg/base/parse.cpp b/toolsrc/src/vcpkg/base/parse.cpp
index c6a7de83d..a082c4d9c 100644
--- a/toolsrc/src/vcpkg/base/parse.cpp
+++ b/toolsrc/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)
diff --git a/toolsrc/src/vcpkg/binarycaching.cpp b/toolsrc/src/vcpkg/binarycaching.cpp
index 8624cb3d3..3c471bd13 100644
--- a/toolsrc/src/vcpkg/binarycaching.cpp
+++ b/toolsrc/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();
diff --git a/toolsrc/src/vcpkg/versiondeserializers.cpp b/toolsrc/src/vcpkg/versiondeserializers.cpp
index 1557f4be9..5c57a9922 100644
--- a/toolsrc/src/vcpkg/versiondeserializers.cpp
+++ b/toolsrc/src/vcpkg/versiondeserializers.cpp
@@ -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) { }