From ba89943f55099e480b74ac47655a058f7bb99a7c Mon Sep 17 00:00:00 2001 From: Jakob Degen Date: Tue, 17 Sep 2024 23:06:05 -0700 Subject: [PATCH] gh shims: Set up shim for `rust_linkable_symbol` Summary: So that we can use it in first party OSS projects Reviewed By: dtolnay Differential Revision: D62731699 Privacy Context Container: L1123788 fbshipit-source-id: 892c43d69a34dd02cf2295ef665b41e45846982b --- shim/build_defs/rust_linkable_symbol.bzl | 18 ++++++++++++++++++ shim/shims.bzl | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 shim/build_defs/rust_linkable_symbol.bzl diff --git a/shim/build_defs/rust_linkable_symbol.bzl b/shim/build_defs/rust_linkable_symbol.bzl new file mode 100644 index 000000000..c29faa396 --- /dev/null +++ b/shim/build_defs/rust_linkable_symbol.bzl @@ -0,0 +1,18 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +load("@prelude//rust:linkable_symbol.bzl", prelude_rust_linkable_symbol = "rust_linkable_symbol") +load("@shim//:shims.bzl", _rust_library = "rust_library") + +def rust_linkable_symbol( + visibility = ["PUBLIC"], + **kwargs): + prelude_rust_linkable_symbol( + visibility = visibility, + rust_library_macro = _rust_library, + **kwargs + ) diff --git a/shim/shims.bzl b/shim/shims.bzl index f48e8583c..d96a9dba2 100644 --- a/shim/shims.bzl +++ b/shim/shims.bzl @@ -451,6 +451,8 @@ def _fix_dep(x: str) -> [ return "root//" + x.removeprefix("//") elif x.startswith("shim//"): return x + elif x.startswith("prelude//"): + return x else: fail("Dependency is unaccounted for `{}`.\n".format(x) + "Did you forget 'oss-disable'?")