Refactor protobuf flag abstraction layer to custom flag targets#28787
Draft
copybara-service[bot] wants to merge 1 commit into
Draft
Refactor protobuf flag abstraction layer to custom flag targets#28787copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
test_952990495
branch
8 times, most recently
from
July 24, 2026 18:53
b83ceee to
3ce22da
Compare
Instead of having rules depend on both native and Starlark versions of flags and reconciling them inside the rule implementation, this change moves the resolution logic into custom build setting flag targets (`compat_bool_flag` and `compat_string_list_flag`) defined in `third_party/protobuf/bazel/private/compat_flag.bzl`. Key details: - `compat_bool_flag`: Defines a string build setting flag target with a "default" sentinel value. When un-set on the command line, it falls back dynamically to reading native options on `ctx.fragments.proto` or default values, providing a boolean `BuildSettingInfo`. - `compat_string_list_flag`: Defines a string-list build setting flag target that reconciles explicit Starlark build settings with `ctx.fragments.proto` and default values. - Rules reference the flag targets directly (without separate helper `_compat` targets or `config_setting` rules). - Replaces `native_bool_flag.bzl` with `compat_flag.bzl`. PiperOrigin-RevId: 952990495
copybara-service
Bot
force-pushed
the
test_952990495
branch
from
July 24, 2026 18:59
3ce22da to
8e44021
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor protobuf flag abstraction layer to custom flag targets
Instead of having rules depend on both native and Starlark versions of flags and reconciling them inside the rule implementation, this change moves the resolution logic into custom build setting flag targets (
compat_bool_flagandcompat_string_list_flag) defined inthird_party/protobuf/bazel/private/compat_flag.bzl.Key details:
compat_bool_flag: Defines a string build setting flag target with a "default" sentinel value. When un-set on the command line, it falls back dynamically to reading native options onctx.fragments.protoor default values, providing a booleanBuildSettingInfo.compat_string_list_flag: Defines a string-list build setting flag target that reconciles explicit Starlark build settings withctx.fragments.protoand default values._compattargets orconfig_settingrules).native_bool_flag.bzlwithcompat_flag.bzl.