Skip to content

Commit 2d67e82

Browse files
Merge remote-tracking branch 'upstream' into 19558-dont-hardcode-protoc
2 parents 3bd939d + e8edc5d commit 2d67e82

File tree

1,016 files changed

+54148
-50672
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,016 files changed

+54148
-50672
lines changed

.bazelci/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Bazel CI test
2+
3+
The `.bazelci/presubmit.yml` file is used by https://buildkite.com/bazel/protobuf
4+
to test building protobuf with Bazel on Bazel CI. It should contain the same
5+
set of tests as `.bcr/presubmit.yml` which is the tests that will run before
6+
publishing protobuf to BCR.

.bazelci/presubmit.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# LINT.IfChange(bazelci_presubmit)
2+
matrix:
3+
platform: ["debian10", "macos", "macos_arm64", "ubuntu2004", "windows"]
4+
bazel: [7.x, 8.x]
5+
6+
tasks:
7+
verify_targets:
8+
name: "Verify build targets"
9+
working_directory: examples
10+
platform: ${{ platform }}
11+
bazel: ${{ bazel }}
12+
build_targets:
13+
- '//...'
14+
- '@com_google_protobuf//:protobuf'
15+
- '@com_google_protobuf//:protobuf_lite'
16+
- '@com_google_protobuf//:protobuf_python'
17+
- '@com_google_protobuf//:protobuf_java'
18+
- '@com_google_protobuf//:protoc'
19+
- '@com_google_protobuf//:test_messages_proto2_cc_proto'
20+
- '@com_google_protobuf//:test_messages_proto3_cc_proto'
21+
# LINT.ThenChange(<ROOT_DIR>/.bcr/presubmit.yml)

.bazeliskrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
USE_BAZEL_VERSION=7.1.2

.bazelrc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr
3131
# Abseil passes nullptr to memcmp with 0 size
3232
build:ubsan --copt=-fno-sanitize=nonnull-attribute
3333

34-
# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
35-
# https://github.com/protocolbuffers/protobuf/issues/14313
36-
common --noenable_bzlmod
37-
3834
# Important: this flag ensures that we remain compliant with the C++ layering
3935
# check.
4036
build --features=layering_check
4137

42-
common --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1
38+
common --enable_platform_specific_config
39+
40+
# Use clang-cl by default on Windows (see https://github.com/protocolbuffers/protobuf/issues/20085).
41+
build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//build_defs:x64_windows-clang-cl --host_platform=//build_defs:x64_windows-clang-cl

