Skip to content

Commit

Permalink
Merge branch 'main' into proper-fix-none-ascii-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fowles authored Jan 11, 2024
2 parents 2129e3f + 06327f0 commit cad753e
Show file tree
Hide file tree
Showing 469 changed files with 46,284 additions and 44,076 deletions.
4 changes: 4 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr
# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
# https://github.com/protocolbuffers/protobuf/issues/14313
common --noenable_bzlmod

# Important: this flag ensures that we remain compliant with the C++ layering
# check.
build --features=layering_check
4 changes: 2 additions & 2 deletions .github/workflows/clear_caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Clear expensive caches to prevent unbounded growth
on:
schedule:
# Run every 4 months at 10 AM UTC (2 AM PDT)
- cron: 0 10 1 */4 *
- cron: 0 10 5 */4 *

# manual
workflow_dispatch:
Expand Down Expand Up @@ -31,5 +31,5 @@ jobs:
- name: Create an empty cache with a single file
run: |
rm -rf .repository-cache
mkdir -p .repository-cache'
mkdir -p .repository-cache
touch .repository-cache/reset_file
32 changes: 24 additions & 8 deletions .github/workflows/test_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
- targets: //pkg/... //src/... @com_google_protobuf_examples//... //third_party/utf8_range/...

# Override cases with custom images
- config: { name: "Bazel7" }
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.0.0-a04396cc76704d4b7c722789e9c08df18f47df53"
targets: "//src/... //third_party/utf8_range/..."
- config: { name: "TCMalloc" }
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc@sha256:bd39119d74b8a3fad4ae335d4cf5294e70384676331b7e19949459fc7a8d8328"
targets: "//src/... //third_party/utf8_range/..."
Expand Down Expand Up @@ -313,21 +316,32 @@ jobs:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
include:
- name: MacOS
- name: MacOS Bazel
os: macos-12
cache_key: macos-12
bazel: test //src/... //third_party/utf8_range/...
- name: MacOS Apple Silicon (build only)
# TODO Enable these once mac setup is working for Bazel 7
#- name: MacOS Bazel 7
# os: macos-12
# cache_key: macos-12-bazel7
# bazel: test //src/... //third_party/utf8_range/...
# bazel_version: '7.0.0'
- name: MacOS Apple Silicon (build only) Bazel
os: macos-12
cache_key: macos-12-arm
# Current github runners are all Intel based, so just build/compile
# for Apple Silicon to detect issues there.
bazel: build --cpu=darwin_arm64 //src/... //third_party/utf8_range/...
- name: Windows
- 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: ${{ matrix.name }} Bazel
- 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.0.0'
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout pending changes
Expand All @@ -340,16 +354,18 @@ jobs:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel: ${{ matrix.bazel }}
bazel-cache: cpp_${{ matrix.cache_key }}
version: ${{ matrix.bazel_version || '6.3.0' }}

non-linux-cmake:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
include:
- name: MacOS CMake
os: macos-12
flags: -DCMAKE_CXX_STANDARD=14
cache-prefix: macos-cmake
# TODO: investigate and fix
# - name: MacOS CMake
# os: macos-12
# flags: -DCMAKE_CXX_STANDARD=14
# cache-prefix: macos-cmake
- name: Windows CMake
os: windows-2022
flags: >-
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test_java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ jobs:
- name: OpenJDK 8
version: '8'
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
targets: //java/... //java/internal:java_version
# 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 --features=-layering_check
- name: OpenJDK 11
version: '11'
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
Expand Down Expand Up @@ -63,7 +65,9 @@ jobs:
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: java_linux/8
bazel: test --test_output=all //java:linkage_monitor --spawn_strategy=standalone
# TODO: b/318555165 - enable the layering check. Currently it does
# not work correctly with the toolchain in this Docker image.
bazel: test --test_output=all //java:linkage_monitor --spawn_strategy=standalone --features=-layering_check

protobuf-bom:
name: Protobuf Maven BOM
Expand Down
27 changes: 16 additions & 11 deletions .github/workflows/test_ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ jobs:
#- { name: Ruby 2.7, ruby: ruby-2.7.0, ffi: FFI }
- { name: Ruby 3.0, ruby: ruby-3.0.2 }
- { name: Ruby 3.1, ruby: ruby-3.1.0 }
- { name: Ruby 3.2, ruby: ruby-3.2.0, ffi: NATIVE }
- { name: Ruby 3.2, ruby: ruby-3.2.0 }
- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: NATIVE }
# TODO Re-enable these once flakes are fixed
#- { name: Ruby 3.2, ruby: ruby-3.2.0, ffi: FFI }
#- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: FFI }
- { name: JRuby 9.4, ruby: jruby-9.4.3.0, ffi: NATIVE }
- { name: JRuby 9.4, ruby: jruby-9.4.3.0, ffi: FFI }

