diff --git a/flake.nix b/flake.nix index be338b5130..e9240073d6 100644 --- a/flake.nix +++ b/flake.nix @@ -75,6 +75,7 @@ cargo-nextest cargo-audit cargo-watch + reindeer ] ++ buck2NativeBuildInputs ++ lib.optionals pkgs.stdenv.isLinux [ diff --git a/shim/custom-third-party/node/turbo/BUCK b/third-party/node/turbo/BUCK similarity index 100% rename from shim/custom-third-party/node/turbo/BUCK rename to third-party/node/turbo/BUCK diff --git a/shim/custom-third-party/node/turbo/package.json b/third-party/node/turbo/package.json similarity index 100% rename from shim/custom-third-party/node/turbo/package.json rename to third-party/node/turbo/package.json diff --git a/shim/custom-third-party/node/turbo/pnpm-lock.yaml b/third-party/node/turbo/pnpm-lock.yaml similarity index 100% rename from shim/custom-third-party/node/turbo/pnpm-lock.yaml rename to third-party/node/turbo/pnpm-lock.yaml diff --git a/shim/custom-third-party/node/turbo/pnpm-workspace.yaml b/third-party/node/turbo/pnpm-workspace.yaml similarity index 100% rename from shim/custom-third-party/node/turbo/pnpm-workspace.yaml rename to third-party/node/turbo/pnpm-workspace.yaml diff --git a/third-party/rust/reindeer.toml b/third-party/rust/reindeer.toml new file mode 100644 index 0000000000..4aa852e04e --- /dev/null +++ b/third-party/rust/reindeer.toml @@ -0,0 +1,29 @@ +# Configuration for Reindeer to generate Buck targets from Cargo.toml +# +# Overview of available options: +# https://github.com/facebookincubator/reindeer/blob/main/example/third-party/reindeer.toml + +# Parse Rust code to work out the precise set of source files for each crate. +precise_srcs = true + +# Include a public top-level target which depends on all other targets. +include_top_level = true + +[cargo] +# Support Cargo's unstable "artifact dependencies" functionality, RFC 3028. +bindeps = true + +[buck] +# Name of the generated file. +file_name = "BUCK" + +# Rules used for various kinds of targets. +rust_library = "cargo.rust_library" +rust_binary = "cargo.rust_binary" +prebuilt_cxx_library = "third_party_rust_prebuilt_cxx_library" + +buckfile_imports = """ +load("@prelude//rust:cargo_buildscript.bzl", "buildscript_run") +load("@prelude//rust:cargo_package.bzl", "cargo") +load("//third-party/macros:rust_third_party.bzl", "third_party_rust_prebuilt_cxx_library") +""" diff --git a/toolchains/workspace-pnpm/macros.bzl b/toolchains/workspace-pnpm/macros.bzl index ac553dd8b4..6ca239ac44 100644 --- a/toolchains/workspace-pnpm/macros.bzl +++ b/toolchains/workspace-pnpm/macros.bzl @@ -165,7 +165,7 @@ build_node_modules = rule( attrs = { "turbo_bin": attrs.dep( providers = [RunInfo], - default = "//shim/custom-third-party/node/turbo:turbo_bin", + default = "//third-party/node/turbo:turbo_bin", doc = """Turbo dependency.""", ), "workspace": attrs.source( diff --git a/vendir.lock.yml b/vendir.lock.yml index 8a3209855a..a80028aa13 100644 --- a/vendir.lock.yml +++ b/vendir.lock.yml @@ -8,4 +8,12 @@ directories: - "2023-10-15" path: . path: prelude +- contents: + - git: + commitTitle: 'prelude/rust: Process CARGO_MANIFEST_DIR during rustdoc test...' + sha: 98a6e7b70dc82a62784f80897d72fefdfb54d70f + tags: + - "2023-10-15" + path: . + path: third-party/rust/reindeer.toml kind: LockConfig diff --git a/vendir.yml b/vendir.yml index c42af76305..106967d23c 100644 --- a/vendir.yml +++ b/vendir.yml @@ -12,4 +12,14 @@ directories: includePaths: - prelude/**/* newRootPath: prelude + - path: third-party/rust/reindeer.toml + contents: + - path: . + git: + url: https://github.com/facebook/buck2.git + # Need to update to $BUCK2_VERSION when new buck2 gets updated via `nix flake update` + ref: '2023-10-15' + includePaths: + - shim/third-party/rust/reindeer.toml + newRootPath: shim/third-party/rust/reindeer.toml