@@ -132,6 +132,13 @@ All actions with `exec_group = "link"` would see the exec properties
132
132
dictionary as ` {"mem": "16g"} ` . As you see here, execution-group-level
133
133
settings override target-level settings.
134
134
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
+
135
142
### Creating exec groups to set exec properties
136
143
137
144
Sometimes you want to use an exec group to give specific actions different exec
@@ -162,3 +169,36 @@ my_rule = rule(
162
169
#
163
170
```
164
171
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