Skip to content

Commit 2cfa16b

Browse files
zhangskzcopybara-github
authored andcommitted
[DRAFT] Remove --noenable_bzlmod from .bazelrc
#test-continuous PiperOrigin-RevId: 705140770
1 parent 34a397b commit 2cfa16b

13 files changed

+41
-23
lines changed

.bazelrc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ 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

.github/workflows/staleness_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
set -ex;
5858
echo "Please run ./regenerate_stale_files.sh to regenerate stale files";
5959
if [[ -z $COMMIT_TRIGGERED_RUN || -z $MAIN_RUN ]]; then
60-
bazel query 'attr(tags, "staleness_test", //...)' | xargs bazel test $BAZEL_FLAGS;
60+
bazel query 'attr(tags, "staleness_test", //...)' | xargs bazel test $BAZEL_FLAGS --noenable_bzlmod;
6161
else
6262
bazel query 'attr(tags, "staleness_test", //...)';
6363
fi

.github/workflows/test_bazel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ jobs:
5858
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
5959
bazel-cache: examples
6060
version: ${{ matrix.bazelversion }}
61-
bash: cd examples && bazel build //... $BAZEL_FLAGS --enable_bzlmod=${{ matrix.bzlmod }} ${{ matrix.toolchain_resolution }}
61+
bash: cd examples && bazel build //... $BAZEL_FLAGS --enable_bzlmod=${{ matrix.bzlmod }} --enable_workspace=${{ !matrix.bzlmod }} ${{ matrix.toolchain_resolution }}

.github/workflows/test_cpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
cache_key: Bazel7
4646
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75"
4747
targets: "//src/... //third_party/utf8_range/..."
48-
- config: { name: "Bazel7 with Bzlmod", flags: --enable_bzlmod --enable_workspace --cxxopt="-Wno-self-assign-overloaded" }
48+
- config: { name: "Bazel7 with Bzlmod", flags: --cxxopt="-Wno-self-assign-overloaded" }
4949
cache_key: Bazel7bzlmod
5050
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75"
5151
targets: "//src/... //third_party/utf8_range/..."

.github/workflows/test_java.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
- name: OpenJDK 8
3232
cache_key: '8'
3333
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-8-d9624f2aa83cba3eaf906f751d75b36aacb9aa82
34+
flags: --noenable_bzlmod # TODO: https://github.com/protocolbuffers/protobuf/actions/runs/12470144355/job/34804726816?pr=19764
3435
# TODO: b/318555165 - enable the layering check. Currently it does
3536
# not work correctly with the toolchain in this Docker image.
3637
targets: //java/... //java/internal:java_version //compatibility/... --features=-layering_check
@@ -53,7 +54,6 @@ jobs:
5354
cache_key: 'bazel7bzlmod'
5455
image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75
5556
targets: //java/... //java/internal:java_version //compatibility/...
56-
flags: --enable_bzlmod --enable_workspace
5757
- name: aarch64
5858
cache_key: 'aarch64'
5959
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:7.1.2-aarch64-2920199ab0090ed427413a8e422e62695c8392a8
@@ -109,8 +109,10 @@ jobs:
109109
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:7.1.2-11-d9624f2aa83cba3eaf906f751d75b36aacb9aa82
110110
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
111111
bazel-cache: java_linux/11
112+
# Bash overrides the docker image's custom entrypoint
112113
bash: |
113114
set -ex
115+
entrypoint.sh
114116
bazel build //java:release $BAZEL_FLAGS
115117
mvn install:install-file -Dfile=java/bom/pom.xml -DpomFile=java/bom/pom.xml
116118
mvn install:install-file -Dfile=java/pom.xml -DpomFile=java/pom.xml

.github/workflows/test_python.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
matrix:
3030
type: [ Pure, C++]
3131
version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
32+
# ERROR: error loading package 'python/dist': cannot load '@@rules_python~~python~python_3_12//:version.bzl': no such file
33+
# https://github.com/protocolbuffers/protobuf/actions/runs/12470144355/job/34804733978?pr=19764
34+
bzlmod: [false]
3235
include:
3336
- type: Pure
3437
targets: //python/... //python:python_version_test
@@ -50,6 +53,8 @@ jobs:
5053
- version: "3.12"
5154
continuous-only: true
5255
- version: "3.13"
56+
- bzlmod: false
57+
bzlmod-flags: --noenable_bzlmod
5358

