nandi/frqpublic Fork 0
9a5c2a8e68ed3adac9515f317282402cb55e9cd3
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Build the APK with buck2, from pins rather than from a second checkout a71ef8f · on 9a5c2a8e68ed3adac9515f317282402cb55e9cd3 · nandi · 18d ago
defs.bzl · 55 lines · 2.4 KBPython Blame HistoryRaw
 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
52
53
54
55
# 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.
#
# Whether actions may run on a worker is an attribute now rather than a
# constant. It was false because it had to be: the toolchain named absolute
# paths inside this checkout, which no worker would have. Both compilers are
# dependencies now, so there is something to ship.
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 = ctx.attrs.local_enabled,
            remote_enabled = ctx.attrs.remote_enabled,
            remote_cache_enabled = True,
            allow_cache_uploads = True,
            remote_execution_properties = ctx.attrs.remote_execution_properties,
            remote_execution_use_case = "buck2-default",
            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]),
        "local_enabled": attrs.bool(default = True),
        "remote_enabled": attrs.bool(default = False),
        "remote_execution_properties": attrs.dict(attrs.string(), attrs.string(), default = {}),
        "os_configuration": attrs.dep(providers = [ConfigurationInfo]),
        "use_windows_path_separators": attrs.bool(),
    },
)