From 9ae37ca46edebe99fa8c18611193152683e0a380 Mon Sep 17 00:00:00 2001 From: Alex Jackson Lambert Date: Tue, 3 Dec 2024 14:34:00 -0800 Subject: [PATCH] Revert D66561338: Rewrite TARGETS files to BUCK files for facebookexperimental/rust-shed Differential Revision: D66561338 Original commit changeset: dba51b9be776 Original Phabricator Diff: D66561338 fbshipit-source-id: b64eb543fa4826884ac17a004894b6832e48a6b2 --- shed/abomonable_string/BUCK | 16 ++ shed/ascii_ext/BUCK | 19 ++ shed/async_once_cell/BUCK | 17 ++ shed/borrowed/BUCK | 15 ++ shed/buffered_weighted/BUCK | 41 ++++ shed/cached_config/BUCK | 41 ++++ shed/cachelib_stub/BUCK | 42 ++++ shed/chrome_trace/BUCK | 28 +++ shed/cloned/BUCK | 15 ++ shed/codegen_includer_proc_macro/BUCK | 40 ++++ shed/codegen_includer_proc_macro/example/BUCK | 8 + shed/detect_eden/BUCK | 26 +++ shed/facet/BUCK | 146 ++++++++++++ shed/failure_ext/BUCK | 29 +++ shed/fbinit/BUCK | 99 ++++++++ shed/fbthrift_ext/BUCK | 135 +++++++++++ shed/futures_01_ext/BUCK | 27 +++ shed/futures_ext/BUCK | 29 +++ shed/futures_lazy_shared/BUCK | 21 ++ shed/futures_stats/BUCK | 33 +++ shed/hash_memo/BUCK | 31 +++ shed/hlist_to_tuple/BUCK | 18 ++ shed/hostname/BUCK | 37 +++ shed/justknobs_stub/BUCK | 55 +++++ .../cached_config_thrift_struct/BUCK | 12 + shed/lock_ext/BUCK | 16 ++ shed/memcache_stub/BUCK | 49 ++++ shed/netstring/BUCK | 22 ++ shed/ods/BUCK | 30 +++ shed/panichandler/BUCK | 129 +++++++++++ shed/perthread/BUCK | 21 ++ shed/quickcheck_arbitrary_derive/BUCK | 30 +++ shed/scuba_sample/BUCK | 103 +++++++++ shed/scuba_stub/BUCK | 39 ++++ shed/secure_utils/BUCK | 37 +++ shed/services/BUCK | 74 ++++++ shed/shared_error/BUCK | 20 ++ shed/slog_glog_fmt/BUCK | 88 +++++++ shed/slog_stats/BUCK | 19 ++ shed/sorted_vector_map/BUCK | 50 ++++ shed/sql/BUCK | 217 ++++++++++++++++++ shed/stats/BUCK | 58 +++++ shed/thrift_compiler/BUCK | 35 +++ shed/time_ext/BUCK | 20 ++ shed/tokio-detectors/BUCK | 41 ++++ shed/tokio-uds-compat/BUCK | 57 +++++ 46 files changed, 2135 insertions(+) create mode 100644 shed/abomonable_string/BUCK create mode 100644 shed/ascii_ext/BUCK create mode 100644 shed/async_once_cell/BUCK create mode 100644 shed/borrowed/BUCK create mode 100644 shed/buffered_weighted/BUCK create mode 100644 shed/cached_config/BUCK create mode 100644 shed/cachelib_stub/BUCK create mode 100644 shed/chrome_trace/BUCK create mode 100644 shed/cloned/BUCK create mode 100644 shed/codegen_includer_proc_macro/BUCK create mode 100644 shed/codegen_includer_proc_macro/example/BUCK create mode 100644 shed/detect_eden/BUCK create mode 100644 shed/facet/BUCK create mode 100644 shed/failure_ext/BUCK create mode 100644 shed/fbinit/BUCK create mode 100644 shed/fbthrift_ext/BUCK create mode 100644 shed/futures_01_ext/BUCK create mode 100644 shed/futures_ext/BUCK create mode 100644 shed/futures_lazy_shared/BUCK create mode 100644 shed/futures_stats/BUCK create mode 100644 shed/hash_memo/BUCK create mode 100644 shed/hlist_to_tuple/BUCK create mode 100644 shed/hostname/BUCK create mode 100644 shed/justknobs_stub/BUCK create mode 100644 shed/justknobs_stub/cached_config_thrift_struct/BUCK create mode 100644 shed/lock_ext/BUCK create mode 100644 shed/memcache_stub/BUCK create mode 100644 shed/netstring/BUCK create mode 100644 shed/ods/BUCK create mode 100644 shed/panichandler/BUCK create mode 100644 shed/perthread/BUCK create mode 100644 shed/quickcheck_arbitrary_derive/BUCK create mode 100644 shed/scuba_sample/BUCK create mode 100644 shed/scuba_stub/BUCK create mode 100644 shed/secure_utils/BUCK create mode 100644 shed/services/BUCK create mode 100644 shed/shared_error/BUCK create mode 100644 shed/slog_glog_fmt/BUCK create mode 100644 shed/slog_stats/BUCK create mode 100644 shed/sorted_vector_map/BUCK create mode 100644 shed/sql/BUCK create mode 100644 shed/stats/BUCK create mode 100644 shed/thrift_compiler/BUCK create mode 100644 shed/time_ext/BUCK create mode 100644 shed/tokio-detectors/BUCK create mode 100644 shed/tokio-uds-compat/BUCK diff --git a/shed/abomonable_string/BUCK b/shed/abomonable_string/BUCK new file mode 100644 index 000000000..5091c8063 --- /dev/null +++ b/shed/abomonable_string/BUCK @@ -0,0 +1,16 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "abomonable_string", + srcs = glob([ + "src/**/*.rs", + "README.*", + ]), + deps = [ + "fbsource//third-party/rust:abomonation", + "fbsource//third-party/rust:quickcheck", + "//common/rust/shed/quickcheck_arbitrary_derive:quickcheck_arbitrary_derive", + ], +) diff --git a/shed/ascii_ext/BUCK b/shed/ascii_ext/BUCK new file mode 100644 index 000000000..4288f04e2 --- /dev/null +++ b/shed/ascii_ext/BUCK @@ -0,0 +1,19 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "ascii_ext", + srcs = ["src/lib.rs"], + autocargo = { + "cargo_toml_config": { + "package": { + "description": "ascii crate extensions", + }, + }, + }, + deps = [ + "fbsource//third-party/rust:ascii", + "fbsource//third-party/rust:quickcheck", + ], +) diff --git a/shed/async_once_cell/BUCK b/shed/async_once_cell/BUCK new file mode 100644 index 000000000..3badb376f --- /dev/null +++ b/shed/async_once_cell/BUCK @@ -0,0 +1,17 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "async_once_cell", + srcs = glob([ + "src/**/*.rs", + ]), + named_deps = { + "tokio": "fbsource//third-party/rust:tokio", + }, + test_deps = [ + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:rand", + ], +) diff --git a/shed/borrowed/BUCK b/shed/borrowed/BUCK new file mode 100644 index 000000000..94fb1e029 --- /dev/null +++ b/shed/borrowed/BUCK @@ -0,0 +1,15 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "borrowed", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Borrow macro", + }, + }, + }, +) diff --git a/shed/buffered_weighted/BUCK b/shed/buffered_weighted/BUCK new file mode 100644 index 000000000..feb5f3fc1 --- /dev/null +++ b/shed/buffered_weighted/BUCK @@ -0,0 +1,41 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "buffered_weighted", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Ordered stream implementation that allows for concurrent polling constrained by the weight of the futures", + }, + }, + }, + compatible_with = [ + "ovr_config//os:linux", + ], + doc_deps = [ + "fbsource//third-party/rust:futures", + ], + os_deps = [ + ( + "linux", + [ + "fbsource//third-party/rust:procfs", + ], + ), + ], + test_deps = [ + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:proptest", + "fbsource//third-party/rust:proptest-derive", + "fbsource//third-party/rust:tokio", + "fbsource//third-party/rust:tokio-stream", + ], + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:futures-util", + "fbsource//third-party/rust:pin-project", + ], +) diff --git a/shed/cached_config/BUCK b/shed/cached_config/BUCK new file mode 100644 index 000000000..4b60dfb53 --- /dev/null +++ b/shed/cached_config/BUCK @@ -0,0 +1,41 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "cached_config", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Helpers to maintain cached set of configs", + }, + }, + }, + compatible_with = [ + "ovr_config//os:linux", + ], + test_deps = [ + "fbsource//third-party/rust:serde_derive", + ], + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:bytes", + "fbsource//third-party/rust:chrono", + "fbsource//third-party/rust:serde", + "fbsource//third-party/rust:serde_json", + "fbsource//third-party/rust:slog", + "fbsource//third-party/rust:tokio", + "//common/rust/configerator:configerator_client", + "//common/rust/shed/fbinit:fbinit", + "//thrift/lib/rust:fbthrift", + ], +) diff --git a/shed/cachelib_stub/BUCK b/shed/cachelib_stub/BUCK new file mode 100644 index 000000000..d68d5954b --- /dev/null +++ b/shed/cachelib_stub/BUCK @@ -0,0 +1,42 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss") + +oncall("autocargo") + +rust_library( + name = "cachelib", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "extra_buck_dependencies": { + "dependencies": [ + "fbsource//third-party/rust:abomonation", + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:bytes", + ], + }, + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Cache library", + }, + }, + }, + compatible_with = [ + "ovr_config//os:linux", + ], + named_deps = { + "fb_cachelib": "//cachelib/rust:cachelib", + }, + deps = [] + ([ + "fbsource//third-party/rust:abomonation", + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:bytes", + ] if rust_oss.is_oss_build() else []), +) diff --git a/shed/chrome_trace/BUCK b/shed/chrome_trace/BUCK new file mode 100644 index 000000000..815967498 --- /dev/null +++ b/shed/chrome_trace/BUCK @@ -0,0 +1,28 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "chrome-trace", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Crate for writing Trace Event JSON files", + }, + }, + }, + test_deps = [ + "fbsource//third-party/rust:maplit", + "fbsource//third-party/rust:tempfile", + ], + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:bytes", + "fbsource//third-party/rust:flate2", + "fbsource//third-party/rust:libc", + "fbsource//third-party/rust:serde", + "fbsource//third-party/rust:serde_json", + "fbsource//third-party/rust:zstd", + ], +) diff --git a/shed/cloned/BUCK b/shed/cloned/BUCK new file mode 100644 index 000000000..b87c3fbf8 --- /dev/null +++ b/shed/cloned/BUCK @@ -0,0 +1,15 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "cloned", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Cloned macro", + }, + }, + }, +) diff --git a/shed/codegen_includer_proc_macro/BUCK b/shed/codegen_includer_proc_macro/BUCK new file mode 100644 index 000000000..89c54b0d5 --- /dev/null +++ b/shed/codegen_includer_proc_macro/BUCK @@ -0,0 +1,40 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs:rust_unittest.bzl", "rust_unittest") + +oncall("autocargo") + +rust_library( + name = "codegen_includer_proc_macro", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "build": "build.rs", + "description": "Workaround for https://github.com/rust-lang/rfcs/issues/752", + }, + }, + }, + crate_root = "src/lib.rs", + doc_env = { + "OUT_DIR": "$(location //common/rust/shed/codegen_includer_proc_macro/example:doc_test_out_dir)", + }, + proc_macro = True, + tests = [ + ":tests", + ], + deps = [ + "fbsource//third-party/rust:quote", + ], +) + +rust_unittest( + name = "tests", + srcs = glob(["tests/**/*.rs"]), + crate_root = "tests/main.rs", + env = { + "OUT_DIR": "tests/fixtures/", + }, + deps = [ + ":codegen_includer_proc_macro", + ], +) diff --git a/shed/codegen_includer_proc_macro/example/BUCK b/shed/codegen_includer_proc_macro/example/BUCK new file mode 100644 index 000000000..244cebf6b --- /dev/null +++ b/shed/codegen_includer_proc_macro/example/BUCK @@ -0,0 +1,8 @@ +load("@fbcode_macros//build_defs:native_rules.bzl", "buck_filegroup") + +oncall("autocargo") + +buck_filegroup( + name = "doc_test_out_dir", + srcs = ["lib.rs"], +) diff --git a/shed/detect_eden/BUCK b/shed/detect_eden/BUCK new file mode 100644 index 000000000..1db4ddf90 --- /dev/null +++ b/shed/detect_eden/BUCK @@ -0,0 +1,26 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("build_infra") + +rust_library( + name = "detect_eden", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Detect if a directory is in an EdenFS", + }, + }, + }, + os_deps = [ + ( + "windows", + [ + "fbsource//third-party/rust:winapi", + ], + ), + ], + deps = [ + "fbsource//third-party/rust:dunce", + ], +) diff --git a/shed/facet/BUCK b/shed/facet/BUCK new file mode 100644 index 000000000..0f6fce7b0 --- /dev/null +++ b/shed/facet/BUCK @@ -0,0 +1,146 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs:rust_unittest.bzl", "rust_unittest") + +oncall("autocargo") + +rust_library( + name = "facet", + srcs = glob(["src/**/*.rs"]), + doc_deps = [ + "fbsource//third-party/rust:tokio", + ], + features = ["impl_never_type"], + tests = [ + ":facet_async_test", + ":facet_basic_test", + ":facet_delegate_test", + ":facet_deps_test", + ":facet_fallible_test", + ":facet_params_test", + ":facet_static_test", + ], + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:async-trait", + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:thiserror", + "fbsource//third-party/rust:trait-set", + ":facet_proc_macros", + ], +) + +rust_library( + name = "facet_proc_macros", + srcs = glob(["proc_macros/*.rs"]), + autocargo = { + "cargo_toml_config": { + "dependencies_override": { + "dependencies": { + "proc-macro-crate": { + "version": "1.1.0", + }, + }, + }, + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fb_buck_build)"], + "level": "warn", + }, + }, + }, + }, + "cargo_toml_dir": "proc_macros", + }, + crate_root = "proc_macros/lib.rs", + proc_macro = True, + deps = [ + "fbsource//third-party/rust:proc-macro2", + "fbsource//third-party/rust:quote", + "fbsource//third-party/rust:syn", + ], +) + +rust_unittest( + name = "facet_basic_test", + srcs = ["test/basic_test.rs"], + crate_root = "test/basic_test.rs", + deps = [ + ":facet", + ], +) + +rust_unittest( + name = "facet_async_test", + srcs = ["test/async_test.rs"], + crate_root = "test/async_test.rs", + deps = [ + "fbsource//third-party/rust:async-trait", + "fbsource//third-party/rust:tokio", + ":facet", + ], +) + +rust_unittest( + name = "facet_params_test", + srcs = ["test/params_test.rs"], + crate_root = "test/params_test.rs", + deps = [ + ":facet", + ], +) + +rust_unittest( + name = "facet_deps_test", + srcs = ["test/deps_test.rs"], + crate_root = "test/deps_test.rs", + deps = [ + ":facet", + ], +) + +rust_unittest( + name = "facet_fallible_test", + srcs = ["test/fallible_test.rs"], + crate_root = "test/fallible_test.rs", + deps = [ + "fbsource//third-party/rust:thiserror", + ":facet", + ], +) + +rust_unittest( + name = "facet_static_test", + srcs = ["test/static_test.rs"], + crate_root = "test/static_test.rs", + deps = [ + ":facet", + ], +) + +rust_unittest( + name = "facet_delegate_test", + srcs = ["test/delegate_test.rs"], + crate_root = "test/delegate_test.rs", + deps = [ + ":facet", + ], +) + +rust_unittest( + name = "facet_from_container_test", + srcs = ["test/from_container_test.rs"], + crate_root = "test/from_container_test.rs", + deps = [ + ":facet", + ], +) + +rust_unittest( + name = "facet_tuple_struct_test", + srcs = ["test/tuple_struct_test.rs"], + crate_root = "test/tuple_struct_test.rs", + deps = [ + ":facet", + ], +) diff --git a/shed/failure_ext/BUCK b/shed/failure_ext/BUCK new file mode 100644 index 000000000..81ae603db --- /dev/null +++ b/shed/failure_ext/BUCK @@ -0,0 +1,29 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "failure_ext", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Extensions to the anyhow crate", + }, + }, + }, + test_deps = ["fbsource//third-party/rust:thiserror"], + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:futures-old", + "fbsource//third-party/rust:slog", + ], +) diff --git a/shed/fbinit/BUCK b/shed/fbinit/BUCK new file mode 100644 index 000000000..527404584 --- /dev/null +++ b/shed/fbinit/BUCK @@ -0,0 +1,99 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs:rust_unittest.bzl", "rust_unittest") +load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss") + +oncall("autocargo") + +rust_library( + name = "fbinit", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "extra_buck_dependencies": { + "dependencies": [ + "fbsource//third-party/rust:quickcheck", + ], + }, + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Facebook init token", + "version": "0.2.0", + }, + }, + }, + doc_deps = [ + "//common/rust/shed/fbinit:fbinit-tokio", + ], + named_deps = { + "real_fbinit": "//common/rust/fbinit:fbinit", + }, + tests = [ + ":fbinit_test", + ], + unittests = False, + deps = [ + ":fbinit_macros", + ] + ([ + "fbsource//third-party/rust:quickcheck", + ] if rust_oss.is_oss_build() else []), +) + +rust_library( + name = "fbinit_macros", + srcs = glob(["fbinit_macros/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Facebook init token macros", + "readme": "../../../README.md", + "version": "0.2.0", + }, + }, + "cargo_toml_dir": "fbinit_macros", + }, + crate_root = "fbinit_macros/lib.rs", + doctests = False, + proc_macro = True, + unittests = False, + deps = [ + "fbsource//third-party/rust:proc-macro2", + "fbsource//third-party/rust:quote", + "fbsource//third-party/rust:syn", + ], +) + +rust_unittest( + name = "fbinit_test", + srcs = ["test/fbinit_test.rs"], + crate_root = "test/fbinit_test.rs", + deps = [ + ":fbinit", + "//common/rust/shed/fbinit:fbinit-tokio", + ], +) + +rust_library( + name = "fbinit-tokio", + srcs = glob(["fbinit-tokio/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "name": "fbinit-tokio", + "version": "0.1.2", + }, + }, + "cargo_toml_dir": "fbinit-tokio", + }, + crate = "fbinit_tokio", + deps = [ + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:tokio", + ], +) diff --git a/shed/fbthrift_ext/BUCK b/shed/fbthrift_ext/BUCK new file mode 100644 index 000000000..51ca09ecf --- /dev/null +++ b/shed/fbthrift_ext/BUCK @@ -0,0 +1,135 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "framed", + srcs = glob(["framed/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "fbthrift extensions for framed transport", + "name": "fbthrift_framed", + "readme": "../../../../README.md", + }, + }, + "cargo_toml_dir": "framed", + }, + crate = "fbthrift_framed", + named_deps = { + "bytes": "fbsource//third-party/rust:bytes", + }, + test_deps = [ + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:tokio", + ], + deps = [ + "fbsource//third-party/rust:byteorder", + "fbsource//third-party/rust:bytes", + "fbsource//third-party/rust:tokio-util", + ], +) + +rust_library( + name = "socket", + srcs = glob(["socket/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "fbthrift extensions for socket transport", + "name": "fbthrift_socket", + "readme": "../../../../README.md", + }, + }, + "cargo_toml_dir": "socket", + }, + crate = "fbthrift_socket", + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:bytes", + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:tokio", + "fbsource//third-party/rust:tokio-tower", + "fbsource//third-party/rust:tokio-util", + "fbsource//third-party/rust:tower-service", + ":framed", + ":util", + "//thrift/lib/rust:fbthrift", + ], +) + +rust_library( + name = "tcp", + srcs = glob(["tcp/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "fbthrift extensions for tcp transport", + "name": "fbthrift_tcp", + "readme": "../../../../README.md", + }, + }, + "cargo_toml_dir": "tcp", + }, + crate = "fbthrift_tcp", + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:bytes", + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:tokio", + "fbsource//third-party/rust:tokio-tower", + "fbsource//third-party/rust:tokio-util", + "fbsource//third-party/rust:tower-service", + ":framed", + ":util", + "//thrift/lib/rust:fbthrift", + ], +) + +rust_library( + name = "util", + srcs = glob(["util/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "fbthrift extensions utilities", + "name": "fbthrift_util", + "readme": "../../../../README.md", + }, + }, + "cargo_toml_dir": "util", + }, + crate = "fbthrift_util", + deps = [ + "fbsource//third-party/rust:tokio", + ], +) + +rust_library( + name = "adapters", + srcs = glob(["adapters/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "fbthrift extensions for thrift adapters", + "name": "fbthrift_adapters", + "readme": "../../../../README.md", + }, + }, + "cargo_toml_dir": "adapters", + }, + crate = "fbthrift_adapters", + deps = [ + "fbsource//third-party/rust:bstr", + "fbsource//third-party/rust:camino", + "fbsource//third-party/rust:chrono", + "fbsource//third-party/rust:ordered-float", + "fbsource//third-party/rust:paste", + "fbsource//third-party/rust:serde", + "fbsource//third-party/rust:serde_derive", + "fbsource//third-party/rust:thiserror", + "fbsource//third-party/rust:uuid", + "fbsource//third-party/rust:valuable", + "//thrift/lib/rust:fbthrift", + ], +) diff --git a/shed/futures_01_ext/BUCK b/shed/futures_01_ext/BUCK new file mode 100644 index 000000000..d598e5ded --- /dev/null +++ b/shed/futures_01_ext/BUCK @@ -0,0 +1,27 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "futures_01_ext", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Extensions for future 0.1 crate", + }, + }, + }, + test_deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:assert_matches", + "fbsource//third-party/rust:tokio", + "//common/rust/shed/cloned:cloned", + ], + test_named_deps = { + "futures03": "fbsource//third-party/rust:futures", + }, + deps = [ + "fbsource//third-party/rust:futures-old", + ], +) diff --git a/shed/futures_ext/BUCK b/shed/futures_ext/BUCK new file mode 100644 index 000000000..9011ae948 --- /dev/null +++ b/shed/futures_ext/BUCK @@ -0,0 +1,29 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "futures_ext", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "future crate extensions", + }, + }, + }, + test_deps = [ + "fbsource//third-party/rust:assert_matches", + "fbsource//third-party/rust:async-stream", + ], + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:maybe-owned", + "fbsource//third-party/rust:pin-project", + "fbsource//third-party/rust:slog", + "fbsource//third-party/rust:thiserror", + "fbsource//third-party/rust:tokio", + "//common/rust/shed/shared_error:shared_error", + ], +) diff --git a/shed/futures_lazy_shared/BUCK b/shed/futures_lazy_shared/BUCK new file mode 100644 index 000000000..20c0f2f2f --- /dev/null +++ b/shed/futures_lazy_shared/BUCK @@ -0,0 +1,21 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "futures_lazy_shared", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "LazyShared extension to futures crate", + }, + }, + }, + test_deps = [ + "fbsource//third-party/rust:tokio", + ], + deps = [ + "fbsource//third-party/rust:futures", + ], +) diff --git a/shed/futures_stats/BUCK b/shed/futures_stats/BUCK new file mode 100644 index 000000000..131dc0ebd --- /dev/null +++ b/shed/futures_stats/BUCK @@ -0,0 +1,33 @@ +load("@fbcode_macros//build_defs:rust_binary.bzl", "rust_binary") +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "futures_stats", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Stats extension to futures crate", + }, + }, + }, + test_deps = [ + "fbsource//third-party/rust:tokio", + ], + deps = [ + "fbsource//third-party/rust:futures", + "//common/rust/shed/futures_ext:futures_ext", + ], +) + +rust_binary( + name = "futures_stats_test", + srcs = glob(["test/**/*.rs"]), + deps = [ + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:tokio", + ":futures_stats", + ], +) diff --git a/shed/hash_memo/BUCK b/shed/hash_memo/BUCK new file mode 100644 index 000000000..de8d4ba59 --- /dev/null +++ b/shed/hash_memo/BUCK @@ -0,0 +1,31 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "hash_memo", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "authors": [ + "Facebook ", + ], + "categories": ["data-structures"], + "description": "memoization/caching of hash values by Hash and Hasher implementations", + "keywords": [ + "cache", + "hash", + "map", + "memo", + "memoize", + "set", + ], + "readme": "README.md", + "repository": "https://github.com/facebookexperimental/rust-shed", + }, + }, + }, + test_deps = ["fbsource//third-party/rust:ahash"], + deps = ["fbsource//third-party/rust:once_cell"], +) diff --git a/shed/hlist_to_tuple/BUCK b/shed/hlist_to_tuple/BUCK new file mode 100644 index 000000000..667006894 --- /dev/null +++ b/shed/hlist_to_tuple/BUCK @@ -0,0 +1,18 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("source_control") + +rust_library( + name = "hlist_to_tuple", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Crate for converting HList to tuple", + }, + }, + }, + deps = [ + "fbsource//third-party/rust:frunk", + ], +) diff --git a/shed/hostname/BUCK b/shed/hostname/BUCK new file mode 100644 index 000000000..9fa54a9fd --- /dev/null +++ b/shed/hostname/BUCK @@ -0,0 +1,37 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss") + +oncall("autocargo") + +rust_library( + name = "hostname", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "extra_buck_dependencies": { + "dependencies": [ + ("real_hostname", "fbsource//third-party/rust:hostname"), + ], + }, + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Crate for getting hostname", + }, + }, + }, + named_deps = {} | ({ + "real_hostname": "fbsource//third-party/rust:hostname", + } if rust_oss.is_oss_build() else {}), + deps = [ + "fbsource//third-party/rust:anyhow", + ] + ([] if rust_oss.is_oss_build() else [ + "//common/rust/fbwhoami:fbwhoami", + ]), +) diff --git a/shed/justknobs_stub/BUCK b/shed/justknobs_stub/BUCK new file mode 100644 index 000000000..f484a0e4a --- /dev/null +++ b/shed/justknobs_stub/BUCK @@ -0,0 +1,55 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs:rust_unittest.bzl", "rust_unittest") + +oncall("autocargo") + +rust_library( + name = "justknobs", + srcs = glob(["src/*.rs"]), + autocargo = { + "cargo_toml_config": { + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Client for accessing JustKnobs. Noop crate for now", + }, + }, + }, + named_deps = { + "fb_justknobs": "//justknobs/rust:justknobs", + }, + test_deps = [ + "fbsource//third-party/rust:maplit", + "fbsource//third-party/rust:tokio", + "//common/rust/shed/fbinit:fbinit", + "//common/rust/shed/slog_glog_fmt:slog_glog_fmt", + ], + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:arc-swap", + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:serde", + "fbsource//third-party/rust:serde_json", + "fbsource//third-party/rust:slog", + "fbsource//third-party/rust:tokio", + "//common/rust/shed/cached_config:cached_config", + "//common/rust/shed/justknobs_stub/cached_config_thrift_struct:just_knobs_struct-rust", + ], +) + +rust_unittest( + name = "justknobs_in_unnitest", + srcs = ["tests/justknobs_in_unittest.rs"], + crate_root = "tests/justknobs_in_unittest.rs", + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:maplit", + ":justknobs", + ], +) diff --git a/shed/justknobs_stub/cached_config_thrift_struct/BUCK b/shed/justknobs_stub/cached_config_thrift_struct/BUCK new file mode 100644 index 000000000..3b2249ac5 --- /dev/null +++ b/shed/justknobs_stub/cached_config_thrift_struct/BUCK @@ -0,0 +1,12 @@ +load("@fbcode_macros//build_defs:thrift_library.bzl", "thrift_library") + +oncall("autocargo") + +thrift_library( + name = "just_knobs_struct", + languages = [ + "rust", + ], + thrift_rust_options = "serde", + thrift_srcs = {"just_knobs.thrift": None}, +) diff --git a/shed/lock_ext/BUCK b/shed/lock_ext/BUCK new file mode 100644 index 000000000..d7a16096a --- /dev/null +++ b/shed/lock_ext/BUCK @@ -0,0 +1,16 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "lock_ext", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Extensions to std::sync::Mutex", + }, + }, + }, + deps = ["fbsource//third-party/rust:parking_lot"], +) diff --git a/shed/memcache_stub/BUCK b/shed/memcache_stub/BUCK new file mode 100644 index 000000000..da994af3d --- /dev/null +++ b/shed/memcache_stub/BUCK @@ -0,0 +1,49 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss") + +oncall("autocargo") + +rust_library( + name = "memcache", + srcs = glob(["src/*.rs"]), + autocargo = { + "cargo_toml_config": { + "extra_buck_dependencies": { + "dependencies": [ + ":memcache_common", + ], + }, + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Client for accessing Memcache. Noop crate for now", + }, + }, + }, + compatible_with = [ + "ovr_config//os:linux", + ], + named_deps = { + "fb_memcache": "//common/rust/memcache:memcache", + }, + deps = [] + ([ + ":memcache_common", + ] if rust_oss.is_oss_build() else []), +) + +rust_library( + name = "memcache_common", + srcs = glob(["common/*.rs"]), + autocargo = {"cargo_toml_dir": "common"}, + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:bytes", + "//common/rust/shed/fbinit:fbinit", + ], +) diff --git a/shed/netstring/BUCK b/shed/netstring/BUCK new file mode 100644 index 000000000..6d22d3d8d --- /dev/null +++ b/shed/netstring/BUCK @@ -0,0 +1,22 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "netstring", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Tokio based implementation of netstrings", + }, + }, + }, + test_deps = ["fbsource//third-party/rust:quickcheck"], + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:bytes", + "fbsource//third-party/rust:thiserror", + "fbsource//third-party/rust:tokio-util", + ], +) diff --git a/shed/ods/BUCK b/shed/ods/BUCK new file mode 100644 index 000000000..46ddc51a0 --- /dev/null +++ b/shed/ods/BUCK @@ -0,0 +1,30 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "ods", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Library that points to meta specific ods for fbcode builds and to the stub for non-fbcode builds", + }, + }, + }, + named_deps = { + "fb_ods": "//common/rust/multiplatform/ods:ods", + }, + deps = [ + "fbsource//third-party/rust:anyhow", + "//common/rust/shed/fbinit:fbinit", + ], +) diff --git a/shed/panichandler/BUCK b/shed/panichandler/BUCK new file mode 100644 index 000000000..583f1f395 --- /dev/null +++ b/shed/panichandler/BUCK @@ -0,0 +1,129 @@ +load("@fbcode_macros//build_defs:rust_binary.bzl", "rust_binary") +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs:rust_unittest.bzl", "rust_unittest") + +oncall("autocargo") + +rust_library( + name = "panichandler", + srcs = glob(["src/*.rs"]), + autocargo = { + "cargo_toml_config": { + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Makes it easier to define a handler for panics", + }, + }, + }, + os_deps = [ + ( + "linux", + [ + "fbsource//third-party/rust:libc", + ], + ), + ( + "macos", + [ + "fbsource//third-party/rust:libc", + ], + ), + ], + tests = [ + ":panichandler_tests", + ], + unittests = False, + deps = [ + "fbsource//third-party/rust:backtrace", + ], +) + +rust_binary( + name = "shed_panic_simple", + srcs = [ + "test/shed_panic_simple.rs", + ], + unittests = False, + deps = [ + ":panichandler", + ], +) + +rust_binary( + name = "shed_panic_deep", + srcs = [ + "test/shed_panic_deep.rs", + ], + unittests = False, + deps = [ + ":panichandler", + ], +) + +rust_binary( + name = "shed_panic_multithread", + srcs = [ + "test/shed_panic_multithread.rs", + ], + unittests = False, + deps = [ + ":panichandler", + ], +) + +rust_binary( + name = "shed_panic_multithread_abort", + srcs = [ + "test/shed_panic_multithread_abort.rs", + ], + os_deps = [ + ( + "linux", + [ + "fbsource//third-party/rust:libc", + ], + ), + ( + "macos", + [ + "fbsource//third-party/rust:libc", + ], + ), + ], + unittests = False, + deps = [ + ":panichandler", + ], +) + +rust_unittest( + name = "panichandler_tests", + srcs = [ + "test/testrunner.rs", + ], + # * fbcode_build builds use buck resources to get the binary names. + # * Cargo builds use Cargo to get the binary names. + # * non-fbcode_build builds (aka //mode/dev-rust-oss) can't do either, + # so ignore it. + allow_oss_build = False, + crate_root = "test/testrunner.rs", + resources = { + "shed_panic_deep": "//common/rust/shed/panichandler:shed_panic_deep", + "shed_panic_multithread": "//common/rust/shed/panichandler:shed_panic_multithread", + "shed_panic_multithread_abort": "//common/rust/shed/panichandler:shed_panic_multithread_abort", + "shed_panic_simple": "//common/rust/shed/panichandler:shed_panic_simple", + }, + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:assert_cmd", + "fbsource//third-party/rust:buck-resources", + "fbsource//third-party/rust:predicates", + ], +) diff --git a/shed/perthread/BUCK b/shed/perthread/BUCK new file mode 100644 index 000000000..010228396 --- /dev/null +++ b/shed/perthread/BUCK @@ -0,0 +1,21 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "perthread", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Provides ThreadMap structure for accessing PerThread thread local variables form a static context", + }, + }, + }, + doc_deps = [ + "fbsource//third-party/rust:once_cell", + ], + test_deps = [ + "fbsource//third-party/rust:once_cell", + ], +) diff --git a/shed/quickcheck_arbitrary_derive/BUCK b/shed/quickcheck_arbitrary_derive/BUCK new file mode 100644 index 000000000..78bf4cf43 --- /dev/null +++ b/shed/quickcheck_arbitrary_derive/BUCK @@ -0,0 +1,30 @@ +load("@fbcode_macros//build_defs:rust_binary.bzl", "rust_binary") +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "quickcheck_arbitrary_derive", + srcs = glob([ + "src/**/*.rs", + ]), + doc_deps = [ + "fbsource//third-party/rust:quickcheck", + ], + proc_macro = True, + deps = [ + "fbsource//third-party/rust:proc-macro2", + "fbsource//third-party/rust:quote", + "fbsource//third-party/rust:syn", + ], +) + +rust_binary( + name = "quickcheck_arbitrary_example", + srcs = ["examples/example.rs"], + crate_root = "examples/example.rs", + deps = [ + "fbsource//third-party/rust:quickcheck", + ":quickcheck_arbitrary_derive", + ], +) diff --git a/shed/scuba_sample/BUCK b/shed/scuba_sample/BUCK new file mode 100644 index 000000000..bf96181be --- /dev/null +++ b/shed/scuba_sample/BUCK @@ -0,0 +1,103 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs:rust_unittest.bzl", "rust_unittest") + +oncall("autocargo") + +rust_library( + name = "scuba_sample", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Provides Scuba sample type and sampling", + }, + }, + }, + test_deps = [ + "fbsource//third-party/rust:assert_matches", + "fbsource//third-party/rust:nonzero_ext", + "fbsource//third-party/rust:quickcheck", + "fbsource//third-party/rust:rand_chacha", + ], + deps = [ + "fbsource//third-party/rust:rand", + "fbsource//third-party/rust:serde", + "fbsource//third-party/rust:serde_json", + "fbsource//third-party/rust:thiserror", + ":scuba_sample_derive", + ], +) + +rust_library( + name = "scuba_sample_derive", + srcs = glob(["derive/src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Provides derive(StructuredSample)", + }, + }, + "cargo_toml_dir": "derive/", + }, + proc_macro = True, + unittests = False, + deps = [ + "fbsource//third-party/rust:proc-macro2", + "fbsource//third-party/rust:quote", + "fbsource//third-party/rust:syn", + ], +) + +rust_library( + name = "scuba_sample_builder", + srcs = glob(["builder/src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Helps build scuba samples", + }, + }, + "cargo_toml_dir": "builder/", + }, + deps = [ + "fbsource//third-party/rust:rand", + "fbsource//third-party/rust:serde_json", + ":scuba_sample", + "//common/rust/shed/fbinit:fbinit", + ], +) + +rust_library( + name = "scuba_sample_client", + srcs = glob(["client/src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Provides scuba sample client stub", + }, + }, + "cargo_toml_dir": "client/", + }, + deps = [ + ":scuba_sample", + "//common/rust/shed/fbinit:fbinit", + ], +) + +rust_unittest( + name = "scuba_sample_derive_test", + srcs = glob(["derive_tests/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Tests derive(StructuredSample)", + }, + }, + "cargo_toml_dir": "derive_tests/", + }, + crate_root = "derive_tests/test.rs", + deps = [ + "fbsource//third-party/rust:serde_json", + ":scuba_sample", + ], +) diff --git a/shed/scuba_stub/BUCK b/shed/scuba_stub/BUCK new file mode 100644 index 000000000..ebfc22a15 --- /dev/null +++ b/shed/scuba_stub/BUCK @@ -0,0 +1,39 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss") + +oncall("autocargo") + +rust_library( + name = "scuba", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "extra_buck_dependencies": { + "dependencies": [ + "//common/rust/shed/scuba_sample:scuba_sample", + "//common/rust/shed/scuba_sample:scuba_sample_builder", + "//common/rust/shed/scuba_sample:scuba_sample_client", + ], + }, + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Stub for scuba client", + }, + }, + }, + named_deps = { + "fb_scuba": "//common/rust/scuba:scuba", + }, + deps = [] + ([ + "//common/rust/shed/scuba_sample:scuba_sample", + "//common/rust/shed/scuba_sample:scuba_sample_builder", + "//common/rust/shed/scuba_sample:scuba_sample_client", + ] if rust_oss.is_oss_build() else []), +) diff --git a/shed/secure_utils/BUCK b/shed/secure_utils/BUCK new file mode 100644 index 000000000..cd110941a --- /dev/null +++ b/shed/secure_utils/BUCK @@ -0,0 +1,37 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss") + +oncall("autocargo") + +rust_library( + name = "secure_utils", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Crate with useful security utilities", + }, + }, + }, + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:openssl", + "fbsource//third-party/rust:slog", + ] + ([ + ] if rust_oss.is_oss_build() else [ + # buildifier: keep sorted + "fbsource//third-party/rust:hex", + "fbsource//third-party/rust:libc", + "fbsource//third-party/rust:openssl-sys", + "fbsource//third-party/rust:serde", + "fbsource//third-party/rust:serde_json", + ]), +) diff --git a/shed/services/BUCK b/shed/services/BUCK new file mode 100644 index 000000000..b9bc73452 --- /dev/null +++ b/shed/services/BUCK @@ -0,0 +1,74 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss") + +oncall("autocargo") + +rust_library( + name = "services", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "extra_buck_dependencies": { + "dependencies": [ + ":services_common", + "//common/rust/shed/fbinit:fbinit", + ], + }, + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Stubs for facebook services", + }, + }, + }, + compatible_with = [ + "ovr_config//os:linux", + ], + named_deps = { + "fb_services": "//common/rust/services:services", + }, + deps = [] + ([ + # buildifier: keep sorted + ":services_common", + "//common/rust/shed/fbinit:fbinit", + ] if rust_oss.is_oss_build() else []), +) + +rust_library( + name = "services_common", + srcs = glob(["common/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Common code for stubbed facebook services", + "homepage": "https://github.com/facebookexperimental/rust-shed/", + "readme": "../../README.md", + "repository": "https://github.com/facebookexperimental/rust-shed/", + }, + }, + "cargo_toml_dir": "common", + }, + compatible_with = [ + "ovr_config//os:linux", + ], + deps = [ + "fbsource//third-party/rust:cxx", + "fbsource//third-party/rust:thiserror", + ] + ([] if rust_oss.is_oss_build() else [ + "//common/fb303/if:fb303-rust", + ]), +) diff --git a/shed/shared_error/BUCK b/shed/shared_error/BUCK new file mode 100644 index 000000000..71fcf8688 --- /dev/null +++ b/shed/shared_error/BUCK @@ -0,0 +1,20 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "shared_error", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Provides SharedError wrapper for cloneable Error", + }, + }, + }, + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:slog", + "fbsource//third-party/rust:thiserror", + ], +) diff --git a/shed/slog_glog_fmt/BUCK b/shed/slog_glog_fmt/BUCK new file mode 100644 index 000000000..13a460a04 --- /dev/null +++ b/shed/slog_glog_fmt/BUCK @@ -0,0 +1,88 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:rust_binary.bzl", "rust_binary") +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbsource//tools/build_defs:cram_test.bzl", "cram_test") + +oncall("autocargo") + +rust_library( + name = "slog_glog_fmt", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "slog Drain for glog-formatted logs", + }, + }, + }, + os_deps = [ + ( + "linux", + [ + "fbsource//third-party/rust:nix", + ], + ), + ( + "macos", + [ + "fbsource//third-party/rust:nix", + ], + ), + ], + test_deps = [ + "fbsource//third-party/rust:once_cell", + "fbsource//third-party/rust:rand", + "fbsource//third-party/rust:regex", + "fbsource//third-party/rust:thiserror", + ], + tests = [ + ":rust-slog-glog-comparison", + ], + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:chrono", + "fbsource//third-party/rust:hostname", + "fbsource//third-party/rust:itertools", + "fbsource//third-party/rust:slog", + "fbsource//third-party/rust:slog-term", + "//common/rust/shed/failure_ext:failure_ext", + ], +) + +rust_binary( + name = "slog_glog_fmt_example", + srcs = glob(["example/**/*.rs"]), + crate = "slog_glog_fmt_example", + deps = [ + "fbsource//third-party/rust:slog", + ":slog_glog_fmt", + ], +) + +cpp_binary( + name = "rust_slog_glog_cmp_cpp", + srcs = ["facebook/RustSlogGlogCmp.cpp"], + deps = ["//common/init:light"], + external_deps = ["glog"], +) + +rust_binary( + name = "rust_slog_glog_cmp_rust", + srcs = ["facebook/rust_slog_glog_cmp.rs"], + autocargo = {"ignore_rule": True}, + crate_root = "facebook/rust_slog_glog_cmp.rs", + deps = [ + "fbsource//third-party/rust:slog", + "//common/rust/shed/slog_glog_fmt:slog_glog_fmt", + ], +) + +# buck run :rust-slog-glog-comparison-cram -- test-rust-slog-glog-comparison.t -iy +cram_test( + name = "rust-slog-glog-comparison", + srcs = ["facebook/test-rust-slog-glog-comparison.t"], + env = { + "RUST_SLOG_GLOG_CMP_CPP": "$(location :rust_slog_glog_cmp_cpp)", + "RUST_SLOG_GLOG_CMP_RUST": "$(location :rust_slog_glog_cmp_rust)", + }, +) diff --git a/shed/slog_stats/BUCK b/shed/slog_stats/BUCK new file mode 100644 index 000000000..fa6fbe2a4 --- /dev/null +++ b/shed/slog_stats/BUCK @@ -0,0 +1,19 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "slog_stats", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Enables exposing counters for number of slog records per level", + }, + }, + }, + deps = [ + "fbsource//third-party/rust:slog", + "//common/rust/shed/stats:stats", + ], +) diff --git a/shed/sorted_vector_map/BUCK b/shed/sorted_vector_map/BUCK new file mode 100644 index 000000000..cfb72eebc --- /dev/null +++ b/shed/sorted_vector_map/BUCK @@ -0,0 +1,50 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "sorted_vector_map", + srcs = glob([ + "src/**/*.rs", + "benches/**/*.rs", + "README.*", + ]), + autocargo = { + "cargo_toml_config": { + "bench": [ + { + "harness": False, + "name": "map", + }, + { + "harness": False, + "name": "set", + }, + ], + "dependencies_override": {"dev-dependencies": {"sapling-minibench": {"version": None}}}, + "extra_buck_dependencies": { + "dev-dependencies": [ + "//eden/scm/lib/minibench:minibench", + ], + }, + "package": { + "authors": [ + "Facebook ", + ], + "categories": ["data-structures"], + "description": "maps and sets backed by sorted vectors", + "keywords": [ + "map", + "set", + ], + "readme": "README.md", + "repository": "https://github.com/facebookexperimental/rust-shed", + "version": "0.2.0", + }, + }, + }, + deps = [ + "fbsource//third-party/rust:itertools", + "fbsource//third-party/rust:quickcheck", + ], +) diff --git a/shed/sql/BUCK b/shed/sql/BUCK new file mode 100644 index 000000000..8a3307a3b --- /dev/null +++ b/shed/sql/BUCK @@ -0,0 +1,217 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") +load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss") + +oncall("autocargo") + +rust_library( + name = "sql", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "extra_buck_dependencies": { + "dependencies": [ + "fbsource//third-party/rust:mysql_common", + ], + }, + "features": { + "default": [ + "mysql_common/chrono", + "mysql_common/default", + ], + }, + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Crate for accessing sql databases", + }, + }, + }, + compatible_with = [ + "ovr_config//os:linux", + ], + doctests = False, # FIXME + test_deps = [ + "fbsource//third-party/rust:tokio", + ":sql_tests_lib", + "//common/rust/mysql:mysql_client", + ] + ([] if rust_oss.is_oss_build() else [ + # buildifier: keep sorted + "//common/rust/shed/fbinit:fbinit", + "//common/rust/shed/fbinit:fbinit-tokio", + ]), + test_labels = [ + "exclude_from_coverage", + ], + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:frunk", + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:futures-util", + "fbsource//third-party/rust:mysql_async", + "fbsource//third-party/rust:rusqlite", + ":sql_common", + "//common/rust/shed/cloned:cloned", + "//common/rust/shed/futures_ext:futures_ext", + ], +) + +rust_library( + name = "sql_common", + srcs = glob(["common/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "extra_buck_dependencies": { + "dependencies": [ + "fbsource//third-party/rust:thiserror", + ], + "dev-dependencies": [ + ":sql", # Used in docs + ":sql_tests_lib", # Used in docs + ], + }, + "features": { + "default": ["rusqlite/bundled"], + }, + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Common definitions for sql crate", + "readme": "../../../README.md", + }, + }, + "cargo_toml_dir": "common", + }, + compatible_with = [ + "ovr_config//os:linux", + ], + doctests = False, # FIXME + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:async-trait", + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:itertools", + "fbsource//third-party/rust:mysql_async", + "fbsource//third-party/rust:rusqlite", + "fbsource//third-party/rust:vec1", + ":mysql_client_traits", + ":mysql_derive", + "//common/rust/mysql:mysql_client", + "//common/rust/shed/futures_stats:futures_stats", + "//common/rust/shed/stats:stats", + "//common/rust/shed/time_ext:time_ext", + ] + ([ + "fbsource//third-party/rust:thiserror", + ] if rust_oss.is_oss_build() else [ + # buildifier: keep sorted + "fbsource//third-party/rust:tokio", + "//common/rust/shed/cloned:cloned", + ]), +) + +rust_library( + name = "mysql_derive", + srcs = glob(["derive/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "proc macro for sql_common::mysql", + "readme": "../../../README.md", + }, + }, + "cargo_toml_dir": "derive", + }, + crate_root = "derive/lib.rs", + proc_macro = True, + deps = [ + "fbsource//third-party/rust:quote", + "fbsource//third-party/rust:syn", + ], +) + +rust_library( + name = "mysql_client_traits", + srcs = glob(["mysql_client_traits/*.rs"]), + autocargo = {"cargo_toml_dir": "mysql_client_traits"}, + crate_root = "mysql_client_traits/lib.rs", + deps = [ + "fbsource//third-party/rust:chrono", + "fbsource//third-party/rust:mysql_common", + "fbsource//third-party/rust:seq-macro", + "fbsource//third-party/rust:thiserror", + ], +) + +rust_library( + name = "sql_facebook", + srcs = glob(["facebook/src/**/*.rs"]), + allow_oss_build = False, + autocargo = {"ignore_rule": True}, + compatible_with = [ + "ovr_config//os:linux", + ], + test_deps = [ + "fbsource//third-party/rust:rand", + ":sql_tests_lib", + "//common/rust/shed/fbinit:fbinit-tokio", + ], + deps = [ + "fbsource//third-party/rust:anyhow", + ":db-bridge", + ":sql_common", + "//common/rust/mysql:mysql_client", + "//common/rust/shed/fbinit:fbinit", + ], +) + +rust_library( + name = "sql_tests_lib", + srcs = glob(["tests_lib/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Test library for sql crate", + "readme": "../../../README.md", + }, + }, + "cargo_toml_dir": "tests_lib", + }, + compatible_with = [ + "ovr_config//os:linux", + ], + deps = [ + "fbsource//third-party/rust:chrono", + "fbsource//third-party/rust:rand", + ":sql", + ], +) + +rust_library( + name = "db-bridge", + srcs = ["facebook/sys/db.rs"], + allow_oss_build = False, + autocargo = {"ignore_rule": True}, + compatible_with = [ + "ovr_config//os:linux", + ], + crate_root = "facebook/sys/db.rs", + named_deps = { + "mysql_client": "//common/db/lang:client-rs_bindings", + "mysql_test_db": "//common/db/lang:test_db-rs_bindings", + "mysql_types": "//common/db/lang:db-rust", + }, + deps = [ + "fbsource//third-party/rust:anyhow", + ], +) diff --git a/shed/stats/BUCK b/shed/stats/BUCK new file mode 100644 index 000000000..964b6f197 --- /dev/null +++ b/shed/stats/BUCK @@ -0,0 +1,58 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "stats", + srcs = glob([ + "src/**/*.rs", + ]), + autocargo = { + "cargo_toml_config": { + "lints": { + "rust": { + "unexpected_cfgs": { + "check-cfg": ["cfg(fbcode_build)"], + "level": "warn", + }, + }, + }, + "package": { + "description": "Stats library", + }, + }, + }, + deps = [ + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:once_cell", + "fbsource//third-party/rust:tokio", + "fbsource//third-party/rust:tokio-stream", + ":stats_traits", + "//common/rust/shed/fbinit:fbinit", + "//common/rust/shed/perthread:perthread", + "//common/rust/shed/stats/facebook:stats_facebook", + ], +) + +rust_library( + name = "stats_traits", + srcs = glob([ + "traits/**/*.rs", + ]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Traits for stats crate", + "homepage": "https://github.com/facebookexperimental/rust-shed/", + "readme": "../../README.md", + "repository": "https://github.com/facebookexperimental/rust-shed/", + }, + }, + "cargo_toml_dir": "traits", + }, + deps = [ + "fbsource//third-party/rust:auto_impl", + "fbsource//third-party/rust:dashmap", + "//common/rust/shed/fbinit:fbinit", + ], +) diff --git a/shed/thrift_compiler/BUCK b/shed/thrift_compiler/BUCK new file mode 100644 index 000000000..2ca1164ef --- /dev/null +++ b/shed/thrift_compiler/BUCK @@ -0,0 +1,35 @@ +load("@fbcode_macros//build_defs:rust_binary.bzl", "rust_binary") +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_binary( + name = "compiler", + srcs = ["src/main.rs"], + crate_root = "src/main.rs", + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:clap", + ":lib", + ], +) + +rust_library( + name = "lib", + srcs = ["src/lib.rs"], + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Calls fbthrift compiler to produce unified lib.rs from thrift files", + }, + }, + }, + crate = "thrift_compiler", + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:clap", + "fbsource//third-party/rust:dunce", + "fbsource//third-party/rust:serde", + "fbsource//third-party/rust:which", + ], +) diff --git a/shed/time_ext/BUCK b/shed/time_ext/BUCK new file mode 100644 index 000000000..7f1ae6c2a --- /dev/null +++ b/shed/time_ext/BUCK @@ -0,0 +1,20 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "time_ext", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "package": { + "description": "Crate exxtending functionality of std::time", + }, + }, + }, + test_deps = ["fbsource//third-party/rust:quickcheck"], + deps = [ + "fbsource//third-party/rust:anyhow", + "fbsource//third-party/rust:thiserror", + ], +) diff --git a/shed/tokio-detectors/BUCK b/shed/tokio-detectors/BUCK new file mode 100644 index 000000000..47bd60f5b --- /dev/null +++ b/shed/tokio-detectors/BUCK @@ -0,0 +1,41 @@ +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "tokio-detectors", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "example": [ + { + "name": "server", + "path": "examples/server.rs", + }, + ], + "package": { + "description": "Provides utility for detection of blocked tokio runtimes.", + "name": "tokio-detectors", + }, + }, + }, + crate = "tokio-detectors", + os_deps = [ + ( + "linux", + [ + "fbsource//third-party/rust:libc", + ], + ), + ( + "macos", + [ + "fbsource//third-party/rust:libc", + ], + ), + ], + deps = [ + "fbsource//third-party/rust:rand", + "fbsource//third-party/rust:tokio", + ], +) diff --git a/shed/tokio-uds-compat/BUCK b/shed/tokio-uds-compat/BUCK new file mode 100644 index 000000000..2bec8ff26 --- /dev/null +++ b/shed/tokio-uds-compat/BUCK @@ -0,0 +1,57 @@ +load("@fbcode_macros//build_defs:rust_binary.bzl", "rust_binary") +load("@fbcode_macros//build_defs:rust_library.bzl", "rust_library") + +oncall("autocargo") + +rust_library( + name = "tokio-uds-compat", + srcs = glob(["src/**/*.rs"]), + autocargo = { + "cargo_toml_config": { + "example": [ + { + "name": "server", + "path": "examples/server.rs", + }, + ], + "extra_buck_dependencies": { + "dev-dependencies": [ + "fbsource//third-party/rust:futures", + ], + }, + "package": { + "description": "Provides a compatibile layer for using UNIX domain socket on UNIX-like systems and Windows with tokio", + "name": "tokio-uds-compat", + }, + }, + }, + crate = "tokio-uds-compat", + os_deps = [ + ( + "windows", + [ + "fbsource//third-party/rust:async-io", + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:uds_windows", + "fbsource//third-party/rust:tracing", + ], + ), + ], + deps = [ + "fbsource//third-party/rust:tokio", + ], +) + +rust_binary( + name = "example_server", + srcs = ["examples/server.rs"], + autocargo = { + "ignore_rule": True, + }, + crate_root = "examples/server.rs", + deps = [ + "fbsource//third-party/rust:futures", + "fbsource//third-party/rust:tokio", + ":tokio-uds-compat", + ], +)