From 1f62059ea19cf04b27b9674c6951fd201dd3e81b Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Tue, 14 Feb 2023 13:08:07 -0800 Subject: [PATCH 01/42] Only run code-spell on our main branches PiperOrigin-RevId: 509616839 --- .github/workflows/codespell.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index e17f174d4e..26b4a327b4 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -2,7 +2,16 @@ # https://github.com/codespell-project/actions-codespell # https://github.com/codespell-project/codespell name: codespell -on: [push, pull_request] +on: + push: + branches: + - main + - '[0-9]+.x' + pull_request: + branches: + - main + - '[0-9]+.x' + permissions: contents: read # to fetch code (actions/checkout) jobs: From 3dd5e8ee6a6d5e52ecdc1294e074fef039455176 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 15 Feb 2023 15:09:52 -0800 Subject: [PATCH 02/42] Implement a workaround for macOS/Bazel flakes. Bazel has a 2 minute timeout for their internal `xcrun` call, which can be exceeded on our github runners about 5% of the time. This leads to flakes and opaque errors, but is a one-time cost. Subsequent xcruns finish in seconds, so we can just do an initial call w/o a timeout before running Bazel. With this change our total flake rate drops from ~30% to nearly 0% for our full suite of tests See https://github.com/bazelbuild/bazel/issues/17437 for background. PiperOrigin-RevId: 509944178 --- .github/actions/bazel/action.yml | 23 +++++++++++++++++++ .../actions/internal/bazel-setup/action.yml | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/actions/bazel/action.yml b/.github/actions/bazel/action.yml index 141527db02..5fd3e9a901 100644 --- a/.github/actions/bazel/action.yml +++ b/.github/actions/bazel/action.yml @@ -93,6 +93,29 @@ runs: shell: bash run: bazelisk version + # Bazel has multiple Xcode calls with hardcoded timeouts. Many of these + # end up timing out on our github runners, causing flakes on every mac + # build that invoked Bazel. To work around this, we manually inoke these + # calls before running Bazel to make sure they end up in Xcode's cache for + # quicker runs later. All of these calls are obtained from xcrun calls in + # https://github.com/bazelbuild/bazel/blob/e8a69f5d5acaeb6af760631490ecbf73e8a04eeb/tools/cpp/osx_cc_configure.bzl. + # See https://github.com/bazelbuild/bazel/issues/17437 for more details. + # TODO(b/269503614) Remove this once Bazel provides an official solution. + - name: Warm up Xcode + if: ${{ runner.os == 'macOS' }} + shell: bash + run: | + mkdir -p mac_bazel_workaround + bazelisk ${{ steps.bazel.outputs.bazel-startup-flags }} build @bazel_tools//tools/osx:xcode_locator.m $BAZEL_FLAGS + XCODE_LOCATOR_FLAGS="--sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices -framework Foundation" + SINGLE_ARCH_COMPILE_FLAGS="--sdk macosx clang -mmacosx-version-min=10.9 -std=c++11 -lc++ -O3" + COMPILE_FLAGS="$SINGLE_ARCH_COMPILE_FLAGS -arch arm64 -arch x86_64 -Wl,-no_adhoc_codesign -Wl,-no_uuid -O3" + time env -i DEVELOPER_DIR=$DEVELOPER_DIR xcrun $XCODE_LOCATOR_FLAGS -o mac_bazel_workaround/xcode-locator-bin $(bazel info output_base)/external/bazel_tools/tools/osx/xcode_locator.m + time env -i DEVELOPER_DIR=$DEVELOPER_DIR xcrun $SINGLE_ARCH_COMPILE_FLAGS -o mac_bazel_workaround/libtool_check_unique $(bazel info output_base)/external/bazel_tools/tools/objc/libtool_check_unique.cc + time env -i DEVELOPER_DIR=$DEVELOPER_DIR xcrun $COMPILE_FLAGS -o mac_bazel_workaround/libtool_check_unique $(bazel info output_base)/external/bazel_tools/tools/objc/libtool_check_unique.cc + time env -i DEVELOPER_DIR=$DEVELOPER_DIR xcrun $SINGLE_ARCH_COMPILE_FLAGS -o mac_bazel_workaround/wrapped_clang $(bazel info output_base)/external/bazel_tools/tools/osx/crosstool/wrapped_clang.cc + time env -i DEVELOPER_DIR=$DEVELOPER_DIR xcrun $COMPILE_FLAGS -o mac_bazel_workaround/wrapped_clang $(bazel info output_base)/external/bazel_tools/tools/osx/crosstool/wrapped_clang.cc + - name: Run Bash if: ${{ inputs.bash }} run: ${{ inputs.bash }} diff --git a/.github/actions/internal/bazel-setup/action.yml b/.github/actions/internal/bazel-setup/action.yml index 20e724199f..0ef5d5a226 100644 --- a/.github/actions/internal/bazel-setup/action.yml +++ b/.github/actions/internal/bazel-setup/action.yml @@ -42,7 +42,9 @@ runs: - name: Initialize MacOS-specific Bazel flags if: runner.os == 'macOS' shell: bash - run: echo "BAZEL_FLAGS=$BAZEL_FLAGS --xcode_version_config=//.github:host_xcodes" >> $GITHUB_ENV + run: | + echo "BAZEL_FLAGS=$BAZEL_FLAGS --xcode_version_config=//.github:host_xcodes" >> $GITHUB_ENV + echo "DEVELOPER_DIR=${{ env.DEVELOPER_DIR || '/Applications/Xcode_14.1.app/Contents/Developer' }}" >> $GITHUB_ENV - name: Configure Bazel caching # Skip bazel cache for local act runs due to issue with credential files From a98e8e1b70d2a3c63b78c5eeb20a7838b3708526 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Thu, 16 Feb 2023 09:30:31 -0800 Subject: [PATCH 03/42] Pull any new changes before pushing staleness updates. This fixes some relatively harmless flakiness in our post-submit. If two commits are made within ~5 minutes of each other, the `git push` command will fail because the git workspace isn't up to date. PiperOrigin-RevId: 510165977 --- push_auto_update.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/push_auto_update.sh b/push_auto_update.sh index 0d0e4371b0..9972da6acf 100755 --- a/push_auto_update.sh +++ b/push_auto_update.sh @@ -39,6 +39,7 @@ else commit_message="Auto-generate files" fi +git pull --rebase git add -A git diff --staged --quiet || git commit -am "$commit_message" git push From d4221d292eff259128ae67f61813f2cfc0b3e253 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Thu, 16 Feb 2023 11:42:17 -0800 Subject: [PATCH 04/42] Cache our ccache download to avoid network flakes from choco. Chocolatey doesn't support any caching, so we're moving back to downloading the exe directly. This issue is responsible for a 5-10% flake rate in our windows cmake builds PiperOrigin-RevId: 510202223 --- .../internal/ccache-setup-windows/action.yml | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/actions/internal/ccache-setup-windows/action.yml b/.github/actions/internal/ccache-setup-windows/action.yml index a42e7bf8a8..7b9f9925b3 100644 --- a/.github/actions/internal/ccache-setup-windows/action.yml +++ b/.github/actions/internal/ccache-setup-windows/action.yml @@ -16,9 +16,41 @@ runs: arch: x64 vsversion: '2019' - - name: Install ccache + - name: Setup ccache path shell: bash - run: choco install ccache --version=4.7.4 + run: | + echo "CCACHE_EXE_PATH=$LOCALAPPDATA\ccache-${{ inputs.ccache-version }}-windows-x86_64" >> $GITHUB_ENV + echo "$LOCALAPPDATA\ccache-${{ inputs.ccache-version }}-windows-x86_64" >> $GITHUB_PATH + + - name: Add ccache to Powershell path + shell: pwsh + run: echo "%LOCALAPPDATA%\ccache-${{ inputs.ccache-version }}-windows-x86_64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - name: Setup caching of ccache download + if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }} + id: ccache-cache + uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4 + with: + path: ${{ env.CCACHE_EXE_PATH }} + key: ccache-exe-${{ inputs.ccache-version }} + + - name: Restore ccache download + if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + id: ccache-restore + uses: actions/cache/restore@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4 + with: + path: ${{ env.CCACHE_EXE_PATH }} + key: ccache-exe-${{ inputs.ccache-version }} + + - name: Download ccache + shell: bash + if: ${{ steps.ccache-cache.outputs.cache-hit != 'true' && steps.ccache-restore.outputs.cache-hit != 'true'}} + run: | + cd $LOCALAPPDATA + curl -kLSs "https://github.com/ccache/ccache/releases/download/v${{ inputs.ccache-version }}/ccache-${{ inputs.ccache-version }}-windows-x86_64.zip" -o ccache.zip + unzip ccache.zip + rm ccache.zip + ccache --version - name: Configure ccache environment variables shell: pwsh From 71d6d767b905a5e8dc1e5e737d7d0f72acc984c2 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Thu, 16 Feb 2023 13:24:38 -0800 Subject: [PATCH 05/42] Fix typo in GHA --- .github/actions/bazel/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/bazel/action.yml b/.github/actions/bazel/action.yml index 5fd3e9a901..952dfad09d 100644 --- a/.github/actions/bazel/action.yml +++ b/.github/actions/bazel/action.yml @@ -95,7 +95,7 @@ runs: # Bazel has multiple Xcode calls with hardcoded timeouts. Many of these # end up timing out on our github runners, causing flakes on every mac - # build that invoked Bazel. To work around this, we manually inoke these + # build that invoked Bazel. To work around this, we manually invoke these # calls before running Bazel to make sure they end up in Xcode's cache for # quicker runs later. All of these calls are obtained from xcrun calls in # https://github.com/bazelbuild/bazel/blob/e8a69f5d5acaeb6af760631490ecbf73e8a04eeb/tools/cpp/osx_cc_configure.bzl. From 9c89a70e6b62ec2914fa7ff72570c553e530b9b7 Mon Sep 17 00:00:00 2001 From: deannagarcia <69992229+deannagarcia@users.noreply.github.com> Date: Fri, 17 Feb 2023 13:26:53 -0800 Subject: [PATCH 06/42] Strip "src" from file name of plugin.proto In 22.x, we accidentally omitted stripping the "src" import prefix for plugin.proto. We stripped the prefix in 21.x and for all other well known types in 22.x. This reverts that unintentional change. --- src/google/protobuf/compiler/BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/src/google/protobuf/compiler/BUILD.bazel b/src/google/protobuf/compiler/BUILD.bazel index cfbf714870..1d3a33570b 100644 --- a/src/google/protobuf/compiler/BUILD.bazel +++ b/src/google/protobuf/compiler/BUILD.bazel @@ -20,6 +20,7 @@ proto_library( "//:__pkg__", "//pkg:__pkg__", ], + strip_import_prefix = "src", deps = ["//:descriptor_proto"], ) From 491d27e4e65417e16501b4dc2ebe74d8567a8d5a Mon Sep 17 00:00:00 2001 From: deannagarcia <69992229+deannagarcia@users.noreply.github.com> Date: Fri, 17 Feb 2023 13:33:10 -0800 Subject: [PATCH 07/42] Add plugin.proto to the list of well known files for python In 21.x, depending on "//python:well_known_types_py_pb2" provided a transitive dependency to `compiler/plugin.proto`. That dependency was incorrectly removed for 22.x. --- python/BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/python/BUILD.bazel b/python/BUILD.bazel index e67422b4ac..5fcece7f04 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -54,6 +54,7 @@ internal_py_proto_library( internal_copy_files( name = "copied_wkt_proto_files", srcs = [ + "//:compiler_plugin_proto", "//:well_known_type_protos", "//src/google/protobuf:descriptor_proto_srcs", ], From aece606096097cb8fa3f6770e3c2cd1359fb0295 Mon Sep 17 00:00:00 2001 From: deannagarcia <69992229+deannagarcia@users.noreply.github.com> Date: Fri, 17 Feb 2023 13:40:01 -0800 Subject: [PATCH 08/42] Add forward slash --- src/google/protobuf/compiler/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/protobuf/compiler/BUILD.bazel b/src/google/protobuf/compiler/BUILD.bazel index 1d3a33570b..5fb5fb87c3 100644 --- a/src/google/protobuf/compiler/BUILD.bazel +++ b/src/google/protobuf/compiler/BUILD.bazel @@ -20,7 +20,7 @@ proto_library( "//:__pkg__", "//pkg:__pkg__", ], - strip_import_prefix = "src", + strip_import_prefix = "/src", deps = ["//:descriptor_proto"], ) From 56c149863c812b50f05cf23b5b25da0a465e587d Mon Sep 17 00:00:00 2001 From: deannagarcia <69992229+deannagarcia@users.noreply.github.com> Date: Fri, 17 Feb 2023 13:43:21 -0800 Subject: [PATCH 09/42] Depend on proto file instead of proto library --- python/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/BUILD.bazel b/python/BUILD.bazel index 5fcece7f04..f6fe071152 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -54,9 +54,9 @@ internal_py_proto_library( internal_copy_files( name = "copied_wkt_proto_files", srcs = [ - "//:compiler_plugin_proto", "//:well_known_type_protos", "//src/google/protobuf:descriptor_proto_srcs", + "//src/google/protobuf/compiler:plugin.proto", ], strip_prefix = "src", ) From 620d21a8ac8ba9b00f4519df6af28f09d184ac3e Mon Sep 17 00:00:00 2001 From: deannagarcia <69992229+deannagarcia@users.noreply.github.com> Date: Fri, 17 Feb 2023 14:07:32 -0800 Subject: [PATCH 10/42] Add visibility of plugin.proto to python directory --- src/google/protobuf/compiler/BUILD.bazel | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/google/protobuf/compiler/BUILD.bazel b/src/google/protobuf/compiler/BUILD.bazel index cfbf714870..a0f3e84ef6 100644 --- a/src/google/protobuf/compiler/BUILD.bazel +++ b/src/google/protobuf/compiler/BUILD.bazel @@ -207,7 +207,10 @@ filegroup( exports_files( srcs = ["plugin.proto"], - visibility = ["//:__pkg__"], + visibility = [ + "//:__pkg__", + "//python:__pkg__", + ], ) cc_library( From 21a5e8dffec759a191ce2e8531043fe8e008e45d Mon Sep 17 00:00:00 2001 From: zhangskz Date: Tue, 21 Feb 2023 14:05:28 -0500 Subject: [PATCH 11/42] Allow empty commits for update_php_repo Fix exit code on git commit which was preventing force-push and tagging from running even though these should work without a new commit. An empty commit is probably clearer anyways to show that sync has happened. --- .github/workflows/update_php_repo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_php_repo.yml b/.github/workflows/update_php_repo.yml index 548cb6eefd..cb3383ad01 100644 --- a/.github/workflows/update_php_repo.yml +++ b/.github/workflows/update_php_repo.yml @@ -43,7 +43,7 @@ jobs: - name: Push Changes run: | git add --all - git commit -m "${{ env.VERSION }} sync" + git commit --allow-empty -m "${{ env.VERSION }} sync" git push --force origin master git tag -a ${{ env.VERSION_TAG }} -m "Tag release ${{ env.VERSION_TAG }}" git push origin ${{ env.VERSION_TAG }} From 9ee7b565c29c6b3216598261d5ad7b87f599b5c3 Mon Sep 17 00:00:00 2001 From: deannagarcia <69992229+deannagarcia@users.noreply.github.com> Date: Tue, 21 Feb 2023 12:03:40 -0800 Subject: [PATCH 12/42] Fix pom_template dependencies. All pom files need a dependency section and kotlin + util need to depend on protobuf-java and kotlin-lite should depend on protobuf-javalite. (#12009) This fixes https://github.com/protocolbuffers/protobuf/issues/11976 PiperOrigin-RevId: 511252224 --- java/core/pom_template.xml | 3 +++ java/kotlin-lite/pom_template.xml | 7 +++++++ java/kotlin/pom_template.xml | 7 +++++++ java/lite/pom_template.xml | 3 +++ java/util/pom_template.xml | 4 ++++ 5 files changed, 24 insertions(+) diff --git a/java/core/pom_template.xml b/java/core/pom_template.xml index 2c61281b0d..4a30ddc863 100644 --- a/java/core/pom_template.xml +++ b/java/core/pom_template.xml @@ -15,4 +15,7 @@ Core Protocol Buffers library. Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. + + {dependencies} + diff --git a/java/kotlin-lite/pom_template.xml b/java/kotlin-lite/pom_template.xml index f8a3397408..90d9857dd8 100644 --- a/java/kotlin-lite/pom_template.xml +++ b/java/kotlin-lite/pom_template.xml @@ -15,6 +15,13 @@ Kotlin lite Protocol Buffers library. Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. + + + ${groupId} + protobuf-javalite + + {dependencies} + 1.6.0 diff --git a/java/kotlin/pom_template.xml b/java/kotlin/pom_template.xml index 0feae33e54..d04bc89fc3 100644 --- a/java/kotlin/pom_template.xml +++ b/java/kotlin/pom_template.xml @@ -15,6 +15,13 @@ Kotlin core Protocol Buffers library. Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. + + + ${groupId} + protobuf-java + + {dependencies} + 1.6.0 diff --git a/java/lite/pom_template.xml b/java/lite/pom_template.xml index 6d705fdcbe..fa6cfd2ae6 100644 --- a/java/lite/pom_template.xml +++ b/java/lite/pom_template.xml @@ -15,5 +15,8 @@ Lite version of Protocol Buffers library. This version is optimized for code size, but does not guarantee API/ABI stability. + + {dependencies} + diff --git a/java/util/pom_template.xml b/java/util/pom_template.xml index 13fe3ecf1c..f897892510 100644 --- a/java/util/pom_template.xml +++ b/java/util/pom_template.xml @@ -13,6 +13,10 @@ Protocol Buffers [Util] Utilities for Protocol Buffers + + ${groupId} + protobuf-java + {dependencies} From e909bfc5174b73d5bcf32199bc0f71dde7325c2f Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Wed, 22 Feb 2023 13:49:28 -0800 Subject: [PATCH 13/42] Add OSGi headers to pom files. This addresses https://github.com/protocolbuffers/protobuf/issues/12017. PiperOrigin-RevId: 511587640 --- java/core/pom_template.xml | 20 ++++++++++++++++++++ java/lite/pom_template.xml | 19 +++++++++++++++++++ java/util/pom_template.xml | 19 +++++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/java/core/pom_template.xml b/java/core/pom_template.xml index 4a30ddc863..11bd41964f 100644 --- a/java/core/pom_template.xml +++ b/java/core/pom_template.xml @@ -18,4 +18,24 @@ {dependencies} + + + + + + org.apache.felix + maven-bundle-plugin + true + + + com.google.protobuf + https://developers.google.com/protocol-buffers/ + com.google.protobuf + com.google.protobuf;version=${project.version} + sun.misc;resolution:=optional,* + + + + + diff --git a/java/lite/pom_template.xml b/java/lite/pom_template.xml index fa6cfd2ae6..728c291a4b 100644 --- a/java/lite/pom_template.xml +++ b/java/lite/pom_template.xml @@ -19,4 +19,23 @@ {dependencies} + + + + + org.apache.felix + maven-bundle-plugin + true + + + com.google.protobuf + https://developers.google.com/protocol-buffers/ + com.google.protobuf + com.google.protobuf;version=${project.version} + sun.misc;resolution:=optional,* + + + + + diff --git a/java/util/pom_template.xml b/java/util/pom_template.xml index f897892510..74ef795f17 100644 --- a/java/util/pom_template.xml +++ b/java/util/pom_template.xml @@ -20,4 +20,23 @@ {dependencies} + + + + + org.apache.felix + maven-bundle-plugin + true + + + com.google.protobuf.util + https://developers.google.com/protocol-buffers/ + com.google.protobuf.util + com.google.protobuf.util;version=${project.version} + + + + + + From f02f8279ce9e01ed87dcb5d54926c6ac62c84d30 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Thu, 23 Feb 2023 16:30:04 -0800 Subject: [PATCH 14/42] Ensure VarintParseSlowArm{32,64} are exported with PROTOBUF_EXPORT This should fix issue #11996. PiperOrigin-RevId: 511917449 --- src/google/protobuf/parse_context.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/google/protobuf/parse_context.h b/src/google/protobuf/parse_context.h index e5b13a027e..4b82927a7c 100644 --- a/src/google/protobuf/parse_context.h +++ b/src/google/protobuf/parse_context.h @@ -617,7 +617,9 @@ inline const char* VarintParseSlow(const char* p, uint32_t res, uint64_t* out) { } #ifdef __aarch64__ +PROTOBUF_EXPORT const char* VarintParseSlowArm64(const char* p, uint64_t* out, uint64_t first8); +PROTOBUF_EXPORT const char* VarintParseSlowArm32(const char* p, uint32_t* out, uint64_t first8); inline const char* VarintParseSlowArm(const char* p, uint32_t* out, From a2e33e79e91bd3af41bc36c89860f0510f320bee Mon Sep 17 00:00:00 2001 From: Jerry Berg <107155935+googleberg@users.noreply.github.com> Date: Fri, 24 Feb 2023 09:28:20 -0700 Subject: [PATCH 15/42] Java fixes for 22.x (#12035) * Fix mutability bug in Java proto lite: sub-messages inside of oneofs were not being set as immutable. This would allow code to get a builder for a sub-message and modify the original (supposedly immutable) copy. PiperOrigin-RevId: 511598810 * Add casts to make protobuf compatible with Java 1.8 runtime. Fix for: https://github.com/protocolbuffers/protobuf/issues/11393 PiperOrigin-RevId: 511807920 --------- Co-authored-by: Protobuf Team Bot --- java/core/BUILD.bazel | 1 + .../com/google/protobuf/AllocatedBuffer.java | 2 +- .../com/google/protobuf/BinaryWriter.java | 28 ++++---- .../com/google/protobuf/ByteBufferWriter.java | 2 +- .../google/protobuf/CodedOutputStream.java | 28 ++++---- .../java/com/google/protobuf/Internal.java | 8 ++- .../IterableByteBufferInputStream.java | 4 +- .../google/protobuf/Java8Compatibility.java | 67 +++++++++++++++++++ .../com/google/protobuf/MessageSchema.java | 6 ++ .../com/google/protobuf/NioByteString.java | 11 ++- .../java/com/google/protobuf/TextFormat.java | 2 +- .../main/java/com/google/protobuf/Utf8.java | 10 +-- java/lite/pom.xml | 1 + .../java/com/google/protobuf/LiteTest.java | 24 +++++-- src/google/protobuf/unittest_lite.proto | 1 + 15 files changed, 142 insertions(+), 53 deletions(-) create mode 100644 java/core/src/main/java/com/google/protobuf/Java8Compatibility.java diff --git a/java/core/BUILD.bazel b/java/core/BUILD.bazel index 6113169c6c..c0e52a4ff4 100644 --- a/java/core/BUILD.bazel +++ b/java/core/BUILD.bazel @@ -49,6 +49,7 @@ LITE_SRCS = [ "src/main/java/com/google/protobuf/Internal.java", "src/main/java/com/google/protobuf/InvalidProtocolBufferException.java", "src/main/java/com/google/protobuf/IterableByteBufferInputStream.java", + "src/main/java/com/google/protobuf/Java8Compatibility.java", "src/main/java/com/google/protobuf/JavaType.java", "src/main/java/com/google/protobuf/LazyField.java", "src/main/java/com/google/protobuf/LazyFieldLite.java", diff --git a/java/core/src/main/java/com/google/protobuf/AllocatedBuffer.java b/java/core/src/main/java/com/google/protobuf/AllocatedBuffer.java index 94b09944d1..75de57a32e 100644 --- a/java/core/src/main/java/com/google/protobuf/AllocatedBuffer.java +++ b/java/core/src/main/java/com/google/protobuf/AllocatedBuffer.java @@ -189,7 +189,7 @@ abstract class AllocatedBuffer { @Override public AllocatedBuffer position(int position) { - buffer.position(position); + Java8Compatibility.position(buffer, position); return this; } diff --git a/java/core/src/main/java/com/google/protobuf/BinaryWriter.java b/java/core/src/main/java/com/google/protobuf/BinaryWriter.java index 66cf51d24c..7eb7886312 100644 --- a/java/core/src/main/java/com/google/protobuf/BinaryWriter.java +++ b/java/core/src/main/java/com/google/protobuf/BinaryWriter.java @@ -2019,8 +2019,8 @@ abstract class BinaryWriter extends ByteOutput implements Writer { buffers.addFirst(allocatedBuffer); buffer = nioBuffer; - buffer.limit(buffer.capacity()); - buffer.position(0); + Java8Compatibility.limit(buffer, buffer.capacity()); + Java8Compatibility.position(buffer, 0); // Set byte order to little endian for fast writing of fixed 32/64. buffer.order(ByteOrder.LITTLE_ENDIAN); @@ -2046,7 +2046,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer { if (buffer != null) { totalDoneBytes += bytesWrittenToCurrentBuffer(); // Update the indices on the netty buffer. - buffer.position(pos + 1); + Java8Compatibility.position(buffer, pos + 1); buffer = null; pos = 0; limitMinusOne = 0; @@ -2475,7 +2475,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer { } pos -= length; - buffer.position(pos + 1); + Java8Compatibility.position(buffer, pos + 1); buffer.put(value, offset, length); } @@ -2494,7 +2494,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer { } pos -= length; - buffer.position(pos + 1); + Java8Compatibility.position(buffer, pos + 1); buffer.put(value, offset, length); } @@ -2506,7 +2506,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer { } pos -= length; - buffer.position(pos + 1); + Java8Compatibility.position(buffer, pos + 1); buffer.put(value); } @@ -2526,7 +2526,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer { } pos -= length; - buffer.position(pos + 1); + Java8Compatibility.position(buffer, pos + 1); buffer.put(value); } @@ -2576,8 +2576,8 @@ abstract class BinaryWriter extends ByteOutput implements Writer { buffers.addFirst(allocatedBuffer); buffer = nioBuffer; - buffer.limit(buffer.capacity()); - buffer.position(0); + Java8Compatibility.limit(buffer, buffer.capacity()); + Java8Compatibility.position(buffer, 0); bufferOffset = UnsafeUtil.addressOffset(buffer); limitMinusOne = bufferOffset + (buffer.limit() - 1); @@ -2602,7 +2602,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer { if (buffer != null) { totalDoneBytes += bytesWrittenToCurrentBuffer(); // Update the indices on the netty buffer. - buffer.position(bufferPos() + 1); + Java8Compatibility.position(buffer, bufferPos() + 1); buffer = null; pos = 0; limitMinusOne = 0; @@ -3016,7 +3016,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer { } pos -= length; - buffer.position(bufferPos() + 1); + Java8Compatibility.position(buffer, bufferPos() + 1); buffer.put(value, offset, length); } @@ -3035,7 +3035,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer { } pos -= length; - buffer.position(bufferPos() + 1); + Java8Compatibility.position(buffer, bufferPos() + 1); buffer.put(value, offset, length); } @@ -3047,7 +3047,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer { } pos -= length; - buffer.position(bufferPos() + 1); + Java8Compatibility.position(buffer, bufferPos() + 1); buffer.put(value); } @@ -3067,7 +3067,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer { } pos -= length; - buffer.position(bufferPos() + 1); + Java8Compatibility.position(buffer, bufferPos() + 1); buffer.put(value); } diff --git a/java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java b/java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java index 2cb3ada67f..3970b0ea5b 100644 --- a/java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java +++ b/java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java @@ -107,7 +107,7 @@ final class ByteBufferWriter { } } finally { // Restore the initial position. - buffer.position(initialPos); + Java8Compatibility.position(buffer, initialPos); } } diff --git a/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java b/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java index 4ad83099d7..44dd4dc20e 100644 --- a/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java +++ b/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java @@ -1271,7 +1271,7 @@ public abstract class CodedOutputStream extends ByteOutput { write(value.array(), value.arrayOffset(), value.capacity()); } else { ByteBuffer duplicated = value.duplicate(); - duplicated.clear(); + Java8Compatibility.clear(duplicated); write(duplicated); } } @@ -1522,7 +1522,7 @@ public abstract class CodedOutputStream extends ByteOutput { @Override public void flush() { // Update the position on the buffer. - byteBuffer.position(initialPosition + getTotalBytesWritten()); + Java8Compatibility.position(byteBuffer, initialPosition + getTotalBytesWritten()); } } @@ -1684,7 +1684,7 @@ public abstract class CodedOutputStream extends ByteOutput { write(value.array(), value.arrayOffset(), value.capacity()); } else { ByteBuffer duplicated = value.duplicate(); - duplicated.clear(); + Java8Compatibility.clear(duplicated); write(duplicated); } } @@ -1794,18 +1794,18 @@ public abstract class CodedOutputStream extends ByteOutput { // Save the current position and increment past the length field. We'll come back // and write the length field after the encoding is complete. final int startOfBytes = buffer.position() + minLengthVarIntSize; - buffer.position(startOfBytes); + Java8Compatibility.position(buffer, startOfBytes); // Encode the string. encode(value); // Now go back to the beginning and write the length. int endOfBytes = buffer.position(); - buffer.position(startPos); + Java8Compatibility.position(buffer, startPos); writeUInt32NoTag(endOfBytes - startOfBytes); // Reposition the buffer past the written data. - buffer.position(endOfBytes); + Java8Compatibility.position(buffer, endOfBytes); } else { final int length = Utf8.encodedLength(value); writeUInt32NoTag(length); @@ -1813,7 +1813,7 @@ public abstract class CodedOutputStream extends ByteOutput { } } catch (UnpairedSurrogateException e) { // Roll back the change and convert to an IOException. - buffer.position(startPos); + Java8Compatibility.position(buffer, startPos); // TODO(nathanmittler): We should throw an IOException here instead. inefficientWriteStringNoTag(value, e); @@ -1826,7 +1826,7 @@ public abstract class CodedOutputStream extends ByteOutput { @Override public void flush() { // Update the position of the original buffer. - originalBuffer.position(buffer.position()); + Java8Compatibility.position(originalBuffer, buffer.position()); } @Override @@ -2014,7 +2014,7 @@ public abstract class CodedOutputStream extends ByteOutput { write(value.array(), value.arrayOffset(), value.capacity()); } else { ByteBuffer duplicated = value.duplicate(); - duplicated.clear(); + Java8Compatibility.clear(duplicated); write(duplicated); } } @@ -2150,7 +2150,7 @@ public abstract class CodedOutputStream extends ByteOutput { // Save the current position and increment past the length field. We'll come back // and write the length field after the encoding is complete. int stringStart = bufferPos(position) + minLengthVarIntSize; - buffer.position(stringStart); + Java8Compatibility.position(buffer, stringStart); // Encode the string. Utf8.encodeUtf8(value, buffer); @@ -2187,7 +2187,7 @@ public abstract class CodedOutputStream extends ByteOutput { @Override public void flush() { // Update the position of the original buffer. - originalBuffer.position(bufferPos(position)); + Java8Compatibility.position(originalBuffer, bufferPos(position)); } @Override @@ -2201,7 +2201,7 @@ public abstract class CodedOutputStream extends ByteOutput { } private void repositionBuffer(long pos) { - buffer.position(bufferPos(pos)); + Java8Compatibility.position(buffer, bufferPos(pos)); } private int bufferPos(long pos) { @@ -2478,7 +2478,7 @@ public abstract class CodedOutputStream extends ByteOutput { write(value.array(), value.arrayOffset(), value.capacity()); } else { ByteBuffer duplicated = value.duplicate(); - duplicated.clear(); + Java8Compatibility.clear(duplicated); write(duplicated); } } @@ -2792,7 +2792,7 @@ public abstract class CodedOutputStream extends ByteOutput { write(value.array(), value.arrayOffset(), value.capacity()); } else { ByteBuffer duplicated = value.duplicate(); - duplicated.clear(); + Java8Compatibility.clear(duplicated); write(duplicated); } } diff --git a/java/core/src/main/java/com/google/protobuf/Internal.java b/java/core/src/main/java/com/google/protobuf/Internal.java index 7a7270b8c3..127a16566e 100644 --- a/java/core/src/main/java/com/google/protobuf/Internal.java +++ b/java/core/src/main/java/com/google/protobuf/Internal.java @@ -313,7 +313,11 @@ public final class Internal { } // ByteBuffer.equals() will only compare the remaining bytes, but we want to // compare all the content. - return a.duplicate().clear().equals(b.duplicate().clear()); + ByteBuffer aDuplicate = a.duplicate(); + Java8Compatibility.clear(aDuplicate); + ByteBuffer bDuplicate = b.duplicate(); + Java8Compatibility.clear(bDuplicate); + return aDuplicate.equals(bDuplicate); } /** Helper method for implementing {@link Message#equals(Object)} for bytes field. */ @@ -353,7 +357,7 @@ public final class Internal { bytes.capacity() > DEFAULT_BUFFER_SIZE ? DEFAULT_BUFFER_SIZE : bytes.capacity(); final byte[] buffer = new byte[bufferSize]; final ByteBuffer duplicated = bytes.duplicate(); - duplicated.clear(); + Java8Compatibility.clear(duplicated); int h = bytes.capacity(); while (duplicated.remaining() > 0) { final int length = diff --git a/java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java b/java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java index 713e806469..1e571cfbbb 100644 --- a/java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java +++ b/java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java @@ -140,9 +140,9 @@ class IterableByteBufferInputStream extends InputStream { updateCurrentByteBufferPos(length); } else { int prevPos = currentByteBuffer.position(); - currentByteBuffer.position(currentByteBufferPos); + Java8Compatibility.position(currentByteBuffer, currentByteBufferPos); currentByteBuffer.get(output, offset, length); - currentByteBuffer.position(prevPos); + Java8Compatibility.position(currentByteBuffer, prevPos); updateCurrentByteBufferPos(length); } return length; diff --git a/java/core/src/main/java/com/google/protobuf/Java8Compatibility.java b/java/core/src/main/java/com/google/protobuf/Java8Compatibility.java new file mode 100644 index 0000000000..ef181c2ae5 --- /dev/null +++ b/java/core/src/main/java/com/google/protobuf/Java8Compatibility.java @@ -0,0 +1,67 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package com.google.protobuf; + +import java.nio.Buffer; + +/** + * Wrappers around {@link Buffer} methods that are covariantly overridden in Java 9+. See + * https://github.com/protocolbuffers/protobuf/issues/11393 + * + *

