xref: /aosp_15_r20/external/executorch/shim/build_defs/native_rules.bzl (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1# Copyright (c) Meta Platforms, Inc. and affiliates.
2#
3# This source code is licensed under both the MIT license found in the
4# LICENSE-MIT file in the root directory of this source tree and the Apache
5# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
6# of this source tree.
7
8def buck_genrule(visibility = ["PUBLIC"], **kwargs):
9    # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode"
10    native.genrule(visibility = visibility, **kwargs)
11
12def buck_command_alias(**_):
13    pass
14
15def buck_filegroup(visibility = ["PUBLIC"], **kwargs):
16    # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode"
17    native.filegroup(visibility = visibility, **kwargs)
18
19def alias(actual, visibility = ["PUBLIC"], **kwargs):
20    if actual.startswith("//buck2/"):
21        actual = "root//" + actual.removeprefix("//buck2/")
22    native.alias(actual = actual, visibility = visibility, **kwargs)
23
24def buck_sh_binary(visibility = ["PUBLIC"], **kwargs):
25    # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode"
26    native.sh_binary(visibility = visibility, **kwargs)
27