Skip to content

Commit 8186fbb

Browse files
quvalcopybara-github
authored andcommitted
Documentation for #13110
Closes #13167. PiperOrigin-RevId: 361885312
1 parent 01e0f43 commit 8186fbb

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

site/docs/exec-groups.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ All actions with `exec_group = "link"` would see the exec properties
132132
dictionary as `{"mem": "16g"}`. As you see here, execution-group-level
133133
settings override target-level settings.
134134

135+
### Execution groups for native rules
136+
137+
The following execution groups are available for actions defined by native rules:
138+
139+
* `test`: Test runner actions.
140+
* `cpp_link`: C++ linking actions.
141+
135142
### Creating exec groups to set exec properties
136143

137144
Sometimes you want to use an exec group to give specific actions different exec
@@ -162,3 +169,36 @@ my_rule = rule(
162169
#
163170
```
164171

172+
### Execution groups and platform execution properties
173+
174+
It is possible to define `exec_properties` for arbitrary execution groups on
175+
platform targets (unlike `exec_properties` set directly on a target, where
176+
properties for unknown execution groups are rejected). Targets then inherit the
177+
execution platform's `exec_properties` that affect the default execution group
178+
and any other relevant execution groups.
179+
180+
For example, suppose running a C++ test requires some resource to be available,
181+
but it isn't required for compiling and linking; this can be modelled as
182+
follows:
183+
184+
```python
185+
constraint_setting(name = "resource")
186+
constraint_value(name = "has_resource", constraint_setting = ":resource")
187+
188+
platform(
189+
name = "platform_with_resource",
190+
constraint_values = [":has_resource"],
191+
exec_properties = {
192+
"test.resource": "...",
193+
},
194+
)
195+
196+
cc_test(
197+
name = "my_test",
198+
srcs = ["my_test.cc"],
199+
exec_compatible_with = [":has_resource"],
200+
)
201+
```
202+
203+
`exec_properties` defined directly on targets take precedence over those that
204+
are inherited from the execution platform.

0 commit comments

Comments
 (0)