PROTOBUF_SYNC_PIPER
pull/9859/head^2
Joshua Haberman 3 years ago
parent a27ce12d3a
commit dc4aad931e
  1. 36
      .github/workflows/objc_cocoapods.yml
  2. 182
      BUILD
  3. 30
      CHANGES.txt
  4. 10
      Protobuf.podspec
  5. 3
      WORKSPACE
  6. 34
      benchmarks/BUILD
  7. 8
      benchmarks/cpp/BUILD
  8. 8
      benchmarks/datasets/BUILD
  9. 8
      benchmarks/datasets/google_message1/proto2/BUILD
  10. 8
      benchmarks/datasets/google_message1/proto3/BUILD
  11. 8
      benchmarks/datasets/google_message2/BUILD
  12. 8
      benchmarks/datasets/google_message3/BUILD
  13. 8
      benchmarks/datasets/google_message4/BUILD
  14. 34
      csharp/BUILD
  15. 2
      csharp/Google.Protobuf.Tools.nuspec
  16. BIN
      csharp/src/Google.Protobuf.Test/testprotos.pb
  17. 2
      csharp/src/Google.Protobuf/CodedInputStream.cs
  18. 2
      csharp/src/Google.Protobuf/Google.Protobuf.csproj
  19. 2
      csharp/src/Google.Protobuf/Reflection/ExtensionCollection.cs
  20. 2
      docs/field_presence.md
  21. 32
      examples/BUILD
  22. 37
      java/BUILD
  23. 6
      java/README.md
  24. 2
      java/bom/pom.xml
  25. 28
      java/core/BUILD
  26. 2
      java/core/pom.xml
  27. 3
      java/core/src/main/java/com/google/protobuf/DescriptorMessageInfoFactory.java
  28. 3
      java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto
  29. 14
      java/internal/BUILD
  30. 51
      java/kotlin-lite/BUILD
  31. 2
      java/kotlin-lite/pom.xml
  32. 76
      java/kotlin/BUILD
  33. 2
      java/kotlin/pom.xml
  34. 2
      java/lite.md
  35. 24
      java/lite/BUILD
  36. 2
      java/lite/pom.xml
  37. 2
      java/pom.xml
  38. 18
      java/util/BUILD
  39. 2
      java/util/pom.xml
  40. 29
      js/BUILD
  41. 2
      js/package.json
  42. 242
      kokoro/linux/64-bit/Dockerfile
  43. 2
      kokoro/linux/aarch64/test_java_aarch64.sh
  44. 1
      kokoro/linux/dockerfile/test/java_stretch/Dockerfile
  45. 17
      kokoro/linux/golang/build.sh
  46. 11
      kokoro/linux/golang/continuous.cfg
  47. 11
      kokoro/linux/golang/presubmit.cfg
  48. 6
      kokoro/linux/java_jdk11/build.sh
  49. 2
      kokoro/linux/java_jdk11/continuous.cfg
  50. 12
      kokoro/linux/java_jdk11/presubmit.cfg
  51. 6
      kokoro/linux/java_jdk17/build.sh
  52. 4
      kokoro/linux/java_jdk17/continuous.cfg
  53. 12
      kokoro/linux/java_jdk17/presubmit.cfg
  54. 11
      kokoro/linux/java_jdk7/presubmit.cfg
  55. 17
      kokoro/linux/java_oracle7/build.sh
  56. 11
      kokoro/linux/java_oracle7/continuous.cfg
  57. 11
      kokoro/linux/java_oracle7/presubmit.cfg
  58. 17
      kokoro/linux/php80/build.sh
  59. 5
      kokoro/linux/php80/continuous.cfg
  60. 5
      kokoro/linux/php80/presubmit.cfg
  61. 5
      kokoro/linux/python_compatibility/continuous.cfg
  62. 5
      kokoro/linux/python_compatibility/presubmit.cfg
  63. 17
      kokoro/linux/python_cpp/build.sh
  64. 11
      kokoro/linux/python_cpp/presubmit.cfg
  65. 9
      kokoro/release/ruby/macos/ruby/ruby_build_environment.sh
  66. 48
      objectivec/BUILD
  67. 4
      objectivec/GPBUtilities.m
  68. 30
      php/BUILD
  69. 8
      php/composer.json.dist
  70. 21
      php/ext/google/protobuf/package.xml
  71. 2
      php/ext/google/protobuf/protobuf.h
  72. 23
      php/release.sh
  73. 4
      php/tests/GeneratedClassTest.php
  74. 261
      pkg/BUILD
  75. 2
      post_process_dist.sh
  76. 13
      protobuf_deps.bzl
  77. 2
      protobuf_version.bzl
  78. 2
      protoc-artifacts/pom.xml
  79. 38
      python/google/protobuf/internal/descriptor_pool_test.py
  80. 76
      python/google/protobuf/internal/message_test.py
  81. 2
      python/google/protobuf/internal/unknown_fields_test.py
  82. 34
      ruby/BUILD
  83. 2
      ruby/google-protobuf.gemspec
  84. 4
      ruby/pom.xml
  85. 2
      src/google/protobuf/compiler/csharp/csharp_enum_field.h
  86. 2
      src/google/protobuf/compiler/csharp/csharp_map_field.h
  87. 2
      src/google/protobuf/compiler/csharp/csharp_message_field.h
  88. 2
      src/google/protobuf/compiler/csharp/csharp_primitive_field.h
  89. 2
      src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
  90. 2
      src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
  91. 2
      src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
  92. 2
      src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
  93. 3
      src/google/protobuf/compiler/java/helpers.cc
  94. 1
      src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
  95. 1
      src/google/protobuf/compiler/objectivec/objectivec_field.cc
  96. 2
      src/google/protobuf/compiler/objectivec/objectivec_message.cc
  97. 1
      src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
  98. 2
      src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
  99. 2
      src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
  100. 24
      src/google/protobuf/compiler/php/php_generator.cc
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,36 @@
name: 'ObjC CocoaPods'
on:
push:
paths:
- '.github/workflows/objc_cocoapods.yml'
- 'Protobuf.podspec'
- 'objectivec/**'
- '!objectivec/DevTools/**'
- '!objectivec/ProtocolBuffers_*.xcodeproj/**'
- '!objectivec/Tests/**'
pull_request:
paths:
- '.github/workflows/objc_cocoapods.yml'
- 'Protobuf.podspec'
- 'objectivec/**'
- '!objectivec/DevTools/**'
- '!objectivec/ProtocolBuffers_*.xcodeproj/**'
- '!objectivec/Tests/**'
jobs:
pod-lib-lint:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
PLATFORM: ["ios", "macos", "tvos", "watchos"]
CONFIGURATION: ["Debug", "Release"]
steps:
- uses: actions/checkout@v2
- name: Pod lib lint
run: |
pod lib lint --verbose \
--configuration=${{ matrix.CONFIGURATION }} \
--platforms=${{ matrix.PLATFORM }} \
Protobuf.podspec

182
BUILD