.bcr/metadata.template.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@
8181
"name": "Dennis Shao",
8282
"do_not_notify": true
8383
},
84-
{
85-
"email": "[email protected]",
86-
"github": "theodorerose",
87-
"name": "Theodore Rose",
88-
"do_not_notify": true
89-
},
9084
{
9185
"email": "[email protected]",
9286
"github": "tonyliaoss",

.bcr/presubmit.yml

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,22 @@
1-
matrix:
2-
platform: ["debian10", "macos", "ubuntu2004", "windows"]
3-
bazel: [7.x]
4-
5-
tasks:
6-
verify_targets:
7-
name: "Verify build targets"
8-
platform: ${{ platform }}
9-
bazel: ${{ bazel }}
10-
build_flags:
11-
- '--host_cxxopt=-std=c++17'
12-
- '--cxxopt=-std=c++17'
13-
build_targets:
14-
- '@protobuf//:protobuf'
15-
- '@protobuf//:protobuf_lite'
16-
- '@protobuf//:protobuf_python'
17-
- '@protobuf//:protobuf_java'
18-
- '@protobuf//:protoc'
19-
- '@protobuf//:test_messages_proto2_cc_proto'
20-
- '@protobuf//:test_messages_proto3_cc_proto'
21-
1+
# LINT.IfChange(bcr_presubmit)
222
bcr_test_module:
23-
module_path: "examples"
3+
module_path: examples
244
matrix:
25-
platform: ["debian10", "macos", "ubuntu2004", "windows"]
26-
bazel: [7.x]
5+
platform: ["debian10", "macos", "macos_arm64", "ubuntu2004", "windows"]
6+
bazel: [7.x, 8.x]
7+
278
tasks:
28-
run_test_module:
29-
name: "Run test module"
9+
verify_targets:
10+
name: "Verify build targets"
3011
platform: ${{ platform }}
3112
bazel: ${{ bazel }}
32-
build_flags:
33-
- '--host_cxxopt=-std=c++17'
34-
- '--cxxopt=-std=c++17'
3513
build_targets:
36-
- "//..."
14+
- '//...'
15+
- '@com_google_protobuf//:protobuf'
16+
- '@com_google_protobuf//:protobuf_lite'
17+
- '@com_google_protobuf//:protobuf_python'
18+
- '@com_google_protobuf//:protobuf_java'
19+
- '@com_google_protobuf//:protoc'
20+
- '@com_google_protobuf//:test_messages_proto2_cc_proto'
21+
- '@com_google_protobuf//:test_messages_proto3_cc_proto'
22+
# LINT.ThenChange(<ROOT_DIR>/.bazelci/presubmit.yml)

.github/workflows/clear_caches.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
actions: write # permission is required to delete caches
2424
contents: read
2525
steps:
26-
- uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
26+
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
2727
with:
2828
path: ${{ github.workspace }}/${{ steps.output.outputs.repository-cache }}
2929
key: repository-cache-${{ github.ref_name }}-${{ runner.os }}-reset-${{ github.sha }}

.github/workflows/staleness_check.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
if: ${{ github.event.repository.full_name == 'protocolbuffers/protobuf' }}
2626
steps:
2727
- name: Checkout
28-
uses: protocolbuffers/protobuf-ci/checkout@v3
28+
uses: protocolbuffers/protobuf-ci/checkout@v4
2929
with:
3030
ref: ${{ inputs.safe-checkout || github.head_ref || github.ref }}
3131

@@ -48,16 +48,17 @@ jobs:
4848
# In branches where automatic updates work as post-submits, we don't want to run staleness
4949
# tests along with user changes. Any stale files will be automatically fixed in a follow-up
5050
# commit.
51-
uses: protocolbuffers/protobuf-ci/bazel@v3
51+
uses: protocolbuffers/protobuf-ci/bazel@v4
5252
with:
5353
version: 7.1.2 # Bazel version
5454
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
5555
bazel-cache: staleness
56+
# TODO: Enable bzlmod once //python/dist is buildable.
5657
bash: >
5758
set -ex;
5859
echo "Please run ./regenerate_stale_files.sh to regenerate stale files";
5960
if [[ -z $COMMIT_TRIGGERED_RUN || -z $MAIN_RUN ]]; then
60-
bazel query 'attr(tags, "staleness_test", //...)' | xargs bazel test $BAZEL_FLAGS;
61+
bazel query 'attr(tags, "staleness_test", //...)' --noenable_bzlmod | xargs bazel test $BAZEL_FLAGS;
6162
else
62-
bazel query 'attr(tags, "staleness_test", //...)';
63+
bazel query 'attr(tags, "staleness_test", //...)' --noenable_bzlmod;
6364
fi

.github/workflows/test_bazel.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,29 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
runner: [ ubuntu, windows, macos ]
30-
bazelversion: [ '7.1.2' ]
30+
bazelversion: [ '7.1.2', '8.0.0' ]
3131
bzlmod: [ true, false ]
3232
toolchain_resolution: [ "", "--incompatible_enable_proto_toolchain_resolution=true" ]
3333
runs-on: ${{ matrix.runner }}-latest
3434
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Examples ${{ matrix.runner }} ${{ matrix.bazelversion }}${{ matrix.bzlmod && ' (bzlmod)' || '' }} ${{ matrix.toolchain_resolution && ' (toolchain resolution)' || '' }}
3535
steps:
3636
- name: Checkout pending changes
3737
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
38-
uses: protocolbuffers/protobuf-ci/checkout@v3
38+
uses: protocolbuffers/protobuf-ci/checkout@v4
3939
with:
4040
ref: ${{ inputs.safe-checkout }}
4141

42+
# rules_jvm_external doesn't support Java 8, which is the default version
43+
# on some github runners. When this is selected, it results in some
44+
# opaque errors about coursier (see
45+
# https://github.com/bazel-contrib/rules_jvm_external/issues/1337).
46+
- name: Pin to Java 11
47+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
48+
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
49+
with:
50+
distribution: 'temurin'
51+
java-version: '11'
52+
4253
- name: Windows startup flags
4354
if: ${{ runner.os == 'Windows' && (!matrix.continuous-only || inputs.continuous-run) }}
4455
working-directory: examples
@@ -53,9 +64,11 @@ jobs:
5364

5465
- name: Run tests
5566
if: ${{ !matrix.continuous-only || inputs.continuous-run }}
56-
uses: protocolbuffers/protobuf-ci/bazel@v3
67+
uses: protocolbuffers/protobuf-ci/bazel@v4
5768
with:
5869
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
5970
bazel-cache: examples
6071
version: ${{ matrix.bazelversion }}
61-
bash: cd examples && bazel build //... $BAZEL_FLAGS --enable_bzlmod=${{ matrix.bzlmod }} ${{ matrix.toolchain_resolution }}
72+
bash: >
73+
cd examples;
74+
bazel build //... @com_google_protobuf-examples-with-hyphen//... $BAZEL_FLAGS --enable_bzlmod=${{ matrix.bzlmod }} --enable_workspace=${{ !matrix.bzlmod }} ${{ matrix.toolchain_resolution }};

0 commit comments

Comments
 (0)