Skip to content

Re-sync with internal repository #1993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added shim/.buckconfig
Empty file.
5 changes: 5 additions & 0 deletions shim/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# We currently expect end users to run reindeer vendor themselves
# so mark these things as to ignore
/third-party/rust/.cargo/
/third-party/rust/BUCK
/third-party/rust/vendor/
36 changes: 4 additions & 32 deletions shim/BUCK
Original file line number Diff line number Diff line change
@@ -1,33 +1,5 @@
"""Copied from prelude since we need to put this file under shim/
"""
load("@prelude//toolchains:demo.bzl", "system_demo_toolchains")

load("@prelude//toolchains:cxx.bzl", "system_cxx_toolchain")
load("@prelude//toolchains:genrule.bzl", "system_genrule_toolchain")
load("@prelude//toolchains:python.bzl", "system_python_bootstrap_toolchain", "system_python_toolchain")
load("@prelude//toolchains:rust.bzl", "system_rust_toolchain")

system_cxx_toolchain(
name = "cxx",
visibility = ["PUBLIC"],
)

system_genrule_toolchain(
name = "genrule",
visibility = ["PUBLIC"],
)

system_rust_toolchain(
name = "rust",
default_edition = "2021",
visibility = ["PUBLIC"],
)

system_python_toolchain(
name = "python",
visibility = ["PUBLIC"],
)

system_python_bootstrap_toolchain(
name = "python_bootstrap",
visibility = ["PUBLIC"],
)
# All the default toolchains, suitable for a quick demo or early prototyping.
# Most real projects should copy/paste the implementation to configure them.
system_demo_toolchains()
4 changes: 4 additions & 0 deletions shim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Open Source Shim

These files are a shim that allow us to build Buck2 with Buck2 outside Meta in
the open source world.
13 changes: 13 additions & 0 deletions shim/buck2/buck_rust_binary.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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(
"//:shims.bzl",
_rust_binary = "rust_binary",
)

buck_rust_binary = _rust_binary
13 changes: 13 additions & 0 deletions shim/buck2/proto_defs.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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(
"//:shims.bzl",
_rust_protobuf_library = "rust_protobuf_library",
)

rust_protobuf_library = _rust_protobuf_library
10 changes: 10 additions & 0 deletions shim/build_defs/cpp_library.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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("//:shims.bzl", _cpp_library = "cpp_library")

cpp_library = _cpp_library
9 changes: 9 additions & 0 deletions shim/build_defs/custom_unittest.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 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.

def custom_unittest(**_):
pass
10 changes: 10 additions & 0 deletions shim/build_defs/export_files.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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.

def export_file(visibility = ["PUBLIC"], **kwargs):
# @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode"
native.export_file(visibility = visibility, **kwargs)
14 changes: 14 additions & 0 deletions shim/build_defs/lib/python_common.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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.

def get_ldflags(*args):
_unused = args # @unused
return []

def get_strip_mode(*args):
_unused = args # @unused
return ""
22 changes: 22 additions & 0 deletions shim/build_defs/native_rules.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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.

def buck_genrule(visibility = ["PUBLIC"], **kwargs):
# @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode"
native.genrule(visibility = visibility, **kwargs)

def buck_command_alias(**_):
pass

def buck_filegroup(visibility = ["PUBLIC"], **kwargs):
# @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode"
native.filegroup(visibility = visibility, **kwargs)

def alias(actual, visibility = ["PUBLIC"], **kwargs):
if actual.startswith("//buck2/"):
actual = "root//" + actual.removeprefix("//buck2/")
native.alias(actual = actual, visibility = visibility, **kwargs)
10 changes: 10 additions & 0 deletions shim/build_defs/ocaml_binary.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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("//:shims.bzl", _ocaml_binary = "ocaml_binary")

ocaml_binary = _ocaml_binary
13 changes: 13 additions & 0 deletions shim/build_defs/package_local_utils.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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.

def _set_clang_version(_version, _overwrite = False):
pass

package_local_utils = struct(
set_clang_version = _set_clang_version,
)
11 changes: 11 additions & 0 deletions shim/build_defs/platform_utils.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 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.

def _get_cxx_platform_for_base_path(_base_path):
return struct(target_platform = None)

platform_utils = struct(get_cxx_platform_for_base_path = _get_cxx_platform_for_base_path)
12 changes: 12 additions & 0 deletions shim/build_defs/python_binary.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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.

def python_binary(srcs = [], **kwargs):
_unused = srcs # @unused

# @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed."
native.python_binary(**kwargs)
10 changes: 10 additions & 0 deletions shim/build_defs/rust_binary.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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("//:shims.bzl", _rust_binary = "rust_binary")

rust_binary = _rust_binary
10 changes: 10 additions & 0 deletions shim/build_defs/rust_library.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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("//:shims.bzl", _rust_library = "rust_library")

rust_library = _rust_library
10 changes: 10 additions & 0 deletions shim/build_defs/rust_unittest.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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("//:shims.bzl", _rust_unittest = "rust_unittest")

rust_unittest = _rust_unittest
3 changes: 3 additions & 0 deletions shim/common/ocaml/interop/defs.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("@root//defs.bzl", _RUST_FLAGS_2018 = "RUST_FLAGS_2018")

RUST_FLAGS_2018 = _RUST_FLAGS_2018
10 changes: 10 additions & 0 deletions shim/grpc_fb/codegen/buck_macros.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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.

def grpc_library(**kwargs):
_unused = kwargs # @unused
pass
Loading