TODO(b/270454719) remove when Java 8 support is no longer needed. + */ +final class Java8Compatibility { + static void clear(Buffer b) { + b.clear(); + } + + static void flip(Buffer b) { + b.flip(); + } + + static void limit(Buffer b, int limit) { + b.limit(limit); + } + + static void mark(Buffer b) { + b.mark(); + } + + static void position(Buffer b, int position) { + b.position(position); + } + + static void reset(Buffer b) { + b.reset(); + } + + private Java8Compatibility() {} +} diff --git a/java/core/src/main/java/com/google/protobuf/MessageSchema.java b/java/core/src/main/java/com/google/protobuf/MessageSchema.java index 084d687d1a..ae5dddc53b 100644 --- a/java/core/src/main/java/com/google/protobuf/MessageSchema.java +++ b/java/core/src/main/java/com/google/protobuf/MessageSchema.java @@ -5510,6 +5510,12 @@ final class MessageSchema implements Schema { getMessageFieldSchema(pos).makeImmutable(UNSAFE.getObject(message, offset)); } break; + case 60: // ONEOF_MESSAGE + case 68: // ONEOF_GROUP + if (isOneofPresent(message, numberAt(pos), pos)) { + getMessageFieldSchema(pos).makeImmutable(UNSAFE.getObject(message, offset)); + } + break; case 18: // DOUBLE_LIST: case 19: // FLOAT_LIST: case 20: // INT64_LIST: diff --git a/java/core/src/main/java/com/google/protobuf/NioByteString.java b/java/core/src/main/java/com/google/protobuf/NioByteString.java index 1e594ff878..f625edafb9 100644 --- a/java/core/src/main/java/com/google/protobuf/NioByteString.java +++ b/java/core/src/main/java/com/google/protobuf/NioByteString.java @@ -37,7 +37,6 @@ import java.io.InputStream; import java.io.InvalidObjectException; import java.io.ObjectInputStream; import java.io.OutputStream; -import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.InvalidMarkException; @@ -110,7 +109,7 @@ final class NioByteString extends ByteString.LeafByteString { protected void copyToInternal( byte[] target, int sourceOffset, int targetOffset, int numberToCopy) { ByteBuffer slice = buffer.slice(); - ((Buffer) slice).position(sourceOffset); + Java8Compatibility.position(slice, sourceOffset); slice.get(target, targetOffset, numberToCopy); } @@ -224,7 +223,7 @@ final class NioByteString extends ByteString.LeafByteString { @Override public void mark(int readlimit) { - buf.mark(); + Java8Compatibility.mark(buf); } @Override @@ -235,7 +234,7 @@ final class NioByteString extends ByteString.LeafByteString { @Override public void reset() throws IOException { try { - buf.reset(); + Java8Compatibility.reset(buf); } catch (InvalidMarkException e) { throw new IOException(e); } @@ -286,8 +285,8 @@ final class NioByteString extends ByteString.LeafByteString { } ByteBuffer slice = buffer.slice(); - ((Buffer) slice).position(beginIndex - buffer.position()); - ((Buffer) slice).limit(endIndex - buffer.position()); + Java8Compatibility.position(slice, beginIndex - buffer.position()); + Java8Compatibility.limit(slice, endIndex - buffer.position()); return slice; } } diff --git a/java/core/src/main/java/com/google/protobuf/TextFormat.java b/java/core/src/main/java/com/google/protobuf/TextFormat.java index 8c3ac5caf1..9d28d06c95 100644 --- a/java/core/src/main/java/com/google/protobuf/TextFormat.java +++ b/java/core/src/main/java/com/google/protobuf/TextFormat.java @@ -1710,7 +1710,7 @@ public final class TextFormat { if (n == -1) { break; } - buffer.flip(); + Java8Compatibility.flip(buffer); text.append(buffer, 0, n); } return text; diff --git a/java/core/src/main/java/com/google/protobuf/Utf8.java b/java/core/src/main/java/com/google/protobuf/Utf8.java index c74497cd81..7c6823d91f 100644 --- a/java/core/src/main/java/com/google/protobuf/Utf8.java +++ b/java/core/src/main/java/com/google/protobuf/Utf8.java @@ -770,7 +770,7 @@ final class Utf8 { if (out.hasArray()) { final int offset = out.arrayOffset(); int endIndex = Utf8.encode(in, out.array(), offset + out.position(), out.remaining()); - out.position(endIndex - offset); + Java8Compatibility.position(out, endIndex - offset); } else if (out.isDirect()) { encodeUtf8Direct(in, out); } else { @@ -801,7 +801,7 @@ final class Utf8 { } if (inIx == inLength) { // Successfully encoded the entire string. - out.position(outIx + inIx); + Java8Compatibility.position(out, outIx + inIx); return; } @@ -844,7 +844,7 @@ final class Utf8 { } // Successfully encoded the entire string. - out.position(outIx); + Java8Compatibility.position(out, outIx); } catch (IndexOutOfBoundsException e) { // TODO(nathanmittler): Consider making the API throw IndexOutOfBoundsException instead. @@ -1545,7 +1545,7 @@ final class Utf8 { } if (inIx == inLimit) { // We're done, it was ASCII encoded. - out.position((int) (outIx - address)); + Java8Compatibility.position(out, (int) (outIx - address)); return; } @@ -1585,7 +1585,7 @@ final class Utf8 { } // All bytes have been encoded. - out.position((int) (outIx - address)); + Java8Compatibility.position(out, (int) (outIx - address)); } /** diff --git a/java/lite/pom.xml b/java/lite/pom.xml index 716ff74d32..d472b36c3e 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -125,6 +125,7 @@ Internal.java InvalidProtocolBufferException.java IterableByteBufferInputStream.java + Java8Compatibility.java JavaType.java LazyField.java LazyFieldLite.java diff --git a/java/lite/src/test/java/com/google/protobuf/LiteTest.java b/java/lite/src/test/java/com/google/protobuf/LiteTest.java index a4f95a2666..a58ce95df0 100644 --- a/java/lite/src/test/java/com/google/protobuf/LiteTest.java +++ b/java/lite/src/test/java/com/google/protobuf/LiteTest.java @@ -190,6 +190,18 @@ public class LiteTest { } } + @Test + public void testParsedOneofSubMessageIsImmutable() throws InvalidProtocolBufferException { + TestAllTypesLite message = + TestAllTypesLite.parseFrom( + TestAllTypesLite.newBuilder() + .setOneofNestedMessage(NestedMessage.newBuilder().addDd(1234).build()) + .build() + .toByteArray()); + IntArrayList subList = (IntArrayList) message.getOneofNestedMessage().getDdList(); + assertThat(subList.isModifiable()).isFalse(); + } + @Test public void testMemoization() throws Exception { GeneratedMessageLite message = TestUtilLite.getAllLiteExtensionsSet(); @@ -2365,8 +2377,7 @@ public class LiteTest { Foo fooWithOnlyValue = Foo.newBuilder().setValue(1).build(); Foo fooWithValueAndExtension = - fooWithOnlyValue - .toBuilder() + fooWithOnlyValue.toBuilder() .setValue(1) .setExtension(Bar.fooExt, Bar.newBuilder().setName("name").build()) .build(); @@ -2382,8 +2393,7 @@ public class LiteTest { Foo fooWithOnlyValue = Foo.newBuilder().setValue(1).build(); Foo fooWithValueAndExtension = - fooWithOnlyValue - .toBuilder() + fooWithOnlyValue.toBuilder() .setValue(1) .setExtension(Bar.fooExt, Bar.newBuilder().setName("name").build()) .build(); @@ -2515,9 +2525,9 @@ public class LiteTest { assertWithMessage("expected exception").fail(); } catch (InvalidProtocolBufferException expected) { assertThat( - TestAllExtensionsLite.newBuilder() - .setExtension(UnittestLite.optionalInt32ExtensionLite, 123) - .build()) + TestAllExtensionsLite.newBuilder() + .setExtension(UnittestLite.optionalInt32ExtensionLite, 123) + .build()) .isEqualTo(expected.getUnfinishedMessage()); } } diff --git a/src/google/protobuf/unittest_lite.proto b/src/google/protobuf/unittest_lite.proto index 010d4a9c0b..e2730c6419 100644 --- a/src/google/protobuf/unittest_lite.proto +++ b/src/google/protobuf/unittest_lite.proto @@ -47,6 +47,7 @@ message TestAllTypesLite { message NestedMessage { optional int32 bb = 1; optional int64 cc = 2; + repeated int32 dd = 3 [packed = true]; } message NestedMessage2 { From 1456462a143efa5b8459123ef990071f9221c119 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 24 Feb 2023 20:59:18 +0000 Subject: [PATCH 16/42] Add java8 tests and build flags --- .github/workflows/test_java.yml | 8 ++++++-- java/core/BUILD.bazel | 18 +++++++++--------- java/util/BUILD.bazel | 6 +++--- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 1ad65537a1..313308cb13 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -14,13 +14,17 @@ jobs: fail-fast: false matrix: include: + - name: OpenJDK 8 + version: '8' + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/bazel:8-03a376b5d6ef66f827fc307716e3b841cc26b709 + targets: //java/... //java/internal:java_version - name: OpenJDK 11 version: '11' - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:5.1.1-aec4d74f2eb6938fc53ef7d9a79a4bf2da24abc1 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/bazel:11-03a376b5d6ef66f827fc307716e3b841cc26b709 targets: //java/... //java/internal:java_version - name: OpenJDK 17 version: '17' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:17-65526ea124d1034eac33e7c37cc6d65c5bef054f + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:17-03a376b5d6ef66f827fc307716e3b841cc26b709 targets: //java/... //java/internal:java_version - name: aarch64 version: 'aarch64' diff --git a/java/core/BUILD.bazel b/java/core/BUILD.bazel index c0e52a4ff4..f08cf4a702 100644 --- a/java/core/BUILD.bazel +++ b/java/core/BUILD.bazel @@ -1,8 +1,8 @@ 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_java//java:defs.bzl", "java_lite_proto_library", "java_proto_library") load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library") +load("//build_defs:java_opts.bzl", "protobuf_java_export", "protobuf_java_library") load("//conformance:defs.bzl", "conformance_test") load("//:protobuf.bzl", "internal_gen_well_known_protos_java") load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION") @@ -121,7 +121,7 @@ internal_gen_well_known_protos_java( ) # Should be used as `//java/lite`. -java_library( +protobuf_java_library( name = "lite", srcs = LITE_SRCS + [ ":gen_well_known_protos_javalite", @@ -132,7 +132,7 @@ java_library( ) # Bazel users, don't depend on this target, use //java/lite. -java_export( +protobuf_java_export( name = "lite_mvn", maven_coordinates = "com.google.protobuf:protobuf-javalite:%s" % PROTOBUF_JAVA_VERSION, pom_template = "//java/lite:pom_template.xml", @@ -143,7 +143,7 @@ java_export( runtime_deps = [":lite"], ) -java_library( +protobuf_java_library( name = "lite_runtime_only", srcs = LITE_SRCS, ) @@ -166,7 +166,7 @@ internal_gen_well_known_protos_java( ], ) -java_library( +protobuf_java_library( name = "core", srcs = glob( [ @@ -186,7 +186,7 @@ java_library( ) # Bazel users, don't depend on this target, use :core. -java_export( +protobuf_java_export( name = "core_mvn", maven_coordinates = "com.google.protobuf:protobuf-java:%s" % PROTOBUF_JAVA_VERSION, pom_template = "pom_template.xml", @@ -269,7 +269,7 @@ java_proto_library( deps = [":java_test_protos"], ) -java_library( +protobuf_java_library( name = "test_util", srcs = [ "src/test/java/com/google/protobuf/TestUtil.java", @@ -390,7 +390,7 @@ genrule( cmd = "awk -f $(location //java/lite:lite.awk) $(location src/test/java/com/google/protobuf/TestUtil.java) > $@", ) -java_library( +protobuf_java_library( name = "test_util_lite", srcs = [ "src/test/java/com/google/protobuf/TestUtilLite.java", diff --git a/java/util/BUILD.bazel b/java/util/BUILD.bazel index e3804fb978..3d042d390a 100644 --- a/java/util/BUILD.bazel +++ b/java/util/BUILD.bazel @@ -1,11 +1,11 @@ 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("//build_defs:java_opts.bzl", "protobuf_java_export", "protobuf_java_library") load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION") load("//java/internal:testing.bzl", "junit_tests") -java_library( +protobuf_java_library( name = "util", srcs = glob([ "src/main/java/com/google/protobuf/util/*.java", @@ -22,7 +22,7 @@ java_library( ) # Bazel users, don't depend on this target, use :util. -java_export( +protobuf_java_export( name = "util_mvn", deploy_env = ["//java/core"], maven_coordinates = "com.google.protobuf:protobuf-java-util:%s" % PROTOBUF_JAVA_VERSION, From 340d24ce8a420919521e6d124cab81f502b47be3 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 24 Feb 2023 21:12:24 +0000 Subject: [PATCH 17/42] Add java opts file --- build_defs/java_opts.bzl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 build_defs/java_opts.bzl diff --git a/build_defs/java_opts.bzl b/build_defs/java_opts.bzl new file mode 100644 index 0000000000..b6ee8142ba --- /dev/null +++ b/build_defs/java_opts.bzl @@ -0,0 +1,21 @@ +"""Java options and protobuf-specific java build rules with those options.""" +load("@rules_java//java:defs.bzl", "java_library") +load("@rules_jvm_external//:defs.bzl", "java_export") + +JAVA_OPTS = [ + "-source 8", + "-target 8", + "-Xep:Java8ApiChecker:ERROR", +] + +def protobuf_java_export(**kwargs): + java_export( + javacopts = JAVA_OPTS, + **kwargs, + ) + +def protobuf_java_library(**kwargs): + java_library( + javacopts = JAVA_OPTS, + **kwargs, + ) From c245167528d4ab5e1bcec4a2a7eef9e315858400 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 24 Feb 2023 21:27:05 +0000 Subject: [PATCH 18/42] Fix docker image --- .github/workflows/test_java.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 313308cb13..b415fdef4a 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -16,11 +16,11 @@ jobs: include: - name: OpenJDK 8 version: '8' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/bazel:8-03a376b5d6ef66f827fc307716e3b841cc26b709 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-03a376b5d6ef66f827fc307716e3b841cc26b709 targets: //java/... //java/internal:java_version - name: OpenJDK 11 version: '11' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/bazel:11-03a376b5d6ef66f827fc307716e3b841cc26b709 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-03a376b5d6ef66f827fc307716e3b841cc26b709 targets: //java/... //java/internal:java_version - name: OpenJDK 17 version: '17' From 27c73191060f2d2bc4e207610b674e1926ac7ad2 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 24 Feb 2023 22:29:04 +0000 Subject: [PATCH 19/42] Fix java version test --- java/internal/JavaVersionTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/internal/JavaVersionTest.java b/java/internal/JavaVersionTest.java index c7957c0d81..af01227bee 100644 --- a/java/internal/JavaVersionTest.java +++ b/java/internal/JavaVersionTest.java @@ -40,12 +40,14 @@ public class JavaVersionTest { @Test public void testJavaVersion() throws Exception { String exp = System.getenv("KOKORO_JAVA_VERSION"); + // Java 8's version is read as "1.8" + if(exp == "8") exp = "1.8"; if(exp == null || exp.isEmpty()) { System.err.println("No kokoro java version found, skipping check"); return; } String version = System.getProperty("java.version"); - assertWithMessage("Expected Python " + exp + " but found Python " + version) + assertWithMessage("Expected Java " + exp + " but found Java " + version) .that(version.startsWith(exp)) .isTrue(); } From 5ffb29d684639df5571495996fd46f6df28e0d3c Mon Sep 17 00:00:00 2001 From: deannagarcia <69992229+deannagarcia@users.noreply.github.com> Date: Fri, 24 Feb 2023 14:44:31 -0800 Subject: [PATCH 20/42] Debug java version test --- java/internal/JavaVersionTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/java/internal/JavaVersionTest.java b/java/internal/JavaVersionTest.java index af01227bee..320ca3d892 100644 --- a/java/internal/JavaVersionTest.java +++ b/java/internal/JavaVersionTest.java @@ -41,7 +41,12 @@ public class JavaVersionTest { public void testJavaVersion() throws Exception { String exp = System.getenv("KOKORO_JAVA_VERSION"); // Java 8's version is read as "1.8" - if(exp == "8") exp = "1.8"; + if(exp == "8") { + System.out.println("The version was 8"); + exp = "1.8"; + } else { + System.out.println("The version was not 8, it was: " + exp); + } if(exp == null || exp.isEmpty()) { System.err.println("No kokoro java version found, skipping check"); return; From 075677e415f215b63267269f681617299542d864 Mon Sep 17 00:00:00 2001 From: deannagarcia <69992229+deannagarcia@users.noreply.github.com> Date: Fri, 24 Feb 2023 14:53:36 -0800 Subject: [PATCH 21/42] Compare strings better --- java/internal/JavaVersionTest.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/java/internal/JavaVersionTest.java b/java/internal/JavaVersionTest.java index 320ca3d892..4ee6e97e12 100644 --- a/java/internal/JavaVersionTest.java +++ b/java/internal/JavaVersionTest.java @@ -41,12 +41,7 @@ public class JavaVersionTest { public void testJavaVersion() throws Exception { String exp = System.getenv("KOKORO_JAVA_VERSION"); // Java 8's version is read as "1.8" - if(exp == "8") { - System.out.println("The version was 8"); - exp = "1.8"; - } else { - System.out.println("The version was not 8, it was: " + exp); - } + if(exp.equals("8")) exp = "1.8"; if(exp == null || exp.isEmpty()) { System.err.println("No kokoro java version found, skipping check"); return; From ae97c826f7d865bb97c4addeecc113699d42a222 Mon Sep 17 00:00:00 2001 From: deannagarcia <69992229+deannagarcia@users.noreply.github.com> Date: Fri, 24 Feb 2023 15:02:53 -0800 Subject: [PATCH 22/42] Fix potential null pointer error --- java/internal/JavaVersionTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/internal/JavaVersionTest.java b/java/internal/JavaVersionTest.java index 4ee6e97e12..c9ea0a504b 100644 --- a/java/internal/JavaVersionTest.java +++ b/java/internal/JavaVersionTest.java @@ -40,12 +40,12 @@ public class JavaVersionTest { @Test public void testJavaVersion() throws Exception { String exp = System.getenv("KOKORO_JAVA_VERSION"); - // Java 8's version is read as "1.8" - if(exp.equals("8")) exp = "1.8"; if(exp == null || exp.isEmpty()) { System.err.println("No kokoro java version found, skipping check"); return; } + // Java 8's version is read as "1.8" + if(exp.equals("8")) exp = "1.8"; String version = System.getProperty("java.version"); assertWithMessage("Expected Java " + exp + " but found Java " + version) .that(version.startsWith(exp)) From 66f80c3610b0cd61bedd42c78e78ae2eac002142 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Tue, 28 Feb 2023 09:43:33 -0800 Subject: [PATCH 23/42] Remove errorprone dependency from kotlin protos. PiperOrigin-RevId: 512960332 --- java/kotlin/BUILD.bazel | 1 - java/kotlin/pom.xml | 5 ----- src/google/protobuf/compiler/java/message.cc | 6 ------ src/google/protobuf/compiler/java/message_lite.cc | 6 ------ 4 files changed, 18 deletions(-) diff --git a/java/kotlin/BUILD.bazel b/java/kotlin/BUILD.bazel index c809117afc..9814c7a0d3 100644 --- a/java/kotlin/BUILD.bazel +++ b/java/kotlin/BUILD.bazel @@ -25,7 +25,6 @@ kt_jvm_library( deps = [ ":only_for_use_in_proto_generated_code_its_generator_and_tests", "//java/lite", - "@maven//:com_google_errorprone_error_prone_annotations", ], ) diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml index 52a368d58f..1d265d56e0 100644 --- a/java/kotlin/pom.xml +++ b/java/kotlin/pom.xml @@ -34,11 +34,6 @@ mockito-core test - - com.google.errorprone - error_prone_annotations - 2.5.1 - com.google.guava guava diff --git a/src/google/protobuf/compiler/java/message.cc b/src/google/protobuf/compiler/java/message.cc index 1bd7449741..5d6a44609f 100644 --- a/src/google/protobuf/compiler/java/message.cc +++ b/src/google/protobuf/compiler/java/message.cc @@ -1305,9 +1305,6 @@ void ImmutableMessageGenerator::GenerateKotlinMembers( "camelcase_name", name_resolver_->GetKotlinFactoryName(descriptor_)); - if (!context_->options().opensource_runtime) { - printer->Print("@com.google.errorprone.annotations.CheckReturnValue\n"); - } printer->Print( "public inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> " @@ -1340,9 +1337,6 @@ void ImmutableMessageGenerator::GenerateTopLevelKotlinMembers( io::Printer* printer) const { printer->Print("@kotlin.jvm.JvmSynthetic\n"); - if (context_->options().opensource_runtime) { - printer->Print("@com.google.errorprone.annotations.CheckReturnValue\n"); - } printer->Print( "public inline fun $message$.copy(block: $message_kt$.Dsl.() -> " diff --git a/src/google/protobuf/compiler/java/message_lite.cc b/src/google/protobuf/compiler/java/message_lite.cc index 02506bace4..721a463c3d 100644 --- a/src/google/protobuf/compiler/java/message_lite.cc +++ b/src/google/protobuf/compiler/java/message_lite.cc @@ -816,9 +816,6 @@ void ImmutableMessageLiteGenerator::GenerateKotlinMembers( "camelcase_name", name_resolver_->GetKotlinFactoryName(descriptor_)); - if (!context_->options().opensource_runtime) { - printer->Print("@com.google.errorprone.annotations.CheckReturnValue\n"); - } printer->Print( "public inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> " "kotlin.Unit): $message$ =\n" @@ -846,9 +843,6 @@ void ImmutableMessageLiteGenerator::GenerateKotlinMembers( void ImmutableMessageLiteGenerator::GenerateTopLevelKotlinMembers( io::Printer* printer) const { - if (!context_->options().opensource_runtime) { - printer->Print("@com.google.errorprone.annotations.CheckReturnValue\n"); - } printer->Print( "public inline fun $message$.copy(block: $message_kt$.Dsl.() -> " "kotlin.Unit): $message$ =\n" From 8ad6cdd007fe8c09ec95e69cc7a7419264d11655 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Tue, 28 Feb 2023 14:07:48 -0800 Subject: [PATCH 24/42] Modify release artifacts for protoc to statically link system libraries. Closes #12063 PiperOrigin-RevId: 513034570 --- .bazelrc | 7 ------- .github/workflows/test_cpp.yml | 10 +++++----- .github/workflows/test_csharp.yml | 2 +- .github/workflows/test_java.yml | 2 +- .github/workflows/test_php.yml | 4 +++- .github/workflows/test_python.yml | 4 ++-- .github/workflows/test_ruby.yml | 5 +++-- BUILD.bazel | 18 ++++++++++++++++-- build_defs/cpp_opts.bzl | 7 ------- ci/common.bazelrc | 8 ++++---- pkg/BUILD.bazel | 2 +- src/google/protobuf/compiler/BUILD.bazel | 4 ++-- 12 files changed, 38 insertions(+), 35 deletions(-) diff --git a/.bazelrc b/.bazelrc index de30d6b48c..fb29fe10d9 100644 --- a/.bazelrc +++ b/.bazelrc @@ -17,13 +17,6 @@ build:msan --copt=-fsanitize-memory-use-after-dtor build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1 build:msan --copt=-DMEMORY_SANITIZER=1 -# Use our instrumented LLVM libc++ in Kokoro. -build:kokoro-msan --config=msan -build:kokoro-msan --linkopt=-L/opt/libcxx_msan/lib -build:kokoro-msan --linkopt=-Wl,-rpath,/opt/libcxx_msan/lib -build:kokoro-msan --cxxopt=-stdlib=libc++ --linkopt=-stdlib=libc++ - - build:tsan --config=san-common --copt=-fsanitize=thread --linkopt=-fsanitize=thread build:tsan --copt=-DTHREAD_SANITIZER=1 diff --git a/.github/workflows/test_cpp.yml b/.github/workflows/test_cpp.yml index f846d80a8d..d5cf8b8a79 100644 --- a/.github/workflows/test_cpp.yml +++ b/.github/workflows/test_cpp.yml @@ -17,25 +17,25 @@ jobs: - { name: Optimized, flags: --config=opt } - { name: Debug, flags: --config=dbg } - { name: ASAN, flags: --config=asan } - - { name: MSAN, flags: --config=kokoro-msan } + - { name: MSAN, flags: --config=docker-msan } - { name: TSAN, flags: --config=tsan } - { name: UBSAN, flags: --config=ubsan } - { name: No-RTTI, flags: --cxxopt=-fno-rtti } include: # Set defaults - - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:dbd2f15fb69734d72c3fd10cb819bbe2ce4890acf49e9a2f9403983fe48e8807 + - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:309dae3122031447d714414814d262e5f31cb93c0e248e9c02f9d8cdafd7e3b9 - targets: //pkg/... //src/... @com_google_protobuf_examples//... # Override cases with custom images - config: { name: "TCMalloc" } - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc@sha256:9d975616c3fd44d5a091aeb60ee94f37e22fb367d471d258fc18cb4a2387c943" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc@sha256:4df3b4749e787ba0a671ec0b783d0f1ba05f60be4c9e9fd72c875550a0cde1ea" targets: "//src/..." - config: { name: "aarch64" } targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test" - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-e863f8ec6b1dfe41f7dc573bac9c8072a0a68b1b" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-508417e5215994ade7585d28ba3aad681a25fa5d" - config: { name: "Bazel4" } targets: "//src/..." - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:4.2.3-3b71de326b62f67bf754c4dc4016d6a2fa9dd664" + image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:4.2.3-6361b3a6e5c97e9951d03a4de28542fc45f1adab" name: Linux ${{ matrix.config.name }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test_csharp.yml b/.github/workflows/test_csharp.yml index 022d4f1f6c..1fe79d4641 100644 --- a/.github/workflows/test_csharp.yml +++ b/.github/workflows/test_csharp.yml @@ -20,7 +20,7 @@ jobs: - name: Run tests uses: ./.github/actions/bazel-docker with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:3.1.415-6.0.100-65526ea124d1034eac33e7c37cc6d65c5bef054f + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:3.1.415-6.0.100-508417e5215994ade7585d28ba3aad681a25fa5d credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: csharp_linux bazel: test //csharp/... --action_env=DOTNET_CLI_TELEMETRY_OPTOUT=1 --test_env=DOTNET_CLI_HOME=/home/bazel diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index b415fdef4a..34347a9554 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -28,7 +28,7 @@ jobs: targets: //java/... //java/internal:java_version - name: aarch64 version: 'aarch64' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-e863f8ec6b1dfe41f7dc573bac9c8072a0a68b1b + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-508417e5215994ade7585d28ba3aad681a25fa5d targets: //java/... //src/google/protobuf/compiler:protoc_aarch64_test name: Linux ${{ matrix.name }} diff --git a/.github/workflows/test_php.yml b/.github/workflows/test_php.yml index 2d93d8f2b2..fda266fb2a 100644 --- a/.github/workflows/test_php.yml +++ b/.github/workflows/test_php.yml @@ -45,7 +45,7 @@ jobs: - name: Run tests uses: ./.github/actions/docker with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:${{ matrix.version }}-6e95c0e221e4bd52e3b4dc1398c6336985196931 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:${{ matrix.version }}-508417e5215994ade7585d28ba3aad681a25fa5d credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: ${{ matrix.command }} @@ -80,6 +80,7 @@ jobs: id: cross-compile uses: ./.github/actions/cross-compile-protoc with: + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:5.1.1-6361b3a6e5c97e9951d03a4de28542fc45f1adab credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-i386 @@ -111,6 +112,7 @@ jobs: id: cross-compile uses: ./.github/actions/cross-compile-protoc with: + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:5.1.1-6361b3a6e5c97e9951d03a4de28542fc45f1adab credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-aarch64 diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml index e7b76a4209..18f29855c8 100644 --- a/.github/workflows/test_python.yml +++ b/.github/workflows/test_python.yml @@ -27,7 +27,7 @@ jobs: targets: //python/... //python:aarch64_test # TODO(b/262628111) Enable this once conformance tests are fixed. flags: --define=use_fast_cpp_protos=true --test_tag_filters=-conformance - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-e863f8ec6b1dfe41f7dc573bac9c8072a0a68b1b + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-508417e5215994ade7585d28ba3aad681a25fa5d name: Linux ${{ matrix.type }} ${{ matrix.version }} runs-on: ubuntu-latest @@ -39,7 +39,7 @@ jobs: - name: Run tests uses: ./.github/actions/bazel-docker with: - image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:{0}-65526ea124d1034eac33e7c37cc6d65c5bef054f', matrix.version) }} + image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:{0}-508417e5215994ade7585d28ba3aad681a25fa5d', matrix.version) }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: python_linux/${{ matrix.type }}_${{ matrix.version }} bazel: test ${{ matrix.targets }} ${{ matrix.flags }} --test_env=KOKORO_PYTHON_VERSION diff --git a/.github/workflows/test_ruby.yml b/.github/workflows/test_ruby.yml index e22bf8a356..31b8f79b9f 100644 --- a/.github/workflows/test_ruby.yml +++ b/.github/workflows/test_ruby.yml @@ -34,7 +34,7 @@ jobs: - name: Run tests uses: ./.github/actions/bazel-docker with: - image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:{0}-{1}-75e79f791b96e056086f43ace729cf3ebf9a9f5d', matrix.ruby, matrix.bazel) }} + image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:{0}-{1}-508417e5215994ade7585d28ba3aad681a25fa5d', matrix.ruby, matrix.bazel) }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: ruby_linux/${{ matrix.ruby }}_${{ matrix.bazel }} bazel: test //ruby/... //ruby/tests:ruby_version --test_env=KOKORO_RUBY_VERSION @@ -52,6 +52,7 @@ jobs: id: cross-compile uses: ./.github/actions/cross-compile-protoc with: + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:5.1.1-6361b3a6e5c97e9951d03a4de28542fc45f1adab credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-aarch64 @@ -125,7 +126,7 @@ jobs: - name: Run tests uses: ./.github/actions/bazel-docker with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:${{ matrix.ruby }}-${{ matrix.bazel }}-75e79f791b96e056086f43ace729cf3ebf9a9f5d + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:${{ matrix.ruby }}-${{ matrix.bazel }}-508417e5215994ade7585d28ba3aad681a25fa5d credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: ruby_install/${{ matrix.ruby }}_${{ matrix.bazel }} bash: > diff --git a/BUILD.bazel b/BUILD.bazel index 69a1ba96c8..bc229ddf67 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -4,7 +4,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_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_java//java:defs.bzl", "java_lite_proto_library", "java_proto_library") -load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS", "PROTOC_LINK_OPTS") +load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS") load(":protobuf.bzl", "internal_objc_proto_library", "internal_php_proto_library", "internal_py_proto_library", "internal_ruby_proto_library") licenses(["notice"]) @@ -168,7 +168,21 @@ alias( cc_binary( name = "protoc", copts = COPTS, - linkopts = LINK_OPTS + PROTOC_LINK_OPTS, + linkopts = LINK_OPTS, + visibility = ["//visibility:public"], + deps = ["//src/google/protobuf/compiler:protoc_lib"], +) + +cc_binary( + name = "protoc_static", + copts = COPTS, + linkopts = LINK_OPTS, + features = select({ + # This isn't possible on mac because there is no static library for lcrt0.o + "@platforms//os:osx": [], + # When cross-compiling we need to statically link all C++ libraries. + "//conditions:default": ["fully_static_link"], + }), visibility = ["//visibility:public"], deps = ["//src/google/protobuf/compiler:protoc_lib"], ) diff --git a/build_defs/cpp_opts.bzl b/build_defs/cpp_opts.bzl index 33e157875b..f95c3e2579 100644 --- a/build_defs/cpp_opts.bzl +++ b/build_defs/cpp_opts.bzl @@ -41,10 +41,3 @@ LINK_OPTS = select({ "-lm", ], }) - -# When cross-compiling for Windows we need to statically link pthread and the C++ library. -PROTOC_LINK_OPTS = select({ - "//build_defs:config_win32": ["-static"], - "//build_defs:config_win64": ["-static"], - "//conditions:default": [], -}) diff --git a/ci/common.bazelrc b/ci/common.bazelrc index 421bcc0934..e5345cfd69 100644 --- a/ci/common.bazelrc +++ b/ci/common.bazelrc @@ -19,10 +19,10 @@ build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1 build:msan --copt=-DMEMORY_SANITIZER=1 # Use our instrumented LLVM libc++ in Kokoro. -build:kokoro-msan --config=msan -build:kokoro-msan --linkopt=-L/opt/libcxx_msan/lib -build:kokoro-msan --linkopt=-Wl,-rpath,/opt/libcxx_msan/lib -build:kokoro-msan --cxxopt=-stdlib=libc++ --linkopt=-stdlib=libc++ +build:docker-msan --config=msan +build:docker-msan --linkopt=-L/opt/libcxx_msan/lib --linkopt=-lc++abi +build:docker-msan --linkopt=-Wl,-rpath,/opt/libcxx_msan/lib +build:docker-msan --cxxopt=-stdlib=libc++ --linkopt=-stdlib=libc++ build:tsan --config=san-common --copt=-fsanitize=thread --linkopt=-fsanitize=thread diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index a3a11399ad..3d871ae90f 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -59,7 +59,7 @@ Please refer to our official github site for more installation instructions: pkg_files( name = "protoc_files", - srcs = ["//:protoc"], + srcs = ["//:protoc_static"], attributes = pkg_attributes(mode = "0555"), prefix = "bin/", visibility = ["//visibility:private"], diff --git a/src/google/protobuf/compiler/BUILD.bazel b/src/google/protobuf/compiler/BUILD.bazel index 64081c9a42..197721101a 100644 --- a/src/google/protobuf/compiler/BUILD.bazel +++ b/src/google/protobuf/compiler/BUILD.bazel @@ -11,7 +11,7 @@ load( ) load("@rules_proto//proto:defs.bzl", "proto_library") load("//build_defs:arch_tests.bzl", "aarch64_test", "x86_64_test") -load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS", "PROTOC_LINK_OPTS") +load("//build_defs:cpp_opts.bzl", "COPTS", "LINK_OPTS") proto_library( name = "plugin_proto", @@ -123,7 +123,7 @@ cc_library( cc_binary( name = "protoc_nowkt", copts = COPTS, - linkopts = LINK_OPTS + PROTOC_LINK_OPTS, + linkopts = LINK_OPTS, visibility = [ "//src/google/protobuf:__pkg__", ], From 90623c7247ea1c41845d9695339adf14dc091cec Mon Sep 17 00:00:00 2001 From: Joshua Humphries <2035234+jhump@users.noreply.github.com> Date: Tue, 28 Feb 2023 14:50:30 -0800 Subject: [PATCH 25/42] Fix trailing comment attribution when file has no final newline (#12082) Fixes #12081. The issue was the call to `MaybeDetachComment`: the conditional assumed that there was a next token, which was on the same line as the previous one, making attribution unclear. However, if there is no next token, we should not detach. The actual fix is a one-liner. The rest of this PR is updates to the tests to verify this behavior under a handful of scenarios. Closes #12082 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/12082 from jhump:jh/fix-trailing-comment-attribution 767e41cb05ba6e176977e86fe33e9aad090f83f6 PiperOrigin-RevId: 513046172 --- src/google/protobuf/io/tokenizer.cc | 3 +- src/google/protobuf/io/tokenizer_unittest.cc | 48 ++++++++++++++++---- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/google/protobuf/io/tokenizer.cc b/src/google/protobuf/io/tokenizer.cc index 53229f8e67..d75dfabf19 100644 --- a/src/google/protobuf/io/tokenizer.cc +++ b/src/google/protobuf/io/tokenizer.cc @@ -942,7 +942,8 @@ bool Tokenizer::NextWithComments(std::string* prev_trailing_comments, // makes no sense to attach a comment to the following token. collector.Flush(); } - if (prev_line == line_ || trailing_comment_end_line == line_) { + if (result && + (prev_line == line_ || trailing_comment_end_line == line_)) { // When previous token and this one are on the same line, or // even if a multi-line trailing comment ends on the same line // as this token, it's unclear to what token the comment diff --git a/src/google/protobuf/io/tokenizer_unittest.cc b/src/google/protobuf/io/tokenizer_unittest.cc index 2654acba69..b956c18f39 100644 --- a/src/google/protobuf/io/tokenizer_unittest.cc +++ b/src/google/protobuf/io/tokenizer_unittest.cc @@ -643,6 +643,7 @@ inline std::ostream& operator<<(std::ostream& out, return out << absl::CEscape(test_case.input); } +// clang-format off DocCommentCase kDocCommentCases[] = { {"prev next", @@ -650,6 +651,18 @@ DocCommentCase kDocCommentCases[] = { {}, ""}, + {"prev // no next token\n", + + " no next token\n", + {}, + ""}, + + {"prev // no next token and no trailing newline", + + " no next token and no trailing newline", + {}, + ""}, + {"prev /* detached */ next", "", @@ -780,7 +793,7 @@ DocCommentCase kDocCommentCases[] = { prev /* a single block comment that spans multiple lines is detached if it ends - on the same line as next */ next" + on the same line as next */ next )pb", "", @@ -791,7 +804,7 @@ DocCommentCase kDocCommentCases[] = { ""}, {R"pb( - prev /* trailing */ /* leading */ next" + prev /* trailing */ /* leading */ next )pb", " trailing ", @@ -802,13 +815,26 @@ DocCommentCase kDocCommentCases[] = { prev /* multi-line trailing */ /* an oddly placed detached */ /* an oddly - placed leading */ next" + placed leading */ next )pb", " multi-line\ntrailing ", {" an oddly\nplaced detached "}, " an oddly\nplaced leading "}, + + {R"pb( + prev // trailing with newline + // detached + /* another detached */ + // leading but no next token to attach it to + )pb", + + " trailing with newline\n", + {" detached\n", " another detached ", + " leading but no next token to attach it to\n"}, + ""}, }; +// clang-format on TEST_2D(TokenizerTest, DocComments, kDocCommentCases, kBlockSizes) { // Set up the tokenizer. @@ -822,8 +848,8 @@ TEST_2D(TokenizerTest, DocComments, kDocCommentCases, kBlockSizes) { kDocCommentCases_case.input.size(), kBlockSizes_case); Tokenizer tokenizer2(&input2, &error_collector); - tokenizer.Next(); - tokenizer2.Next(); + EXPECT_TRUE(tokenizer.Next()); + EXPECT_TRUE(tokenizer2.Next()); EXPECT_EQ("prev", tokenizer.current().text); EXPECT_EQ("prev", tokenizer2.current().text); @@ -831,11 +857,13 @@ TEST_2D(TokenizerTest, DocComments, kDocCommentCases, kBlockSizes) { std::string prev_trailing_comments; std::vector detached_comments; std::string next_leading_comments; - tokenizer.NextWithComments(&prev_trailing_comments, &detached_comments, - &next_leading_comments); - tokenizer2.NextWithComments(NULL, NULL, NULL); - EXPECT_EQ("next", tokenizer.current().text); - EXPECT_EQ("next", tokenizer2.current().text); + bool has_next = tokenizer.NextWithComments( + &prev_trailing_comments, &detached_comments, &next_leading_comments); + EXPECT_EQ(has_next, tokenizer2.NextWithComments(nullptr, nullptr, nullptr)); + if (has_next) { + EXPECT_EQ("next", tokenizer.current().text); + EXPECT_EQ("next", tokenizer2.current().text); + } EXPECT_EQ(kDocCommentCases_case.prev_trailing_comments, prev_trailing_comments); From b1435864256653b18cb8c1fc40b1c9e0da5f978e Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Tue, 28 Feb 2023 15:03:20 -0800 Subject: [PATCH 26/42] Version protoc according to the compiler version number. Previously we were using the C++ runtime version, which includes an extra major version number. See #12064 PiperOrigin-RevId: 513049588 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c71a74d4a1..2c3e002697 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,7 +125,7 @@ message(STATUS "${protobuf_VERSION_PRERELEASE}") # Package version set(protobuf_VERSION - "${protobuf_VERSION_MAJOR}.${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}") + "${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}") if(protobuf_VERSION_PRERELEASE) set(protobuf_VERSION "${protobuf_VERSION}.${protobuf_VERSION_PRERELEASE}") From 46680103a7b89a9221fd1c030a287bef27890bb4 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Wed, 1 Mar 2023 00:22:27 +0000 Subject: [PATCH 27/42] Update UPB dep --- protobuf_deps.bzl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index 9f6436e046..f3b8c11c05 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -149,7 +149,6 @@ def protobuf_deps(): _github_archive( name = "upb", repo = "https://github.com/protocolbuffers/upb", - commit = "1fb480bc76bc0e331564d672e60b97a388aa3f76", - sha256 = "a5396af1eeb1144c17cec454332997374d32854007f74390b154ec7255b49ded", + commit = "9d69c47896648691e854b7078478ed4320efbcab", patches = ["@com_google_protobuf//build_defs:upb.patch"], ) From f3bb8cb8d8e3e882c9f4706bf2da6e3848740c10 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Wed, 1 Mar 2023 18:33:12 +0000 Subject: [PATCH 28/42] Add sha256 for upb --- protobuf_deps.bzl | 1 + 1 file changed, 1 insertion(+) diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index f3b8c11c05..5686623dfa 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -150,5 +150,6 @@ def protobuf_deps(): name = "upb", repo = "https://github.com/protocolbuffers/upb", commit = "9d69c47896648691e854b7078478ed4320efbcab", + sha256 = "4b67f05495abfd886227fdae841cdf8c54d0e99b9907ed15b318a451082e9647", patches = ["@com_google_protobuf//build_defs:upb.patch"], ) From c9092fe0ed7d01d97db485d477095c8ec243919b Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 1 Mar 2023 13:45:10 -0800 Subject: [PATCH 29/42] Internal change PiperOrigin-RevId: 513329841 --- BUILD.bazel | 2 +- build_defs/BUILD.bazel | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/BUILD.bazel b/BUILD.bazel index bc229ddf67..b0b29f8128 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -179,7 +179,7 @@ cc_binary( linkopts = LINK_OPTS, features = select({ # This isn't possible on mac because there is no static library for lcrt0.o - "@platforms//os:osx": [], + "//build_defs:config_osx": [], # When cross-compiling we need to statically link all C++ libraries. "//conditions:default": ["fully_static_link"], }), diff --git a/build_defs/BUILD.bazel b/build_defs/BUILD.bazel index 4ac09c8298..0926b856d8 100644 --- a/build_defs/BUILD.bazel +++ b/build_defs/BUILD.bazel @@ -1,5 +1,6 @@ # Internal Starlark definitions for Protobuf. +load("@bazel_skylib//lib:selects.bzl", "selects") load("@rules_cc//cc:defs.bzl", starlark_cc_proto_library = "cc_proto_library") load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test") @@ -83,6 +84,25 @@ config_setting( }, ) +config_setting( + name = "config_osx_aarch64", + values = {"cpu": "osx-aarch_64"}, +) + +config_setting( + name = "config_osx_x86_64", + values = {"cpu": "osx-aarch_64"}, +) + +selects.config_setting_group( + name = "config_osx", + match_any = [ + "@platforms//os:osx", + ":config_osx_aarch64", + ":config_osx_x86_64", + ] +) + # Internal testing: starlark_cc_proto_library( From 964a7f0e058f0b81e745e9817dd47e4994a27f0c Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 1 Mar 2023 14:59:04 -0800 Subject: [PATCH 30/42] Add libm linkage to toolchains PiperOrigin-RevId: 513350744 --- toolchain/cc_toolchain_config.bzl | 1 + 1 file changed, 1 insertion(+) diff --git a/toolchain/cc_toolchain_config.bzl b/toolchain/cc_toolchain_config.bzl index b610a8ee9d..3bfe1bfa93 100644 --- a/toolchain/cc_toolchain_config.bzl +++ b/toolchain/cc_toolchain_config.bzl @@ -98,6 +98,7 @@ def _impl(ctx): flags = [ "-B" + ctx.attr.linker_path, "-lstdc++", + "-lm", "--target=" + ctx.attr.target_full_name, ] + ctx.attr.extra_linker_flags, ), From 3b727f84f24345fdd342d6650ddbe51f6b898644 Mon Sep 17 00:00:00 2001 From: deannagarcia <69992229+deannagarcia@users.noreply.github.com> Date: Wed, 1 Mar 2023 15:57:05 -0800 Subject: [PATCH 31/42] Fix toolchain resolution for osx x86_64 --- build_defs/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_defs/BUILD.bazel b/build_defs/BUILD.bazel index 0926b856d8..1f1b21b8b0 100644 --- a/build_defs/BUILD.bazel +++ b/build_defs/BUILD.bazel @@ -91,7 +91,7 @@ config_setting( config_setting( name = "config_osx_x86_64", - values = {"cpu": "osx-aarch_64"}, + values = {"cpu": "osx-x86_64"}, ) selects.config_setting_group( From 8a07f45293191b084e535766e790621784743fe8 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Mon, 6 Mar 2023 10:20:14 -0800 Subject: [PATCH 32/42] Add release tests for statically linked binaries For now, this only covers linux on the two architectures we have testing support for. However, it serves as a good sanity check and can be expanded in the future. PiperOrigin-RevId: 514449399 --- .github/workflows/test_cpp.yml | 45 ++++++++++++++++++++++++++++--- .github/workflows/test_java.yml | 2 +- .github/workflows/test_python.yml | 2 +- BUILD.bazel | 1 + CMakeLists.txt | 11 +++++--- build_defs/BUILD.bazel | 1 - cmake/protobuf-generate.cmake | 4 +-- 7 files changed, 55 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test_cpp.yml b/.github/workflows/test_cpp.yml index d5cf8b8a79..c46a72326e 100644 --- a/.github/workflows/test_cpp.yml +++ b/.github/workflows/test_cpp.yml @@ -32,7 +32,7 @@ jobs: targets: "//src/..." - config: { name: "aarch64" } targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test" - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-508417e5215994ade7585d28ba3aad681a25fa5d" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-3af05275178e16af30961976af126eabbbb2c733" - config: { name: "Bazel4" } targets: "//src/..." image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:4.2.3-6361b3a6e5c97e9951d03a4de28542fc45f1adab" @@ -51,6 +51,45 @@ jobs: bazel-cache: cpp_linux/${{ matrix.config.name }} bazel: test ${{ matrix.targets }} ${{ matrix.config.flags }} --distinct_host_configuration=false + linux-release: + strategy: + fail-fast: false # Don't cancel all jobs if one fails. + matrix: + arch: [x86_64, aarch64] + name: Linux Release ${{ matrix.arch}} + runs-on: ubuntu-latest + steps: + - name: Checkout pending changes + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + submodules: recursive + ref: ${{ inputs.safe-checkout }} + - name: Cross compile protoc for ${{ matrix.arch }} + id: cross-compile + uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v1 + with: + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:5.1.1-6361b3a6e5c97e9951d03a4de28542fc45f1adab + credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} + architecture: linux-${{ matrix.arch }} + - name: Setup ccache + uses: protocolbuffers/protobuf-ci/ccache@v1 + with: + cache-prefix: linux-release-${{ matrix.arch }} + - name: Run tests + uses: protocolbuffers/protobuf-ci/docker@v1 + with: + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:${{ matrix.arch }}-3af05275178e16af30961976af126eabbbb2c733 + credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} + skip-staleness-check: true + entrypoint: bash + command: > + -c "set -ex; + ccache -z; + cmake . -DWITH_PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} -Dprotobuf_BUILD_CONFORMANCE=ON -DCMAKE_CXX_STANDARD=14 -Dprotobuf_WITH_ZLIB=OFF ${{ env.CCACHE_CMAKE_FLAGS }}; + cmake --build . --parallel 20; + ctest --parallel 20; + ccache -s -v" + linux-cmake: strategy: fail-fast: false # Don't cancel all jobs if one fails. @@ -91,7 +130,7 @@ jobs: - name: Run tests uses: ./.github/actions/docker with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:e8282f42b1c1c0e6227d746e861954fd6fad0bd2e7424e6ceb23c249289a4016 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:e0eb6c69b7551d89f0dbdbe11906077a1d501229c28db39623b945e0c5d7029a credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: ${{ matrix.command }} ${{ env.CCACHE_CMAKE_FLAGS }} @@ -113,7 +152,7 @@ jobs: - name: Run tests uses: ./.github/actions/docker with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:e8282f42b1c1c0e6227d746e861954fd6fad0bd2e7424e6ceb23c249289a4016 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake@sha256:e0eb6c69b7551d89f0dbdbe11906077a1d501229c28db39623b945e0c5d7029a credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} command: >- /install.sh -DCMAKE_CXX_STANDARD=14 ${{ env.CCACHE_CMAKE_FLAGS }} \&\& diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 34347a9554..cea3223f12 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -28,7 +28,7 @@ jobs: targets: //java/... //java/internal:java_version - name: aarch64 version: 'aarch64' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-508417e5215994ade7585d28ba3aad681a25fa5d + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-3af05275178e16af30961976af126eabbbb2c733 targets: //java/... //src/google/protobuf/compiler:protoc_aarch64_test name: Linux ${{ matrix.name }} diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml index 18f29855c8..3547635277 100644 --- a/.github/workflows/test_python.yml +++ b/.github/workflows/test_python.yml @@ -27,7 +27,7 @@ jobs: targets: //python/... //python:aarch64_test # TODO(b/262628111) Enable this once conformance tests are fixed. flags: --define=use_fast_cpp_protos=true --test_tag_filters=-conformance - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-508417e5215994ade7585d28ba3aad681a25fa5d + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-3af05275178e16af30961976af126eabbbb2c733 name: Linux ${{ matrix.type }} ${{ matrix.version }} runs-on: ubuntu-latest diff --git a/BUILD.bazel b/BUILD.bazel index b0b29f8128..3f8e5635e8 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -179,6 +179,7 @@ cc_binary( linkopts = LINK_OPTS, features = select({ # This isn't possible on mac because there is no static library for lcrt0.o + "@platforms//os:osx": [], "//build_defs:config_osx": [], # When cross-compiling we need to statically link all C++ libraries. "//conditions:default": ["fully_static_link"], diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c3e002697..7b6389cca6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,9 +50,6 @@ endif() # Options option(protobuf_INSTALL "Install protobuf binaries and files" ON) -if(WITH_PROTOC) - set(protobuf_PROTOC_EXE ${WITH_PROTOC} CACHE FILEPATH "Protocol Buffer Compiler executable" FORCE) -endif() option(protobuf_BUILD_TESTS "Build tests" ON) option(protobuf_BUILD_CONFORMANCE "Build conformance tests" OFF) option(protobuf_BUILD_EXAMPLES "Build examples" OFF) @@ -76,6 +73,14 @@ option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT set(protobuf_DEBUG_POSTFIX "d" CACHE STRING "Default debug postfix") mark_as_advanced(protobuf_DEBUG_POSTFIX) + +if(WITH_PROTOC) + set(protobuf_PROTOC_EXE protoc) + set(protobuf_BUILD_PROTOC_BINARIES OFF) + add_executable(protoc IMPORTED) + set_property(TARGET protoc PROPERTY IMPORTED_LOCATION ${WITH_PROTOC}) +endif() + # User options include(${protobuf_SOURCE_DIR}/cmake/protobuf-options.cmake) diff --git a/build_defs/BUILD.bazel b/build_defs/BUILD.bazel index 1f1b21b8b0..023d4cb089 100644 --- a/build_defs/BUILD.bazel +++ b/build_defs/BUILD.bazel @@ -97,7 +97,6 @@ config_setting( selects.config_setting_group( name = "config_osx", match_any = [ - "@platforms//os:osx", ":config_osx_aarch64", ":config_osx_x86_64", ] diff --git a/cmake/protobuf-generate.cmake b/cmake/protobuf-generate.cmake index 10fd616a53..5a4ff391e0 100644 --- a/cmake/protobuf-generate.cmake +++ b/cmake/protobuf-generate.cmake @@ -137,9 +137,9 @@ function(protobuf_generate) add_custom_command( OUTPUT ${_generated_srcs} - COMMAND protobuf::protoc + COMMAND ${protobuf_PROTOC_EXE} ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file} - DEPENDS ${_abs_file} protobuf::protoc ${protobuf_generate_DEPENDENCIES} + DEPENDS ${_abs_file} ${protobuf_PROTOC_EXE} ${protobuf_generate_DEPENDENCIES} COMMENT ${_comment} VERBATIM ) endforeach() From f6c0767a28044388756af8ba4476ee7cda2ba33f Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Mon, 6 Mar 2023 13:03:04 -0800 Subject: [PATCH 33/42] Rename protoc_static for release PiperOrigin-RevId: 514500346 --- pkg/BUILD.bazel | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index 3d871ae90f..1cb49ed38f 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -57,11 +57,17 @@ Please refer to our official github site for more installation instructions: visibility = ["//visibility:private"], ) +genrule( + name = "rename_protoc", + srcs = ["//:protoc_static"], + outs = ["bin/protoc"], + cmd = "cp $< $@", +) + pkg_files( name = "protoc_files", - srcs = ["//:protoc_static"], + srcs = ["bin/protoc"], attributes = pkg_attributes(mode = "0555"), - prefix = "bin/", visibility = ["//visibility:private"], ) From b3733bfc74b8e08f3929ffd6b297ace86e7642e8 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Mon, 6 Mar 2023 15:53:40 -0800 Subject: [PATCH 34/42] Fix released protoc path PiperOrigin-RevId: 514551233 --- pkg/BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index 1cb49ed38f..da5ccf6a5e 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -68,6 +68,7 @@ pkg_files( name = "protoc_files", srcs = ["bin/protoc"], attributes = pkg_attributes(mode = "0555"), + prefix = "bin/", visibility = ["//visibility:private"], ) From 5476b46af3da5e3727f1aeaf49bb1daaa17c9585 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Tue, 7 Mar 2023 19:03:16 +0000 Subject: [PATCH 35/42] Condition executable name on build system --- build_defs/BUILD.bazel | 8 ++++++++ pkg/BUILD.bazel | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/build_defs/BUILD.bazel b/build_defs/BUILD.bazel index 023d4cb089..0a45eae504 100644 --- a/build_defs/BUILD.bazel +++ b/build_defs/BUILD.bazel @@ -84,6 +84,14 @@ config_setting( }, ) +selects.config_setting_group( + name = "config_win", + match_any = [ + ":config_win32", + ":config_win64", + ] +) + config_setting( name = "config_osx_aarch64", values = {"cpu": "osx-aarch_64"}, diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index da5ccf6a5e..4edda57b43 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -62,11 +62,23 @@ genrule( srcs = ["//:protoc_static"], outs = ["bin/protoc"], cmd = "cp $< $@", + tags = ["manual"], +) + +genrule( + name = "rename_protoc_exe", + srcs = ["//:protoc_static"], + outs = ["bin/protoc.exe"], + cmd = "cp $< $@", + tags = ["manual"], ) pkg_files( name = "protoc_files", - srcs = ["bin/protoc"], + srcs = select({ + "//build_defs:config_win": ["bin/protoc.exe"], + "//conditions:default": ["bin/protoc"], + }), attributes = pkg_attributes(mode = "0555"), prefix = "bin/", visibility = ["//visibility:private"], From 839e8d25eab89b8cf5fa6a5a18575a8d383aaad1 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 7 Mar 2023 12:51:16 -0800 Subject: [PATCH 36/42] Updating version.json and repo version numbers to: 22.1 --- CMakeLists.txt | 2 +- Protobuf-C++.podspec | 2 +- Protobuf.podspec | 2 +- csharp/Google.Protobuf.Tools.nuspec | 2 +- .../Google.Protobuf/Google.Protobuf.csproj | 2 +- java/README.md | 6 +++--- java/bom/pom.xml | 2 +- java/core/pom.xml | 2 +- java/kotlin-lite/pom.xml | 2 +- java/kotlin/pom.xml | 2 +- java/lite.md | 2 +- java/lite/pom.xml | 2 +- java/pom.xml | 2 +- java/protoc/pom.xml | 2 +- java/util/pom.xml | 2 +- php/ext/google/protobuf/protobuf.h | 2 +- protobuf_version.bzl | 10 +++++----- python/google/protobuf/__init__.py | 2 +- ruby/google-protobuf.gemspec | 2 +- ruby/pom.xml | 4 ++-- src/google/protobuf/any.pb.h | 2 +- src/google/protobuf/api.pb.h | 2 +- src/google/protobuf/compiler/plugin.pb.h | 2 +- src/google/protobuf/descriptor.pb.h | 2 +- src/google/protobuf/duration.pb.h | 2 +- src/google/protobuf/empty.pb.h | 2 +- src/google/protobuf/field_mask.pb.h | 2 +- src/google/protobuf/port_def.inc | 2 +- src/google/protobuf/source_context.pb.h | 2 +- src/google/protobuf/struct.pb.h | 2 +- src/google/protobuf/stubs/common.h | 2 +- src/google/protobuf/timestamp.pb.h | 2 +- src/google/protobuf/type.pb.h | 2 +- src/google/protobuf/wrappers.pb.h | 2 +- version.json | 20 +++++++++---------- 35 files changed, 51 insertions(+), 51 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b6389cca6..544ce942ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,7 +104,7 @@ if (protobuf_BUILD_SHARED_LIBS) endif () # Version metadata -set(protobuf_VERSION_STRING "4.22.0") +set(protobuf_VERSION_STRING "4.22.1") set(protobuf_DESCRIPTION "Protocol Buffers") set(protobuf_CONTACT "protobuf@googlegroups.com") diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index 8b90ccce49..07e2298973 100644 --- a/Protobuf-C++.podspec +++ b/Protobuf-C++.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Protobuf-C++' - s.version = '4.22.0' + s.version = '4.22.1' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = 'BSD-3-Clause' diff --git a/Protobuf.podspec b/Protobuf.podspec index 286db4b45c..695bba4562 100644 --- a/Protobuf.podspec +++ b/Protobuf.podspec @@ -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.22.0' + s.version = '3.22.1' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/protocolbuffers/protobuf' s.license = 'BSD-3-Clause' diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index e8bc49731b..85ae51bf8e 100644 --- a/csharp/Google.Protobuf.Tools.nuspec +++ b/csharp/Google.Protobuf.Tools.nuspec @@ -5,7 +5,7 @@ Google Protocol Buffers tools

