bazelbuild / bazelbuild/bazel

Protobuf flags are migrating to Starlark

Open
#29,359 0 comments 0 reactions 0 assignees View on GitHub
incompatible-change team-Configurability team-ExternalDeps team-Starlark-Integration
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Motivation

Reduce tech debt and maintenance in Bazel. Facilitate development of the Proto rules by the Protobuf team.

### Description

We are converting the flags in https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoConfiguration.java their Starlark equivalents in https://github.com/protocolbuffers/protobuf/tree/main/bazel/flags.

Deleting the flags from Bazel requires updating to a version of protobuf rules that can read the Starlark flags (34.1). This version of protobuf also contains the following breaking changes, as described in their release notes. Please see https://protobuf.dev/news/2025-09-19/ and https://protobuf.dev/news/2026-01-16/

### Incompatible Flag

No incompatible flag. A combination of factors, including google-internal constraints and some surprising behavior around depending on fragments contributed to the need to create a breaking change in protobuf in order to delete the fragment in Bazel.

### Migration Guide

To migrate, please use the Starlark versions of these flags instead of their native equivalents.

`--@protobuf//bazel/flags/cc:proto_toolchain_for_cc` (for --proto_toolchain_for_cc)
`--@protobuf//bazel/flags/java:proto_toolchain_for_java` (for --proto_toolchain_for_java)
`--@protobuf//bazel/flags/java:proto_toolchain_for_javalite` (for --proto_toolchain_for_javalite)
`--@protobuf//bazel/flags:proto_compiler` (for --proto_compiler)
`--@protobuf//bazel/flags:strict_proto_deps` (for --strict_proto_deps)
`--@protobuf/bazel/flags:strict_public_imports` (for --strict_public_imports)
`--@protobuf/bazel/flags:experimental_proto_descriptor_sets_include_source_info` (for --experimental_proto_descriptor_sets_include_source_info)
`--@protobuf/bazel/flags/cc:cc_proto_library_header_suffixes` (for --cc_proto_library_header_suffixes)
`--@protobuf/bazel/flags/cc:cc_proto_library_source_suffixes` (for --cc_proto_library_source_suffixes)
`--@protobuf//bazel/flags:protocopt` (for --protocopt)

### In which Bazel LTS version will this incompatible change be enabled?

Bazel 10

### Additional Context

_No response_

### TODO List

[ ] Implement the incompatible change at Bazel HEAD.
[ ] Check the [downstream pipeline](https://github.com/bazelbuild/continuous-integration/blob/master/docs/downstream-testing.md#bazel-downstream-testing) result and inform broken projects.

Contributor guide

Open the contributing guide

Research direction

Start with src/main/java/com/google/devtools/build/lib/rules/proto/ProtoConfiguration.java and compare its native flags with the Starlark equivalents in protobuf's bazel/flags directory. Update Bazel to use the protobuf rules version 34.1, remove the native flags, and check the downstream pipeline. Done means the listed flags migrate without leaving the Proto configuration fragment in Bazel.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.