Expand All @@ -40,7 +41,7 @@ jobs:
- name: Run tests
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
with:
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:{0}-6.3.0-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea', matrix.ruby) }}
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:{0}-6.3.0-904cad5249547845454998ca3837a34c71fabf96', matrix.ruby) }}
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 --test_env=BAZEL=true ${{ matrix.ffi == 'FFI' && '--//ruby:ffi=enabled --test_env=PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION=FFI' || '' }}
Expand All @@ -67,9 +68,10 @@ jobs:
with:
image: i386/ruby:2.7.3-buster
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
# Pin to Ruby 2.7 compatible bundler version.
command: >-
/bin/bash -cex '
gem install bundler;
gem install bundler -v 2.4.22;
cd /workspace/ruby;
bundle;
PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake;
Expand Down Expand Up @@ -98,9 +100,10 @@ jobs:
with:
image: arm64v8/ruby:2.7.3-buster
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
# Pin to Ruby 2.7 compatible bundler version.
command: >-
/bin/bash -cex '
gem install bundler;
gem install bundler -v 2.4.22;
cd /workspace/ruby;
bundle;
PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} rake;
Expand All @@ -120,9 +123,10 @@ jobs:
#- { version: "2.7", ffi: FFI }
- { version: "3.0" }
- { version: "3.1" }
- { version: "3.2", ffi: NATIVE }
- { version: "3.2" }
- { version: "3.3", ffi: NATIVE }
# TODO Re-enable these once flakes are fixed
#- { version: "3.2", ffi: FFI }
#- { version: "3.3", ffi: FFI }

name: MacOS Ruby ${{ matrix.version }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
runs-on: macos-12
Expand All @@ -133,7 +137,7 @@ jobs:
ref: ${{ inputs.safe-checkout }}

- name: Pin Ruby version
uses: ruby/setup-ruby@ee26e27437bde475b19a6bf8cb73c9fa658876a2 # v1.134.0
uses: ruby/setup-ruby@961f85197f92e4842e3cb92a4f97bd8e010cdbaf # v1.165.0
with:
ruby-version: ${{ matrix.version }}

Expand All @@ -158,8 +162,9 @@ jobs:
- { name: Ruby 2.7, ruby: ruby-2.7.0, ffi: FFI }
- { name: Ruby 3.0, ruby: ruby-3.0.2}
- { name: Ruby 3.1, ruby: ruby-3.1.0}
- { name: Ruby 3.2, ruby: ruby-3.2.0, ffi: NATIVE }
- { name: Ruby 3.2, ruby: ruby-3.2.0, ffi: FFI }
- { name: Ruby 3.2, ruby: ruby-3.2.0}
- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: NATIVE }
- { name: Ruby 3.3, ruby: ruby-3.3.0, ffi: FFI }
- { name: JRuby 9.4, ruby: jruby-9.4.3.0, ffi: NATIVE }
- { name: JRuby 9.4, ruby: jruby-9.4.3.0, ffi: FFI }
name: Install ${{ matrix.name }}${{ matrix.ffi == 'FFI' && ' FFI' || '' }}
Expand All @@ -172,7 +177,7 @@ jobs:
- name: Run tests
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
with:
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:${{ matrix.ruby }}-6.3.0-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:${{ matrix.ruby }}-6.3.0-904cad5249547845454998ca3837a34c71fabf96
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: ruby_install/${{ matrix.ruby }}_${{ matrix.bazel }}
bash: >
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Run tests
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
with:
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.0.0-a04396cc76704d4b7c722789e9c08df18f47df53"
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: rust_linux
bazel: >-
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test_upb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
config:
- { name: "Bazel 7", bazel_version: "7.0.0" }
- { name: "Fastbuild" }
- { name: "Optimized", flags: "-c opt" }
- { name: "FastTable", flags: "--//upb:fasttable_enabled=true" }
- { name: "FastTable ASAN", flags: "--//upb:fasttable_enabled=true --config=asan", exclude-targets: "-//benchmarks:benchmark -//python/..." }
- { name: "ASAN", flags: "--config=asan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/..." }
- { name: "UBSAN", flags: "--config=ubsan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/... -//lua/..." }
- { name: "32-bit", flags: "--copt=-m32 --linkopt=-m32", exclude-targets: "-//benchmarks:benchmark -//python/..." }
# TODO: b/297027295 - Add 32-bit ASAN test
# TODO: Add 32-bit ASAN test
# TODO: Restore the FastTable tests