Tools for Protocol Buffers - Google's data interchange format. See project site for more info. - 3.22.0 + 3.22.1 Google Inc. protobuf-packages https://github.com/protocolbuffers/protobuf/blob/main/LICENSE diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj index 026a1d718d..344f4c49eb 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -5,7 +5,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.22.0 + 3.22.1 10.0 Google Inc. netstandard1.1;netstandard2.0;net45;net50 diff --git a/java/README.md b/java/README.md index 8f60bb2af3..7611897e8c 100644 --- a/java/README.md +++ b/java/README.md @@ -23,7 +23,7 @@ If you are using Maven, use the following: com.google.protobuf protobuf-java - 3.22.0 + 3.22.1 ``` @@ -37,14 +37,14 @@ protobuf-java-util package: com.google.protobuf protobuf-java-util - 3.22.0 + 3.22.1 ``` ### Gradle If you are using Gradle, add the following to your `build.gradle` file's -dependencies: `implementation 'com.google.protobuf:protobuf-java:3.22.0'` +dependencies: `implementation 'com.google.protobuf:protobuf-java:3.22.1'` Again, be sure to check that the version number matches (or is newer than) the version number of protoc that you are using. diff --git a/java/bom/pom.xml b/java/bom/pom.xml index f792a62966..22d812da21 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-bom - 3.22.0 + 3.22.1 pom Protocol Buffers [BOM] diff --git a/java/core/pom.xml b/java/core/pom.xml index 6f32c9d59f..b43bf2df7b 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.0 + 3.22.1 protobuf-java diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml index c91bd889ad..37193f2921 100644 --- a/java/kotlin-lite/pom.xml +++ b/java/kotlin-lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.0 + 3.22.1 protobuf-kotlin-lite diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml index 1d265d56e0..f9aa88edf4 100644 --- a/java/kotlin/pom.xml +++ b/java/kotlin/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.0 + 3.22.1 protobuf-kotlin diff --git a/java/lite.md b/java/lite.md index 035b86c2bf..41e00aadfa 100644 --- a/java/lite.md +++ b/java/lite.md @@ -29,7 +29,7 @@ protobuf Java Lite runtime. If you are using Maven, include the following: com.google.protobuf protobuf-javalite - 3.22.0 + 3.22.1 ``` diff --git a/java/lite/pom.xml b/java/lite/pom.xml index d472b36c3e..ae9689fd03 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.0 + 3.22.1 protobuf-javalite diff --git a/java/pom.xml b/java/pom.xml index cedeb04d0e..26b595ee6b 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.0 + 3.22.1 pom Protocol Buffers [Parent] diff --git a/java/protoc/pom.xml b/java/protoc/pom.xml index 4ffc34dde8..a891850ac7 100644 --- a/java/protoc/pom.xml +++ b/java/protoc/pom.xml @@ -8,7 +8,7 @@ com.google.protobuf protoc - 3.22.0 + 3.22.1 pom Protobuf Compiler diff --git a/java/util/pom.xml b/java/util/pom.xml index 84cba14001..f8bc8e6e35 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.0 + 3.22.1 protobuf-java-util diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index e26ee44285..4ed924b607 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -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.22.0" +#define PHP_PROTOBUF_VERSION "3.22.1" // ptr -> PHP object cache. This is a weak map that caches lazily-created // wrapper objects around upb types: diff --git a/protobuf_version.bzl b/protobuf_version.bzl index e3e45eba50..0d93a46668 100644 --- a/protobuf_version.bzl +++ b/protobuf_version.bzl @@ -1,5 +1,5 @@ -PROTOC_VERSION = "22.0" -PROTOBUF_JAVA_VERSION = "3.22.0" -PROTOBUF_PYTHON_VERSION = "4.22.0" -PROTOBUF_PHP_VERSION = "3.22.0" -PROTOBUF_RUBY_VERSION = "3.22.0" +PROTOC_VERSION = "22.1" +PROTOBUF_JAVA_VERSION = "3.22.1" +PROTOBUF_PYTHON_VERSION = "4.22.1" +PROTOBUF_PHP_VERSION = "3.22.1" +PROTOBUF_RUBY_VERSION = "3.22.1" diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index a301349e31..b9650b1969 100755 --- a/python/google/protobuf/__init__.py +++ b/python/google/protobuf/__init__.py @@ -30,4 +30,4 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '4.22.0' +__version__ = '4.22.1' diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index 174657dee3..37acd1bb15 100644 --- a/ruby/google-protobuf.gemspec +++ b/ruby/google-protobuf.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "google-protobuf" - s.version = "3.22.0" + s.version = "3.22.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" diff --git a/ruby/pom.xml b/ruby/pom.xml index 1d3de9b563..503d3af02d 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -9,7 +9,7 @@ com.google.protobuf.jruby protobuf-jruby - 3.22.0 + 3.22.1 Protocol Buffer JRuby native extension Protocol Buffers are a way of encoding structured data in an efficient yet @@ -76,7 +76,7 @@ com.google.protobuf protobuf-java-util - 3.22.0 + 3.22.1 org.jruby diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index 6bedd8fae7..8a74236445 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index 4e7097ac41..ac59bce495 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index d5480b1aae..bc6d390ffb 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index d2005d163d..ff15dcb7e5 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index 69f4ada05f..6609a9e420 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index 7fa63da62e..16bacbf9c2 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index bf9954e71c..7b7833ef28 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index ef458adb83..def5de4fab 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -218,7 +218,7 @@ static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and #ifdef PROTOBUF_VERSION #error PROTOBUF_VERSION was previously defined #endif -#define PROTOBUF_VERSION 4022000 +#define PROTOBUF_VERSION 4022001 #ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC #error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index 45bc094f61..ee2b4ff586 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index 5ff466f41e..64944211f3 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index 5f1652d25d..80426dc306 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -66,7 +66,7 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 4022000 +#define GOOGLE_PROTOBUF_VERSION 4022001 // A suffix string for alpha, beta or rc releases. Empty for stable releases. #define GOOGLE_PROTOBUF_VERSION_SUFFIX "" diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index b7b25cf43b..86ffd2afaf 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index 710f8cf7b8..64236a6714 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index d5fb290c8f..0b41068199 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022000 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/version.json b/version.json index bc12f0e681..0db51012ac 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "22.x": { - "protoc_version": "22.1-dev", + "protoc_version": "22.1", "lts": false, - "date": "2023-02-16", + "date": "2023-03-07", "languages": { - "cpp": "4.22.1-dev", - "csharp": "3.22.1-dev", - "java": "3.22.1-dev", - "javascript": "3.22.1-dev", - "objectivec": "3.22.1-dev", - "php": "3.22.1-dev", - "python": "4.22.1-dev", - "ruby": "3.22.1-dev" + "cpp": "4.22.1", + "csharp": "3.22.1", + "java": "3.22.1", + "javascript": "3.22.1", + "objectivec": "3.22.1", + "php": "3.22.1", + "python": "4.22.1", + "ruby": "3.22.1" } } } \ No newline at end of file From 9c02d4c0de5b32225716483332c892692b19a483 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 7 Mar 2023 12:51:16 -0800 Subject: [PATCH 37/42] Updating version.json to: 22.2-dev --- version.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/version.json b/version.json index 0db51012ac..9593f13181 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "22.x": { - "protoc_version": "22.1", + "protoc_version": "22.2-dev", "lts": false, "date": "2023-03-07", "languages": { - "cpp": "4.22.1", - "csharp": "3.22.1", - "java": "3.22.1", - "javascript": "3.22.1", - "objectivec": "3.22.1", - "php": "3.22.1", - "python": "4.22.1", - "ruby": "3.22.1" + "cpp": "4.22.2-dev", + "csharp": "3.22.2-dev", + "java": "3.22.2-dev", + "javascript": "3.22.2-dev", + "objectivec": "3.22.2-dev", + "php": "3.22.2-dev", + "python": "4.22.2-dev", + "ruby": "3.22.2-dev" } } } \ No newline at end of file From 8ac23375950e905f54f2523807b68618bd047835 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Wed, 8 Mar 2023 17:29:14 +0000 Subject: [PATCH 38/42] Remove $ in pom files --- java/core/pom_template.xml | 2 +- java/kotlin-lite/pom_template.xml | 2 +- java/kotlin/pom_template.xml | 2 +- java/lite/pom_template.xml | 2 +- java/util/pom_template.xml | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/java/core/pom_template.xml b/java/core/pom_template.xml index 11bd41964f..a5ea5e3b6d 100644 --- a/java/core/pom_template.xml +++ b/java/core/pom_template.xml @@ -31,7 +31,7 @@ com.google.protobuf https://developers.google.com/protocol-buffers/ com.google.protobuf - com.google.protobuf;version=${project.version} + com.google.protobuf;version={project.version} sun.misc;resolution:=optional,* diff --git a/java/kotlin-lite/pom_template.xml b/java/kotlin-lite/pom_template.xml index 90d9857dd8..f9265b18d2 100644 --- a/java/kotlin-lite/pom_template.xml +++ b/java/kotlin-lite/pom_template.xml @@ -17,7 +17,7 @@ - ${groupId} + {groupId} protobuf-javalite {dependencies} diff --git a/java/kotlin/pom_template.xml b/java/kotlin/pom_template.xml index d04bc89fc3..a4a04f2ff0 100644 --- a/java/kotlin/pom_template.xml +++ b/java/kotlin/pom_template.xml @@ -17,7 +17,7 @@ - ${groupId} + {groupId} protobuf-java {dependencies} diff --git a/java/lite/pom_template.xml b/java/lite/pom_template.xml index 728c291a4b..878b64658a 100644 --- a/java/lite/pom_template.xml +++ b/java/lite/pom_template.xml @@ -31,7 +31,7 @@ com.google.protobuf https://developers.google.com/protocol-buffers/ com.google.protobuf - com.google.protobuf;version=${project.version} + com.google.protobuf;version={project.version} sun.misc;resolution:=optional,* diff --git a/java/util/pom_template.xml b/java/util/pom_template.xml index 74ef795f17..456aac471e 100644 --- a/java/util/pom_template.xml +++ b/java/util/pom_template.xml @@ -14,7 +14,7 @@ Utilities for Protocol Buffers - ${groupId} + {groupId} protobuf-java {dependencies} @@ -32,7 +32,7 @@ com.google.protobuf.util https://developers.google.com/protocol-buffers/ com.google.protobuf.util - com.google.protobuf.util;version=${project.version} + com.google.protobuf.util;version={project.version} From d80c12d3221fd489b779fccf0020a17bd666a311 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 9 Mar 2023 17:08:04 +0000 Subject: [PATCH 39/42] Add $ back for osgi header --- java/core/pom_template.xml | 2 +- java/lite/pom_template.xml | 2 +- java/util/pom_template.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/core/pom_template.xml b/java/core/pom_template.xml index a5ea5e3b6d..11bd41964f 100644 --- a/java/core/pom_template.xml +++ b/java/core/pom_template.xml @@ -31,7 +31,7 @@ com.google.protobuf https://developers.google.com/protocol-buffers/ com.google.protobuf - com.google.protobuf;version={project.version} + com.google.protobuf;version=${project.version} sun.misc;resolution:=optional,* diff --git a/java/lite/pom_template.xml b/java/lite/pom_template.xml index 878b64658a..728c291a4b 100644 --- a/java/lite/pom_template.xml +++ b/java/lite/pom_template.xml @@ -31,7 +31,7 @@ com.google.protobuf https://developers.google.com/protocol-buffers/ com.google.protobuf - com.google.protobuf;version={project.version} + com.google.protobuf;version=${project.version} sun.misc;resolution:=optional,* diff --git a/java/util/pom_template.xml b/java/util/pom_template.xml index 456aac471e..77ffa8538d 100644 --- a/java/util/pom_template.xml +++ b/java/util/pom_template.xml @@ -32,7 +32,7 @@ com.google.protobuf.util https://developers.google.com/protocol-buffers/ com.google.protobuf.util - com.google.protobuf.util;version={project.version} + com.google.protobuf.util;version=${project.version} From 99ed01009f14fbfb885f98c3512818af8033ef6a Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 10 Mar 2023 00:13:38 +0000 Subject: [PATCH 40/42] Add version to intra proto dependencies and add kotlin stdlib dependency --- java/kotlin-lite/pom_template.xml | 6 ++++++ java/kotlin/pom_template.xml | 6 ++++++ java/util/pom_template.xml | 1 + 3 files changed, 13 insertions(+) diff --git a/java/kotlin-lite/pom_template.xml b/java/kotlin-lite/pom_template.xml index f9265b18d2..6e3e05fcce 100644 --- a/java/kotlin-lite/pom_template.xml +++ b/java/kotlin-lite/pom_template.xml @@ -19,6 +19,12 @@ {groupId} protobuf-javalite + {version} + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} {dependencies} diff --git a/java/kotlin/pom_template.xml b/java/kotlin/pom_template.xml index a4a04f2ff0..a66e44d52b 100644 --- a/java/kotlin/pom_template.xml +++ b/java/kotlin/pom_template.xml @@ -19,6 +19,12 @@ {groupId} protobuf-java + {version} + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} {dependencies} diff --git a/java/util/pom_template.xml b/java/util/pom_template.xml index 77ffa8538d..82d84c8721 100644 --- a/java/util/pom_template.xml +++ b/java/util/pom_template.xml @@ -16,6 +16,7 @@ {groupId} protobuf-java + {version} {dependencies} From 81f89d509d6771dcccb619cbe26ac86cec472582 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Fri, 10 Mar 2023 07:57:16 -0800 Subject: [PATCH 41/42] Updating version.json and repo version numbers to: 22.2 --- CMakeLists.txt | 2 +- Protobuf-C++.podspec | 2 +- Protobuf.podspec | 2 +- csharp/Google.Protobuf.Tools.nuspec | 2 +- .../Google.Protobuf/Google.Protobuf.csproj | 2 +- java/README.md | 6 +++--- java/bom/pom.xml | 2 +- java/core/pom.xml | 2 +- java/kotlin-lite/pom.xml | 2 +- java/kotlin/pom.xml | 2 +- java/lite.md | 2 +- java/lite/pom.xml | 2 +- java/pom.xml | 2 +- java/protoc/pom.xml | 2 +- java/util/pom.xml | 2 +- php/ext/google/protobuf/protobuf.h | 2 +- protobuf_version.bzl | 10 +++++----- python/google/protobuf/__init__.py | 2 +- ruby/google-protobuf.gemspec | 2 +- ruby/pom.xml | 4 ++-- src/google/protobuf/any.pb.h | 2 +- src/google/protobuf/api.pb.h | 2 +- src/google/protobuf/compiler/plugin.pb.h | 2 +- src/google/protobuf/descriptor.pb.h | 2 +- src/google/protobuf/duration.pb.h | 2 +- src/google/protobuf/empty.pb.h | 2 +- src/google/protobuf/field_mask.pb.h | 2 +- src/google/protobuf/port_def.inc | 2 +- src/google/protobuf/source_context.pb.h | 2 +- src/google/protobuf/struct.pb.h | 2 +- src/google/protobuf/stubs/common.h | 2 +- src/google/protobuf/timestamp.pb.h | 2 +- src/google/protobuf/type.pb.h | 2 +- src/google/protobuf/wrappers.pb.h | 2 +- version.json | 20 +++++++++---------- 35 files changed, 51 insertions(+), 51 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 544ce942ea..2e38c1bac8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,7 +104,7 @@ if (protobuf_BUILD_SHARED_LIBS) endif () # Version metadata -set(protobuf_VERSION_STRING "4.22.1") +set(protobuf_VERSION_STRING "4.22.2") set(protobuf_DESCRIPTION "Protocol Buffers") set(protobuf_CONTACT "protobuf@googlegroups.com") diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index 07e2298973..fcdc2a45db 100644 --- a/Protobuf-C++.podspec +++ b/Protobuf-C++.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Protobuf-C++' - s.version = '4.22.1' + s.version = '4.22.2' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = 'BSD-3-Clause' diff --git a/Protobuf.podspec b/Protobuf.podspec index 695bba4562..47a964848b 100644 --- a/Protobuf.podspec +++ b/Protobuf.podspec @@ -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.22.1' + s.version = '3.22.2' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/protocolbuffers/protobuf' s.license = 'BSD-3-Clause' diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index 85ae51bf8e..e2e665b3c2 100644 --- a/csharp/Google.Protobuf.Tools.nuspec +++ b/csharp/Google.Protobuf.Tools.nuspec @@ -5,7 +5,7 @@ Google Protocol Buffers tools Tools for Protocol Buffers - Google's data interchange format. See project site for more info. - 3.22.1 + 3.22.2 Google Inc. protobuf-packages https://github.com/protocolbuffers/protobuf/blob/main/LICENSE diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj index 344f4c49eb..1c9a007950 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -5,7 +5,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.22.1 + 3.22.2 10.0 Google Inc. netstandard1.1;netstandard2.0;net45;net50 diff --git a/java/README.md b/java/README.md index 7611897e8c..30db5936d8 100644 --- a/java/README.md +++ b/java/README.md @@ -23,7 +23,7 @@ If you are using Maven, use the following: com.google.protobuf protobuf-java - 3.22.1 + 3.22.2 ``` @@ -37,14 +37,14 @@ protobuf-java-util package: com.google.protobuf protobuf-java-util - 3.22.1 + 3.22.2 ``` ### Gradle If you are using Gradle, add the following to your `build.gradle` file's -dependencies: `implementation 'com.google.protobuf:protobuf-java:3.22.1'` +dependencies: `implementation 'com.google.protobuf:protobuf-java:3.22.2'` Again, be sure to check that the version number matches (or is newer than) the version number of protoc that you are using. diff --git a/java/bom/pom.xml b/java/bom/pom.xml index 22d812da21..c08916d260 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-bom - 3.22.1 + 3.22.2 pom Protocol Buffers [BOM] diff --git a/java/core/pom.xml b/java/core/pom.xml index b43bf2df7b..60696c3b5c 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.1 + 3.22.2 protobuf-java diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml index 37193f2921..da3059f096 100644 --- a/java/kotlin-lite/pom.xml +++ b/java/kotlin-lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.1 + 3.22.2 protobuf-kotlin-lite diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml index f9aa88edf4..ec6cf3a63c 100644 --- a/java/kotlin/pom.xml +++ b/java/kotlin/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.1 + 3.22.2 protobuf-kotlin diff --git a/java/lite.md b/java/lite.md index 41e00aadfa..1bda472627 100644 --- a/java/lite.md +++ b/java/lite.md @@ -29,7 +29,7 @@ protobuf Java Lite runtime. If you are using Maven, include the following: com.google.protobuf protobuf-javalite - 3.22.1 + 3.22.2 ``` diff --git a/java/lite/pom.xml b/java/lite/pom.xml index ae9689fd03..e69f773ae3 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.1 + 3.22.2 protobuf-javalite diff --git a/java/pom.xml b/java/pom.xml index 26b595ee6b..8092ca6c2f 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.1 + 3.22.2 pom Protocol Buffers [Parent] diff --git a/java/protoc/pom.xml b/java/protoc/pom.xml index a891850ac7..02976e1a83 100644 --- a/java/protoc/pom.xml +++ b/java/protoc/pom.xml @@ -8,7 +8,7 @@ com.google.protobuf protoc - 3.22.1 + 3.22.2 pom Protobuf Compiler diff --git a/java/util/pom.xml b/java/util/pom.xml index f8bc8e6e35..d8326eb0ca 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.22.1 + 3.22.2 protobuf-java-util diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 4ed924b607..0d9399a199 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -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.22.1" +#define PHP_PROTOBUF_VERSION "3.22.2" // ptr -> PHP object cache. This is a weak map that caches lazily-created // wrapper objects around upb types: diff --git a/protobuf_version.bzl b/protobuf_version.bzl index 0d93a46668..b71c23ff42 100644 --- a/protobuf_version.bzl +++ b/protobuf_version.bzl @@ -1,5 +1,5 @@ -PROTOC_VERSION = "22.1" -PROTOBUF_JAVA_VERSION = "3.22.1" -PROTOBUF_PYTHON_VERSION = "4.22.1" -PROTOBUF_PHP_VERSION = "3.22.1" -PROTOBUF_RUBY_VERSION = "3.22.1" +PROTOC_VERSION = "22.2" +PROTOBUF_JAVA_VERSION = "3.22.2" +PROTOBUF_PYTHON_VERSION = "4.22.2" +PROTOBUF_PHP_VERSION = "3.22.2" +PROTOBUF_RUBY_VERSION = "3.22.2" diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index b9650b1969..2af0a0262d 100755 --- a/python/google/protobuf/__init__.py +++ b/python/google/protobuf/__init__.py @@ -30,4 +30,4 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '4.22.1' +__version__ = '4.22.2' diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index 37acd1bb15..157efc060d 100644 --- a/ruby/google-protobuf.gemspec +++ b/ruby/google-protobuf.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "google-protobuf" - s.version = "3.22.1" + s.version = "3.22.2" 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" diff --git a/ruby/pom.xml b/ruby/pom.xml index 503d3af02d..3a5f626c5b 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -9,7 +9,7 @@ com.google.protobuf.jruby protobuf-jruby - 3.22.1 + 3.22.2 Protocol Buffer JRuby native extension Protocol Buffers are a way of encoding structured data in an efficient yet @@ -76,7 +76,7 @@ com.google.protobuf protobuf-java-util - 3.22.1 + 3.22.2 org.jruby diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index 8a74236445..e128168113 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index ac59bce495..f5653cc168 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index bc6d390ffb..f6b0317bd2 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index ff15dcb7e5..ad00d873a7 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index 6609a9e420..b286f88fa1 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index 16bacbf9c2..1ecc2ff6b1 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index 7b7833ef28..2e6bf30e19 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index def5de4fab..90cae4916a 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -218,7 +218,7 @@ static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and #ifdef PROTOBUF_VERSION #error PROTOBUF_VERSION was previously defined #endif -#define PROTOBUF_VERSION 4022001 +#define PROTOBUF_VERSION 4022002 #ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC #error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index ee2b4ff586..3e11f7ac25 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index 64944211f3..fc4329030c 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index 80426dc306..25cffd08c8 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -66,7 +66,7 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 4022001 +#define GOOGLE_PROTOBUF_VERSION 4022002 // A suffix string for alpha, beta or rc releases. Empty for stable releases. #define GOOGLE_PROTOBUF_VERSION_SUFFIX "" diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index 86ffd2afaf..128021faf3 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index 64236a6714..750250993b 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index 0b41068199..70c4d4ffd6 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -15,7 +15,7 @@ #error "your headers." #endif // PROTOBUF_VERSION -#if 4022001 < PROTOBUF_MIN_PROTOC_VERSION +#if 4022002 < PROTOBUF_MIN_PROTOC_VERSION #error "This file was generated by an older version of protoc which is" #error "incompatible with your Protocol Buffer headers. Please" #error "regenerate this file with a newer version of protoc." diff --git a/version.json b/version.json index 9593f13181..1f5a26323c 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "22.x": { - "protoc_version": "22.2-dev", + "protoc_version": "22.2", "lts": false, - "date": "2023-03-07", + "date": "2023-03-10", "languages": { - "cpp": "4.22.2-dev", - "csharp": "3.22.2-dev", - "java": "3.22.2-dev", - "javascript": "3.22.2-dev", - "objectivec": "3.22.2-dev", - "php": "3.22.2-dev", - "python": "4.22.2-dev", - "ruby": "3.22.2-dev" + "cpp": "4.22.2", + "csharp": "3.22.2", + "java": "3.22.2", + "javascript": "3.22.2", + "objectivec": "3.22.2", + "php": "3.22.2", + "python": "4.22.2", + "ruby": "3.22.2" } } } \ No newline at end of file From 653673916c9190ef582e61fca68ee03370ee8527 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Fri, 10 Mar 2023 07:57:16 -0800 Subject: [PATCH 42/42] Updating version.json to: 22.3-dev --- version.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/version.json b/version.json index 1f5a26323c..643dcbb18b 100644 --- a/version.json +++ b/version.json @@ -1,17 +1,17 @@ { "22.x": { - "protoc_version": "22.2", + "protoc_version": "22.3-dev", "lts": false, "date": "2023-03-10", "languages": { - "cpp": "4.22.2", - "csharp": "3.22.2", - "java": "3.22.2", - "javascript": "3.22.2", - "objectivec": "3.22.2", - "php": "3.22.2", - "python": "4.22.2", - "ruby": "3.22.2" + "cpp": "4.22.3-dev", + "csharp": "3.22.3-dev", + "java": "3.22.3-dev", + "javascript": "3.22.3-dev", + "objectivec": "3.22.3-dev", + "php": "3.22.3-dev", + "python": "4.22.3-dev", + "ruby": "3.22.3-dev" } } } \ No newline at end of file