5459
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.type }} ${{ matrix.version }}
5560
runs-on: ubuntu-latest
@@ -66,7 +71,7 @@ jobs:
6671
image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:7.1.2-{0}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82', matrix.version) }}
6772
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
6873
bazel-cache: python_linux/${{ matrix.type }}_${{ matrix.version }}
69-
bazel: test ${{ matrix.targets }} ${{ matrix.flags }} --test_env=KOKORO_PYTHON_VERSION
74+
bazel: test ${{ matrix.targets }} ${{ matrix.flags }} ${{ matrix.bzlmod-flags }} --test_env=KOKORO_PYTHON_VERSION
7075
exclude-targets: -//python/pb_unit_tests/...
7176

7277

@@ -76,6 +81,7 @@ jobs:
7681
matrix:
7782
type: [ Pure, C++]
7883
version: [ "3.12", "3.13" ]
84+
bzlmod: [false]
7985
include:
8086
- type: Pure
8187
targets: //python/... //python:python_version_test
@@ -84,6 +90,8 @@ jobs:
8490
flags: --define=use_fast_cpp_protos=true
8591
- version: "3.13"
8692
continuous-only: true
93+
- bzlmod: false
94+
bzlmod-flags: --noenable_bzlmod
8795

8896
name: MacOS ${{ matrix.type }} ${{ matrix.version }}
8997
runs-on: macos-13
@@ -117,7 +125,7 @@ jobs:
117125
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
118126
bazel-cache: python_macos/${{ matrix.type }}_${{ matrix.version }}
119127
bazel: >-
120-
test ${{ matrix.targets }} ${{ matrix.flags }}
128+
test ${{ matrix.targets }} ${{ matrix.flags }} ${{ matrix.bzlmod-flags }}
121129
--test_env=KOKORO_PYTHON_VERSION=${{ matrix.version }}
122130
--macos_minimum_os=11.0
123131
exclude-targets: -//python/pb_unit_tests/...

.github/workflows/test_ruby.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ jobs:
200200
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/ruby:7.1.2-${{ matrix.ruby }}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82
201201
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
202202
bazel-cache: ruby_install/${{ matrix.ruby }}_${{ matrix.bazel }}
203+
# Bash overrides the docker image's custom entrypoint
203204
bash: >
205+
entrypoint.sh;
204206
bazel --version;
205207
ruby --version;
206208
./regenerate_stale_files.sh $BAZEL_FLAGS;

.github/workflows/test_upb.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize:${{ matrix.config.bazel_version || '7.1.2' }}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82
5353
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
5454
bazel-cache: upb-bazel
55-
bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/... ${{ matrix.config.flags }}
55+
bazel: test --noenable_bzlmod --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/... ${{ matrix.config.flags }}
5656
exclude-targets: ${{ matrix.config.exclude-targets }}
5757

5858
linux-gcc:
@@ -72,7 +72,7 @@ jobs:
7272
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
7373
bazel-cache: "upb-bazel-gcc"
7474
bazel: >-
75-
test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -c opt
75+
test --noenable_bzlmod --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -c opt
7676
--copt="-Wno-error=maybe-uninitialized" --copt="-Wno-error=attributes"
7777
//bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/...
7878
@@ -96,7 +96,7 @@ jobs:
9696
with:
9797
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
9898
bazel-cache: "upb-bazel-windows"
99-
bazel: test --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 //upb/... //upb_generator/... //python/...
99+
bazel: test --noenable_bzlmod --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 //upb/... //upb_generator/... //python/...
100100
version: 7.1.2
101101
exclude-targets: -//python:conformance_test -//upb/reflection:def_builder_test
102102

@@ -125,7 +125,7 @@ jobs:
125125
with:
126126
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
127127
bazel-cache: "upb-bazel-macos"
128-
bazel: ${{ matrix.config.bazel-command }} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/...
128+
bazel: ${{ matrix.config.bazel-command }} --noenable_bzlmod --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} //bazel/... //benchmarks/... //lua/... //python/... //upb/... //upb_generator/...
129129
version: 7.1.2
130130

