Skip to content

Commit 36de7b6

Browse files
zhangskzcopybara-github
authored andcommitted
Explicitly enable workspace when bzlmod is disabled in examples tests.
Note in Bazel 8 --enable_workspace is now false by default, which is probably why continuous tests fail when testing with bzlmod disabled: https://github.com/protocolbuffers/protobuf/actions/runs/12274024400/job/34246134153 `bazelversion` here also doesn't seem to be applied as Bazel 8 is being used based on the logs. #test-continuous PiperOrigin-RevId: 705140770
1 parent 05af18d commit 36de7b6

File tree

8 files changed

+26
-14
lines changed

8 files changed

+26
-14
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/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: --enable_bzlmod --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: 2 additions & 2 deletions
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
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
@@ -111,7 +111,7 @@ jobs:
111111
bazel-cache: java_linux/11
112112
bash: |
113113
set -ex
114-
bazel build //java:release $BAZEL_FLAGS
114+
bazel build //java:release $BAZEL_FLAGS --noenable_bzlmod
115115
mvn install:install-file -Dfile=java/bom/pom.xml -DpomFile=java/bom/pom.xml
116116
mvn install:install-file -Dfile=java/pom.xml -DpomFile=java/pom.xml
117117
mvn install:install-file -Dfile=bazel-bin/java/core/core_mvn-project.jar -DpomFile=bazel-bin/java/core/core_mvn-pom.xml

.github/workflows/test_python.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
matrix:
3030
type: [ Pure, C++]
3131
version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
32+
bzlmod: [false]
3233
include:
3334
- type: Pure
3435
targets: //python/... //python:python_version_test
@@ -50,6 +51,8 @@ jobs:
5051
- version: "3.12"
5152
continuous-only: true
5253
- version: "3.13"
54+
- bzlmod: false
55+
flags: --noenable_bzlmod
5356

5457
name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Linux ${{ matrix.type }} ${{ matrix.version }}
5558
runs-on: ubuntu-latest
@@ -76,6 +79,7 @@ jobs:
7679
matrix:
7780
type: [ Pure, C++]
7881
version: [ "3.12", "3.13" ]
82+
bzlmod: [false]
7983
include:
8084
- type: Pure
8185
targets: //python/... //python:python_version_test
@@ -84,6 +88,8 @@ jobs:
8488
flags: --define=use_fast_cpp_protos=true
8589
- version: "3.13"
8690
continuous-only: true
91+
- bzlmod: false
92+
flags: --noenable_bzlmod
8793

8894
name: MacOS ${{ matrix.type }} ${{ matrix.version }}
8995
runs-on: macos-13

MODULE.bazel

Lines changed: 2 additions & 1 deletion
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")
@@ -115,8 +116,8 @@ bazel_dep(name = "rules_testing", version = "0.6.0", dev_dependency = True)
115116
bazel_dep(
116117
name = "abseil-py",
117118
version = "2.1.0",
118-
repo_name = "com_google_absl_py",
119119
dev_dependency = True,
120+
repo_name = "com_google_absl_py",
120121
)
121122

122123
# rules_proto are needed for @com_google_protobuf_v25.0 used in //compatibility/... tests

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

0 commit comments

Comments
 (0)