Remove hostcaps fb feature

Summary:
`hostcaps`'s `fb` feature enables getting the real `fbwhoami` values
during cargo builds.

The only cargo-based projects using `hostcaps` are
`eden/scm/lib/commitcloudsubscriber` and `eden/scm/lib/config/loader`.
Neither is making internal builds with `cargo`, so neither the `fb`
feature nor `fbwhoami` are actually used.

The `fbwhoami` refs in `eden/mononoke/rate_limiting`
`eden/mononoke/server/qps` are from internal code. So that's not used
either.

The only thing using `fbwhoami` from a cargo build that needs it is
`common/rust/scuba` and `scm/telemetry/scm-telem-log` - so both for
`scm_telemetry`.

Reviewed By: dtolnay

Differential Revision: D52216174

fbshipit-source-id: 8c97e20d2eb0dd3152503d40e4796656b932d2a0
This commit is contained in:
Andres Suarez 2023-12-15 20:25:56 -08:00 committed by Facebook GitHub Bot
parent 25c93ffd88
commit b724028d55
10 changed files with 33 additions and 27 deletions

View File

@ -58,7 +58,6 @@ lmdb
[shipit.pathmap.fb=on]
# for internal builds that use getdeps
fbcode/fb303 = fb303
fbcode/common/rust/fbwhoami = common/rust/fbwhoami
fbcode/common/rust/shed = common/rust/shed
fbcode/thrift/lib/rust = thrift/lib/rust

View File

@ -15,7 +15,3 @@ path = "src/bin/test.rs"
[dependencies]
once_cell = "1.12"
[features]
default = []
fb = []

View File

@ -10,14 +10,14 @@ rust_library(
srcs = glob(["src/**/*.rs"]),
autocargo = {
"cargo_toml_config": {
"features": {
"default": [],
"fb": [],
"extra_buck_dependencies": {
"dependencies": [
(None, "//common/rust/fbwhoami:fbwhoami"), # T172908111
],
},
},
},
crate_root = "src/lib.rs",
features = ["fb"],
deps = [
"fbsource//third-party/rust:once_cell",
"//common/rust/fbwhoami:fbwhoami",

View File

@ -9,39 +9,39 @@
use once_cell::sync::Lazy;
#[cfg(any(fbcode_build, feature = "fb"))]
#[cfg(fbcode_build)]
mod facebook;
#[cfg(any(fbcode_build, feature = "fb"))]
#[cfg(fbcode_build)]
pub use facebook::get_env;
#[cfg(any(fbcode_build, feature = "fb"))]
#[cfg(fbcode_build)]
pub use facebook::is_corp;
#[cfg(any(fbcode_build, feature = "fb"))]
#[cfg(fbcode_build)]
pub use facebook::is_lab;
#[cfg(any(fbcode_build, feature = "fb"))]
#[cfg(fbcode_build)]
pub use facebook::is_prod;
#[cfg(any(fbcode_build, feature = "fb"))]
#[cfg(fbcode_build)]
pub use facebook::Env;
pub static IN_PROD: Lazy<bool> = Lazy::new(is_prod);
pub static IN_CORP: Lazy<bool> = Lazy::new(is_corp);
pub static IN_LAB: Lazy<bool> = Lazy::new(is_lab);
#[cfg(not(any(fbcode_build, feature = "fb")))]
#[cfg(not(fbcode_build))]
pub fn get_env() -> u8 {
0
}
#[cfg(not(any(fbcode_build, feature = "fb")))]
#[cfg(not(fbcode_build))]
pub fn is_prod() -> bool {
false
}
#[cfg(not(any(fbcode_build, feature = "fb")))]
#[cfg(not(fbcode_build))]
pub fn is_corp() -> bool {
false
}
#[cfg(not(any(fbcode_build, feature = "fb")))]
#[cfg(not(fbcode_build))]
pub fn is_lab() -> bool {
false
}

View File

@ -5,6 +5,15 @@ oncall("mononoke")
rust_library(
name = "rate_limiting",
srcs = glob(["src/**/*.rs"]),
autocargo = {
"cargo_toml_config": {
"extra_buck_dependencies": {
"dependencies": [
(None, "//common/rust/fbwhoami:fbwhoami"), # T172908111
],
},
},
},
deps = [
"fbsource//third-party/rust:anyhow",
"fbsource//third-party/rust:async-trait",

View File

@ -6,6 +6,15 @@ oncall("mononoke")
rust_library(
name = "qps",
srcs = glob(["src/**/*.rs"]),
autocargo = {
"cargo_toml_config": {
"extra_buck_dependencies": {
"dependencies": [
(None, "//common/rust/fbwhoami:fbwhoami"), # T172908111
],
},
},
},
deps = [
"fbsource//third-party/rust:anyhow",
"//common/rust/fbwhoami:fbwhoami",

View File

@ -39,6 +39,3 @@ tokio = { version = "1.29.1", features = ["full", "test-util", "tracing"] }
[dev-dependencies]
tempfile = "3.8"
[features]
default = []

View File

@ -8,9 +8,6 @@ rust_library(
srcs = glob(["src/**/*.rs"]),
autocargo = {
"cargo_toml_config": {
"features": {
"default": ["hostcaps/fb"],
},
"package": {
"description": """\
Cross platform client for subscribing to Commit Cloud eventsource (http server-sent events)

View File

@ -49,4 +49,4 @@ testutil = { version = "0.1.0", path = "../../util/testutil" }
[features]
default = []
fb = ["filetime", "hgtime", "hostcaps/fb", "http-client", "identity/fb", "regex", "serde", "serde_json", "serde_urlencoded", "sha2", "sha2", "tempfile", "types", "zstd"]
fb = ["filetime", "hgtime", "http-client", "identity/fb", "regex", "serde", "serde_json", "serde_urlencoded", "sha2", "sha2", "tempfile", "types", "zstd"]

View File

@ -38,7 +38,6 @@ rust_library(
"sha2",
"types",
"zstd",
"hostcaps/fb",
"identity/fb",
"tempfile",
"filetime",