From afe2de261861717026c3b57ec83678590d5de838 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 6 Dec 2024 13:02:16 -0800 Subject: [PATCH] Move to bazel 7 and turn down support for bazel 6. Migrate all tests to run on bazel 7 and fix errors that came up in the process. 30.x will no longer guarantee support for bazel 6. #test-continuous PiperOrigin-RevId: 703590770 --- .github/workflows/staleness_check.yml | 1 + .github/workflows/test_bazel.yml | 13 +--------- .github/workflows/test_cpp.yml | 36 +++++++++------------------ .github/workflows/test_csharp.yml | 4 +-- .github/workflows/test_java.yml | 15 +++++------ .github/workflows/test_objectivec.yml | 2 ++ .github/workflows/test_php_ext.yml | 1 + .github/workflows/test_python.yml | 2 +- .github/workflows/test_ruby.yml | 11 ++++---- .github/workflows/test_rust.yml | 4 +-- .github/workflows/test_upb.yml | 15 ++++++----- MODULE.bazel | 1 + WORKSPACE | 11 ++++++++ ci/common.bazelrc | 2 ++ ci/macOS.bazelrc | 4 ++- protobuf_deps.bzl | 16 +++++++++--- toolchain/toolchains.bazelrc | 1 + 17 files changed, 73 insertions(+), 66 deletions(-) diff --git a/.github/workflows/staleness_check.yml b/.github/workflows/staleness_check.yml index 72dafb22a478..5cb0fbe30c38 100644 --- a/.github/workflows/staleness_check.yml +++ b/.github/workflows/staleness_check.yml @@ -50,6 +50,7 @@ jobs: # commit. uses: protocolbuffers/protobuf-ci/bazel@v3 with: + version: 7.1.2 # Bazel version credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: staleness bash: > diff --git a/.github/workflows/test_bazel.yml b/.github/workflows/test_bazel.yml index ef273306b61b..d824c5c32b6b 100644 --- a/.github/workflows/test_bazel.yml +++ b/.github/workflows/test_bazel.yml @@ -29,18 +29,7 @@ jobs: runner: [ ubuntu, windows, macos ] bazelversion: [ '7.1.2' ] bzlmod: [ true, false ] - toolchain_resolution: [ "" ] - include: - - runner: ubuntu - bazelversion: '6.4.0' - # Not running Bazel 6 with bzlmod, because it doesn't support use_repo_rule in rules_jvm_external - bzlmod: false - - runner: ubuntu - bzlmod: false - toolchain_resolution: --incompatible_enable_proto_toolchain_resolution=true - - runner: ubuntu - bzlmod: true - toolchain_resolution: --incompatible_enable_proto_toolchain_resolution=true + toolchain_resolution: [ "", "--incompatible_enable_proto_toolchain_resolution=true" ] runs-on: ${{ matrix.runner }}-latest name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Examples ${{ matrix.runner }} ${{ matrix.bazelversion }}${{ matrix.bzlmod && ' (bzlmod)' || '' }} ${{ matrix.toolchain_resolution && ' (toolchain resolution)' || '' }} steps: diff --git a/.github/workflows/test_cpp.yml b/.github/workflows/test_cpp.yml index 437c35b310f0..f9a468e1cf79 100644 --- a/.github/workflows/test_cpp.yml +++ b/.github/workflows/test_cpp.yml @@ -37,27 +37,27 @@ jobs: - { name: No-RTTI, flags: --cxxopt=-fno-rtti, continuous-only: true } include: # Set defaults - - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:6.4.0-27cf7b86212020d7e552bc13b1e084abb971da75 + - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:7.1.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 - targets: //pkg/... //src/... @com_google_protobuf_examples//... //third_party/utf8_range/... //conformance:conformance_framework_tests # Override cases with custom images - config: { name: "Bazel7", flags: --noenable_bzlmod } cache_key: Bazel7 - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-cf84e92285ca133b9c8104ad7b14d70e953cbb8e" + image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75" targets: "//src/... //third_party/utf8_range/..." # TODO: remove -Wno-unreachable-code" when dropping C++14 - config: { name: "Bazel7 with Bzlmod", flags: --enable_bzlmod --enable_workspace --per_file_copt=.*/absl/strings/string_view.h@-Wno-unreachable-code --cxxopt="-Wno-self-assign-overloaded" } cache_key: Bazel7bzlmod - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-cf84e92285ca133b9c8104ad7b14d70e953cbb8e" + image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75" targets: "//src/... //third_party/utf8_range/..." - config: { name: "TCMalloc" } cache_key: TcMalloc - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc:6.4.0-27cf7b86212020d7e552bc13b1e084abb971da75" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc:7.1.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82" targets: "//src/... //third_party/utf8_range/..." - config: { name: "aarch64" } - cache_key: TcMalloc + cache_key: aarch64-bazel7 targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test //third_party/utf8_range/..." - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:6.4.0-aarch64-08714ed7a713068c8418003a2d95f423d4b1eac9" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-aarch64-2920199ab0090ed427413a8e422e62695c8392a8" name: ${{ matrix.config.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.config.name }} runs-on: ${{ matrix.config.runner || 'ubuntu-latest' }} steps: @@ -91,7 +91,7 @@ jobs: - name: Run tests uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:6.4.0-${{ matrix.version }}-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:7.1.2-${{ matrix.version }}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: cpp_linux/gcc-${{ matrix.version }} bazel: test //pkg/... //src/... @com_google_protobuf_examples//... //third_party/utf8_range/... //conformance:conformance_framework_tests @@ -101,7 +101,7 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: arch: [x86_64, aarch64] - name: Linux Release ${{ matrix.arch}} + name: Linux Release ${{ matrix.arch }} runs-on: ubuntu-20-4core steps: - name: Checkout pending changes @@ -112,7 +112,7 @@ jobs: id: cross-compile uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.4.0-cf84e92285ca133b9c8104ad7b14d70e953cbb8e + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-${{ matrix.arch }} - name: Setup sccache @@ -123,7 +123,7 @@ jobs: - name: Run tests uses: protocolbuffers/protobuf-ci/docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:6.4.0-${{ matrix.arch }}-08714ed7a713068c8418003a2d95f423d4b1eac9 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-${{ matrix.arch }}-2920199ab0090ed427413a8e422e62695c8392a8 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} entrypoint: bash command: > @@ -293,7 +293,7 @@ jobs: if: ${{ !matrix.continuous-only || inputs.continuous-run }} uses: protocolbuffers/protobuf-ci/docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:6.4.0-12.2-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:7.1.2-12.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} entrypoint: bash command: >- @@ -341,15 +341,9 @@ jobs: matrix: include: - name: MacOS Bazel - os: macos-13 - cache_key: macos-13 - bazel: test //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests - - name: MacOS Bazel 7 os: macos-13 cache_key: macos-13-bazel7 bazel: test //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests - bazel_version: '7.1.2' - continuous-only: true - name: MacOS Apple Silicon (build only) Bazel os: macos-13 cache_key: macos-13-arm @@ -357,15 +351,9 @@ jobs: # for Apple Silicon to detect issues there. bazel: build --cpu=darwin_arm64 //src/... //third_party/utf8_range/... //conformance:conformance_framework_tests - name: Windows Bazel - os: windows-2022 - cache_key: windows-2022 - bazel: test //src/... @com_google_protobuf_examples//... --test_tag_filters=-conformance --build_tag_filters=-conformance - - name: Windows Bazel 7 os: windows-2022 cache_key: windows-2022-bazel7 bazel: test //src/... @com_google_protobuf_examples//... --test_tag_filters=-conformance --build_tag_filters=-conformance - bazel_version: '7.1.2' - continuous-only: true name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: @@ -381,7 +369,7 @@ jobs: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel: ${{ matrix.bazel }} bazel-cache: cpp_${{ matrix.cache_key }} - version: ${{ matrix.bazel_version || '6.4.0' }} + version: ${{ matrix.bazel_version || '7.1.2' }} non-linux-cmake: strategy: diff --git a/.github/workflows/test_csharp.yml b/.github/workflows/test_csharp.yml index b41a18a54777..f6248ad2c0dd 100644 --- a/.github/workflows/test_csharp.yml +++ b/.github/workflows/test_csharp.yml @@ -27,7 +27,7 @@ jobs: - name: Run tests uses: protocolbuffers/protobuf-ci/docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:6.4.0-3.1.415-6.0.100-08714ed7a713068c8418003a2d95f423d4b1eac9 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:7.1.2-3.1.415-6.0.100-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} entrypoint: /bin/bash command: >- @@ -43,7 +43,7 @@ jobs: - name: Run conformance tests uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:6.4.0-3.1.415-6.0.100-08714ed7a713068c8418003a2d95f423d4b1eac9 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:7.1.2-3.1.415-6.0.100-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: csharp_linux bazel: test //csharp:conformance_test --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 2af1bdeadba8..4f444bb6deb9 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -30,32 +30,33 @@ jobs: include: - name: OpenJDK 8 cache_key: '8' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:6.4.0-8-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-8-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 # TODO: b/318555165 - enable the layering check. Currently it does # not work correctly with the toolchain in this Docker image. targets: //java/... //java/internal:java_version //compatibility/... --features=-layering_check + flags: --java_language_version=8 - name: OpenJDK 11 cache_key: '11' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:6.4.0-11-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-11-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 targets: //java/... //java/internal:java_version //compatibility/... continuous-only: true - name: OpenJDK 17 cache_key: '17' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:6.4.0-17-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-17-641278a52587c01f44525819b76499db35c2804d targets: //java/... //java/internal:java_version //compatibility/... - name: Bazel7 cache_key: 'bazel7nobzlmod' - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-cf84e92285ca133b9c8104ad7b14d70e953cbb8e + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 targets: //java/... //java/internal:java_version //compatibility/... flags: --noenable_bzlmod - name: Bazel7 with Bzlmod cache_key: 'bazel7bzlmod' - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-cf84e92285ca133b9c8104ad7b14d70e953cbb8e + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 targets: //java/... //java/internal:java_version //compatibility/... flags: --enable_bzlmod --enable_workspace - name: aarch64 cache_key: 'aarch64' - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:6.4.0-aarch64-08714ed7a713068c8418003a2d95f423d4b1eac9 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-aarch64-2920199ab0090ed427413a8e422e62695c8392a8 targets: //java/... //compatibility/... //src/google/protobuf/compiler:protoc_aarch64_test name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.name }} @@ -105,7 +106,7 @@ jobs: - name: Generate maven artifacts with bazel and install using maven uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:6.4.0-11-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-11-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: java_linux/11 bash: | diff --git a/.github/workflows/test_objectivec.yml b/.github/workflows/test_objectivec.yml index 6be5bbed6525..4df89db90f7d 100644 --- a/.github/workflows/test_objectivec.yml +++ b/.github/workflows/test_objectivec.yml @@ -111,6 +111,7 @@ jobs: if: ${{ !matrix.continuous-only || inputs.continuous-run }} uses: protocolbuffers/protobuf-ci/bazel@v3 with: + version: 7.1.2 # Bazel version credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: cocoapods/${{ matrix.XCODE }} bash: | @@ -158,6 +159,7 @@ jobs: if: ${{ !matrix.config.continuous-only || inputs.continuous-run }} uses: protocolbuffers/protobuf-ci/bazel@v3 with: + version: 7.1.2 # Bazel version credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel: ${{ matrix.config.bazel_action }} ${{ matrix.config.flags }} ${{ matrix.bazel_targets }} bazel-cache: objc_${{ matrix.platform }}_${{ matrix.config.name }} diff --git a/.github/workflows/test_php_ext.yml b/.github/workflows/test_php_ext.yml index 5179c9f7baa6..79342a75ef43 100644 --- a/.github/workflows/test_php_ext.yml +++ b/.github/workflows/test_php_ext.yml @@ -35,6 +35,7 @@ jobs: - name: Package extension uses: protocolbuffers/protobuf-ci/bazel@v3 with: + version: 7.1.2 # Bazel version credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: php_ext/${{ matrix.version }} bash: > diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml index ddb2fd4616df..faf6dcdbb139 100644 --- a/.github/workflows/test_python.yml +++ b/.github/workflows/test_python.yml @@ -41,7 +41,7 @@ jobs: targets: //python/... //python:aarch64_test # TODO 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-63dd26c0c7a808d92673a3e52e848189d4ab0f17 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-aarch64-2920199ab0090ed427413a8e422e62695c8392a8 - version: "3.9" - version: "3.10" continuous-only: true diff --git a/.github/workflows/test_ruby.yml b/.github/workflows/test_ruby.yml index 5d052ccd3318..93746ceddc83 100644 --- a/.github/workflows/test_ruby.yml +++ b/.github/workflows/test_ruby.yml @@ -51,9 +51,9 @@ jobs: if: ${{ !matrix.continuous-only || inputs.continuous-run }} uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:6.4.0-{0}-27cf7b86212020d7e552bc13b1e084abb971da75', matrix.ruby) }} + image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-{0}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82', matrix.ruby) }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - bazel-cache: ruby_linux/${{ matrix.ruby }}_${{ matrix.bazel }} + bazel-cache: ruby_linux/${{ matrix.ruby }} bazel: test //ruby/... //ruby/tests:ruby_version --test_env=KOKORO_RUBY_VERSION --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }} # Useful tool for troubleshooting, but the action introduces flakes as well, # e.g. https://github.com/actions/upload-artifact/issues/569 @@ -77,7 +77,7 @@ jobs: id: cross-compile uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.4.0-cf84e92285ca133b9c8104ad7b14d70e953cbb8e + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-i386 @@ -108,7 +108,7 @@ jobs: id: cross-compile uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.4.0-cf84e92285ca133b9c8104ad7b14d70e953cbb8e + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-cf84e92285ca133b9c8104ad7b14d70e953cbb8e credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} architecture: linux-aarch64 @@ -164,6 +164,7 @@ jobs: if: ${{ !matrix.continuous-only || inputs.continuous-run }} uses: protocolbuffers/protobuf-ci/bazel@v3 with: + version: 7.1.2 # Bazel version credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: ruby_macos/${{ matrix.version }} bazel: test //ruby/... --test_env=KOKORO_RUBY_VERSION=${{ matrix.version }} --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }} @@ -196,7 +197,7 @@ jobs: if: ${{ inputs.continuous-run }} uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:6.4.0-${{ matrix.ruby }}-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-${{ matrix.ruby }}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: ruby_install/${{ matrix.ruby }}_${{ matrix.bazel }} bash: > diff --git a/.github/workflows/test_rust.yml b/.github/workflows/test_rust.yml index 2f0bb2632127..c05b5c9b5aa2 100644 --- a/.github/workflows/test_rust.yml +++ b/.github/workflows/test_rust.yml @@ -26,12 +26,12 @@ jobs: include: - targets: "//rust/... //src/google/protobuf/compiler/rust/..." - - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.1-97f82260fd504923d8af642d567afb2d83a1959d" + - image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75" - bazel_cmd: "test" # Override cases with custom images - config: { name: Cargo } - image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:6.3.0-1.74.0-8858126dd9480abf91e6ce8d6e41a5cd3c03882c" + image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:7.1.2-1.74.0-d9624f2aa83cba3eaf906f751d75b36aacb9aa82" bazel_cmd: "run" targets: "//rust/release_crates:cargo_test" name: Linux ${{ matrix.config.name }} diff --git a/.github/workflows/test_upb.yml b/.github/workflows/test_upb.yml index 3b918ad3e32a..42c05987145b 100644 --- a/.github/workflows/test_upb.yml +++ b/.github/workflows/test_upb.yml @@ -28,7 +28,6 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: config: - - { name: "Bazel 7", bazel_version: "7.1.1", continuous-only: true } - { name: "Fastbuild" } - { name: "Optimized", flags: "-c opt", continuous-only: true } - { name: "ASAN", flags: "--config=asan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/...", runner: ubuntu-22-4core } @@ -50,7 +49,7 @@ jobs: if: ${{ !matrix.config.continuous-only || inputs.continuous-run }} uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:${{ matrix.config.bazel_version || '6.4.0' }}-27cf7b86212020d7e552bc13b1e084abb971da75 + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:${{ matrix.config.bazel_version || '7.1.2' }}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: upb-bazel bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/... ${{ matrix.config.flags }} @@ -69,7 +68,7 @@ jobs: - name: Run tests uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:6.4.0-12.2-27cf7b86212020d7e552bc13b1e084abb971da75" + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:7.1.2-12.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82" credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: "upb-bazel-gcc" bazel: >- @@ -98,7 +97,7 @@ jobs: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: "upb-bazel-windows" bazel: test --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 //upb/... //upb_generator/... //python/... - version: 6.4.0 + version: 7.1.2 exclude-targets: -//python:conformance_test -//upb/reflection:def_builder_test macos: @@ -127,7 +126,7 @@ jobs: credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: "upb-bazel-macos" bazel: ${{ matrix.config.bazel-command }} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/... - version: 6.4.0 + version: 7.1.2 no-python: strategy: @@ -142,7 +141,7 @@ jobs: - name: Run tests uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.4.0-cf84e92285ca133b9c8104ad7b14d70e953cbb8e + image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: "upb-bazel-no-python" bash: >- @@ -163,10 +162,10 @@ jobs: - name: Build Wheels uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: us-docker.pkg.dev/protobuf-build/release-containers/linux/apple:6.4.0-5be0f4fde927ca702ed4cebe096bfb632d6d9a36 + image: us-docker.pkg.dev/protobuf-build/release-containers/linux/apple:7.1.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: upb-bazel-python - bazel: build --crosstool_top=//toolchain:clang_suite --//toolchain:release=true --symlink_prefix=/ -c dbg //python/dist //python/dist:test_wheel //python/dist:source_wheel + bazel: build --crosstool_top=//toolchain:clang_suite --//toolchain:release=true --symlink_prefix=/ -c dbg --incompatible_enable_cc_toolchain_resolution=false //python/dist //python/dist:test_wheel //python/dist:source_wheel - name: Move Wheels run: mkdir wheels && find _build/out \( -name 'protobuf*.whl' -o -name 'protobuf-*.tar.gz' \) -exec mv '{}' wheels ';' - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 diff --git a/MODULE.bazel b/MODULE.bazel index 30b1d815fcd6..2a47a8318393 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -15,6 +15,7 @@ module( bazel_dep(name = "abseil-cpp", version = "20240722.0", repo_name = "com_google_absl") bazel_dep(name = "bazel_skylib", version = "1.7.0") bazel_dep(name = "jsoncpp", version = "1.9.6") +bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support") bazel_dep(name = "rules_cc", version = "0.0.16") bazel_dep(name = "rules_fuzzing", version = "0.5.2") bazel_dep(name = "rules_java", version = "8.3.2") diff --git a/WORKSPACE b/WORKSPACE index ace370cde92b..3716b137afd0 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -24,6 +24,10 @@ load("//:protobuf_extra_deps.bzl", "protobuf_extra_deps") protobuf_extra_deps() +load("@bazel_features//:deps.bzl", "bazel_features_deps") + +bazel_features_deps() + load("@rules_python//python:repositories.bzl", "py_repositories") py_repositories() @@ -98,6 +102,12 @@ load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependen apple_support_dependencies() +load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") + +rules_java_dependencies() + +rules_java_toolchains() + load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies") rules_cc_dependencies() @@ -241,6 +251,7 @@ crate_repositories() # For testing runtime against old gencode from a previous major version. http_archive( name = "com_google_protobuf_v25.0", + integrity = "sha256-e+7ZxRHWMs/3wirACU3Xcg5VAVMDnV2n4Fm8zrSIR0o=", strip_prefix = "protobuf-25.0", url = "https://github.com/protocolbuffers/protobuf/releases/download/v25.0/protobuf-25.0.tar.gz", ) diff --git a/ci/common.bazelrc b/ci/common.bazelrc index 2d8924ca9aa5..a5f37ae1ccba 100644 --- a/ci/common.bazelrc +++ b/ci/common.bazelrc @@ -87,3 +87,5 @@ build --verbose_failures # Important: this flag ensures that we remain compliant with the C++ layering # check. build --features=layering_check + +build --enable_platform_specific_config \ No newline at end of file diff --git a/ci/macOS.bazelrc b/ci/macOS.bazelrc index 2fd5a2a3db22..370a039d7432 100644 --- a/ci/macOS.bazelrc +++ b/ci/macOS.bazelrc @@ -4,6 +4,8 @@ build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 build --cxxopt="-Woverloaded-virtual" build --copt="-Wpointer-arith" build --copt="-Werror" --copt="-Wno-sign-compare" --copt="-Wno-sign-conversion" --copt="-Wno-error=sign-conversion" --copt="-Wno-deprecated-declarations" -common --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1 common --xcode_version_config=@com_google_protobuf//.github:host_xcodes +build --apple_crosstool_top=@local_config_apple_cc//:toolchain +build --crosstool_top=@local_config_apple_cc//:toolchain +build --host_crosstool_top=@local_config_apple_cc//:toolchain \ No newline at end of file diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index 9a5b752899f9..e15ad7ebaa1b 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -52,6 +52,14 @@ def _github_archive(repo, commit, **kwargs): def protobuf_deps(): """Loads common dependencies needed to compile the protobuf library.""" + if not native.existing_rule("bazel_features"): + http_archive( + name = "bazel_features", + sha256 = "95fb3cfd11466b4cad6565e3647a76f89886d875556a4b827c021525cb2482bb", + strip_prefix = "bazel_features-1.10.0", + url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.10.0/bazel_features-v1.10.0.tar.gz", + ) + if not native.existing_rule("bazel_skylib"): http_archive( name = "bazel_skylib", @@ -152,15 +160,15 @@ def protobuf_deps(): if not native.existing_rule("build_bazel_rules_apple"): http_archive( name = "build_bazel_rules_apple", - sha256 = "9c4f1e1ec4fdfeac5bddb07fa0e872c398e3d8eb0ac596af9c463f9123ace292", - url = "https://github.com/bazelbuild/rules_apple/releases/download/3.2.1/rules_apple.3.2.1.tar.gz", + sha256 = "b892911288715b354e05b9a6fe9009635f7155991f24f27e779fe80d435c92bc", + url = "https://github.com/bazelbuild/rules_apple/releases/download/3.13.0/rules_apple.3.13.0.tar.gz", ) if not native.existing_rule("build_bazel_apple_support"): http_archive( name = "build_bazel_apple_support", - sha256 = "100d12617a84ebc7ee7a10ecf3b3e2fdadaebc167ad93a21f820a6cb60158ead", - url = "https://github.com/bazelbuild/apple_support/releases/download/1.12.0/apple_support.1.12.0.tar.gz", + sha256 = "c4bb2b7367c484382300aee75be598b92f847896fb31bbd22f3a2346adf66a80", + url = "https://github.com/bazelbuild/apple_support/releases/download/1.15.1/apple_support.1.15.1.tar.gz", ) if not native.existing_rule("rules_kotlin"): diff --git a/toolchain/toolchains.bazelrc b/toolchain/toolchains.bazelrc index 79ea8e539341..d0858f48f232 100644 --- a/toolchain/toolchains.bazelrc +++ b/toolchain/toolchains.bazelrc @@ -1,6 +1,7 @@ build:cross_config --crosstool_top=//toolchain:clang_suite build:cross_config --//toolchain:release=true build:cross_config --host_crosstool_top=@bazel_tools//tools/cpp:toolchain +build:cross_config --incompatible_enable_cc_toolchain_resolution=false build:linux-aarch_64 --config=cross_config --cpu=linux-aarch_64 build:linux-aarch64 --config=cross_config --cpu=linux-aarch_64