Skip to content

Commit

Permalink
Merge branch 'facebook:main' into user/vaskomitanov/add-build-id
Browse files Browse the repository at this point in the history
  • Loading branch information
vaskomitanov authored Nov 27, 2023
2 parents dbfcc1c + 1326105 commit fde1407
Show file tree
Hide file tree
Showing 89 changed files with 737 additions and 292 deletions.
8 changes: 1 addition & 7 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
[build]
# `cargo_internal_build` is set for cargo builds inside Meta.
# The flag enables features not available in opensource version,
# in particular, dependencies on libraries not available in open source.
rustflags = [
# @oss-disable: "--cfg",
# @oss-disable: "cargo_internal_build",
"--cfg",
"tokio_unstable",
"--cfg=tokio_unstable",
]

# @oss-disable: [source.crates-io]
Expand Down
6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ members = [
"app/buck2_data",
"app/buck2_worker_proto",
"app/buck2_wrapper_common",
# @oss-disable: "buck2_tpx",
# @oss-disable: "buck2_tpx_cli",
"app/buck2_build_api",
"app/buck2_build_api_derive",
"app/buck2_build_api_tests",
Expand All @@ -78,7 +76,7 @@ members = [
"dice/dice_examples",
"dice/dice_tests",
# @oss-disable: "dice/fuzzy_dice",
# @oss-disable: "dice_replay",
"dice/read_dump",
# @oss-disable: "host_sharing",
"gazebo/display_container",
"gazebo/cmp_any",
Expand Down Expand Up @@ -372,8 +370,6 @@ buck2_test = { path = "app/buck2_test" }
buck2_test_api = { path = "app/buck2_test_api" }
buck2_test_proto = { path = "app/buck2_test_proto" }
buck2_test_runner = { path = "app/buck2_test_runner" }
buck2_tpx = { path = "buck2_tpx" }
buck2_tpx_cli = { path = "buck2_tpx_cli" }
buck2_transition = { path = "app/buck2_transition" }
buck2_util = { path = "app/buck2_util" }
buck2_worker_proto = { path = "app/buck2_worker_proto" }
Expand Down
12 changes: 7 additions & 5 deletions app/buck2/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ rust_library(
(
"linux",
[
"fbsource//third-party/rust:dirs",
"fbsource//third-party/rust:nix",
"//buck2/app/buck2_forkserver:buck2_forkserver",
],
),
(
"macos",
[
"fbsource//third-party/rust:dirs",
"fbsource//third-party/rust:nix",
"//buck2/app/buck2_forkserver:buck2_forkserver",
],
),
(
Expand All @@ -32,7 +36,6 @@ rust_library(
"fbsource//third-party/rust:async-trait",
"fbsource//third-party/rust:backtrace",
"fbsource//third-party/rust:clap-3",
"fbsource//third-party/rust:dirs",
"fbsource//third-party/rust:futures",
"fbsource//third-party/rust:libc",
"fbsource//third-party/rust:rand",
Expand All @@ -54,7 +57,6 @@ rust_library(
"//buck2/app/buck2_error:buck2_error",
"//buck2/app/buck2_event_observer:buck2_event_observer",
"//buck2/app/buck2_events:buck2_events",
"//buck2/app/buck2_forkserver:buck2_forkserver",
"//buck2/app/buck2_query:buck2_query",
"//buck2/app/buck2_server:buck2_server",
"//buck2/app/buck2_server_ctx:buck2_server_ctx",
Expand All @@ -64,7 +66,7 @@ rust_library(
"//buck2/app/buck2_wrapper_common:buck2_wrapper_common",
"//buck2/dice/dice:dice",
"//buck2/gazebo/dupe:dupe",
"//common/rust/gflags:gflags",
# @oss-disable: "//common/rust/gflags:gflags",
"//common/rust/shed/fbinit:fbinit",
],
)
Expand Down Expand Up @@ -109,8 +111,8 @@ buck_rust_binary(
"//buck2/app/buck2_transition:buck2_transition",
"//buck2/app/buck2_wrapper_common:buck2_wrapper_common",
"//buck2/gazebo/dupe:dupe",
"//common/rust/folly/logging:logging",
"//common/rust/gflags:gflags",
# @oss-disable: "//common/rust/folly/logging:logging",
# @oss-disable: "//common/rust/gflags:gflags",
"//common/rust/shed/fbinit:fbinit",
],
)
8 changes: 3 additions & 5 deletions app/buck2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ async-trait = { workspace = true }
backtrace = { workspace = true }
blake3 = { workspace = true }
clap = { workspace = true }
dirs = { workspace = true }
futures = { workspace = true }
hex = { workspace = true }
# @oss-disable: hostcaps = { path = "../../../common/rust/shed/hostcaps" }
libc = { workspace = true }
rand = { workspace = true }
serde = { workspace = true }
Expand All @@ -22,15 +20,13 @@ termimad = { workspace = true }
tokio = { workspace = true }
tokio-stream = { workspace = true }
tracing = { workspace = true }
which = "4.2.4"

allocative = { workspace = true }
dice = { workspace = true }
dupe = { workspace = true }
fbinit = { workspace = true }
gazebo = { workspace = true }
host_sharing = { workspace = true }
# @oss-disable: user = { path = "../../../common/rust/user", optional = true }

buck2_action_impl = { workspace = true }
buck2_analysis = { workspace = true }
Expand All @@ -53,7 +49,6 @@ buck2_data = { workspace = true }
buck2_error = { workspace = true }
buck2_event_observer = { workspace = true }
buck2_events = { workspace = true }
buck2_forkserver = { workspace = true }
buck2_interpreter_for_build = { workspace = true }
buck2_query = { workspace = true }
buck2_query_impls = { workspace = true }
Expand All @@ -71,8 +66,11 @@ buck2_wrapper_common = { workspace = true }
jemallocator = { workspace = true }

[target.'cfg(unix)'.dependencies]
dirs = { workspace = true }
nix = { workspace = true }

buck2_forkserver = { workspace = true }

[target.'cfg(windows)'.dependencies]
libc = { workspace = true }
winapi = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion app/buck2_action_impl_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
name = "buck2_action_impl_tests"
version = "0.1.0"

[dependencies]
[dev-dependencies]
anyhow = { workspace = true }
ctor = { workspace = true }
indoc = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion app/buck2_action_impl_tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* of this source tree.
*/

#![feature(error_generic_member_access)]
#![cfg(test)]
#![feature(error_generic_member_access)]

mod context;

Expand Down
1 change: 0 additions & 1 deletion app/buck2_action_metadata_proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ version = "0.1.0"

[dependencies]
prost = { workspace = true }
prost-types = { workspace = true }
tonic = { workspace = true }

[build-dependencies]
Expand Down
6 changes: 0 additions & 6 deletions app/buck2_build_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,32 @@ anyhow = { workspace = true }
async-recursion = { workspace = true }
async-trait = { workspace = true }
blake3 = { workspace = true }
crossbeam-epoch = { workspace = true }
dashmap = { workspace = true }
derivative = { workspace = true }
derive_more = { workspace = true }
either = { workspace = true }
fnv = { workspace = true }
futures = { workspace = true }
glob = { workspace = true }
higher-order-closure = { workspace = true }
indexmap = { workspace = true }
internment = { workspace = true }
inventory = { workspace = true }
itertools = { workspace = true }
once_cell = { workspace = true }
pin-project = { workspace = true }
ref-cast = { workspace = true }
regex = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
shlex = { workspace = true }
smallvec = { workspace = true }
static_assertions = { workspace = true }
structopt = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }

allocative = { workspace = true }
dice = { workspace = true }
display_container = { workspace = true }
dupe = { workspace = true }
fbinit = { workspace = true }
gazebo = { workspace = true }
more_futures = { workspace = true }
provider = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl<'a> ActionExecutionTarget<'a> {
self.action.owner().dupe(),
self.action.category(),
self.action.identifier(),
self.action.action_key(),
)
.unwrap()
}
Expand Down
5 changes: 5 additions & 0 deletions app/buck2_build_api/src/actions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@ impl RegisteredAction {
self.key.deferred_key().owner()
}

/// Gets the action key, uniquely identifying this action in a target.
pub fn action_key(&self) -> String {
self.key.deferred_key().action_key()
}

pub fn key(&self) -> &ActionKey {
&self.key
}
Expand Down
2 changes: 0 additions & 2 deletions app/buck2_build_info/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ name = "buck2_build_info"
version = "0.1.0"

[dependencies]
buck2_error = { workspace = true }
buck2_util = { workspace = true }
# @oss-disable: build_info = { path = "../../../common/rust/build_info" }
4 changes: 2 additions & 2 deletions app/buck2_build_info/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ pub fn win_internal_version() -> Option<&'static str> {

/// Get the time at which this binary was built, if available.
pub fn time_iso8601() -> Option<&'static str> {
#[cfg(any(fbcode_build, cargo_internal_build))]
#[cfg(fbcode_build)]
{
Some(build_info::BuildInfo::get_time_iso8601())
}

#[cfg(not(any(fbcode_build, cargo_internal_build)))]
#[cfg(not(fbcode_build))]
{
None
}
Expand Down
4 changes: 0 additions & 4 deletions app/buck2_bxl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ higher-order-closure = { workspace = true }
indexmap = { workspace = true }
itertools = { workspace = true }
num-bigint = { workspace = true }
once_cell = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
structopt = { workspace = true }
tokio = { workspace = true }

fbinit = { workspace = true }

allocative = { workspace = true }
buck2_events = { workspace = true }
cmp_any = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion app/buck2_cfg_constructor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ starlark = { workspace = true }

buck2_build_api = { workspace = true }
buck2_common = { workspace = true }
buck2_configured = { workspace = true }
buck2_core = { workspace = true }
buck2_error = { workspace = true }
buck2_events = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion app/buck2_client/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ rust_library(
"//buck2/app/buck2_error:buck2_error",
"//buck2/app/buck2_event_observer:buck2_event_observer",
"//buck2/app/buck2_events:buck2_events",
"//buck2/app/buck2_execute:buck2_execute",
# @oss-disable: "//buck2/app/buck2_execute:buck2_execute",
"//buck2/app/buck2_offline_archive:buck2_offline_archive",
"//buck2/app/buck2_query_parser:buck2_query_parser",
"//buck2/app/buck2_subscription_proto:buck2_subscription_proto",
Expand Down
2 changes: 0 additions & 2 deletions app/buck2_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ chrono = { workspace = true }
clap = { workspace = true }
csv = { workspace = true }
derive_more = { workspace = true }
dice = { workspace = true }
dupe = { workspace = true }
futures = { workspace = true }
gazebo = { workspace = true }
Expand Down Expand Up @@ -54,7 +53,6 @@ buck2_data = { workspace = true }
buck2_error = { workspace = true }
buck2_event_observer = { workspace = true }
buck2_events = { workspace = true }
buck2_execute = { workspace = true }
buck2_offline_archive = { workspace = true }
buck2_query_parser = { workspace = true }
buck2_subscription_proto = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions app/buck2_client/src/commands/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ fn clean_buck_out(path: &AbsNormPathBuf) -> anyhow::Result<()> {
Ok(())
}

#[cfg(any(fbcode_build, cargo_internal_build))]
#[cfg(fbcode_build)]
async fn try_clean_eden_buck_out(
buck_out: &AbsNormPathBuf,
dryrun: bool,
Expand Down Expand Up @@ -270,7 +270,7 @@ async fn try_clean_eden_buck_out(
Ok(Some(vec![buck_out.display().to_string()]))
}

#[cfg(not(any(fbcode_build, cargo_internal_build)))]
#[cfg(not(fbcode_build))]
async fn try_clean_eden_buck_out(
_buck_out: &AbsNormPathBuf,
_dryrun: bool,
Expand Down
5 changes: 0 additions & 5 deletions app/buck2_client_ctx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ bytes = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true }
crossterm = { workspace = true }
csv = { workspace = true }
derivative = { workspace = true }
derive_more = { workspace = true }
dupe = { workspace = true }
Expand All @@ -27,7 +26,6 @@ httparse = { workspace = true }
hyper = { workspace = true }
itertools = { workspace = true }
libc = { workspace = true }
linked-hash-map = { workspace = true }
memmap2 = { workspace = true }
object = { workspace = true }
once_cell = { workspace = true }
Expand All @@ -48,8 +46,6 @@ tokio-util = { workspace = true }
tonic = { workspace = true }
tracing = { workspace = true }

# @oss-disable: detect_eden = { path = "../../../common/rust/shed/detect_eden" }
# @oss-disable: hostcaps = { path = "../../../common/rust/shed/hostcaps" }
superconsole = { version = "0.2.0", path = "../../superconsole" }

# Please do not add dependency on `buck2_build_api`.
Expand All @@ -62,7 +58,6 @@ buck2_error = { workspace = true }
buck2_event_observer = { workspace = true }
buck2_events = { workspace = true }
buck2_http = { workspace = true }
buck2_test_api = { workspace = true }
buck2_util = { workspace = true }
buck2_wrapper_common = { workspace = true }

Expand Down
4 changes: 2 additions & 2 deletions app/buck2_client_ctx/src/manifold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ impl Bucket {

/// Return the place to upload logs, or None to not upload logs at all
fn log_upload_url(use_vpnless: bool) -> Option<&'static str> {
#[cfg(any(fbcode_build, cargo_internal_build))]
#[cfg(fbcode_build)]
if hostcaps::is_prod() {
Some("https://manifold.facebook.net")
} else if use_vpnless {
Some("http://manifold.edge.x2p.facebook.net")
} else {
Some("https://manifold.c2p.facebook.net")
}
#[cfg(not(any(fbcode_build, cargo_internal_build)))]
#[cfg(not(fbcode_build))]
{
#[cfg(fbcode_build)]
compile_error!("this code is not meant to be compiled in fbcode");
Expand Down
4 changes: 2 additions & 2 deletions app/buck2_client_ctx/src/subscribers/recorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ pub fn try_get_invocation_recorder<'a>(
.map(|path| path.resolve(&ctx.working_dir));

let filesystem;
#[cfg(any(fbcode_build, cargo_internal_build))]
#[cfg(fbcode_build)]
{
let root = std::path::Path::to_owned(ctx.paths()?.project_root().root().to_buf().as_ref());
if detect_eden::is_eden(root).unwrap_or(false) {
Expand All @@ -1132,7 +1132,7 @@ pub fn try_get_invocation_recorder<'a>(
filesystem = "default".to_owned();
}
}
#[cfg(not(any(fbcode_build, cargo_internal_build)))]
#[cfg(not(fbcode_build))]
{
filesystem = "default".to_owned();
}
Expand Down
2 changes: 1 addition & 1 deletion app/buck2_common/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ rust_library(
"//buck2/gazebo/gazebo:gazebo",
"//buck2/shed/more_futures:more_futures",
"//buck2/starlark-rust/starlark_map:starlark_map",
"//common/rust/folly/memory:memory",
# @oss-disable: "//common/rust/folly/memory:memory",
],
)
Loading

0 comments on commit fde1407

Please sign in to comment.