@ -2,6 +2,7 @@
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library", native_cc_proto_library = "cc_proto_library")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
load("@rules_python//python:defs.bzl", "py_library")
load("@rules_java//java:defs.bzl", "java_binary", "java_lite_proto_library", "java_proto_library")
@ -530,7 +531,10 @@ cc_binary(
filegroup(
name = "testdata",
srcs = glob(["src/google/protobuf/testdata/**/*"]),
visibility = ["//:__subpackages__"],
visibility = [
"//:__subpackages__",
"@upb//:__subpackages__",
],
)
RELATIVE_LITE_TEST_PROTOS = [
@ -892,13 +896,23 @@ py_library(
[
"python/google/protobuf/**/*.py",
],
exclude = [
),
imports = ["python"],
srcs_version = "PY2AND3",
visibility = ["@upb//:__subpackages__"],
)
py_library(
name = "python_test_srcs",
srcs = glob(
[
"python/google/protobuf/internal/*_test.py",
"python/google/protobuf/internal/test_util.py",
],
),
imports = ["python"],
srcs_version = "PY2AND3",
srcs_version = "PY3",
visibility = ["@upb//:__subpackages__"],
)
cc_binary(
@ -995,9 +1009,21 @@ internal_copied_filegroup(
COPIED_WELL_KNOWN_PROTOS = ["python/" + s[4:] for s in WELL_KNOWN_PROTOS]
py_proto_library(
name = "protobuf_python",
name = "well_known_types_py_pb2",
srcs = COPIED_WELL_KNOWN_PROTOS,
include = "python",
default_runtime = "",
protoc = ":protoc",
srcs_version = "PY2AND3",
visibility = ["@upb//:__subpackages__"],
)
py_library(
name = "protobuf_python",
deps = [
":well_known_types_py_pb2",
":python_srcs",
],
data = select({
"//conditions:default": [],
":use_fast_cpp_protos": [
@ -1005,13 +1031,6 @@ py_proto_library(
":python/google/protobuf/pyext/_message.so",
],
}),
default_runtime = "",
protoc = ":protoc",
py_libs = [
":python_srcs",
],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
)
# Copy the test proto files from src/google/protobuf to
@ -1039,7 +1058,8 @@ py_proto_library(
default_runtime = "",
protoc = ":protoc",
srcs_version = "PY2AND3",
deps = [":protobuf_python"],
deps = [":well_known_types_py_pb2"],
visibility = ["//visibility:public"],
)
py_proto_library(
@ -1053,6 +1073,7 @@ py_proto_library(
protoc = ":protoc",
srcs_version = "PY2AND3",
deps = [":python_common_test_protos"],
visibility = ["//visibility:public"],
)
py_library(
@ -1445,3 +1466,140 @@ internal_gen_kt_protos(
visibility = ["//java:__subpackages__"],
deps = [":kt_proto3_unittest"],
)
################################################################################
# Packaging rules
################################################################################
# Files included in all source distributions
pkg_files(
name = "common_dist_files",
srcs = glob([
"*.bzl",
"cmake/*.cmake",
"cmake/*.in",
"editors/*",
# Several of these files are generated by autogen.sh, so using
# glob() lets us ignore them if they are missing. (This is not good
# practice, though.)
"Makefile.in",
"aclocal.m4",
"ar-lib",
"compile",
"config*",
"depcomp",
"install-sh",
"ltmain.sh",
"m4/*.m4",
"missing",
"protobuf*.pc.in",
"test-driver",
]) + [
"BUILD",
"CHANGES.txt",
"CMakeLists.txt",
"CONTRIBUTORS.txt",
"LICENSE",
"Makefile.am",
"README.md",
"WORKSPACE",
"autogen.sh",
"build_files_updated_unittest.sh",
"cmake/CMakeLists.txt",
"cmake/README.md",
"generate_descriptor_proto.sh",
"maven_install.json",
"update_file_lists.sh",
"//third_party:zlib.BUILD",
"//util/python:BUILD",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)
# Conformance tests
pkg_files(
name = "conformance_dist_files",
srcs = glob(
["conformance/**/*"],
exclude = [
# The following are not in autotools dist:
"conformance/autoload.php",
"conformance/conformance_nodejs.js",
"conformance/conformance_test_runner.sh",
"conformance/failure_list_java_lite.txt",
"conformance/failure_list_jruby.txt",
"conformance/text_format_failure_list_*.txt",
"conformance/update_failure_list.py",
],
),
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)
# C++ runtime
pkg_files(
name = "cpp_dist_files",
srcs = glob(
["src/**/*"],
exclude = [
"src/google/protobuf/compiler/objectivec/method_dump.sh", # not in autotools dist
],
),
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)
# Additional files for C#
pkg_files(
name = "csharp_dist_files",
srcs = [
"global.json",
],
visibility = ["//pkg:__pkg__"],
)
# Additional files for ObjC
pkg_files(
name = "objectivec_dist_files",
srcs = [
"Protobuf.podspec",
],
visibility = ["//pkg:__pkg__"],
)
# Additional files for PHP
pkg_files(
name = "php_dist_files",
srcs = [
"composer.json",
],
visibility = ["//pkg:__pkg__"],
)
# Python runtime
pkg_files(
name = "python_dist_files",
srcs = glob([
"python/google/**/*.proto",
"python/google/**/*.py",
"python/google/protobuf/internal/*.cc",
"python/google/protobuf/pyext/*.cc",
"python/google/protobuf/pyext/*.h",
]) + [
"python/MANIFEST.in",
"python/README.md",
"python/google/protobuf/proto_api.h",
"python/google/protobuf/pyext/README",
"python/google/protobuf/python_protobuf.h",
"python/mox.py",
"python/release.sh",
"python/setup.cfg",
"python/setup.py",
"python/stubout.py",
"python/tox.ini",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)

@ -1,35 +1,41 @@
Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Compiler
* Require package names to be less than 512 bytes in length
2022-04-05 version 3.20.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
PHP
* Fix building packaged PHP extension (#9727)
* Fixed composer.json to only advertise compatibility with PHP 7.0+. (#9819)
Ruby
* Disable the aarch64 build on macOS until it can be fixed. (#9816)
Other
* Fix versioning issues in 3.20.0
Unreleased Changes
C++
C++
* Refactor generated message class layout
* Optimize tokenizer ParseInteger by removing division
* Reserve exactly the right amount of capacity in ExtensionSet::MergeFrom
Compiler
Compiler
* Protoc outputs the list of suggested field numbers when invalid field
numbers are specified in the .proto file.
* Require package names to be less than 512 bytes in length
Java
Java
* 6x speedup in ArrayEncoder.writeUInt32NotTag
Python
Python
* Added UnknownFieldSet(message) for pure Python. The old
message.UnknownFields() will be deprecated after UnknownFieldSet(message) is
added for cpp extension.
2022-04-21 version 3.20.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
PHP
* Fix building packaged PHP extension (#9727)
Other
* Fix versioning issues in 3.20.0
2022-03-04 version 3.20.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
Ruby
@ -97,6 +103,8 @@ Python
JSON serializations with UTF-8 or other non-ASCII encodings.
* Added experimental support for directly assigning numpy scalars and array.
* Improve the calculation of public_dependencies in DescriptorPool.
* [Breaking Change] Disallow setting fields to numpy singleton arrays or repeated fields to numpy
multi-dimensional arrays. Numpy arrays should be indexed or flattened explicitly before assignment.
Compiler
* Migrate IsDefault(const std::string*) and UnsafeSetDefault(const std::string*)

@ -5,7 +5,7 @@
# dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s|
s.name = 'Protobuf'
s.version = '3.20.1-rc1'
s.version = '3.20.1'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/protocolbuffers/protobuf'
s.license = 'BSD-3-Clause'
@ -39,4 +39,12 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = '9.0'
s.watchos.deployment_target = '2.0'
s.requires_arc = false
# The unittest need the generate sources from the testing related .proto
# files. So to add a `test_spec`, there would also need to be something like a
# `script_phases` to generate them, but there would also need to be a way to
# ensure `protoc` had be built. Another option would be to move to a model
# where the needed files are always generated and checked in. Neither of these
# seem that great at the moment, so the tests have *not* been wired into here
# at this time.
end

@ -66,3 +66,6 @@ kotlin_repositories()
load("@io_bazel_rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
kt_register_toolchains()
load("@upb//bazel:workspace_deps.bzl", "upb_deps")
upb_deps()

@ -1,5 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library")
proto_library(
@ -63,3 +64,36 @@ java_proto_library(
"google_size_proto",
],
)
pkg_files(
name = "dist_files",
srcs = glob(
[
"*",
"python/*.cc",
"util/*.cc",
],
exclude = [
"__init__.py", # not in autotools dist
"BUILD",
"go/*",
],
),
strip_prefix = strip_prefix.from_root(""),
)
# Convenience filegroup for all files that should be packaged.
pkg_filegroup(
name = "all_dist_files",
srcs = [
":dist_files",
"//benchmarks/cpp:dist_files",
# "//benchmarks/datasets:dist_files", # not in autotools dist
"//benchmarks/datasets/google_message1/proto2:dist_files",
"//benchmarks/datasets/google_message1/proto3:dist_files",
"//benchmarks/datasets/google_message2:dist_files",
"//benchmarks/datasets/google_message3:dist_files",
"//benchmarks/datasets/google_message4:dist_files",
],
visibility = ["//pkg:__pkg__"],
)

@ -1,4 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
cc_binary(
name = "cpp",
@ -13,3 +14,10 @@ cc_binary(
"@com_github_google_benchmark//:benchmark_main",
],
)
pkg_files(
name = "dist_files",
srcs = ["cpp_benchmark.cc"],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//benchmarks:__pkg__"],
)

@ -1,5 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_java//java:defs.bzl", "java_library")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library")
filegroup(
@ -57,3 +58,10 @@ java_library(
"//benchmarks/datasets/google_message4:benchmark_message4_java_proto",
],
)
pkg_files(
name = "dist_files",
srcs = ["BUILD"],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//benchmarks:__pkg__"],
)

@ -1,5 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library")
filegroup(
@ -42,3 +43,10 @@ java_proto_library(
"benchmark_message1_proto2_proto",
],
)
pkg_files(
name = "dist_files",
srcs = glob(["*.proto"]),
strip_prefix = strip_prefix.from_root(""),
visibility = ["//benchmarks:__pkg__"],
)

@ -1,6 +1,7 @@
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
filegroup(
name = "datasets",
@ -42,3 +43,10 @@ java_proto_library(
"benchmark_message1_proto3_proto",
],
)
pkg_files(
name = "dist_files",
srcs = glob(["*.proto"]),
strip_prefix = strip_prefix.from_root(""),
visibility = ["//benchmarks:__pkg__"],
)

@ -1,5 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library")
filegroup(
@ -42,3 +43,10 @@ java_proto_library(
"benchmark_message2_proto",
],
)
pkg_files(
name = "dist_files",
srcs = glob(["*.proto"]),
strip_prefix = strip_prefix.from_root(""),
visibility = ["//benchmarks:__pkg__"],
)

@ -1,5 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library")
filegroup(
@ -48,3 +49,10 @@ java_proto_library(
"benchmark_message3_proto",
],
)
pkg_files(
name = "dist_files",
srcs = glob(["*.proto"]),
strip_prefix = strip_prefix.from_root(""),
visibility = ["//benchmarks:__pkg__"],
)

@ -1,5 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library")
filegroup(
@ -43,3 +44,10 @@ java_proto_library(
"benchmark_message4_proto",
],
)
pkg_files(
name = "dist_files",
srcs = glob(["*.proto"]),
strip_prefix = strip_prefix.from_root(""),
visibility = ["//benchmarks:__pkg__"],
)

@ -0,0 +1,34 @@
# Protobuf C# runtime
#
# See also code generation logic under /src/google/protobuf/compiler/csharp.
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
pkg_files(
name = "dist_files",
srcs = glob([
"keys/*",
"protos/*",
"src/**/*.cs*", # .cs and .csproj
]) + [
".editorconfig",
".gitignore",
"BUILD",
"CHANGES.txt",
"Google.Protobuf.Tools.nuspec",
"Google.Protobuf.Tools.targets",
"NuGet.Config",
"README.md",
"build_packages.bat",
"build_tools.sh",
"buildall.bat",
"buildall.sh",
"generate_protos.sh",
"install_dotnet_sdk.ps1",
"src/Google.Protobuf.Benchmarks/wrapper_benchmark_messages.proto",
"src/Google.Protobuf.Test/testprotos.pb",
"src/Google.Protobuf.sln",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)

@ -5,7 +5,7 @@
<title>Google Protocol Buffers tools</title>
<summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
<description>See project site for more info.</description>
<version>3.20.1-rc1</version>
<version>3.20.1</version>
<authors>Google Inc.</authors>
<owners>protobuf-packages</owners>
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/main/LICENSE</licenseUrl>

@ -431,7 +431,7 @@ namespace Google.Protobuf
{
// TODO(jtattermusch): if the message doesn't implement IBufferMessage (and thus does not provide the InternalMergeFrom method),
// what we're doing here works fine, but could be more efficient.
// What happends is that we first initialize a ParseContext from the current coded input stream only to parse the length of the message, at which point
// What happens is that we first initialize a ParseContext from the current coded input stream only to parse the length of the message, at which point
// we will need to switch back again to CodedInputStream-based parsing (which involves copying and storing the state) to be able to
// invoke the legacy MergeFrom(CodedInputStream) method.
// For now, this inefficiency is fine, considering this is only a backward-compatibility scenario (and regenerating the code fixes it).

@ -4,7 +4,7 @@
<Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
<Copyright>Copyright 2015, Google Inc.</Copyright>
<AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
<VersionPrefix>3.20.1-rc1</VersionPrefix>
<VersionPrefix>3.20.1</VersionPrefix>
<!-- C# 7.2 is required for Span/BufferWriter/ReadOnlySequence -->
<LangVersion>7.2</LangVersion>
<Authors>Google Inc.</Authors>

@ -93,7 +93,7 @@ namespace Google.Protobuf.Reflection
/// <summary>
/// Returns a readonly list of all the extensions define in this type that extend
/// the provided descriptor type in accending field order
/// the provided descriptor type in ascending field order
/// </summary>
public IList<FieldDescriptor> GetExtensionsInNumberOrder(MessageDescriptor descriptor)
{

@ -16,7 +16,7 @@ _Presence disciplines_ define the semantics for translating between the _API rep
The wire format is a stream of tagged, _self-delimiting_ values. By definition, the wire format represents a sequence of _present_ values. In other words, every value found within a serialization represents a _present_ field; furthermore, the serialization contains no information about not-present values.
The generated API for a proto message includes (de)serialization definitions which translate between API types and a stream of definitionally _present_ (tag, value) pairs. This translation is designed to be forward- and backward-compatibile across changes to the message definition; however, this compatibility introduces some (perhaps surprising) considerations when deserializing wire-formatted messages:
The generated API for a proto message includes (de)serialization definitions which translate between API types and a stream of definitionally _present_ (tag, value) pairs. This translation is designed to be forward- and backward-compatible across changes to the message definition; however, this compatibility introduces some (perhaps surprising) considerations when deserializing wire-formatted messages:
- When serializing, fields with _no presence_ are not serialized if they contain their default value.
- For numeric types, the default is 0.

@ -6,6 +6,7 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_proto_library")
load("@rules_java//java:defs.bzl", "java_binary", "java_lite_proto_library", "java_proto_library")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library")
# For each .proto file, a proto_library target should be defined. This target
@ -103,3 +104,34 @@ java_binary(
main_class = "ListPeople",
deps = [":addressbook_java_lite_proto"],
)
# Files included in all source distributions
pkg_files(
name = "dist_files",
srcs = [
"AddPerson.java",
"BUILD",
"CMakeLists.txt",
"ListPeople.java",
"Makefile",
"README.md",
"WORKSPACE",
"add_person.cc",
"add_person.dart",
"add_person.py",
"addressbook.proto",
"go/cmd/add_person/add_person.go",
"go/cmd/add_person/add_person_test.go",
"go/cmd/list_people/list_people.go",
"go/cmd/list_people/list_people_test.go",
"go/go.mod",
"go/go.sum",
"list_people.cc",
"list_people.dart",
"list_people.py",
"pubspec.yaml",
],
prefix = "examples/",
strip_prefix = strip_prefix.from_root(""),
visibility = ["//visibility:public"],
)

@ -1,3 +1,5 @@
load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
test_suite(
name = "tests",
tests = [
@ -12,9 +14,40 @@ test_suite(
filegroup(
name = "release",
srcs = [
"//java/core:release", # contains lite.
"//java/core:release", # contains lite.
"//java/kotlin:release",
"//java/kotlin-lite:release",
"//java/util:release",
]
],
)
################################################################################
# Packaging rules
################################################################################
pkg_files(
name = "dist_files",
srcs = [
"BUILD",
"README.md",
"bom/pom.xml",
"lite.md",
"pom.xml",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)
pkg_filegroup(
name = "all_dist_files",
srcs = [
":dist_files",
"//java/core:dist_files",
"//java/internal:dist_files",
"//java/kotlin:dist_files",
"//java/kotlin-lite:dist_files",
"//java/lite:dist_files",
"//java/util:dist_files",
],
visibility = ["//pkg:__pkg__"],
)

@ -23,7 +23,7 @@ If you are using Maven, use the following:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
</dependency>
```
@ -37,7 +37,7 @@ protobuf-java-util package:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
</dependency>
```
@ -45,7 +45,7 @@ protobuf-java-util package:
If you are using Gradle, add the following to your `build.gradle` file's dependencies:
```
implementation 'com.google.protobuf:protobuf-java:3.20.1-rc-1'
implementation 'com.google.protobuf:protobuf-java:3.20.1'
```
Again, be sure to check that the version number matches (or is newer than) the version number of protoc that you are using.

@ -4,7 +4,7 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
<packaging>pom</packaging>
<name>Protocol Buffers [BOM]</name>

@ -1,6 +1,7 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library", "java_lite_proto_library", "java_proto_library")
load("@rules_jvm_external//:defs.bzl", "java_export")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
load("//:internal.bzl", "conformance_test")
load("//:protobuf_version.bzl", "PROTOBUF_VERSION")
@ -175,9 +176,6 @@ filegroup(
proto_lang_toolchain(
name = "toolchain",
command_line = "--java_out=$(OUT)",
runtime = ":core",
visibility = ["//visibility:public"],
# keep this in sync w/ WELL_KNOWN_PROTO_MAP in //:BUILD
blacklisted_protos = [
"//:any_proto",
@ -193,6 +191,9 @@ proto_lang_toolchain(
"//:type_proto",
"//:wrappers_proto",
],
command_line = "--java_out=$(OUT)",
runtime = ":core",
visibility = ["//visibility:public"],
)
proto_library(
@ -226,6 +227,7 @@ java_library(
"src/test/java/com/google/protobuf/TestUtil.java",
"src/test/java/com/google/protobuf/TestUtilLite.java",
],
visibility = ["//java:__subpackages__"],
deps = [
":core",
":generic_test_protos_java_proto",
@ -233,7 +235,6 @@ java_library(
"@maven//:com_google_guava_guava",
"@maven//:junit_junit",
],
visibility = ["//java:__subpackages__"],
)
test_suite(
@ -336,8 +337,8 @@ java_library(
":rewrite_javalite_test_util",
],
visibility = [
"//java/lite:__pkg__",
"//java/kotlin-lite:__pkg__",
"//java/lite:__pkg__",
],
deps = [
":generic_test_protos_java_proto_lite",
@ -411,3 +412,20 @@ junit_tests(
"@maven//:org_mockito_mockito_core",
],
)
pkg_files(
name = "dist_files",
srcs = glob([
"src/main/java/com/google/protobuf/*.java",
"src/test/java/**/*.java",
"src/test/proto/**/*.proto",
]) + [
"BUILD",
"generate-sources-build.xml",
"generate-test-sources-build.xml",
"pom.xml",
"pom_template.xml",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//java:__pkg__"],
)

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
</parent>
<artifactId>protobuf-java</artifactId>

@ -83,8 +83,7 @@ final class DescriptorMessageInfoFactory implements MessageInfoFactory {
"AllFields",
"DescriptorForType",
"InitializationErrorString",
// TODO(b/219045204): re-enable
// "UnknownFields",
"UnknownFields",
// obsolete. kept for backwards compatibility of generated code
"CachedSize"));

@ -57,8 +57,7 @@ message ForbiddenWordsUnderscoreMessage {
optional bool all_fields = 5;
optional bool descriptor_for_type = 6;
optional bool initialization_error_string = 7;
// TODO(b/219045204): re-enable
// optional bool unknown_fields = 8;
optional bool unknown_fields = 8;
// obsolete. kept for backwards compatibility of generated code
optional bool cached_size = 9;
}

@ -1 +1,13 @@
package(default_visibility = ["//java:__subpackages__"])
package(default_visibility = ["//java:__subpackages__"])
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
pkg_files(
name = "dist_files",
srcs = [
"BUILD",
"testing.bzl",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//java:__pkg__"],
)

@ -1,6 +1,7 @@
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("@rules_java//java:defs.bzl", "java_lite_proto_library")
load("@rules_jvm_external//:kt_defs.bzl", "kt_jvm_export")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("//:protobuf_version.bzl", "PROTOBUF_VERSION")
load("//:protobuf.bzl", "internal_gen_kt_protos")
@ -21,14 +22,18 @@ kt_jvm_library(
"//:gen_well_known_protos_kotlinlite",
],
deps = [
"//java/lite",
"//java/kotlin:only_for_use_in_proto_generated_code_its_generator_and_tests",
"//java/kotlin:shared_runtime",
"//java/lite",
],
)
kt_jvm_export(
name = "kotlin-lite_mvn",
deploy_env = [
"@com_github_jetbrains_kotlin//:kotlin-stdlib",
"//java/lite",
],
maven_coordinates = "com.google.protobuf:protobuf-kotlin-lite:%s" % PROTOBUF_VERSION,
pom_template = "//java/kotlin-lite:pom_template.xml",
resources = ["//:well_known_protos"],
@ -39,10 +44,6 @@ kt_jvm_export(
"//java/kotlin:only_for_use_in_proto_generated_code_its_generator_and_tests",
"//java/kotlin:shared_runtime",
],
deploy_env = [
"@com_github_jetbrains_kotlin//:kotlin-stdlib",
"//java/lite",
],
)
filegroup(
@ -59,9 +60,9 @@ filegroup(
test_suite(
name = "tests",
tests = [
"test_lite_extensions",
"proto2_test_lite",
"proto3_test_lite",
"test_lite_extensions",
],
)
@ -71,9 +72,9 @@ kt_jvm_library(
deps = [
":example_extensible_message_java_proto_lite",
":lite_extensions",
"//java/lite",
"//java/kotlin:only_for_use_in_proto_generated_code_its_generator_and_tests",
"//java/kotlin:shared_runtime",
"//java/lite",
"@com_github_jetbrains_kotlin//:kotlin-test",
"@maven//:com_google_truth_truth",
"@maven//:junit_junit",
@ -82,8 +83,8 @@ kt_jvm_library(
java_test(
name = "test_lite_extensions",
runtime_deps = [":test_lite_extensions_library"],
test_class = "com.google.protobuf.kotlin.ExtendableMessageLiteExtensionsTest",
runtime_deps = [":test_lite_extensions_library"],
)
java_lite_proto_library(
@ -93,8 +94,8 @@ java_lite_proto_library(
internal_gen_kt_protos(
name = "gen_evil_names_proto2_lite",
deps = ["//java/kotlin:evil_names_proto2"],
lite = True,
deps = ["//java/kotlin:evil_names_proto2"],
)
java_lite_proto_library(
@ -104,8 +105,8 @@ java_lite_proto_library(
internal_gen_kt_protos(
name = "gen_evil_names_proto3_lite",
deps = ["//java/kotlin:evil_names_proto3"],
lite = True,
deps = ["//java/kotlin:evil_names_proto3"],
)
java_lite_proto_library(
@ -126,10 +127,10 @@ kt_jvm_library(
],
deps = [
":evil_names_proto2_java_proto_lite",
"//java/lite:lite",
"//:java_lite_test_protos",
"//java/kotlin:only_for_use_in_proto_generated_code_its_generator_and_tests",
"//java/kotlin:shared_runtime",
"//:java_lite_test_protos",
"//java/lite",
],
)
@ -143,10 +144,10 @@ kt_jvm_library(
deps = [
":evil_names_proto3_java_proto_lite",
":multiple_files_proto3_java_proto_lite",
"//java/lite:lite",
"//:java_lite_test_protos",
"//java/kotlin:only_for_use_in_proto_generated_code_its_generator_and_tests",
"//java/kotlin:shared_runtime",
"//:java_lite_test_protos",
"//java/lite",
],
)
@ -163,8 +164,8 @@ kt_jvm_library(
java_test(
name = "proto2_test_lite",
runtime_deps = [":proto2_test_lite_library"],
test_class = "com.google.protobuf.kotlin.Proto2LiteTest",
runtime_deps = [":proto2_test_lite_library"],
)
kt_jvm_library(
@ -180,6 +181,24 @@ kt_jvm_library(
java_test(
name = "proto3_test_lite",
runtime_deps = [":proto3_test_lite_library"],
test_class = "com.google.protobuf.kotlin.Proto3Test",
runtime_deps = [":proto3_test_lite_library"],
)
pkg_files(
name = "dist_files",
srcs = glob([
"src/main/kotlin/com/google/protobuf/*.kt",
"src/test/kotlin/**/*.kt",
]) + [
"BUILD",
"generate-sources-build.xml",
"generate-test-sources-build.xml",
"lite.awk",
"pom.xml",
"pom_template.xml",
"process-lite-sources-build.xml",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//java:__pkg__"],
)

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
</parent>
<artifactId>protobuf-kotlin-lite</artifactId>

@ -1,12 +1,13 @@
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_jvm_external//:kt_defs.bzl", "kt_jvm_export")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//:protobuf_version.bzl", "PROTOBUF_VERSION")
load("//:protobuf.bzl", "internal_gen_kt_protos")
exports_files([
"src/test/kotlin/com/google/protobuf/Proto3Test.kt",
"src/test/kotlin/com/google/protobuf/Proto3Test.kt",
])
# Kotlin generated protos depend on this and only this.
@ -36,34 +37,34 @@ kt_jvm_library(
kt_jvm_library(
name = "bytestring_lib",
srcs = ["src/main/kotlin/com/google/protobuf/ByteStrings.kt"],
deps = ["//java/lite"],
visibility = ["//java:__subpackages__"],
deps = ["//java/lite"],
)
kt_jvm_library(
name = "full_extensions",
srcs = [
"src/main/kotlin/com/google/protobuf/Anies.kt",
"src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt",
"src/main/kotlin/com/google/protobuf/Anies.kt",
"src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt",
],
deps = ["//java/core"],
)
kt_jvm_export(
name = "kotlin_mvn",
deploy_env = [
"@com_github_jetbrains_kotlin//:kotlin-stdlib",
"//java/core",
],
maven_coordinates = "com.google.protobuf:protobuf-kotlin:%s" % PROTOBUF_VERSION,
pom_template = "//java/kotlin:pom_template.xml",
resources = ["//:well_known_protos"],
runtime_deps = [
":bytestring_lib",
":full_extensions",
":only_for_use_in_proto_generated_code_its_generator_and_tests",
":shared_runtime",
":well_known_protos_kotlin",
],
deploy_env = [
"@com_github_jetbrains_kotlin//:kotlin-stdlib",
"//java/core",
":bytestring_lib",
":full_extensions",
":only_for_use_in_proto_generated_code_its_generator_and_tests",
":shared_runtime",
":well_known_protos_kotlin",
],
)
@ -82,10 +83,10 @@ test_suite(
name = "tests",
tests = [
"bytestring_test",
"shared_tests",
"test_extensions",
"proto2_test",
"proto3_test",
"shared_tests",
"test_extensions",
],
)
@ -103,8 +104,8 @@ kt_jvm_library(
java_test(
name = "bytestring_test",
runtime_deps = [":bytestring_test_library"],
test_class = "com.google.protobuf.kotlin.ByteStringsTest",
runtime_deps = [":bytestring_test_library"],
)
proto_library(
@ -131,31 +132,31 @@ kt_jvm_library(
":only_for_use_in_proto_generated_code_its_generator_and_tests",
":shared_runtime",
"@com_github_jetbrains_kotlin//:kotlin-test",
"@maven//:com_google_truth_truth",
"@maven//:com_google_guava_guava_testlib",
"@maven//:com_google_truth_truth",
"@maven//:junit_junit",
],
)
java_test(
name = "shared_tests",
runtime_deps = [":shared_tests_library"],
test_class = "com.google.protobuf.kotlin.DslListTest",
runtime_deps = [":shared_tests_library"],
)
kt_jvm_library(
name = "test_extensions_library",
srcs = [
"src/test/kotlin/com/google/protobuf/AniesTest.kt",
"src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt",
"src/test/kotlin/com/google/protobuf/AniesTest.kt",
"src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt",
],
deps = [
":example_extensible_message_java_proto",
":full_extensions",
"//java/core:core",
":kotlin_unittest",
":only_for_use_in_proto_generated_code_its_generator_and_tests",
":shared_runtime",
"//java/core",
"@com_github_jetbrains_kotlin//:kotlin-test",
"@maven//:com_google_truth_truth",
"@maven//:junit_junit",
@ -164,8 +165,8 @@ kt_jvm_library(
java_test(
name = "test_extensions",
runtime_deps = [":test_extensions_library"],
test_class = "com.google.protobuf.kotlin.ExtendableMessageExtensionsTest",
runtime_deps = [":test_extensions_library"],
)
proto_library(
@ -224,11 +225,11 @@ kt_jvm_library(
],
deps = [
":evil_names_proto2_java_proto",
"//java/core:core",
":only_for_use_in_proto_generated_code_its_generator_and_tests",
":shared_runtime",
":well_known_protos_kotlin",
"//:java_test_protos",
"//java/core",
],
)
@ -242,10 +243,10 @@ kt_jvm_library(
deps = [
":evil_names_proto3_java_proto",
":multiple_files_proto3_java_proto",
"//java/core:core",
":only_for_use_in_proto_generated_code_its_generator_and_tests",
":shared_runtime",
"//:java_test_protos",
"//java/core",
],
)
@ -262,8 +263,8 @@ kt_jvm_library(
java_test(
name = "proto2_test",
runtime_deps = [":proto2_test_library"],
test_class = "com.google.protobuf.kotlin.Proto2Test",
runtime_deps = [":proto2_test_library"],
)
kt_jvm_library(
@ -279,8 +280,8 @@ kt_jvm_library(
java_test(
name = "proto3_test",
runtime_deps = [":proto3_test_library"],
test_class = "com.google.protobuf.kotlin.Proto3Test",
runtime_deps = [":proto3_test_library"],
)
kt_jvm_library(
@ -289,8 +290,25 @@ kt_jvm_library(
"//:gen_well_known_protos_kotlin",
],
deps = [
"//java/core",
":only_for_use_in_proto_generated_code_its_generator_and_tests",
":shared_runtime",
":only_for_use_in_proto_generated_code_its_generator_and_tests",
":shared_runtime",
"//java/core",
],
)
pkg_files(
name = "dist_files",
srcs = glob([
"src/main/kotlin/com/google/protobuf/*.kt",
"src/test/kotlin/**/*.kt",
"src/test/proto/**/*.proto",
]) + [
"BUILD",
"generate-sources-build.xml",
"generate-test-sources-build.xml",
"pom.xml",
"pom_template.xml",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//java:__pkg__"],
)

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
</parent>
<artifactId>protobuf-kotlin</artifactId>

@ -29,7 +29,7 @@ protobuf Java Lite runtime. If you are using Maven, include the following:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-javalite</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
</dependency>
```

@ -1,4 +1,5 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")
load("//:internal.bzl", "conformance_test")
load("//java/internal:testing.bzl", "junit_tests")
@ -21,9 +22,6 @@ alias(
proto_lang_toolchain(
name = "toolchain",
command_line = "--java_out=lite:$(OUT)",
runtime = ":lite",
visibility = ["//visibility:public"],
# keep this in sync w/ LITE_WELL_KNOWN_PROTO_MAP in //:BUILD
blacklisted_protos = [
"//:any_proto",
@ -37,6 +35,9 @@ proto_lang_toolchain(
"//:type_proto",
"//:wrappers_proto",
],
command_line = "--java_out=lite:$(OUT)",
runtime = ":lite",
visibility = ["//visibility:public"],
)
test_suite(
@ -76,3 +77,20 @@ junit_tests(
"@maven//:junit_junit",
],
)
pkg_files(
name = "dist_files",
srcs = glob([
"**/*.java",
]) + [
"BUILD",
"generate-sources-build.xml",
"generate-test-sources-build.xml",
"lite.awk",
"pom.xml",
"pom_template.xml",
"process-lite-sources-build.xml",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//java:__pkg__"],
)

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
</parent>
<artifactId>protobuf-javalite</artifactId>

@ -4,7 +4,7 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
<packaging>pom</packaging>
<name>Protocol Buffers [Parent]</name>

@ -1,5 +1,6 @@
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@rules_jvm_external//:defs.bzl", "java_export")
load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//:protobuf_version.bzl", "PROTOBUF_VERSION")
load("//java/internal:testing.bzl", "junit_tests")
@ -23,11 +24,11 @@ java_library(
# Bazel users, don't depend on this target, use :util.
java_export(
name = "util_mvn",
deploy_env = ["//java/core"],
maven_coordinates = "com.google.protobuf:protobuf-java-util:%s" % PROTOBUF_VERSION,
pom_template = "pom_template.xml",
visibility = ["//java:__pkg__"],
runtime_deps = [":util"],
deploy_env = ["//java/core"],
)
filegroup(
@ -74,3 +75,18 @@ junit_tests(
"@maven//:junit_junit",
],
)
pkg_files(
name = "dist_files",
srcs = glob([
"src/main/**/*.java",
"src/test/**/*.java",
"src/test/**/*.proto",
]) + [
"BUILD",
"pom.xml",
"pom_template.xml",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//java:__pkg__"],
)

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
</parent>
<artifactId>protobuf-java-util</artifactId>

@ -0,0 +1,29 @@
# Protobuf JS runtime
#
# See also code generation logic under /src/google/protobuf/compiler/js.
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
pkg_files(
name = "dist_files",
srcs = glob([
"*.js",
"*.json",
"*.proto",
"binary/*.js",
"commonjs/*.js*", # js, json
"commonjs/**/*.proto",
"compatibility_tests/v3.0.0/**/*.js*",
"compatibility_tests/v3.0.0/**/*.proto",
"compatibility_tests/v3.0.0/**/*.sh",
"compatibility_tests/v3.1.0/**/*.js*",
"compatibility_tests/v3.1.0/**/*.proto",
"experimental/benchmarks/**/*.js",
"experimental/runtime/**/*.js",
]) + [
"BUILD",
"README.md",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)

@ -1,6 +1,6 @@
{
"name": "google-protobuf",
"version": "3.20.1-rc.1",
"version": "3.20.1",
"description": "Protocol Buffers for JavaScript",
"main": "google-protobuf.js",
"files": [

@ -1,242 +0,0 @@
# This Dockerfile specifies the recipe for creating an image for the tests
# to run in.
#
# We install as many test dependencies here as we can, because these setup
# steps can be cached. They do *not* run every time we run the build.
# The Docker image is only rebuilt when the Dockerfile (ie. this file)
# changes.
# Base Dockerfile for gRPC dev images
FROM debian:latest
# Apt source for old Python versions.
RUN echo 'deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main' > /etc/apt/sources.list.d/deadsnakes.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB82666C
# Apt source for Oracle Java.
RUN echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
# Apt source for Mono
RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list && \
echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
# Apt source for php
RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu trusty main" | tee /etc/apt/sources.list.d/various-php.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F4FCBB07
# Install dotnet SDK based on https://www.microsoft.com/net/core#debian
# (Ubuntu instructions need apt to support https)
RUN apt-get update && apt-get install -y --force-yes curl libunwind8 gettext && \
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=847105 && \
mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet && \
ln -s /opt/dotnet/dotnet /usr/local/bin
# Install dependencies. We start with the basic ones require to build protoc
# and the C++ build
RUN apt-get clean && apt-get update && apt-get install -y --force-yes \
autoconf \
autotools-dev \
build-essential \
bzip2 \
ccache \
curl \
gcc \
git \
libc6 \
libc6-dbg \
libc6-dev \
libgtest-dev \
libtool \
make \
parallel \
time \
wget \
# -- For csharp --
mono-devel \
referenceassemblies-pcl \
nunit \
# -- For all Java builds -- \
maven \
# -- For java_jdk7 -- \
openjdk-7-jdk \
# -- For java_oracle7 -- \
oracle-java7-installer \
# -- For python / python_cpp -- \
python-setuptools \
python-pip \
python-dev \
python2.6-dev \
python3.3-dev \
python3.4-dev \
# -- For Ruby --
ruby \
# -- For C++ benchmarks --
cmake \
# -- For PHP --
php5.6 \
php5.6-dev \
php5.6-xml \
php7.0 \
php7.0-dev \
php7.0-xml \
phpunit \
valgrind \
libxml2-dev \
&& apt-get clean
##################
# C# dependencies
RUN wget www.nuget.org/NuGet.exe -O /usr/local/bin/nuget.exe
##################
# Python dependencies
# These packages exist in apt-get, but their versions are too old, so we have
# to get updates from pip.
RUN pip install pip --upgrade
RUN pip install virtualenv tox yattag
##################
# Ruby dependencies
# Install rvm
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN \curl -sSL https://get.rvm.io | bash -s stable
# Install Ruby 2.1, Ruby 2.2 and JRuby 1.7
RUN /bin/bash -l -c "rvm install ruby-2.1"
RUN /bin/bash -l -c "rvm install ruby-2.2"
RUN /bin/bash -l -c "rvm install jruby-1.7"
RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
##################
# Java dependencies
# This step requires compiling protoc. :(
ENV MAVEN_REPO /var/maven_local_repository
ENV MVN mvn --batch-mode
RUN cd /tmp && \
git clone https://github.com/google/protobuf.git && \
cd protobuf && \
git reset --hard 129a6e2aca95dcfb6c3e717d7b9cca1f104fde39 && \
./autogen.sh && \
./configure && \
make -j4 && \
cd java && \
$MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO && \
cd ../javanano && \
$MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO
##################
# PHP dependencies.
RUN wget http://am1.php.net/get/php-5.5.38.tar.bz2/from/this/mirror
RUN mv mirror php-5.5.38.tar.bz2
RUN tar -xvf php-5.5.38.tar.bz2
RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.5-zts && \
make && make install && cd ..
RUN cd php-5.5.38 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.5 && \
make && make install && cd ..
RUN wget http://am1.php.net/get/php-5.6.30.tar.bz2/from/this/mirror
RUN mv mirror php-5.6.30.tar.bz2
RUN tar -xvf php-5.6.30.tar.bz2
RUN cd php-5.6.30 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.6-zts && \
make && make install && cd ..
RUN cd php-5.6.30 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.6 && \
make && make install && cd ..
RUN wget http://am1.php.net/get/php-7.0.18.tar.bz2/from/this/mirror
RUN mv mirror php-7.0.18.tar.bz2
RUN tar -xvf php-7.0.18.tar.bz2
RUN cd php-7.0.18 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.0-zts && \
make && make install && cd ..
RUN cd php-7.0.18 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.0 && \
make && make install && cd ..
RUN wget http://am1.php.net/get/php-7.1.4.tar.bz2/from/this/mirror
RUN mv mirror php-7.1.4.tar.bz2
RUN tar -xvf php-7.1.4.tar.bz2
RUN cd php-7.1.4 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.1-zts && \
make && make install && cd ..
RUN cd php-7.1.4 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.1 && \
make && make install && cd ..
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php composer-setup.php
RUN mv composer.phar /usr/bin/composer
RUN php -r "unlink('composer-setup.php');"
RUN composer config -g -- disable-tls true
RUN composer config -g -- secure-http false
RUN cd /tmp && \
rm -rf protobuf && \
git clone https://github.com/google/protobuf.git && \
cd protobuf && \
git reset --hard 49b44bff2b6257a119f9c6a342d6151c736586b8 && \
cd php && \
ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \
ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \
composer install && \
mv vendor /usr/local/vendor-5.5 && \
ln -sfn /usr/local/php-5.6/bin/php /usr/bin/php && \
ln -sfn /usr/local/php-5.6/bin/php-config /usr/bin/php-config && \
ln -sfn /usr/local/php-5.6/bin/phpize /usr/bin/phpize && \
composer install && \
mv vendor /usr/local/vendor-5.6 && \
ln -sfn /usr/local/php-7.0/bin/php /usr/bin/php && \
ln -sfn /usr/local/php-7.0/bin/php-config /usr/bin/php-config && \
ln -sfn /usr/local/php-7.0/bin/phpize /usr/bin/phpize && \
composer install && \
mv vendor /usr/local/vendor-7.0 && \
ln -sfn /usr/local/php-7.1/bin/php /usr/bin/php && \
ln -sfn /usr/local/php-7.1/bin/php-config /usr/bin/php-config && \
ln -sfn /usr/local/php-7.1/bin/phpize /usr/bin/phpize && \
composer install && \
mv vendor /usr/local/vendor-7.1
##################
# Go dependencies.
RUN apt-get install -y \
# -- For go -- \
golang
##################
# Javascript dependencies.
RUN apt-get install -y \
# -- For javascript -- \
npm
##################
# Python 3.5 3.6 dependencies.
RUN apt-get clean && apt-get update && apt-get install -y --force-yes \
python3.5-dev \
python3.6-dev \
&& apt-get clean
# On Debian/Ubuntu, nodejs binary is named 'nodejs' because the name 'node'
# is taken by another legacy binary. We don't have that legacy binary and
# npm expects the binary to be named 'node', so we just create a symbol
# link here.
RUN ln -s `which nodejs` /usr/bin/node
##################
# Prepare ccache
RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
RUN ln -s /usr/bin/ccache /usr/local/bin/g++
RUN ln -s /usr/bin/ccache /usr/local/bin/cc
RUN ln -s /usr/bin/ccache /usr/local/bin/c++
RUN ln -s /usr/bin/ccache /usr/local/bin/clang
RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
# Define the default command.
CMD ["bash"]

@ -18,7 +18,7 @@ fi
kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh
# the command that will be used to build and test java under an emulator
# * IsValidUtf8Test and DecodeUtf8Test tests are being skipped because that take very long under an emulator.
# * IsValidUtf8Test and DecodeUtf8Test tests are skipped because they take very long under an emulator.
TEST_JAVA_COMMAND="mvn --batch-mode -DskipTests install && mvn --batch-mode -Dtest='**/*Test, !**/*IsValidUtf8Test, !**/*DecodeUtf8Test' -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false surefire:test"
# use an actual aarch64 docker image (with a real aarch64 java and maven) to run build & test protobuf java under an emulator

@ -28,6 +28,7 @@ RUN apt-get update && apt-get install -y \
# Java dependencies
maven \
openjdk-11-jdk \
openjdk-17-jdk \
# Required for the gtest build.
python2 \
# Python dependencies

@ -1,17 +0,0 @@
#!/bin/bash
#
# This is the top-level script we give to Kokoro as the entry point for
# running the "pull request" project:
#
# This script selects a specific Dockerfile (for building a Docker image) and
# a script to run inside that image. Then we delegate to the general
# build_and_run_docker.sh script.
# Change to repo root
cd $(dirname $0)/../../..
export DOCKERFILE_DIR=kokoro/linux/64-bit
export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
export OUTPUT_DIR=testoutput
export TEST_SET="golang"
./kokoro/linux/build_and_run_docker.sh

@ -1,11 +0,0 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/golang/build.sh"
timeout_mins: 120
action {
define_artifacts {
regex: "**/sponge_log.xml"
}
}

@ -1,11 +0,0 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/golang/build.sh"
timeout_mins: 120
action {
define_artifacts {
regex: "**/sponge_log.xml"
}
}

@ -10,8 +10,10 @@
# Change to repo root
cd $(dirname $0)/../../..
export DOCKERFILE_DIR=kokoro/linux/64-bit
export DOCKERHUB_ORGANIZATION=protobuftesting
# The image of the Dockerfile sha1 is fetched from the organization
export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/java_stretch
export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
export OUTPUT_DIR=testoutput
export TEST_SET="python_compatibility"
export TEST_SET="java_jdk11"
./kokoro/linux/build_and_run_docker.sh

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh"
build_file: "protobuf/kokoro/linux/java_jdk11/build.sh"
timeout_mins: 120
action {

@ -0,0 +1,12 @@
# Config file for running Linkage Monitor in Kokoro
# https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/linkage-monitor
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/java_jdk11/build.sh"
timeout_mins: 120
action {
define_artifacts {
regex: "**/sponge_log.xml"
}
}

@ -10,8 +10,10 @@
# Change to repo root
cd $(dirname $0)/../../..
export DOCKERFILE_DIR=kokoro/linux/64-bit
export DOCKERHUB_ORGANIZATION=protobuftesting
# The image of the Dockerfile sha1 is fetched from the organization
export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/java_stretch
export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
export OUTPUT_DIR=testoutput
export TEST_SET="java_jdk7"
export TEST_SET="java_jdk17"
./kokoro/linux/build_and_run_docker.sh

@ -1,8 +1,8 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/java_jdk7/build.sh"
timeout_mins: 120
build_file: "protobuf/kokoro/linux/java_jdk17/build.sh"
timeout_mins: 60
action {
define_artifacts {

@ -0,0 +1,12 @@
# Config file for running Linkage Monitor in Kokoro
# https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/linkage-monitor
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/java_jdk17/build.sh"
timeout_mins: 60
action {
define_artifacts {
regex: "**/sponge_log.xml"
}
}

@ -1,11 +0,0 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/java_jdk7/build.sh"
timeout_mins: 120
action {
define_artifacts {
regex: "**/sponge_log.xml"
}
}

@ -1,17 +0,0 @@
#!/bin/bash
#
# This is the top-level script we give to Kokoro as the entry point for
# running the "pull request" project:
#
# This script selects a specific Dockerfile (for building a Docker image) and
# a script to run inside that image. Then we delegate to the general
# build_and_run_docker.sh script.
# Change to repo root
cd $(dirname $0)/../../..
export DOCKERFILE_DIR=kokoro/linux/64-bit
export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
export OUTPUT_DIR=testoutput
export TEST_SET="java_oracle7"
./kokoro/linux/build_and_run_docker.sh

@ -1,11 +0,0 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/java_oracle7/build.sh"
timeout_mins: 120
action {
define_artifacts {
regex: "**/sponge_log.xml"
}
}

@ -1,11 +0,0 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/java_oracle7/build.sh"
timeout_mins: 120
action {
define_artifacts {
regex: "**/sponge_log.xml"
}
}

@ -1,17 +0,0 @@
#!/bin/bash
#
# This is the entry point for kicking off a Kokoro job. This path is referenced
# from the .cfg files in this directory.
set -ex
cd $(dirname $0)
# Most of our tests use a debug build of PHP, but we do one build against an opt
# php just in case that surfaces anything unexpected.
../test_php.sh gcr.io/protobuf-build/php/linux:8.0.5-14a06550010c0649bf69b6c9b803c1ca609bbb6d
../test_php.sh gcr.io/protobuf-build/php/linux:7.0.33-dbg-14a06550010c0649bf69b6c9b803c1ca609bbb6d
../test_php.sh gcr.io/protobuf-build/php/linux:7.3.28-dbg-14a06550010c0649bf69b6c9b803c1ca609bbb6d
../test_php.sh gcr.io/protobuf-build/php/linux:7.4.18-dbg-14a06550010c0649bf69b6c9b803c1ca609bbb6d
../test_php.sh gcr.io/protobuf-build/php/linux:8.0.5-dbg-14a06550010c0649bf69b6c9b803c1ca609bbb6d

@ -1,5 +0,0 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/php80/build.sh"
timeout_mins: 20

@ -1,5 +0,0 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/php80/build.sh"
timeout_mins: 20

@ -1,5 +0,0 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_compatibility/build.sh"
timeout_mins: 1440

@ -1,5 +0,0 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_compatibility/build.sh"
timeout_mins: 1440

@ -1,17 +0,0 @@
#!/bin/bash
#
# This is the top-level script we give to Kokoro as the entry point for
# running the "pull request" project:
#
# This script selects a specific Dockerfile (for building a Docker image) and
# a script to run inside that image. Then we delegate to the general
# build_and_run_docker.sh script.
# Change to repo root
cd $(dirname $0)/../../..
export DOCKERFILE_DIR=kokoro/linux/64-bit
export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
export OUTPUT_DIR=testoutput
export TEST_SET="python_cpp"
./kokoro/linux/build_and_run_docker.sh

@ -1,11 +0,0 @@
# Config file for running tests in Kokoro
# Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh"
timeout_mins: 120
action {
define_artifacts {
regex: "**/sponge_log.xml"
}
}

@ -91,7 +91,8 @@ ruby --version | grep 'ruby 3.1.0'
for v in 3.1.0 ; do
ccache -c
rake -f "$CROSS_RUBY31" cross-ruby VERSION="$v" HOST=x86_64-darwin MAKE="$MAKE"
rake -f "$CROSS_RUBY31" cross-ruby VERSION="$v" HOST=aarch64-darwin MAKE="$MAKE"
# Disabled until it can be fixed: https://github.com/protocolbuffers/protobuf/issues/9804
# rake -f "$CROSS_RUBY31" cross-ruby VERSION="$v" HOST=aarch64-darwin MAKE="$MAKE"
done
set +x # rvm commands are very verbose
@ -101,7 +102,8 @@ ruby --version | grep 'ruby 2.7.0'
for v in 3.0.0 2.7.0 ; do
ccache -c
rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin MAKE="$MAKE"
rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=aarch64-darwin MAKE="$MAKE"
# Disabled until it can be fixed: https://github.com/protocolbuffers/protobuf/issues/9804
# rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=aarch64-darwin MAKE="$MAKE"
done
set +x
rvm use 2.5.0
@ -110,7 +112,8 @@ ruby --version | grep 'ruby 2.5.0'
for v in 2.6.0 2.5.1; do
ccache -c
rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin MAKE="$MAKE"
rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=aarch64-darwin MAKE="$MAKE"
# Disabled until it can be fixed: https://github.com/protocolbuffers/protobuf/issues/9804
# rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=aarch64-darwin MAKE="$MAKE"
done
set +x
rvm use 2.7.0

@ -1,4 +1,5 @@
load("@rules_cc//cc:defs.bzl", "objc_library")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
objc_library(
name = "objectivec",
@ -63,28 +64,59 @@ objc_library(
non_arc_srcs = [
"GPBAny.pbobjc.m",
"GPBApi.pbobjc.m",
"GPBDuration.pbobjc.m",
"GPBEmpty.pbobjc.m",
"GPBFieldMask.pbobjc.m",
"GPBSourceContext.pbobjc.m",
"GPBStruct.pbobjc.m",
"GPBTimestamp.pbobjc.m",
"GPBType.pbobjc.m",
"GPBWrappers.pbobjc.m",
"GPBArray.m",
"GPBCodedInputStream.m",
"GPBCodedOutputStream.m",
"GPBDescriptor.m",
"GPBDictionary.m",
"GPBDuration.pbobjc.m",
"GPBEmpty.pbobjc.m",
"GPBExtensionInternals.m",
"GPBExtensionRegistry.m",
"GPBFieldMask.pbobjc.m",
"GPBMessage.m",
"GPBRootObject.m",
"GPBSourceContext.pbobjc.m",
"GPBStruct.pbobjc.m",
"GPBTimestamp.pbobjc.m",
"GPBType.pbobjc.m",
"GPBUnknownField.m",
"GPBUnknownFieldSet.m",
"GPBUtilities.m",
"GPBWellKnownTypes.m",
"GPBWireFormat.m",
"GPBWrappers.pbobjc.m",
],
visibility = ["//visibility:public"],
)
pkg_files(
name = "dist_files",
srcs = glob([
"*.h",
"*.m",
"**/*.h",
"**/*.m",
"**/*.mm",
"**/*.swift",
"DevTools/*.sh",
"DevTools/*.py",
"ProtocolBuffers_iOS.xcodeproj/**/*",
"ProtocolBuffers_OSX.xcodeproj/**/*",
"ProtocolBuffers_tvOS.xcodeproj/**/*",
"Tests/CocoaPods/**/*",
"Tests/*.pddm",
"Tests/*.txt",
"Tests/*.plist",
"Tests/*.proto",
]) + [
".clang-format",
"BUILD",
"README.md",
"Tests/golden_message",
"Tests/golden_packed_fields_message",
"generate_well_known_types.sh",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)

@ -2070,9 +2070,9 @@ NSString *GPBTextFormatForUnknownFieldSet(GPBUnknownFieldSet *unknownSet,
for (GPBUnknownFieldSet *subUnknownSet in field.groupList) {
[result appendFormat:@"%@%d: {\n", lineIndent, fieldNumber];
NSString *subIndent = [lineIndent stringByAppendingString:@" "];
NSString *subUnknwonSetStr =
NSString *subUnknownSetStr =
GPBTextFormatForUnknownFieldSet(subUnknownSet, subIndent);
[result appendString:subUnknwonSetStr];
[result appendString:subUnknownSetStr];
[result appendFormat:@"%@}\n", lineIndent];
}
}

@ -0,0 +1,30 @@
# Protobuf PHP runtime
#
# See also code generation logic under /src/google/protobuf/compiler/php.
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
pkg_files(
name = "dist_files",
srcs = glob([
"ext/google/protobuf/**/*",
"src/GPBMetadata/Google/Protobuf/**/*.php",
"src/Google/Protobuf/**/*.php",
"tests/*.php",
"tests/*.sh",
"tests/proto/**/*.proto",
]) + [
"BUILD",
"README.md",
"REFCOUNTING.md",
"composer.json",
"generate_descriptor_protos.sh",
"generate_test_protos.sh",
"release.sh",
"src/phpdoc.dist.xml",
"tests/valgrind.supp",
],
prefix = "php",
strip_prefix = strip_prefix.from_pkg(""),
visibility = ["//pkg:__pkg__"],
)

@ -6,18 +6,18 @@
"homepage": "https://developers.google.com/protocol-buffers/",
"license": "BSD-3-Clause",
"require": {
"php": ">=5.5.0"
"php": ">=7.0.0"
},
"require-dev": {
"phpunit/phpunit": ">=4.8.0"
"phpunit/phpunit": ">=5.0.0"
},
"suggest": {
"ext-bcmath": "Need to support JSON deserialization"
},
"autoload": {
"psr-4": {
"Google\\Protobuf\\": "php/src/Google/Protobuf",
"GPBMetadata\\Google\\Protobuf\\": "php/src/GPBMetadata/Google/Protobuf"
"Google\\Protobuf\\": "src/Google/Protobuf",
"GPBMetadata\\Google\\Protobuf\\": "src/GPBMetadata/Google/Protobuf"
}
}
}

@ -10,10 +10,10 @@
<email>protobuf-opensource@google.com</email>
<active>yes</active>
</lead>
<date>2022-04-05</date>
<time>17:06:47</time>
<date>2022-04-20</date>
<time>22:01:25</time>
<version>
<release>3.20.1RC1</release>
<release>3.20.1</release>
<api>3.20.1</api>
</version>
<stability>
@ -1268,5 +1268,20 @@ G A release.
<notes>
</notes>
</release>
<release>
<version>
<release>3.20.1</release>
<api>3.20.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2022-04-20</date>
<time>22:01:25</time>
<license uri="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause</license>
<notes>
</notes>
</release>
</changelog>
</package>

@ -127,7 +127,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
#define PHP_PROTOBUF_VERSION "3.20.1RC1"
#define PHP_PROTOBUF_VERSION "3.20.1"
// ptr -> PHP object cache. This is a weak map that caches lazily-created
// wrapper objects around upb types:

@ -10,24 +10,17 @@ set -ex
VERSION=$1
rm -rf protobuf-php
git clone https://github.com/protocolbuffers/protobuf-php.git
git clone https://github.com/protocolbuffers/protobuf.git
# Clean old files
pushd protobuf-php
rm -rf src
popd
# Checkout the target version
pushd protobuf/php
git checkout -b $VERSION
popd
rm -rf protobuf-php/src
# Copy files
pushd protobuf-php
mv ../protobuf/php/src src
mv ../protobuf/composer.json composer.json
sed -i 's|php/src|src|g' composer.json
cp -r php/src protobuf-php
cp php/composer.json.dist protobuf-php/composer.json
cd protobuf-php
git add .
git commit -m "$VERSION"
if [ $(git tag -l "$VERSION") ]; then
@ -35,7 +28,3 @@ if [ $(git tag -l "$VERSION") ]; then
else
git tag "$VERSION"
fi
popd
# Clean up
rm -rf protobuf

@ -291,6 +291,10 @@ class GeneratedClassTest extends TestBase
// Test Enum methods
$this->assertEquals('ONE', TestEnum::name(1));
$this->assertEquals(1, TestEnum::value('ONE'));
$this->assertEquals('ECHO', TestEnum::name(3));
$this->assertEquals(3, TestEnum::value('ECHO'));
// Backwards compat value lookup by prefixed-name.
$this->assertEquals(3, TestEnum::value('PBECHO'));
}
public function testInvalidEnumValueThrowsException()

@ -1,8 +1,17 @@
load("@rules_pkg//:pkg.bzl", "pkg_zip")
load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_files")
load("@rules_pkg//:pkg.bzl", "pkg_tar", "pkg_zip")
load(
"@rules_pkg//:mappings.bzl",
"pkg_attributes",
"pkg_filegroup",
"pkg_files",
)
load("//:protobuf_release.bzl", "package_naming")
load(":cc_dist_library.bzl", "cc_dist_library")
package_naming(
name = "protobuf_pkg_naming",
)
pkg_files(
name = "wkt_protos_files",
srcs = [
@ -69,10 +78,6 @@ pkg_files(
visibility = ["//visibility:private"],
)
package_naming(
name = "protoc_pkg_naming",
)
pkg_zip(
name = "protoc_release",
srcs = [
@ -83,7 +88,249 @@ pkg_zip(
":wkt_protos_files",
],
package_file_name = "protoc-{version}-{platform}.zip",
package_variables = ":protoc_pkg_naming",
package_variables = ":protobuf_pkg_naming",
)
################################################################################
# Source distribution packaging
#
# TODO: these will eventually replace autotools for release artifact packaging.
################################################################################
pkg_filegroup(
name = "dist_common",
srcs = [
"//:common_dist_files",
"//:conformance_dist_files",
"//:cpp_dist_files", # to build protoc
"//benchmarks:all_dist_files",
"@com_google_protobuf_examples//:dist_files",
],
)
pkg_filegroup(
name = "cpp_srcs",
srcs = [
":dist_common",
"//:cpp_dist_files",
],
)
pkg_tar(
name = "dist_cpp_tar",
srcs = [":cpp_srcs"],
extension = "tar.gz",
package_dir = "protobuf-{version}",
package_file_name = "protobuf-cpp-{version}.tar.gz",
package_variables = ":protobuf_pkg_naming",
)
pkg_zip(
name = "dist_cpp_zip",
srcs = [":cpp_srcs"],
package_file_name = "protobuf-cpp-{version}.zip",
package_variables = ":protobuf_pkg_naming",
)
pkg_filegroup(
name = "csharp_srcs",
srcs = [
":dist_common",
"//:csharp_dist_files",
"//csharp:dist_files",
],
)
pkg_tar(
name = "dist_csharp_tar",
srcs = [":csharp_srcs"],
extension = "tar.gz",
package_dir = "protobuf-{version}",
package_file_name = "protobuf-csharp-{version}.tar.gz",
package_variables = ":protobuf_pkg_naming",
)
pkg_zip(
name = "dist_csharp_zip",
srcs = [":csharp_srcs"],
package_file_name = "protobuf-csharp-{version}.zip",
package_variables = ":protobuf_pkg_naming",
)
pkg_filegroup(
name = "java_srcs",
srcs = [
":dist_common",
"//java:all_dist_files",
],
)
pkg_tar(
name = "dist_java_tar",
srcs = [":java_srcs"],
extension = "tar.gz",
package_dir = "protobuf-{version}",
package_file_name = "protobuf-java-{version}.tar.gz",
package_variables = ":protobuf_pkg_naming",
)
pkg_zip(
name = "dist_java_zip",
srcs = [":java_srcs"],
package_file_name = "protobuf-java-{version}.zip",
package_variables = ":protobuf_pkg_naming",
)
pkg_filegroup(
name = "js_srcs",
srcs = [
":dist_common",
"//js:dist_files",
],
)
pkg_tar(
name = "dist_js_tar",
srcs = [":js_srcs"],
extension = "tar.gz",
package_dir = "protobuf-{version}",
package_file_name = "protobuf-js-{version}.tar.gz",
package_variables = ":protobuf_pkg_naming",
)
pkg_zip(
name = "dist_js_zip",
srcs = [":js_srcs"],
package_file_name = "protobuf-js-{version}.zip",
package_variables = ":protobuf_pkg_naming",
)
pkg_filegroup(
name = "objectivec_srcs",
srcs = [
":dist_common",
"//:objectivec_dist_files",
"//objectivec:dist_files",
],
)
pkg_tar(
name = "dist_objectivec_tar",
srcs = [":objectivec_srcs"],
extension = "tar.gz",
package_dir = "protobuf-{version}",
package_file_name = "protobuf-objectivec-{version}.tar.gz",
package_variables = ":protobuf_pkg_naming",
)
pkg_zip(
name = "dist_objectivec_zip",
srcs = [":objectivec_srcs"],
package_file_name = "protobuf-objectivec-{version}.zip",
package_variables = ":protobuf_pkg_naming",
)
pkg_filegroup(
name = "php_srcs",
srcs = [
":dist_common",
"//:php_dist_files",
"//php:dist_files",
],
)
pkg_tar(
name = "dist_php_tar",
srcs = [":php_srcs"],
extension = "tar.gz",
package_dir = "protobuf-{version}",
package_file_name = "protobuf-php-{version}.tar.gz",
package_variables = ":protobuf_pkg_naming",
)
pkg_zip(
name = "dist_php_zip",
srcs = [":php_srcs"],
package_file_name = "protobuf-php-{version}.zip",
package_variables = ":protobuf_pkg_naming",
)
pkg_filegroup(
name = "python_srcs",
srcs = [
":dist_common",
"//:python_dist_files",
],
)
pkg_tar(
name = "dist_python_tar",
srcs = [":python_srcs"],
extension = "tar.gz",
package_dir = "protobuf-{version}",
package_file_name = "protobuf-python-{version}.tar.gz",
package_variables = ":protobuf_pkg_naming",
)
pkg_zip(
name = "dist_python_zip",
srcs = [":python_srcs"],
package_file_name = "protobuf-python-{version}.zip",
package_variables = ":protobuf_pkg_naming",
)
pkg_filegroup(
name = "ruby_srcs",
srcs = [
":dist_common",
"//ruby:dist_files",
],
)
pkg_tar(
name = "dist_ruby_tar",
srcs = [":ruby_srcs"],
extension = "tar.gz",
package_dir = "protobuf-{version}",
package_file_name = "protobuf-ruby-{version}.tar.gz",
package_variables = ":protobuf_pkg_naming",
)
pkg_zip(
name = "dist_ruby_zip",
srcs = [":ruby_srcs"],
package_file_name = "protobuf-ruby-{version}.zip",
package_variables = ":protobuf_pkg_naming",
)
pkg_filegroup(
name = "dist_all",
srcs = [
":cpp_srcs",
":csharp_srcs",
":java_srcs",
":js_srcs",
":objectivec_srcs",
":php_srcs",
":python_srcs",
":ruby_srcs",
],
)
pkg_tar(
name = "dist_all_tar",
srcs = [":dist_all"],
extension = "tar.gz",
package_dir = "protobuf-{version}",
package_file_name = "protobuf-all-{version}.tar.gz",
package_variables = ":protobuf_pkg_naming",
)
pkg_zip(
name = "dist_all_zip",
srcs = [":dist_all"],
package_file_name = "protobuf-all-{version}.zip",
package_variables = ":protobuf_pkg_naming",
)
################################################################################

@ -11,7 +11,7 @@
# 2005 *or* 2008 can open them. (In version control, we keep things in
# MSVC 2008 format since that's what we use in development.)
# 4) Uses the result to create .tar.gz, .tar.bz2, and .zip versions and
# deposites them in the "dist" directory. In the .zip version, all
# deposits them in the "dist" directory. In the .zip version, all
# non-testdata .txt files are converted to Windows-style line endings.
# 5) Cleans up after itself.

@ -1,6 +1,7 @@
"""Load dependencies needed to compile the protobuf library as a 3rd-party consumer."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
PROTOBUF_MAVEN_ARTIFACTS = [
"com.google.code.findbugs:jsr305:3.0.2",
@ -72,8 +73,9 @@ def protobuf_deps():
if not native.existing_rule("rules_python"):
http_archive(
name = "rules_python",
sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
urls = ["https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz"],
sha256 = "9fcf91dbcc31fde6d1edb15f117246d912c33c36f44cf681976bd886538deba6",
strip_prefix = "rules_python-0.8.0",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.8.0.tar.gz",
)
if not native.existing_rule("rules_jvm_external"):
@ -100,3 +102,10 @@ def protobuf_deps():
urls = ["https://github.com/bazelbuild/rules_kotlin/releases/download/v1.5.0-beta-4/rules_kotlin_release.tgz"],
sha256 = "6cbd4e5768bdfae1598662e40272729ec9ece8b7bded8f0d2c81c8ff96dc139d",
)
if not native.existing_rule("upb"):
git_repository(
name = "upb",
remote = "https://github.com/protocolbuffers/upb.git",
commit = "a0bc6693b069e6d1f083c7727ea08621cea4155e",
)

@ -1 +1 @@
PROTOBUF_VERSION = '3.20.1-rc-1'
PROTOBUF_VERSION = '3.20.1'

@ -8,7 +8,7 @@
</parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
<packaging>pom</packaging>
<name>Protobuf Compiler</name>
<description>

@ -243,10 +243,10 @@ class DescriptorPoolTestBase(object):
self.assertRaises(KeyError, self.pool.FindMethodByName, '')
# TODO(jieluo): Fix python to raise correct errors.
if api_implementation.Type() == 'cpp':
error_type = TypeError
else:
if api_implementation.Type() == 'python':
error_type = AttributeError
else:
error_type = TypeError
self.assertRaises(error_type, self.pool.FindMessageTypeByName, 0)
self.assertRaises(error_type, self.pool.FindFieldByName, 0)
self.assertRaises(error_type, self.pool.FindExtensionByName, 0)
@ -395,7 +395,7 @@ class DescriptorPoolTestBase(object):
def testAddSerializedFile(self):
if isinstance(self, SecondaryDescriptorFromDescriptorDB):
if api_implementation.Type() == 'cpp':
if api_implementation.Type() != 'python':
# Cpp extension cannot call Add on a DescriptorPool
# that uses a DescriptorDatabase.
# TODO(jieluo): Fix python and cpp extension diff.
@ -434,7 +434,7 @@ class DescriptorPoolTestBase(object):
_CheckDefaultValue(file_descriptor)
if isinstance(self, SecondaryDescriptorFromDescriptorDB):
if api_implementation.Type() == 'cpp':
if api_implementation.Type() != 'python':
# Cpp extension cannot call Add on a DescriptorPool
# that uses a DescriptorDatabase.
# TODO(jieluo): Fix python and cpp extension diff.
@ -488,7 +488,7 @@ class DescriptorPoolTestBase(object):
def testAddFileDescriptor(self):
if isinstance(self, SecondaryDescriptorFromDescriptorDB):
if api_implementation.Type() == 'cpp':
if api_implementation.Type() != 'python':
# Cpp extension cannot call Add on a DescriptorPool
# that uses a DescriptorDatabase.
# TODO(jieluo): Fix python and cpp extension diff.
@ -499,7 +499,7 @@ class DescriptorPoolTestBase(object):
def testComplexNesting(self):
if isinstance(self, SecondaryDescriptorFromDescriptorDB):
if api_implementation.Type() == 'cpp':
if api_implementation.Type() != 'python':
# Cpp extension cannot call Add on a DescriptorPool
# that uses a DescriptorDatabase.
# TODO(jieluo): Fix python and cpp extension diff.
@ -518,7 +518,7 @@ class DescriptorPoolTestBase(object):
def testConflictRegister(self):
if isinstance(self, SecondaryDescriptorFromDescriptorDB):
if api_implementation.Type() == 'cpp':
if api_implementation.Type() != 'python':
# Cpp extension cannot call Add on a DescriptorPool
# that uses a DescriptorDatabase.
# TODO(jieluo): Fix python and cpp extension diff.
@ -527,7 +527,7 @@ class DescriptorPoolTestBase(object):
unittest_pb2.DESCRIPTOR.serialized_pb)
conflict_fd = copy.deepcopy(unittest_fd)
conflict_fd.name = 'other_file'
if api_implementation.Type() == 'cpp':
if api_implementation.Type() != 'python':
pass
else:
pool = copy.deepcopy(self.pool)
@ -670,7 +670,7 @@ class SecondaryDescriptorFromDescriptorDB(DescriptorPoolTestBase,
# called the first time, a KeyError will be raised but call the find
# method later will return a descriptor which is not build.
# TODO(jieluo): fix pure python to revert the load if file can not be build
if api_implementation.Type() == 'cpp':
if api_implementation.Type() != 'python':
error_msg = ('Invalid proto descriptor for file "error_file":\\n '
'collector.ErrorMessage.nested_message_field: "SubMessage" '
'is not defined.\\n collector.ErrorMessage.MyOneof: Oneof '
@ -906,8 +906,8 @@ class AddDescriptorTest(unittest.TestCase):
pool.FindFileContainingSymbol(
prefix + 'protobuf_unittest.TestAllTypes.NestedMessage').name)
@unittest.skipIf(api_implementation.Type() == 'cpp',
'With the cpp implementation, Add() must be called first')
@unittest.skipIf(api_implementation.Type() != 'python',
'Only pure python allows _Add*()')
def testMessage(self):
self._TestMessage('')
self._TestMessage('.')
@ -948,14 +948,14 @@ class AddDescriptorTest(unittest.TestCase):
pool.FindFileContainingSymbol(
prefix + 'protobuf_unittest.TestAllTypes.NestedEnum').name)
@unittest.skipIf(api_implementation.Type() == 'cpp',
'With the cpp implementation, Add() must be called first')
@unittest.skipIf(api_implementation.Type() != 'python',
'Only pure python allows _Add*()')
def testEnum(self):
self._TestEnum('')
self._TestEnum('.')
@unittest.skipIf(api_implementation.Type() == 'cpp',
'With the cpp implementation, Add() must be called first')
@unittest.skipIf(api_implementation.Type() != 'python',
'Only pure python allows _Add*()')
def testService(self):
pool = descriptor_pool.DescriptorPool()
with self.assertRaises(KeyError):
@ -965,8 +965,8 @@ class AddDescriptorTest(unittest.TestCase):
'protobuf_unittest.TestService',
pool.FindServiceByName('protobuf_unittest.TestService').full_name)
@unittest.skipIf(api_implementation.Type() == 'cpp',
'With the cpp implementation, Add() must be called first')
@unittest.skipIf(api_implementation.Type() != 'python',
'Only pure python allows _Add*()')
def testFile(self):
pool = descriptor_pool.DescriptorPool()
pool._AddFileDescriptor(unittest_pb2.DESCRIPTOR)
@ -1043,7 +1043,7 @@ class AddDescriptorTest(unittest.TestCase):
def testAddTypeError(self):
pool = descriptor_pool.DescriptorPool()
if api_implementation.Type() == 'cpp':
if api_implementation.Type() != 'python':
with self.assertRaises(TypeError):
pool.AddDescriptor(0)
with self.assertRaises(TypeError):

@ -58,11 +58,7 @@ from google.protobuf import map_proto2_unittest_pb2
from google.protobuf import map_unittest_pb2
from google.protobuf import unittest_pb2
from google.protobuf import unittest_proto3_arena_pb2
from google.protobuf import descriptor_pb2
from google.protobuf import descriptor
from google.protobuf import descriptor_pool
from google.protobuf import message_factory
from google.protobuf import text_format
from google.protobuf.internal import api_implementation
from google.protobuf.internal import encoder
from google.protobuf.internal import more_extensions_pb2
@ -2542,66 +2538,34 @@ class PackedFieldTest(unittest.TestCase):
self.assertEqual(golden_data, message.SerializeToString())
@unittest.skipIf(api_implementation.Type() != 'cpp',
@unittest.skipIf(api_implementation.Type() == 'python',
'explicit tests of the C++ implementation')
@testing_refleaks.TestCase
class OversizeProtosTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
# At the moment, reference cycles between DescriptorPool and Message classes
# are not detected and these objects are never freed.
# To avoid errors with ReferenceLeakChecker, we create the class only once.
file_desc = """
name: "f/f.msg2"
package: "f"
message_type {
name: "msg1"
field {
name: "payload"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
}
}
message_type {
name: "msg2"
field {
name: "field"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: "msg1"
}
}
"""
pool = descriptor_pool.DescriptorPool()
desc = descriptor_pb2.FileDescriptorProto()
text_format.Parse(file_desc, desc)
pool.Add(desc)
cls.proto_cls = message_factory.MessageFactory(pool).GetPrototype(
pool.FindMessageTypeByName('f.msg2'))
def setUp(self):
self.p = self.proto_cls()
self.p.field.payload = 'c' * (1024 * 1024 * 64 + 1)
self.p_serialized = self.p.SerializeToString()
def GenerateNestedProto(self, n):
msg = unittest_pb2.TestRecursiveMessage()
sub = msg
for _ in range(n):
sub = sub.a
sub.i = 0
return msg.SerializeToString()
def testSucceedOkSizedProto(self):
msg = unittest_pb2.TestRecursiveMessage()
msg.ParseFromString(self.GenerateNestedProto(100))
def testAssertOversizeProto(self):
from google.protobuf.pyext._message import SetAllowOversizeProtos
SetAllowOversizeProtos(False)
q = self.proto_cls()
try:
q.ParseFromString(self.p_serialized)
except message.DecodeError as e:
self.assertEqual(str(e), 'Error parsing message')
api_implementation._c_module.SetAllowOversizeProtos(False)
msg = unittest_pb2.TestRecursiveMessage()
with self.assertRaises(message.DecodeError) as context:
msg.ParseFromString(self.GenerateNestedProto(101))
self.assertIn('Error parsing message', str(context.exception))
def testSucceedOversizeProto(self):
from google.protobuf.pyext._message import SetAllowOversizeProtos
SetAllowOversizeProtos(True)
q = self.proto_cls()
q.ParseFromString(self.p_serialized)
self.assertEqual(self.p.field.payload, q.field.payload)
api_implementation._c_module.SetAllowOversizeProtos(True)
msg = unittest_pb2.TestRecursiveMessage()
msg.ParseFromString(self.GenerateNestedProto(101))
if __name__ == '__main__':

@ -184,7 +184,7 @@ class UnknownFieldsAccessorsTest(unittest.TestCase):
# serialized string is checked.
# TODO(jieluo): Remove message._unknown_fields.
def InternalCheckUnknownField(self, name, expected_value):
if api_implementation.Type() == 'cpp':
if api_implementation.Type() != 'python':
return
field_descriptor = self.descriptor.fields_by_name[name]
wire_type = type_checkers.FIELD_TYPE_TO_WIRE_TYPE[field_descriptor.type]

@ -0,0 +1,34 @@
# Protobuf Ruby runtime
#
# See also code generation logic under /src/google/protobuf/compiler/ruby.
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
pkg_files(
name = "dist_files",
srcs = glob([
"compatibility_tests/v3.0.0/**/*",
"ext/google/protobuf_c/*",
"src/main/java/com/google/protobuf/jruby/*.java",
"tests/*.proto",
"tests/*.rb",
]) + [
".gitignore",
"BUILD",
"Gemfile",
"README.md",
"Rakefile",
"google-protobuf.gemspec",
"lib/google/protobuf.rb",
"lib/google/protobuf/descriptor_dsl.rb",
"lib/google/protobuf/message_exts.rb",
"lib/google/protobuf/repeated_field.rb",
"lib/google/protobuf/well_known_types.rb",
"pom.xml",
"src/main/java/google/ProtobufJavaService.java",
"src/main/sentinel.proto",
"travis-test.sh",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)

@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "google-protobuf"
s.version = "3.20.1.rc.1"
s.version = "3.20.1"
git_tag = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag
s.licenses = ["BSD-3-Clause"]
s.summary = "Protocol Buffers"

@ -9,7 +9,7 @@
<groupId>com.google.protobuf.jruby</groupId>
<artifactId>protobuf-jruby</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
<name>Protocol Buffer JRuby native extension</name>
<description>
Protocol Buffers are a way of encoding structured data in an efficient yet
@ -76,7 +76,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.20.1-rc-1</version>
<version>3.20.1</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>

@ -31,8 +31,6 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_FIELD_H__
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_FIELD_H__
#include <string>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/csharp/csharp_primitive_field.h>

@ -31,8 +31,6 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_MAP_FIELD_H__
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_MAP_FIELD_H__
#include <string>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/csharp/csharp_field_base.h>

@ -31,8 +31,6 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_FIELD_H__
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_FIELD_H__
#include <string>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/csharp/csharp_field_base.h>

@ -31,8 +31,6 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_PRIMITIVE_FIELD_H__
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_PRIMITIVE_FIELD_H__
#include <string>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/csharp/csharp_field_base.h>

@ -31,8 +31,6 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_ENUM_FIELD_H__
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_ENUM_FIELD_H__
#include <string>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/csharp/csharp_field_base.h>

@ -31,8 +31,6 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__
#include <string>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/csharp/csharp_field_base.h>

@ -31,8 +31,6 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_PRIMITIVE_FIELD_H__
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_PRIMITIVE_FIELD_H__
#include <string>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/csharp/csharp_field_base.h>

@ -31,8 +31,6 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_WRAPPER_FIELD_H__
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_WRAPPER_FIELD_H__
#include <string>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/csharp/csharp_field_base.h>

@ -86,8 +86,7 @@ const char* kForbiddenWordList[] = {
"AllFields",
"DescriptorForType",
"InitializationErrorString",
// TODO(b/219045204): re-enable
// "UnknownFields",
"UnknownFields",
// obsolete. kept for backwards compatibility of generated code
"CachedSize",
};

@ -34,7 +34,6 @@
#include <google/protobuf/compiler/objectivec/objectivec_enum_field.h>
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/wire_format.h>
namespace google {
namespace protobuf {

@ -37,7 +37,6 @@
#include <google/protobuf/compiler/objectivec/objectivec_message_field.h>
#include <google/protobuf/compiler/objectivec/objectivec_primitive_field.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
namespace google {

@ -41,8 +41,6 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/descriptor.pb.h>
namespace google {

@ -34,7 +34,6 @@
#include <google/protobuf/compiler/objectivec/objectivec_message_field.h>
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/wire_format.h>
namespace google {
namespace protobuf {

@ -35,8 +35,6 @@
#include <google/protobuf/compiler/objectivec/objectivec_primitive_field.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/wire_format_lite.h>
namespace google {
namespace protobuf {

@ -31,8 +31,6 @@
#ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_PRIMITIVE_FIELD_H__
#define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_PRIMITIVE_FIELD_H__
#include <map>
#include <string>
#include <google/protobuf/compiler/objectivec/objectivec_field.h>
namespace google {

@ -1373,11 +1373,18 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en,
"name", fullname);
Indent(&printer);
bool hasReserved = false;
for (int i = 0; i < en->value_count(); i++) {
const EnumValueDescriptor* value = en->value(i);
GenerateEnumValueDocComment(&printer, value);
std::string prefix = ConstantNamePrefix(value->name());
if (!prefix.empty()) {
hasReserved = true;
}
printer.Print("const ^name^ = ^number^;\n",
"name", ConstantNamePrefix(value->name()) + value->name(),
"name", prefix + value->name(),
"number", IntToString(value->number()));
}
@ -1385,8 +1392,9 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en,
Indent(&printer);
for (int i = 0; i < en->value_count(); i++) {
const EnumValueDescriptor* value = en->value(i);
printer.Print("self::^name^ => '^name^',\n",
"name", ConstantNamePrefix(value->name()) + value->name());
printer.Print("self::^constant^ => '^name^',\n",
"constant", ConstantNamePrefix(value->name()) + value->name(),
"name", value->name());
}
Outdent(&printer);
printer.Print("];\n");
@ -1416,12 +1424,22 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en,
printer.Print("$const = __CLASS__ . '::' . strtoupper($name);\n"
"if (!defined($const)) {\n");
Indent(&printer);
if (hasReserved) {
printer.Print("$pbconst = __CLASS__. '::PB' . strtoupper($name);\n"
"if (!defined($pbconst)) {\n");
Indent(&printer);
}
printer.Print("throw new UnexpectedValueException(sprintf(\n");
Indent(&printer);
Indent(&printer);
printer.Print("'Enum %s has no value defined for name %s', __CLASS__, $name));\n");
Outdent(&printer);
Outdent(&printer);
if (hasReserved) {
Outdent(&printer);
printer.Print("}\n"
"return constant($pbconst);\n");
}
Outdent(&printer);
printer.Print("}\n"
"return constant($const);\n");

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save