-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split into multiple examples, one for hybrid Cargo + Buck projects
- Loading branch information
1 parent
43dc5b4
commit 36e657f
Showing
58 changed files
with
872 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[cells] | ||
root = . | ||
prelude = prelude | ||
toolchains = toolchains | ||
none = none | ||
|
||
[cell_aliases] | ||
config = prelude | ||
ovr_config = prelude | ||
fbcode = none | ||
fbsource = none | ||
fbcode_macros = none | ||
buck = none | ||
|
||
# Uses a copy of the prelude bundled with the buck2 binary. You can alternatively delete this | ||
# section and vendor a copy of the prelude to the `prelude` directory of your project. | ||
[external_cells] | ||
prelude = bundled | ||
|
||
[parser] | ||
target_platform_detector_spec = target:root//...->prelude//platforms:default | ||
|
||
[build] | ||
execution_platforms = prelude//platforms:default |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/buck-out | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# A list of available rules and their signatures can be found here: https://buck2.build/docs/prelude/globals/ | ||
|
||
genrule( | ||
name = "hello_world", | ||
out = "out.txt", | ||
cmd = "echo BUILT BY BUCK2> $OUT", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
rust_binary( | ||
name = "test", | ||
srcs = ["src/main.rs"], | ||
deps = [ | ||
"//third-party:once_cell", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
use once_cell::sync::Lazy; | ||
|
||
const MAGIC: &str = "this is a magic string"; | ||
|
||
static SPECIAL: Lazy<String> = Lazy::new(|| MAGIC.to_string()); | ||
|
||
fn main() { | ||
println!("static {}", &*SPECIAL); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
## | ||
## Reindeer Config | ||
## | ||
## This file sets all of Reindeer's basic configuration. This file also marks | ||
## the top of the reindeer-managed directory, as all other paths are relative to | ||
## this one (both paths mentioned in this file, and implicit). | ||
## | ||
## Reindeer is under active development, and the layout and options in this file | ||
## may change. | ||
|
||
# Write output to third-party/BUCK | ||
# This also sets the default input (manifest_path) to third-party/Cargo.toml | ||
third_party_dir = "third-party" | ||
|
||
# If a fixups.toml file is needed (eg, the package has a build.rs), then | ||
# generate a template fixups.toml to be edited. | ||
fixup_templates = true | ||
|
||
# Configuration for generated BUCK file | ||
[buck] | ||
# Name of the generated file | ||
file_name = "BUCK" # default | ||
|
||
# Rules used for various kinds of targets. These rules don't directly | ||
# correspond with BUCK rules - they have extra attributes such as | ||
# per-platform settings. The intent is that you provide a set of macro | ||
# definitions which resolve them to appropriate underlying rules | ||
# suitable for your environment. (This may also work for Buck-like | ||
# build systems such as Bazel.) | ||
rust_library = "cargo.rust_library" # A plain Rust library | ||
rust_binary = "cargo.rust_binary" # A Rust executable | ||
buildscript_genrule = "buildscript_run" # Rule for running a build script to produce rustc args and generated sources | ||
|
||
# Load the macros to which the rules above will resolve. | ||
buckfile_imports = """ | ||
load("@prelude//rust:cargo_buildscript.bzl", "buildscript_run") | ||
load("@prelude//rust:cargo_package.bzl", "cargo") | ||
""" | ||
|
||
# Banner comment for the generated BUCK File. | ||
generated_file_header = """ | ||
## | ||
## \u0040generated by reindeer | ||
## Do not edit by hand. | ||
## | ||
## See README.md for directions on how to update this. | ||
## | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 2 additions & 5 deletions
7
example/third-party/.gitignore → examples/01-intro/third-party/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## | ||
## @generated by reindeer | ||
## Do not edit by hand. | ||
## | ||
## See README.md for directions on how to update this. | ||
## | ||
|
||
load("@prelude//rust:cargo_buildscript.bzl", "buildscript_run") | ||
load("@prelude//rust:cargo_package.bzl", "cargo") | ||
|
||
alias( | ||
name = "once_cell", | ||
actual = ":once_cell-1.20.2", | ||
visibility = ["PUBLIC"], | ||
) | ||
|
||
http_archive( | ||
name = "once_cell-1.20.2.crate", | ||
sha256 = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775", | ||
strip_prefix = "once_cell-1.20.2", | ||
urls = ["https://static.crates.io/crates/once_cell/1.20.2/download"], | ||
visibility = [], | ||
) | ||
|
||
cargo.rust_library( | ||
name = "once_cell-1.20.2", | ||
srcs = [":once_cell-1.20.2.crate"], | ||
crate = "once_cell", | ||
crate_root = "once_cell-1.20.2.crate/src/lib.rs", | ||
edition = "2021", | ||
features = [ | ||
"alloc", | ||
"default", | ||
"race", | ||
"std", | ||
], | ||
visibility = [], | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
load("@prelude//toolchains:demo.bzl", "system_demo_toolchains") | ||
|
||
# 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() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/buck-out | ||
/target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[workspace] | ||
|
||
members = ["project"] | ||
resolver = "2" | ||
|
||
# Local patches - typically git references | ||
[patch.crates-io] |
Oops, something went wrong.