Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: patch nlohmann/json #1904

Merged
merged 8 commits into from
Dec 23, 2021
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
10 changes: 6 additions & 4 deletions bazel/envoy_mobile_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ def upstream_envoy_overrides():
http_archive(
name = "com_github_nlohmann_json",
# 3.10.4 introduced incompatible changes with Envoy Mobile. Until Envoy Mobile updates it's
# minimum iOS version to 13+ this dependency cannot be updated.
sha256 = "081ed0f9f89805c2d96335c3acfa993b39a0a5b4b4cef7edb68dd2210a13458c",
strip_prefix = "json-3.10.2",
urls = ["https://github.com/nlohmann/json/archive/v3.10.2.tar.gz"],
# minimum iOS version to 13+ this dependency needs to be patched.
patches = ["@envoy_mobile//bazel:json.patch"],
patch_args = ["-p1"],
sha256 = "1155fd1a83049767360e9a120c43c578145db3204d2b309eba49fbbedd0f4ed3",
strip_prefix = "json-3.10.4",
urls = ["https://github.com/nlohmann/json/archive/v3.10.4.tar.gz"],
build_file = "@envoy//bazel/external:json.BUILD",
)

Expand Down
48 changes: 48 additions & 0 deletions bazel/json.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/include/nlohmann/detail/conversions/from_json.hpp b/include/nlohmann/detail/conversions/from_json.hpp
index 71e32aaf7..6a4575ecb 100644
--- a/include/nlohmann/detail/conversions/from_json.hpp
+++ b/include/nlohmann/detail/conversions/from_json.hpp
@@ -448,7 +448,7 @@ void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyE
}
}

-#ifdef JSON_HAS_CPP_17
+#if defined(JSON_HAS_CPP_17) && (defined(__APPLE__) && (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000))
template<typename BasicJsonType>
void from_json(const BasicJsonType& j, std::filesystem::path& p)
{
diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp
index 79fdb3233..6a4aa7ff3 100644
--- a/include/nlohmann/detail/conversions/to_json.hpp
+++ b/include/nlohmann/detail/conversions/to_json.hpp
@@ -391,7 +391,7 @@ void to_json(BasicJsonType& j, const T& t)
to_json_tuple_impl(j, t, make_index_sequence<std::tuple_size<T>::value> {});
}

-#ifdef JSON_HAS_CPP_17
+#if defined(JSON_HAS_CPP_17) && (defined(__APPLE__) && (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000))
template<typename BasicJsonType>
void to_json(BasicJsonType& j, const std::filesystem::path& p)
{
diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp
index 87475ab31..c999784a2 100644
--- a/single_include/nlohmann/json.hpp
+++ b/single_include/nlohmann/json.hpp
@@ -4379,7 +4379,7 @@ void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyE
}
}

-#ifdef JSON_HAS_CPP_17
+#if defined(JSON_HAS_CPP_17) && (defined(__APPLE__) && (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000))
template<typename BasicJsonType>
void from_json(const BasicJsonType& j, std::filesystem::path& p)
{
@@ -5002,7 +5002,7 @@ void to_json(BasicJsonType& j, const T& t)
to_json_tuple_impl(j, t, make_index_sequence<std::tuple_size<T>::value> {});
}

-#ifdef JSON_HAS_CPP_17
+#if defined(JSON_HAS_CPP_17) && (defined(__APPLE__) && (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000))
template<typename BasicJsonType>
void to_json(BasicJsonType& j, const std::filesystem::path& p)
{