Skip to content

Commit 2c9f2b3

Browse files
authored
Add re2 shim for Buck2 OSS builds (pytorch#17664)
This is a follow-up of pytorch#17638 since it's breaking internal. The tokenizers BUCK file references fbsource//third-party/re2:re2, which resolves to shim_et//third-party/re2:re2 in OSS builds. This target didn't exist, causing Buck2 build failures. Add a shim cxx_library in shim_et/third-party/re2/ that re-exports from the actual re2 build in extension/llm/tokenizers/third-party. The shim is gated behind runtime.is_oss so it's a no-op internally. This PR was authored with the help of Claude.
1 parent c54feac commit 2c9f2b3

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

shim_et/third-party/re2/BUCK

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
cxx_library(
2-
name = "re2",
3-
exported_deps = ["root//extension/llm/tokenizers/third-party:re2"],
4-
visibility = ["PUBLIC"],
5-
)
1+
load(":targets.bzl", "define_common_targets")
2+
3+
define_common_targets()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2+
3+
def define_common_targets():
4+
if runtime.is_oss:
5+
native.cxx_library(
6+
name = "re2",
7+
exported_deps = ["root//extension/llm/tokenizers/third-party:re2"],
8+
visibility = ["PUBLIC"],
9+
)

0 commit comments

Comments
 (0)