-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cherry-pick changes related to new Bazel rules #18339
Merged
Merged
Conversation
This file contains 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
Move toolchain helpers into a separate private file. After the migration those should be removed, so let's not make it a new public APIs. Copybara also handles differences in toolchain type labels. Remove ProtoLangToolchainInfo from proto_common. Providers need special care when moving and will be moved last. Read INCOMPATIBLE_ENABLE_PROTO_TOOLCHAIN_RESOLUTION from native proto_common. This is a BuildLanguageConfiguration flag (load time flag) and may only be read through native support. Add a dependency to the latest bazel_features that supports this check. On older Bazel versions fail if ALLOWLIST is configured. Implement version check for PackageSpecificationInfo. It's only available after Bazel 6.4.0. The rest of the implementation matches Bazel version. Tests are quite extensive and will be submitted in separate PRs. PiperOrigin-RevId: 651699412
Rewrite compile tests from BazelProtoCommonTest to Starlark. This is using rules_analysis for testing. The tests are super fast (cca. 1s for all of the to run). The tests work either with a redirect (calling native rule) or with actual implementation in the protobuf repository. PiperOrigin-RevId: 651748083
Enable the Starlark rule only on Bazel versions, that have the Starlark version of ProtoInfo provider. That's needed, because only that exposed _transitive_proto_info field that's used in the rule. PiperOrigin-RevId: 651753437
Use paths.is_normalized and paths.is_absolute from bazel skylib. Upgrade skylib to latest version that has the implementation. Use copybara for the differences in STRIC_DEPS_FLAG_TEMPLATE. Implement native_bool_flag to read native flags and use them in proto_library. Those are implemented in such a way, that they can be replaced in place with starlark bool_flag targets. Implement version check for PackageSpecificationInfo. It's only available after Bazel 6.4.0. Tests will be submitted in separate PRs. PiperOrigin-RevId: 653532601
The change is a no-op. Just reduces code duplication. PiperOrigin-RevId: 654702701
The toolchain type is consumed by proto_library and produced by proto_toolchain rule. As such it's a private dependency, because both rules are now part of protobuf repo. There are some early adopters of --incompatible_enable_proto_toolchain_resolution that might be broken from this: grpc, rules_go, rules_ts, rules_rust, rules_lint, because they have implementation that is not using proto_common. Those repositories need to define their own proto_lang_toolchain and consume it with proto_common.compile. PiperOrigin-RevId: 654897871
PiperOrigin-RevId: 660861340
PiperOrigin-RevId: 667891921
PiperOrigin-RevId: 668980574
PiperOrigin-RevId: 670152183
PiperOrigin-RevId: 671292735
PiperOrigin-RevId: 671513654
PiperOrigin-RevId: 671679277
zhangskz
approved these changes
Sep 16, 2024
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.
This PR cherry-picks all commits on main in the
bazel/
directory, except for these, which are not related to the new rules:Cherry-pick command was:
There was only one merge conflict that required manual resolution, in
WORKSPACE
. But the resolution was straightforward.