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
45
46
47
48
49
50
51
|
# The stock prelude//platforms:default with its cache switches flipped on.
#
# The prelude's own `execution_platform` rule is static Starlark — there is no
# buckconfig key that turns caching on for it — so the rule is copied here and
# its CommandExecutorConfig changed. Everything else mirrors the original
# exactly, so this platform stays configuration-identical to the default.
#
# Cache only, never remote execution. The toolchain in toolchains/BUCK points
# at absolute paths inside this checkout (see the note there about os.execl),
# which no RE worker will have. `remote_enabled = False` is the switch that
# says so; the cache is read and written over the network regardless, and
# every action still runs locally.
load("@prelude//cfg/exec_platform:marker.bzl", "get_exec_platform_marker")
def _execution_platform_impl(ctx: AnalysisContext) -> list[Provider]:
constraints = dict()
constraints.update(ctx.attrs.cpu_configuration[ConfigurationInfo].constraints)
constraints.update(ctx.attrs.os_configuration[ConfigurationInfo].constraints)
cfg = ConfigurationInfo(constraints = constraints, values = {})
name = ctx.label.raw_target()
platform = ExecutionPlatformInfo(
label = name,
configuration = cfg,
executor_config = CommandExecutorConfig(
local_enabled = True,
remote_enabled = False,
remote_cache_enabled = True,
allow_cache_uploads = True,
use_windows_path_separators = ctx.attrs.use_windows_path_separators,
),
)
return [
DefaultInfo(),
platform,
PlatformInfo(label = str(name), configuration = cfg),
ExecutionPlatformRegistrationInfo(
platforms = [platform],
exec_marker_constraint = get_exec_platform_marker(),
),
]
execution_platform = rule(
impl = _execution_platform_impl,
attrs = {
"cpu_configuration": attrs.dep(providers = [ConfigurationInfo]),
"os_configuration": attrs.dep(providers = [ConfigurationInfo]),
"use_windows_path_separators": attrs.bool(),
},
)
|