name: ${{ matrix.config.name }}
runs-on: ubuntu-latest
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Run tests
uses: protocolbuffers/protobuf-ci/bazel-docker@v2
with:
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:04cd765285bc52cbbf51d66c8c66d8603579cf0f19cc42df26b09d2c270541fb
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:${{ matrix.config.bazel_version || '6.3.0' }}-d07b7d649401d147e71e7182d2832cc8344f1f35
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: upb-bazel
bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //bazel/... //benchmarks/... //lua/... //protos/... //protos_generator/... //python/... //upb/... //upb_generator/... ${{ matrix.config.flags }}
Expand Down Expand Up @@ -81,6 +81,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/... //protos/... //protos_generator/...
version: 6.3.0
exclude-targets: -//python:conformance_test -//upb/reflection:def_builder_test

macos:
Expand All @@ -107,6 +108,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/... //protos/... //protos_generator/... //python/... //upb/... //upb_generator/...
version: 6.3.0

no-python:
strategy:
Expand Down
88 changes: 70 additions & 18 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,68 @@ alias(
visibility = ["//visibility:public"],
)

# C++ targets for the well-known types

alias(
name = "any_cc_proto",
actual = "//src/google/protobuf:any_cc_proto",
visibility = ["//visibility:public"],
)

alias(
name = "api_cc_proto",
actual = "//src/google/protobuf:api_cc_proto",
visibility = ["//visibility:public"],
)

alias(
name = "duration_cc_proto",
actual = "//src/google/protobuf:duration_cc_proto",
visibility = ["//visibility:public"],
)

alias(
name = "empty_cc_proto",
actual = "//src/google/protobuf:empty_cc_proto",
visibility = ["//visibility:public"],
)

alias(
name = "field_mask_cc_proto",
actual = "//src/google/protobuf:field_mask_cc_proto",
visibility = ["//visibility:public"],
)

alias(
name = "source_context_cc_proto",
actual = "//src/google/protobuf:source_context_cc_proto",
visibility = ["//visibility:public"],
)

alias(
name = "struct_cc_proto",
actual = "//src/google/protobuf:struct_cc_proto",
visibility = ["//visibility:public"],
)

alias(
name = "timestamp_cc_proto",
actual = "//src/google/protobuf:timestamp_cc_proto",
visibility = ["//visibility:public"],
)

alias(
name = "type_cc_proto",
actual = "//src/google/protobuf:type_cc_proto",
visibility = ["//visibility:public"],
)

alias(
name = "wrappers_cc_proto",
actual = "//src/google/protobuf:wrappers_cc_proto",
visibility = ["//visibility:public"],
)

# Source files: these are aliases to a filegroup, not a `proto_library`.
#
# (This is _probably_ not what you want.)
Expand Down Expand Up @@ -189,9 +251,16 @@ cc_binary(

# Expose the runtime for the proto_lang_toolchain so that it can also be used in
# a user-defined proto_lang_toolchain.
alias(
name = "protobuf",
actual = "//src/google/protobuf",
visibility = ["//visibility:public"],
)

alias(
name = "protobuf_nowkt",
actual = "//src/google/protobuf:protobuf_nowkt",
deprecation = "Use //:protobuf instead",
visibility = ["//visibility:public"],
)

Expand All @@ -210,23 +279,6 @@ alias(
visibility = ["//visibility:public"],
)

cc_library(
name = "protobuf",
copts = COPTS,
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],
deps = [
"//src/google/protobuf",
"//src/google/protobuf/compiler:importer",
"//src/google/protobuf/util:delimited_message_util",
"//src/google/protobuf/util:differencer",
"//src/google/protobuf/util:field_mask_util",
"//src/google/protobuf/util:json_util",
"//src/google/protobuf/util:time_util",
"//src/google/protobuf/util:type_resolver_util",
],
)

# This provides just the header files for use in projects that need to build
# shared libraries for dynamic loading. This target is available until Bazel
# adds native support for such use cases.
Expand Down Expand Up @@ -324,7 +376,7 @@ proto_lang_toolchain(
"//:descriptor_proto",
],
command_line = "--cpp_out=$(OUT)",
runtime = "//src/google/protobuf:protobuf_nowkt",
runtime = "//src/google/protobuf",
visibility = ["//visibility:public"],
)

Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ endif (MSVC)
include_directories(
${ZLIB_INCLUDE_DIRECTORIES}
${protobuf_BINARY_DIR}
# Support #include-ing other top-level directories, i.e. upb_generator.
${protobuf_SOURCE_DIR}
${protobuf_SOURCE_DIR}/src)

set(protobuf_ABSL_PROVIDER "module" CACHE STRING "Provider of absl library")
Expand Down
5 changes: 0 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,6 @@ load("@fuzzing_py_deps//:requirements.bzl", fuzzing_py_deps_install_deps = "inst

fuzzing_py_deps_install_deps()

bind(
name = "python_headers",
actual = "@system_python//:python_headers",
)

http_archive(
name = "rules_rust",
sha256 = "9ecd0f2144f0a24e6bc71ebcc50a1ee5128cedeceb32187004532c9710cb2334",
Expand Down
Loading

0 comments on commit cad753e

Please sign in to comment.