From 2a5426c459ae89f51de65439f642fc7108883b95 Mon Sep 17 00:00:00 2001 From: Chen Lai Date: Mon, 30 Sep 2024 11:23:49 -0700 Subject: [PATCH] add command_alias in runtime_wrapper (#5737) Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/5737 As title, expand the runtime wrapper to support `command_alias` so we can use it to set env_variable. Test in D63556730 Reviewed By: derekxu, larryliu0820 Differential Revision: D63570326 --- shim/xplat/executorch/build/env_interface.bzl | 2 ++ shim/xplat/executorch/build/runtime_wrapper.bzl | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/shim/xplat/executorch/build/env_interface.bzl b/shim/xplat/executorch/build/env_interface.bzl index b6e30cd9f65..c4111c744b8 100644 --- a/shim/xplat/executorch/build/env_interface.bzl +++ b/shim/xplat/executorch/build/env_interface.bzl @@ -201,6 +201,8 @@ def _struct_to_json(object): return native.json.encode(object) env = struct( + # @lint-ignore BUCKLINT: native and fb_native are explicitly forbidden in fbcode. + command_alias = native.command_alias, # @lint-ignore BUCKLINT: native and fb_native are explicitly forbidden in fbcode. cxx_binary = native.cxx_binary, # @lint-ignore BUCKLINT: native and fb_native are explicitly forbidden in fbcode. diff --git a/shim/xplat/executorch/build/runtime_wrapper.bzl b/shim/xplat/executorch/build/runtime_wrapper.bzl index 6b0ada353fa..ea5b2eee1fc 100644 --- a/shim/xplat/executorch/build/runtime_wrapper.bzl +++ b/shim/xplat/executorch/build/runtime_wrapper.bzl @@ -301,6 +301,10 @@ def _filegroup(*args, **kwargs): _patch_kwargs_common(kwargs) env.filegroup(*args, **kwargs) +def _command_alias(*args, **kwargs): + _patch_kwargs_common(kwargs) + env.command_alias(*args, **kwargs) + def _genrule(*args, **kwargs): _patch_kwargs_common(kwargs) env.patch_platforms(kwargs) @@ -345,6 +349,7 @@ def get_oss_build_kwargs(): # see the "Build Rules" section in the sidebar of # https://buck.build/concept/build_rule.html. runtime = struct( + command_alias = _command_alias, cxx_binary = _cxx_binary, cxx_library = _cxx_library, cxx_python_extension = _cxx_python_extension,