Skip to content

Commit 9c51e58

Browse files
authored
Move ExecuTorch-specific stuff in shim to shim_et (try #3) (#8647)
In preparation for replacing the checked-in files in shim/ with https://github.com/facebook/buck2-shims-meta as a submodule. The portions of this diff that are not a pure move are: creation of shim_et/BUCK symlink shim/tools to shim_et/tools so that fbsource//tools movement of Android toolchains from shim/BUCK to shim_et/BUCK because they are not present in buck2-shims-meta edits to .buckconfig edit to Utils.cmake to point at shim_et// instead of shim// edit to shim_et/README.md (note that shim/README.md will come back when shim/ is a submodule pointing to buck2-shims-meta)
1 parent cc5b3ed commit 9c51e58

File tree

20 files changed

+84
-45
lines changed

20 files changed

+84
-45
lines changed

.buckconfig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
root = .
99
prelude = third-party/prelude
1010
shim = shim
11+
shim_et = shim_et
1112

1213
[repository_aliases]
1314
config = prelude
1415
ovr_config = prelude
15-
toolchains = shim
16-
fbcode = shim
17-
fbcode_macros = shim
18-
fbsource = shim
16+
toolchains = shim_et
17+
fbcode = shim_et
18+
fbcode_macros = shim_et
19+
fbsource = shim_et
1920
buck = shim
2021

2122
[cxx]

build/Utils.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ function(extract_sources sources_file)
206206

207207
if(ANDROID_ABI)
208208
if("${ANDROID_ABI}" STREQUAL "arm64-v8a")
209-
set(target_platforms_arg "--target-platforms=shim//:android-arm64")
209+
set(target_platforms_arg "--target-platforms=shim_et//:android-arm64")
210210
elseif("${ANDROID_ABI}" STREQUAL "x86_64")
211-
set(target_platforms_arg "--target-platforms=shim//:android-x86_64")
211+
set(target_platforms_arg "--target-platforms=shim_et//:android-x86_64")
212212
else()
213213
message(
214214
FATAL_ERROR

shim/BUCK

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,3 @@ remote_test_execution_toolchain(
6161
name = "remote_test_execution",
6262
visibility = ["PUBLIC"],
6363
)
64-
65-
execution_platform(
66-
name = "android-arm64",
67-
cpu_configuration = "prelude//cpu:arm64",
68-
os_configuration = "prelude//os:android",
69-
# REVIEW: not sure if this is correct
70-
use_windows_path_separators = host_info().os.is_windows,
71-
visibility = ["PUBLIC"],
72-
)
73-
74-
execution_platform(
75-
name = "android-x86_64",
76-
cpu_configuration = "prelude//cpu:x86_64",
77-
os_configuration = "prelude//os:android",
78-
# REVIEW: not sure if this is correct
79-
use_windows_path_separators = host_info().os.is_windows,
80-
visibility = ["PUBLIC"],
81-
)
82-
83-
noop_test_toolchain(
84-
name = "test",
85-
visibility = ["PUBLIC"],
86-
)

shim/README.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

shim_et/BUCK

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
load("@prelude//platforms:defs.bzl", "execution_platform")
2+
load("@prelude//tests:test_toolchain.bzl", "noop_test_toolchain")
3+
load("@prelude//toolchains:cxx.bzl", "system_cxx_toolchain")
4+
load("@prelude//toolchains:genrule.bzl", "system_genrule_toolchain")
5+
load("@prelude//toolchains:python.bzl", "system_python_bootstrap_toolchain", "system_python_toolchain")
6+
load("@prelude//toolchains:remote_test_execution.bzl", "remote_test_execution_toolchain")
7+
8+
# Although the non-Android toolchains below are present in shim/BUCK, it appears that we
9+
# have to duplicate them here or builds won't work.
10+
system_cxx_toolchain(
11+
name = "cxx",
12+
cxx_flags = ["-std=c++20"],
13+
visibility = ["PUBLIC"],
14+
)
15+
16+
system_genrule_toolchain(
17+
name = "genrule",
18+
visibility = ["PUBLIC"],
19+
)
20+
21+
system_python_toolchain(
22+
name = "python",
23+
visibility = ["PUBLIC"],
24+
)
25+
26+
system_python_bootstrap_toolchain(
27+
name = "python_bootstrap",
28+
visibility = ["PUBLIC"],
29+
)
30+
31+
execution_platform(
32+
name = "android-arm64",
33+
cpu_configuration = "prelude//cpu:arm64",
34+
os_configuration = "prelude//os:android",
35+
# REVIEW: not sure if this is correct
36+
use_windows_path_separators = host_info().os.is_windows,
37+
visibility = ["PUBLIC"],
38+
)
39+
40+
execution_platform(
41+
name = "android-x86_64",
42+
cpu_configuration = "prelude//cpu:x86_64",
43+
os_configuration = "prelude//os:android",
44+
# REVIEW: not sure if this is correct
45+
use_windows_path_separators = host_info().os.is_windows,
46+
visibility = ["PUBLIC"],
47+
)
48+
49+
noop_test_toolchain(
50+
name = "test",
51+
visibility = ["PUBLIC"],
52+
)
53+
54+
remote_test_execution_toolchain(
55+
name = "remote_test_execution",
56+
visibility = ["PUBLIC"],
57+
)

shim_et/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# buck2 shims
2+
3+
The `shim_et/` subtree helps the Meta-internal buck2 build system also work in the
4+
open-source repo.
5+
6+
Shims are how open-source buck2 supports a [line
7+
like](https://github.com/pytorch/executorch/blob/50aa517549d10324147534d91d04a923b76421d6/kernels/optimized/targets.bzl#L1):
8+
9+
```
10+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
11+
```
12+
13+
In the open-source repo, `fbsource//xplat` (a Meta-internal root) doesn't exist.
14+
The `fbsource = shim_et` line in `../.buckconfig` tells buck2 to look in
15+
[`shim_et/xplat/executorch/build/runtime_wrapper.bzl`](https://github.com/pytorch/executorch/blob/main/shim_et/xplat/executorch/build/runtime_wrapper.bzl)
16+
instead.
17+
18+
NOTE: `tools` is a symlink to `../shim/tools` because `fbsource//`
19+
must refer here, but `fbsource//tools` in particular lives in `shim/`.

shim_et/tools

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../shim/tools

0 commit comments

Comments
 (0)