-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move proto_library from Bazel repository
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
- Loading branch information
1 parent
7c5dd9e
commit 3ff2cf0
Showing
6 changed files
with
439 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Protocol Buffers - Google's data interchange format | ||
# Copyright 2008 Google Inc. All rights reserved. | ||
# | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file or at | ||
# https://developers.google.com/open-source/licenses/bsd | ||
""" | ||
A helper rule that reads a native boolean flag. | ||
""" | ||
|
||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") | ||
|
||
def _impl(ctx): | ||
return [BuildSettingInfo(value = ctx.attr.value)] | ||
|
||
_native_bool_flag_rule = rule( | ||
implementation = _impl, | ||
attrs = {"value": attr.bool()}, | ||
) | ||
|
||
def native_bool_flag(*, name, flag, match_value = "true", result = True, **kwargs): | ||
_native_bool_flag_rule( | ||
name = name, | ||
value = select({ | ||
name + "_setting": result, | ||
"//conditions:default": not result, | ||
}), | ||
**kwargs | ||
) | ||
|
||
native.config_setting( | ||
name = name + "_setting", | ||
values = {flag: match_value}, | ||
visibility = ["//visibility:private"], | ||
) |
Oops, something went wrong.