Skip to content

Commit

Permalink
Sync from Piper @392076391
Browse files Browse the repository at this point in the history
PROTOBUF_SYNC_PIPER
  • Loading branch information
acozzette committed Aug 20, 2021
2 parents 509aee4 + 8a3c494 commit 4eed0da
Show file tree
Hide file tree
Showing 141 changed files with 1,937 additions and 1,383 deletions.
4 changes: 2 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ cc_library(
"src/google/protobuf/dynamic_message.cc",
"src/google/protobuf/empty.pb.cc",
"src/google/protobuf/extension_set_heavy.cc",
"src/google/protobuf/field_access_listener.cc",
"src/google/protobuf/field_mask.pb.cc",
"src/google/protobuf/generated_message_bases.cc",
"src/google/protobuf/generated_message_reflection.cc",
"src/google/protobuf/generated_message_table_driven.cc",
"src/google/protobuf/io/gzip_stream.cc",
Expand Down Expand Up @@ -667,6 +667,7 @@ cc_test(
"src/google/protobuf/arena_unittest.cc",
"src/google/protobuf/arenastring_unittest.cc",
"src/google/protobuf/compiler/annotation_test_util.cc",
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_move_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
Expand Down Expand Up @@ -741,7 +742,6 @@ cc_test(
] + select({
"//conditions:default": [
# AUTOGEN(non_msvc_test_srcs)
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
],
":msvc": [],
}),
Expand Down
15 changes: 9 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ java_EXTRA_DIST=
java/core/generate-sources-build.xml \
java/core/generate-test-sources-build.xml \
java/core/pom.xml \
java/core/pom_template.xml \
java/core/src/main/java/com/google/protobuf/AbstractMessage.java \
java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java \
java/core/src/main/java/com/google/protobuf/AbstractParser.java \
Expand Down Expand Up @@ -535,6 +536,7 @@ java_EXTRA_DIST=
java/kotlin/generate-sources-build.xml \
java/kotlin/generate-test-sources-build.xml \
java/kotlin/pom.xml \
java/kotlin/src/main/kotlin/com/google/protobuf/ByteStrings.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/DslProxy.kt \
Expand All @@ -544,6 +546,7 @@ java_EXTRA_DIST=
java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt\
java/kotlin/src/main/kotlin/com/google/protobuf/ProtoDslMarker.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/UnmodifiableCollections.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/ByteStringsTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt\
Expand All @@ -567,26 +570,26 @@ java_EXTRA_DIST=
java/lite/generate-test-sources-build.xml \
java/lite/lite.awk \
java/lite/pom.xml \
java/lite/pom_template.xml \
java/lite/process-lite-sources-build.xml \
java/lite/src/test/java/com/google/protobuf/LiteTest.java \
java/lite/src/test/java/com/google/protobuf/Proto2MessageLiteInfoFactory.java \
java/BUILD \
java/pom.xml \
java/util/BUILD \
java/util/pom.xml \
java/util/pom_template.xml \
java/util/src/main/java/com/google/protobuf/util/Durations.java \
java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java \
java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java \
java/util/src/main/java/com/google/protobuf/util/JsonFormat.java \
java/util/src/main/java/com/google/protobuf/util/TimeUtil.java \
java/util/src/main/java/com/google/protobuf/util/Structs.java \
java/util/src/main/java/com/google/protobuf/util/Timestamps.java \
java/util/src/main/java/com/google/protobuf/util/Values.java \
java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java \
java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java \
java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java \
java/util/src/test/java/com/google/protobuf/util/StructsTest.java \
java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java \
java/util/src/test/java/com/google/protobuf/util/ValuesTest.java \
java/util/src/test/proto/com/google/protobuf/util/json_test.proto

Expand Down Expand Up @@ -801,6 +804,7 @@ objectivec_EXTRA_DIST= \
php_EXTRA_DIST= \
composer.json \
php/README.md \
php/REFCOUNTING.md \
php/composer.json \
php/ext/google/protobuf/arena.c \
php/ext/google/protobuf/arena.h \
Expand All @@ -825,7 +829,6 @@ php_EXTRA_DIST= \
php/ext/google/protobuf/wkt.inc \
php/generate_descriptor_protos.sh \
php/generate_test_protos.sh \
php/prepare_c_extension.sh \
php/release.sh \
php/src/GPBMetadata/Google/Protobuf/Any.php \
php/src/GPBMetadata/Google/Protobuf/Api.php \
Expand Down Expand Up @@ -1136,6 +1139,7 @@ ruby_EXTRA_DIST= \
ruby/ext/google/protobuf_c/ruby-upb.h \
ruby/ext/google/protobuf_c/wrap_memcpy.c \
ruby/google-protobuf.gemspec \
ruby/lib/google/protobuf/descriptor_dsl.rb \
ruby/lib/google/protobuf/message_exts.rb \
ruby/lib/google/protobuf/repeated_field.rb \
ruby/lib/google/protobuf/well_known_types.rb \
Expand Down Expand Up @@ -1424,9 +1428,8 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
protobuf_deps.bzl \
third_party/six.BUILD \
third_party/zlib.BUILD \
third_party/wyhash/LICENSE \
third_party/wyhash/wyhash.h \
util/python/BUILD
util/python/BUILD \
internal.bzl


# Deletes all the files generated by autogen.sh.
Expand Down
2 changes: 1 addition & 1 deletion Protobuf-C++.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Protobuf-C++'
s.version = '3.15.8'
s.version = '3.17.3'
s.summary = 'Protocol Buffers v3 runtime library for C++.'
s.homepage = 'https://github.com/google/protobuf'
s.license = '3-Clause BSD License'
Expand Down
8 changes: 6 additions & 2 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ set -ex

# The absence of a m4 directory in googletest causes autoreconf to fail when
# building under the CentOS docker image. It's a warning in regular build on
# Ubuntu/gLinux as well.
mkdir -p third_party/googletest/m4
# Ubuntu/gLinux as well. (This is only needed if git submodules have been
# initialized, which is typically only needed for testing; see the installation
# instructions for details.)
if test -d third_party/googletest; then
mkdir -p third_party/googletest/m4
fi

# TODO(kenton): Remove the ",no-obsolete" part and fix the resulting warnings.
autoreconf -f -i -Wall,no-obsolete
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<dependency>
<groupId>com.google.caliper</groupId>
<artifactId>caliper</artifactId>
<version>1.0-beta-2</version>
<version>1.0-beta-3</version>
</dependency>
</dependencies>

Expand Down
52 changes: 52 additions & 0 deletions benchmarks/util/result_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This import depends on the automake rule protoc_middleman, please make sure
# protoc_middleman has been built before run this file.
import argparse
import json
import re
import os.path
Expand Down Expand Up @@ -298,3 +299,54 @@ def get_result_from_file(cpp_file="",
__parse_php_result(php_c_file, "php")

return __results


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-cpp",
"--cpp_input_file",
help="The CPP benchmark result file's name",
default="")
parser.add_argument(
"-java",
"--java_input_file",
help="The Java benchmark result file's name",
default="")
parser.add_argument(
"-python",
"--python_input_file",
help="The Python benchmark result file's name",
default="")
parser.add_argument(
"-go",
"--go_input_file",
help="The golang benchmark result file's name",
default="")
parser.add_argument(
"-node",
"--node_input_file",
help="The node.js benchmark result file's name",
default="")
parser.add_argument(
"-php",
"--php_input_file",
help="The pure php benchmark result file's name",
default="")
parser.add_argument(
"-php_c",
"--php_c_input_file",
help="The php with c ext benchmark result file's name",
default="")
args = parser.parse_args()

results = get_result_from_file(
cpp_file=args.cpp_input_file,
java_file=args.java_input_file,
python_file=args.python_input_file,
go_file=args.go_input_file,
node_file=args.node_input_file,
php_file=args.php_input_file,
php_c_file=args.php_c_input_file,
)
print(json.dumps(results, indent=2))
20 changes: 12 additions & 8 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ else (protobuf_BUILD_SHARED_LIBS)
endif (protobuf_BUILD_SHARED_LIBS)

if (MSVC)
# Build with multiple processes
add_definitions(/MP)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Build with multiple processes
add_definitions(/MP)
endif()
# MSVC warning suppressions
add_definitions(
/wd4018 # 'expression' : signed/unsigned mismatch
Expand Down Expand Up @@ -222,12 +224,14 @@ if (MSVC)
# Suppress linker warnings about files with no symbols defined.
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")

# Configure Resource Compiler
enable_language(RC)
# use English language (0x409) in resource compiler
set(rc_flags "/l0x409")
# fix rc.exe invocations because of usage of add_definitions()
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Configure Resource Compiler
enable_language(RC)
# use English language (0x409) in resource compiler
set(rc_flags "/l0x409")
# fix rc.exe invocations because of usage of add_definitions()
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>")
endif()

configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
endif (MSVC)
Expand Down
4 changes: 4 additions & 0 deletions cmake/extract_includes.bat.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\dynamic_message.h" in
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.pb.h" include\google\protobuf\empty.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set.h" include\google\protobuf\extension_set.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set_inl.h" include\google\protobuf\extension_set_inl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_access_listener.h" include\google\protobuf\field_access_listener.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.pb.h" include\google\protobuf\field_mask.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflection.h" include\google\protobuf\generated_enum_reflection.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h" include\google\protobuf\generated_enum_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h" include\google\protobuf\generated_message_reflection.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven.h" include\google\protobuf\generated_message_table_driven.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_decl.h" include\google\protobuf\generated_message_tctable_decl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.h" include\google\protobuf\generated_message_tctable_impl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.inc" include\google\protobuf\generated_message_tctable_impl.inc
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_util.h" include\google\protobuf\generated_message_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\has_bits.h" include\google\protobuf\has_bits.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\implicit_weak_message.h" include\google\protobuf\implicit_weak_message.h
Expand Down
3 changes: 2 additions & 1 deletion cmake/libprotobuf-lite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set(libprotobuf_lite_files
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc
${protobuf_source_dir}/src/google/protobuf/inlined_string_field.cc
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc
${protobuf_source_dir}/src/google/protobuf/io/io_win32.cc
${protobuf_source_dir}/src/google/protobuf/io/strtod.cc
Expand Down Expand Up @@ -57,7 +58,7 @@ set(libprotobuf_lite_includes
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h
)

if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(libprotobuf_lite_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
Expand Down
2 changes: 1 addition & 1 deletion cmake/libprotobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ set(libprotobuf_includes
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h
)

if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(libprotobuf_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
Expand Down
2 changes: 1 addition & 1 deletion cmake/libprotoc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ set(libprotoc_headers
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
)

if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(libprotoc_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
Expand Down
2 changes: 1 addition & 1 deletion cmake/protoc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set(protoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/main.cc
)

if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(protoc_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
Expand Down
2 changes: 2 additions & 0 deletions cmake/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ set(tests_files
${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/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
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ AC_PREREQ(2.59)
# In the SVN trunk, the version should always be the next anticipated release
# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed
# the size of one file name in the dist tarfile over the 99-char limit.)
AC_INIT([Protocol Buffers],[3.15.8],[[email protected]],[protobuf])
AC_INIT([Protocol Buffers],[3.17.3],[[email protected]],[protobuf])

AM_MAINTAINER_MODE([enable])

Expand Down Expand Up @@ -125,7 +125,7 @@ AC_LINK_IFELSE(
[have_ld_version_script=yes; AC_MSG_RESULT(yes)],
[have_ld_version_script=no; AC_MSG_RESULT(no)])
LDFLAGS=$save_LDFLAGS
AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT], [test "$have_ld_version_script" == "yes"])
AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT], [test "$have_ld_version_script" = "yes"])

# Checks for header files.
AC_HEADER_STDC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.Ignore;

/**
* Tests for {@link ExtensionRegistryFactory} and the {@link ExtensionRegistry} instances it
Expand All @@ -55,8 +56,12 @@
*
* <p>The test mechanism employed here is based on the pattern in {@code
* com.google.common.util.concurrent.AbstractFutureFallbackAtomicHelperTest}
*
* <p>This test is temporarily disabled while we figure out how to fix the class loading used for
* testing lite functionality.
*/
@SuppressWarnings("JUnit4ClassUsedInJUnit3")
@Ignore
public class ExtensionRegistryFactoryTest extends TestCase {

// A classloader which blacklists some non-Lite classes.
Expand Down
4 changes: 3 additions & 1 deletion java/core/src/test/java/com/google/protobuf/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3758,7 +3758,9 @@ public void assertReflectionRepeatedSettersRejectNull(Message.Builder builder)

/** @param filePath The path relative to {@link #getTestDataDir}. */
public static String readTextFromFile(String filePath) {
return readBytesFromFile(filePath).toStringUtf8();
return readBytesFromFile(filePath)
.toStringUtf8()
.replace(System.getProperty("line.separator"), "\n");
}

private static File getTestDataDir() {
Expand Down
14 changes: 7 additions & 7 deletions java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ import com.google.protobuf.ExtensionLite
import com.google.protobuf.MessageLite

/**
* Implementation for ExtensionList and ExtensionListLite. Like [DslList], represents an
* unmodifiable view of a repeated proto field -- in this case, an extension field -- but
* supports querying the extension.
* Implementation for ExtensionList and ExtensionListLite. Like [DslList], represents an
* unmodifiable view of a repeated proto field -- in this case, an extension field -- but supports
* querying the extension.
*/
class ExtensionList<E, M : MessageLite> @OnlyForUseByGeneratedProtoCode constructor(
val extension: ExtensionLite<M, List<E>>,
@JvmField private val delegate: List<E>
) : List<E> by delegate {
class ExtensionList<E, M : MessageLite>
@OnlyForUseByGeneratedProtoCode
constructor(val extension: ExtensionLite<M, List<E>>, private val delegate: List<E>) :
List<E> by delegate {
override fun iterator(): Iterator<E> = UnmodifiableIterator(delegate.iterator())

override fun listIterator(): ListIterator<E> = UnmodifiableListIterator(delegate.listIterator())
Expand Down
Loading

0 comments on commit 4eed0da

Please sign in to comment.