File: README.md

package info (click to toggle)
bazel-bootstrap 4.2.3%2Bds-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 85,476 kB
  • sloc: java: 721,710; sh: 55,859; cpp: 35,359; python: 12,139; xml: 295; objc: 269; makefile: 113; ansic: 106; ruby: 3
file content (44 lines) | stat: -rwxr-xr-x 868 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Common scalar build settings.

## Overview

These definitions are only for use in Bazel built-in tools.  In all
other cases, use flag type definitions from
github.com/bazelbuild/bazel-skylib/rules/common_settings.bzl.

<a name="basic-example"></a>
## Basic Example

### //tools/my_pkg/BUILD

```python
load("//tools/config:common_settings.bzl", "bool_flag")

bool_flag(
    name = "experimental_new_behavior",
    build_setting_default = False,
)
```

### //tools/my_pkg/myrule.bzl

```python
load("//tools/flags:flags.bzl", "BuildSettingInfo")


def _myrule_impl(ctx):
    if ctx.attr._experimental_new_behavior[BuildSettingInfo].value:
       ...
    ...


myrule = rule(
    implementation = _myrule_impl.
    attrs = {
        ...

        "_experimental_new_behavior": attr.label(
            default = "//tools/my_pkg:experimental_new_behavior"),
    },
)
```