Skip to content

Commit 9883914

Browse files
authored
Merge pull request #35 from dtolnay/remote
Enable remote execution
2 parents 1e9384a + bc51366 commit 9883914

File tree

4 files changed

+51
-10
lines changed

4 files changed

+51
-10
lines changed

platforms/defs.bzl

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("//remote_execution:config.bzl", "executor_config")
2+
13
def _platform_impl(ctx: AnalysisContext) -> list[Provider]:
24
platform_label = ctx.label.raw_target()
35
constraints = {}
@@ -10,11 +12,6 @@ def _platform_impl(ctx: AnalysisContext) -> list[Provider]:
1012
for label, value in dep[ConfigurationInfo].constraints.items():
1113
constraints[label] = value
1214

13-
use_windows_path_separators = False
14-
for value in constraints.values():
15-
if str(value.label) == "prelude//os/constraints:windows":
16-
use_windows_path_separators = True
17-
1815
configuration = ConfigurationInfo(
1916
constraints = constraints,
2017
values = {},
@@ -49,11 +46,7 @@ def _platform_impl(ctx: AnalysisContext) -> list[Provider]:
4946
[ExecutionPlatformInfo(
5047
label = platform_label,
5148
configuration = configuration,
52-
executor_config = CommandExecutorConfig(
53-
local_enabled = True,
54-
remote_enabled = False,
55-
use_windows_path_separators = use_windows_path_separators,
56-
),
49+
executor_config = executor_config(configuration),
5750
)] if ctx.attrs.execution_platform else []
5851
)
5952

remote_execution/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM debian:trixie-slim
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
clang-19 \
5+
lld-19 \
6+
python3 \
7+
xz-utils \
8+
zlib1g-dev \
9+
&& rm -rf /var/lib/apt/lists/* \
10+
&& ln -s clang-19 /usr/bin/clang \
11+
&& ln -s clang++-19 /usr/bin/clang++ \
12+
&& ln -s lld-19 /usr/bin/lld

remote_execution/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
To enable Remote Execution, add the following 4 entries to `.buckconfig.local`
2+
in the repo root, using values given by your Remote Execution provider. For
3+
example BuildBuddy would look like this (but with a real API key):
4+
5+
```ini
6+
[buck2_re_client]
7+
engine_address = remote.buildbuddy.io
8+
action_cache_address = remote.buildbuddy.io
9+
cas_address = remote.buildbuddy.io
10+
http_headers = x-buildbuddy-api-key:zzzzzzzzzzzzzzzzzzzz
11+
```

remote_execution/config.bzl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
def executor_config(configuration: ConfigurationInfo) -> CommandExecutorConfig:
2+
use_windows_path_separators = False
3+
for value in configuration.constraints.values():
4+
if str(value.label) == "prelude//os/constraints:windows":
5+
use_windows_path_separators = True
6+
7+
if read_config("buck2_re_client", "engine_address"):
8+
return CommandExecutorConfig(
9+
local_enabled = True,
10+
remote_enabled = True,
11+
use_limited_hybrid = True,
12+
remote_execution_properties = {
13+
"OSFamily": "Linux",
14+
"dockerNetwork": "off",
15+
"container-image": "docker://docker.io/dtolnay/buck2-rustc-bootstrap:latest",
16+
},
17+
remote_execution_use_case = "buck2-rustc-bootstrap",
18+
use_windows_path_separators = use_windows_path_separators,
19+
)
20+
else:
21+
return CommandExecutorConfig(
22+
local_enabled = True,
23+
remote_enabled = False,
24+
use_windows_path_separators = use_windows_path_separators,
25+
)

0 commit comments

Comments
 (0)