dep-protobuf/bazel
Joshua Haberman f1c23cb216 Prepare Protobuf for a future version of Bazel which will lack the proto fragment
The ultimate effect of this change will be that both the native flags and Starlark flags will continue to work with future versions of Bazel that lack the proto fragment, until such time as we deprecate or remove the flags in a Protobuf release.  This decouples Bazel releases from Protobuf behavior changes.

1. Builds on the Bazel 8-compatible abstraction layer we submitted in cl/955468205 by setting `HAS_NATIVE_PROTO_FLAGS` properly in Bazel.  We do this by adding a `rules.has_proto_fragment` setting to the `proto_bazel_features.bzl` mechanism: we know that the fragment no longer needs to be read in Bazel 9+, because we can use `flag_alias()` instead.
2. Adds `flag_alias()` declarations in MODULE.bazel for all compat layer flags.  This will work in Bazel 9, but is ignored in Bazel 8.

This leads to a slight inconsistency.  Consider the following set of flags set by a user:

```
--@protobuf//bazel/flags:protocopt=foo --protocopt=bar
```

In Bazel 9+, where the flag alias is respected, the final value of the flag will be `bar`.  In Bazel 8, where we emulate `flag_alias()` by reconciling the two different values at analysis time, we always prefer the Starlark version (and cannot tell the relative order), so the final value of the flag will be `foo`.

To avoid this, prefer setting the Starlark version of the flag whenever possible.

PiperOrigin-RevId: 970834999
2026-08-25 15:30:42 -07:00
..
common Internal Change 2026-07-15 08:35:16 -07:00
flags Prepare Protobuf for a future version of Bazel which will lack the proto fragment 2026-08-25 15:30:42 -07:00
private Prepare Protobuf for a future version of Bazel which will lack the proto fragment 2026-08-25 15:30:42 -07:00
tests Prepare Protobuf for a future version of Bazel which will lack the proto fragment 2026-08-25 15:30:42 -07:00
toolchains Post-Bazel 7 cleanups. 2026-03-28 13:02:10 -07:00
BUILD chore: add a unit test for .github/release_prep.sh (#26247) 2026-07-08 08:05:06 -07:00
cc_proto_library.bzl Dropped support for Bazel 7. 2026-02-14 14:50:17 -08:00
java_lite_proto_library.bzl Dropped support for Bazel 7. 2026-02-14 14:50:17 -08:00
java_proto_library.bzl Dropped support for Bazel 7. 2026-02-14 14:50:17 -08:00
proto_descriptor_set.bzl Migrate proto_descriptor_set (#23369) 2025-10-02 10:01:01 -07:00
proto_library.bzl Dropped support for Bazel 7. 2026-02-14 14:50:17 -08:00
py_proto_library.bzl Refactored and rearranged Bazel rules. 2026-01-27 20:24:28 -08:00
upb_c_proto_library.bzl Fix breaking change related to upb_c_proto_library and upb_proto_reflection_library 2026-01-30 12:12:49 -08:00
upb_proto_reflection_library.bzl Actually fix breaking change related to upb_proto_reflection_library 2026-01-30 13:27:22 -08:00