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

Make jsoncpp a formal dependency #10739

Merged
merged 6 commits into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
path = third_party/abseil-cpp
url = https://github.com/abseil/abseil-cpp.git
branch = lts_2022_06_23
[submodule "third_party/jsoncpp"]
path = third_party/jsoncpp
url = https://github.com/open-source-parsers/jsoncpp.git
16 changes: 14 additions & 2 deletions cmake/conformance.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@

if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/jsoncpp/CMakeLists.txt")
message(FATAL_ERROR
"Cannot find third_party/jsoncpp directory that's needed to "
"build conformance tests. If you use git, make sure you have cloned "
"submodules:\n"
" git submodule update --init --recursive\n"
"If instead you want to skip them, run cmake with:\n"
" cmake -Dprotobuf_BUILD_CONFORMANCE=OFF\n")
endif()

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/jsoncpp third_party/jsoncpp)

add_custom_command(
OUTPUT
${protobuf_SOURCE_DIR}/conformance/conformance.pb.h
Expand Down Expand Up @@ -33,8 +45,6 @@ add_executable(conformance_test_runner
${protobuf_SOURCE_DIR}/conformance/conformance_test_main.cc
${protobuf_SOURCE_DIR}/conformance/text_format_conformance_suite.cc
${protobuf_SOURCE_DIR}/conformance/text_format_conformance_suite.h
${protobuf_SOURCE_DIR}/conformance/third_party/jsoncpp/json.h
${protobuf_SOURCE_DIR}/conformance/third_party/jsoncpp/jsoncpp.cpp
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.h
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.h
Expand All @@ -59,9 +69,11 @@ target_include_directories(
conformance_cpp
PUBLIC ${protobuf_SOURCE_DIR})

target_include_directories(conformance_test_runner PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/jsoncpp/include)
target_include_directories(conformance_test_runner PRIVATE ${ABSL_ROOT_DIR})
target_include_directories(conformance_cpp PRIVATE ${ABSL_ROOT_DIR})

target_link_libraries(conformance_test_runner jsoncpp_lib)
target_link_libraries(conformance_test_runner ${protobuf_LIB_PROTOBUF})
target_link_libraries(conformance_test_runner ${protobuf_ABSL_USED_TARGETS})
target_link_libraries(conformance_cpp ${protobuf_LIB_PROTOBUF})
Expand Down
18 changes: 1 addition & 17 deletions conformance/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,6 @@ internal_ruby_proto_library(
],
)

cc_library(
name = "jsoncpp",
srcs = ["third_party/jsoncpp/jsoncpp.cpp"],
hdrs = ["third_party/jsoncpp/json.h"],
includes = ["."],
)

cc_library(
name = "conformance_test",
srcs = [
Expand All @@ -156,7 +149,7 @@ cc_library(
hdrs = ["binary_json_conformance_suite.h"],
deps = [
":conformance_test",
":jsoncpp",
"@jsoncpp//:jsoncpp",
":test_messages_proto2_proto_cc",
":test_messages_proto3_proto_cc",
"@com_google_absl//absl/status",
Expand Down Expand Up @@ -368,19 +361,10 @@ pkg_files(
visibility = ["//pkg:__pkg__"],
)

pkg_files(
name = "dist_scripts",
srcs = ["conformance_test_runner.sh"],
attributes = pkg_attributes(mode = "0555"),
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)

pkg_filegroup(
name = "all_dist_files",
srcs = [
":dist_files",
":dist_scripts",
],
visibility = ["//pkg:__pkg__"],
)
2 changes: 1 addition & 1 deletion conformance/binary_json_conformance_suite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "google/protobuf/util/type_resolver_util.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "third_party/jsoncpp/json.h"
#include "json/json.h"
#include "conformance/conformance.pb.h"
#include "conformance_test.h"
#include "google/protobuf/test_messages_proto2.pb.h"
Expand Down
2 changes: 1 addition & 1 deletion conformance/binary_json_conformance_suite.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H

#include "google/protobuf/descriptor.h"
#include "third_party/jsoncpp/json.h"
#include "json/json.h"
#include "conformance_test.h"

namespace google {
Expand Down
Loading