Skip to content

Commit

Permalink
fbshipit-source-id: 4e3cfdee46b216ce5ea85d0955be6804976a8a8b
Browse files Browse the repository at this point in the history
  • Loading branch information
facebook-github-bot committed Feb 16, 2024
1 parent ea68bc5 commit 1609ce2
Show file tree
Hide file tree
Showing 130 changed files with 1,952 additions and 161 deletions.
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/
39 changes: 4 additions & 35 deletions shim/BUCK
Original file line number Diff line number Diff line change
@@ -1,36 +1,5 @@
load("@prelude//toolchains:cxx.bzl", "system_cxx_toolchain")
load("@prelude//toolchains:genrule.bzl", "system_genrule_toolchain")
load("@prelude//toolchains:ocaml.bzl", "system_ocaml_toolchain")
load("@prelude//toolchains:python.bzl", "system_python_bootstrap_toolchain", "system_python_toolchain")
load("@prelude//toolchains:rust.bzl", "system_rust_toolchain")
load("@prelude//toolchains:demo.bzl", "system_demo_toolchains")

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

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

system_ocaml_toolchain(
name = "ocaml",
visibility = ["PUBLIC"],
)

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

system_python_bootstrap_toolchain(
name = "python_bootstrap",
visibility = ["PUBLIC"],
)

system_rust_toolchain(
name = "rust",
default_edition = "2021",
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
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 ""
14 changes: 10 additions & 4 deletions shim/build_defs/native_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@
# 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
)
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)
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_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
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

0 comments on commit 1609ce2

Please sign in to comment.