Sync from Piper @acozzette/proto_github_202203101748
PROTOBUF_SYNC_PIPER
diff --git a/cmake/tests.cmake b/cmake/tests.cmake
index 0b0e1be..c92b07e 100644
--- a/cmake/tests.cmake
+++ b/cmake/tests.cmake
@@ -7,7 +7,7 @@
if (protobuf_USE_EXTERNAL_GTEST)
find_package(GTest REQUIRED)
else()
- if (NOT EXISTS "${PROJECT_SOURCE_DIR}/../third_party/googletest/CMakeLists.txt")
+ if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/googletest/CMakeLists.txt")
message(FATAL_ERROR
"Cannot find third_party/googletest directory that's needed to "
"build tests. If you use git, make sure you have cloned submodules:\n"
@@ -16,8 +16,8 @@
" cmake -Dprotobuf_BUILD_TESTS=OFF\n")
endif()
- set(googlemock_source_dir "${protobuf_source_dir}/third_party/googletest/googlemock")
- set(googletest_source_dir "${protobuf_source_dir}/third_party/googletest/googletest")
+ set(googlemock_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googlemock")
+ set(googletest_source_dir "${protobuf_SOURCE_DIR}/third_party/googletest/googletest")
include_directories(
${googlemock_source_dir}
${googletest_source_dir}
@@ -95,11 +95,11 @@
get_filename_component(dirname ${filename} PATH)
get_filename_component(basename ${filename} NAME_WE)
add_custom_command(
- OUTPUT ${protobuf_source_dir}/src/${dirname}/${basename}.pb.cc
- DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/${dirname}/${basename}.proto
- COMMAND ${protobuf_PROTOC_EXE} ${protobuf_source_dir}/src/${dirname}/${basename}.proto
- --proto_path=${protobuf_source_dir}/src
- --cpp_out=${protobuf_source_dir}/src
+ OUTPUT ${protobuf_SOURCE_DIR}/src/${dirname}/${basename}.pb.cc
+ DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/${dirname}/${basename}.proto
+ COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/${dirname}/${basename}.proto
+ --proto_path=${protobuf_SOURCE_DIR}/src
+ --cpp_out=${protobuf_SOURCE_DIR}/src
--experimental_allow_proto3_optional
)
endmacro(compile_proto_file)
@@ -109,7 +109,7 @@
compile_proto_file(${proto_file})
string(REPLACE .proto .pb.cc pb_file ${proto_file})
set(lite_test_proto_files ${lite_test_proto_files}
- ${protobuf_source_dir}/src/${pb_file})
+ ${protobuf_SOURCE_DIR}/src/${pb_file})
endforeach(proto_file)
set(tests_proto_files)
@@ -117,104 +117,104 @@
compile_proto_file(${proto_file})
string(REPLACE .proto .pb.cc pb_file ${proto_file})
set(tests_proto_files ${tests_proto_files}
- ${protobuf_source_dir}/src/${pb_file})
+ ${protobuf_SOURCE_DIR}/src/${pb_file})
endforeach(proto_file)
set(common_lite_test_files
- ${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc
- ${protobuf_source_dir}/src/google/protobuf/map_lite_test_util.cc
- ${protobuf_source_dir}/src/google/protobuf/test_util_lite.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_test_util.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/map_lite_test_util.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/test_util_lite.cc
)
set(common_test_files
${common_lite_test_files}
- ${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
- ${protobuf_source_dir}/src/google/protobuf/map_test_util.inc
- ${protobuf_source_dir}/src/google/protobuf/reflection_tester.cc
- ${protobuf_source_dir}/src/google/protobuf/test_util.cc
- ${protobuf_source_dir}/src/google/protobuf/testing/file.cc
- ${protobuf_source_dir}/src/google/protobuf/testing/googletest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/map_test_util.inc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_tester.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/test_util.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/googletest.cc
)
set(tests_files
- ${protobuf_source_dir}/src/google/protobuf/any_test.cc
- ${protobuf_source_dir}/src/google/protobuf/arena_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/arenastring_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/arenaz_sampler_test.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.h
- ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.inc
- ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/metadata_test.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/importer_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_plugin_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/parser_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_plugin_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/descriptor_database_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/descriptor_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/drop_unknown_fields_test.cc
- ${protobuf_source_dir}/src/google/protobuf/dynamic_message_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/extension_set_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_lite_test.cc
- ${protobuf_source_dir}/src/google/protobuf/inlined_string_field_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/io/coded_stream_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/io/io_win32_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/io/printer_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/io/tokenizer_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/map_field_test.cc
- ${protobuf_source_dir}/src/google/protobuf/map_test.cc
- ${protobuf_source_dir}/src/google/protobuf/map_test.inc
- ${protobuf_source_dir}/src/google/protobuf/message_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/message_unittest.inc
- ${protobuf_source_dir}/src/google/protobuf/no_field_presence_test.cc
- ${protobuf_source_dir}/src/google/protobuf/preserve_unknown_enum_test.cc
- ${protobuf_source_dir}/src/google/protobuf/proto3_arena_lite_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/proto3_arena_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/proto3_lite_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/proto3_lite_unittest.inc
- ${protobuf_source_dir}/src/google/protobuf/reflection_ops_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/repeated_field_reflection_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/repeated_field_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/stubs/common_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/stubs/int128_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/stubs/status_test.cc
- ${protobuf_source_dir}/src/google/protobuf/stubs/statusor_test.cc
- ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/stubs/structurally_valid_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/stubs/strutil_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/stubs/template_util_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/stubs/time_test.cc
- ${protobuf_source_dir}/src/google/protobuf/text_format_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/unknown_field_set_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util_test.cc
- ${protobuf_source_dir}/src/google/protobuf/util/field_comparator_test.cc
- ${protobuf_source_dir}/src/google/protobuf/util/field_mask_util_test.cc
- ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter_test.cc
- ${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter_test.cc
- ${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser_test.cc
- ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource_test.cc
- ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
- ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc
- ${protobuf_source_dir}/src/google/protobuf/util/json_util_test.cc
- ${protobuf_source_dir}/src/google/protobuf/util/message_differencer_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/util/time_util_test.cc
- ${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util_test.cc
- ${protobuf_source_dir}/src/google/protobuf/well_known_types_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/wire_format_unittest.cc
- ${protobuf_source_dir}/src/google/protobuf/wire_format_unittest.inc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/any_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/arena_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/annotation_test_util.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/annotation_test_util.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_unittest.inc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/metadata_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_plugin_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/python_plugin_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/drop_unknown_fields_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_lite_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/io/printer_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/io/tokenizer_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/map_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/map_test.inc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/message_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/message_unittest.inc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/no_field_presence_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/preserve_unknown_enum_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_arena_lite_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_arena_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_lite_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/proto3_lite_unittest.inc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field_reflection_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/bytestream_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/int128_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/statusor_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringprintf_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/structurally_valid_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/template_util_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/time_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/text_format_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/default_value_objectwriter_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_objectwriter_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/json_stream_parser_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectsource_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/type_info_test_helper.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_util_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_util_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver_util_test.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/well_known_types_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_unittest.inc
)
if(protobuf_ABSOLUTE_TEST_PLUGIN_PATH)
@@ -241,23 +241,23 @@
target_link_libraries(tests libprotoc libprotobuf GTest::gmock_main)
set(test_plugin_files
- ${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
- ${protobuf_source_dir}/src/google/protobuf/compiler/test_plugin.cc
- ${protobuf_source_dir}/src/google/protobuf/testing/file.cc
- ${protobuf_source_dir}/src/google/protobuf/testing/file.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/test_plugin.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.h
)
add_executable(test_plugin ${test_plugin_files})
target_link_libraries(test_plugin libprotoc libprotobuf GTest::gmock)
set(lite_test_files
- ${protobuf_source_dir}/src/google/protobuf/lite_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/lite_unittest.cc
)
add_executable(lite-test ${lite_test_files} ${common_lite_test_files} ${lite_test_proto_files})
target_link_libraries(lite-test libprotobuf-lite GTest::gmock_main)
set(lite_arena_test_files
- ${protobuf_source_dir}/src/google/protobuf/lite_arena_unittest.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/lite_arena_unittest.cc
)
add_executable(lite-arena-test ${lite_arena_test_files} ${common_lite_test_files} ${lite_test_proto_files})
target_link_libraries(lite-arena-test libprotobuf-lite GTest::gmock_main)
@@ -265,8 +265,8 @@
add_custom_target(check
COMMAND tests
DEPENDS tests test_plugin
- WORKING_DIRECTORY ${protobuf_source_dir})
+ WORKING_DIRECTORY ${protobuf_SOURCE_DIR})
add_test(NAME check
COMMAND tests
- WORKING_DIRECTORY "${protobuf_source_dir}")
+ WORKING_DIRECTORY "${protobuf_SOURCE_DIR}")