Skip to content

Commit 0067c70

Browse files
authored
Manual merge of #14155, second try (#14265)
Something went wrong with the automated merge here as well as the first manual merge. This is an exact export of the corresponding diff. Differential Revision: D82127663
1 parent 8fe6227 commit 0067c70

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

codegen/tools/targets.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ def define_common_targets(is_fbcode = False):
1717
],
1818
deps = [
1919
"//executorch/codegen:gen_lib",
20-
] + select({
20+
] + ([] if runtime.is_oss else select({
2121
"DEFAULT": [],
22-
"ovr_config//os:linux": [] if runtime.is_oss else ["//executorch/codegen/tools:selective_build"], # TODO(larryliu0820) :selective_build doesn't build in OSS yet
23-
}),
22+
"ovr_config//os:linux": ["//executorch/codegen/tools:selective_build"], # TODO(larryliu0820) :selective_build doesn't build in OSS yet
23+
})),
2424
)
2525

2626
runtime.python_binary(

shim_et/xplat/executorch/build/runtime_wrapper.bzl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ def _cxx_test(*args, **kwargs):
290290

291291
def _cxx_python_extension(*args, **kwargs):
292292
_patch_kwargs_common(kwargs)
293+
_remove_caffe2_deps(kwargs)
293294
kwargs["srcs"] = _patch_executorch_references(kwargs["srcs"])
294295
if "types" in kwargs:
295296
kwargs["types"] = _patch_executorch_references(kwargs["types"])
@@ -324,8 +325,19 @@ def _genrule(*args, **kwargs):
324325
kwargs["name"] += "_static"
325326
env.genrule(*args, **kwargs)
326327

328+
def _remove_caffe2_deps(kwargs):
329+
if not env.is_oss:
330+
return
331+
# We don't have Buckified PyTorch in OSS. At least let buck query work.
332+
MISSING_BUCK_DIRS = ("//caffe2", "//pytorch", "fbsource//third-party")
333+
for dep_type in ('deps', 'exported_deps'):
334+
if dep_type not in kwargs:
335+
continue
336+
kwargs[dep_type] = [x for x in kwargs[dep_type] if not any([x.startswith(y) for y in MISSING_BUCK_DIRS])]
337+
327338
def _python_library(*args, **kwargs):
328339
_patch_kwargs_common(kwargs)
340+
_remove_caffe2_deps(kwargs)
329341
env.python_library(*args, **kwargs)
330342

331343
def _python_binary(*args, **kwargs):

0 commit comments

Comments
 (0)