131131
no-python:
@@ -148,7 +148,7 @@ jobs:
148148
which python3 &&
149149
mv `which python3` /tmp &&
150150
! which python3 &&
151-
bazel test $BAZEL_FLAGS --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //python/... -- -//python/dist:source_wheel -//python:aarch64_test -//python:x86_64_test -//python:google/protobuf/pyext/_message.so -//python:proto_api
151+
bazel test $BAZEL_FLAGS --noenable_bzlmod --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 //python/... -- -//python/dist:source_wheel -//python:aarch64_test -//python:x86_64_test -//python:google/protobuf/pyext/_message.so -//python:proto_api
152152
153153
build_wheels:
154154
name: Build Wheels
@@ -165,7 +165,7 @@ jobs:
165165
image: us-docker.pkg.dev/protobuf-build/release-containers/linux/apple:7.1.2-d9624f2aa83cba3eaf906f751d75b36aacb9aa82
166166
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
167167
bazel-cache: upb-bazel-python
168-
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
168+
bazel: build --noenable_bzlmod --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
169169
- name: Move Wheels
170170
run: mkdir wheels && find _build/out \( -name 'protobuf*.whl' -o -name 'protobuf-*.tar.gz' \) -exec mv '{}' wheels ';'
171171
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module(
1515
bazel_dep(name = "abseil-cpp", version = "20240722.0", repo_name = "com_google_absl")
1616
bazel_dep(name = "bazel_skylib", version = "1.7.0")
1717
bazel_dep(name = "jsoncpp", version = "1.9.6")
18+
bazel_dep(name = "rules_apple", version = "3.13.0", repo_name = "build_bazel_rules_apple")
1819
bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support")
1920
bazel_dep(name = "rules_cc", version = "0.0.16")
2021
bazel_dep(name = "rules_fuzzing", version = "0.5.2")

WORKSPACE.bzlmod

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,22 @@ ruby_runtime("system_ruby")
2121

2222
register_toolchains("@system_ruby//:toolchain")
2323

24+
load("@system_ruby//:bundle.bzl", "ruby_bundle")
25+
26+
ruby_bundle(
27+
name = "protobuf_bundle",
28+
srcs = ["//ruby:google-protobuf.gemspec"],
29+
gemfile = "//ruby:Gemfile",
30+
)
31+
2432
# Following are just needed to run conformance tests, not really needed to support them via MODULE.bazel
2533

34+
# For testing from another repo.
35+
local_repository(
36+
name = "com_google_protobuf_examples",
37+
path = "examples",
38+
)
39+
2640
# For testing runtime against old gencode from a previous major version.
2741
http_archive(
2842
name = "com_google_protobuf_v25.0",
@@ -34,7 +48,6 @@ http_archive(
3448
load("@com_google_protobuf_v25.0//:protobuf_deps.bzl", protobuf_v25_deps="protobuf_deps")
3549
protobuf_v25_deps()
3650

37-
3851
# Needed for checking breaking changes from the previous release version.
3952
load("//:protobuf_version.bzl", "PROTOBUF_PREVIOUS_RELEASE")
4053

ci/common.bazelrc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ build --incompatible_use_host_features
7676
# --incompatible_fail_on_unknown_attributes
7777
# --incompatible_merge_fixed_and_default_shell_env
7878

79-
# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
80-
# https://github.com/protocolbuffers/protobuf/issues/14313
81-
common --noenable_bzlmod
82-
8379
# For easier debugging of build failures.
8480
common --announce_rc
8581
build --verbose_failures

ci/macOS.bazelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import common.bazelrc
33
build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
44
build --cxxopt="-Woverloaded-virtual"
55
build --copt="-Wpointer-arith"
6-
build --copt="-Werror" --copt="-Wno-sign-compare" --copt="-Wno-sign-conversion" --copt="-Wno-error=sign-conversion" --copt="-Wno-deprecated-declarations"
6+
build --copt="-Werror" --copt="-Wno-sign-compare" --copt="-Wno-sign-conversion" --copt="-Wno-error=sign-conversion" --copt="-Wno-deprecated-declarations" --copt="-Wno-unknown-warning-option"
77
common --xcode_version_config=@com_google_protobuf//.github:host_xcodes
88

99
build --apple_crosstool_top=@local_config_apple_cc//:toolchain

regenerate_stale_files.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ STALENESS_TESTS=(
3030

3131
# Run and fix all staleness tests.
3232
for test in ${STALENESS_TESTS[@]}; do
33-
${BazelBin} test $test "$@" || ./bazel-bin/${test%%:*}/${test#*:} --fix
33+
${BazelBin} test $test "$@" || ./bazel-bin/${test%%:*}/${test#*:} --fix --noenable_bzlmod
3434
done
3535

3636
# Generate C# code.

0 commit comments

Comments
 (0)