diff --git a/buck2 b/buck2 new file mode 100755 index 00000000000..123c0ac4f13 --- /dev/null +++ b/buck2 @@ -0,0 +1,67 @@ +#!/usr/bin/env dotslash + +{ + "name": "buck2", + "platforms": { + "macos-aarch64": { + "size": 23110012, + "hash": "blake3", + "digest": "2e534798cfa67c02357b9edc410ea0b65984af42aecab22f077f8b8b69b635ed", + "format": "zst", + "path": "buck2-aarch64-apple-darwin", + "providers": [ + { + "url": "https://github.com/facebook/buck2/releases/download/2024-04-15/buck2-aarch64-apple-darwin.zst" + } + ] + }, + "linux-aarch64": { + "size": 25625575, + "hash": "blake3", + "digest": "9b87f3af61a3aeaa78051c780c7c2ed5a19d5bffdabd2386a7a5925af3da9069", + "format": "zst", + "path": "buck2-aarch64-unknown-linux-musl", + "providers": [ + { + "url": "https://github.com/facebook/buck2/releases/download/2024-04-15/buck2-aarch64-unknown-linux-musl.zst" + } + ] + }, + "macos-x86_64": { + "size": 25044637, + "hash": "blake3", + "digest": "aaf132b70d317c7e3e8573de5f73783c8325a96badd539805bf56dcaf0e0a285", + "format": "zst", + "path": "buck2-x86_64-apple-darwin", + "providers": [ + { + "url": "https://github.com/facebook/buck2/releases/download/2024-04-15/buck2-x86_64-apple-darwin.zst" + } + ] + }, + "windows-x86_64": { + "size": 20557271, + "hash": "blake3", + "digest": "a750d714cedca0369f62ae3e6c6cd3bf6d8c65f2f79d53f5dce10e27fcc1c9a5", + "format": "zst", + "path": "buck2-x86_64-pc-windows-msvc.exe", + "providers": [ + { + "url": "https://github.com/facebook/buck2/releases/download/2024-04-15/buck2-x86_64-pc-windows-msvc.exe.zst" + } + ] + }, + "linux-x86_64": { + "size": 26368190, + "hash": "blake3", + "digest": "486cb1458f356863331cdeacb2491afb60e3d78e4fda33adb4112dfca7dc63dd", + "format": "zst", + "path": "buck2-x86_64-unknown-linux-musl", + "providers": [ + { + "url": "https://github.com/facebook/buck2/releases/download/2024-04-15/buck2-x86_64-unknown-linux-musl.zst" + } + ] + } + } +} diff --git a/folly/BUCK b/folly/BUCK new file mode 100644 index 00000000000..32b2db69415 --- /dev/null +++ b/folly/BUCK @@ -0,0 +1,1553 @@ +###################################################################### +# Libraries + +load("@fbcode_macros//build_defs:auto_headers.bzl", "AutoHeaders") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "concurrent_bit_set", + headers = ["ConcurrentBitSet.h"], + exported_deps = [":portability"], +) + +cpp_library( + name = "atomic_hash_array", + headers = [ + "AtomicHashArray.h", + "AtomicHashArray-inl.h", + ], + exported_deps = [ + ":thread_cached_int", + ":utility", + "//folly/detail:atomic_hash_utils", + "//folly/detail:iterators", + "//folly/hash:hash", + "//folly/lang:bits", + "//folly/lang:exception", + ], +) + +cpp_library( + name = "atomic_hash_map", + headers = [ + "AtomicHashMap.h", + "AtomicHashMap-inl.h", + ], + exported_deps = [ + ":atomic_hash_array", + ":c_portability", + ":likely", + ":thread_cached_int", + "//folly/container:foreach", + "//folly/detail:atomic_hash_utils", + "//folly/detail:iterators", + "//folly/hash:hash", + ], +) + +cpp_library( + name = "atomic_linked_list", + headers = [ + "AtomicIntrusiveLinkedList.h", + "AtomicLinkedList.h", + ], + exported_deps = [":memory"], +) + +cpp_library( + name = "atomic_unordered_map", + headers = ["AtomicUnorderedMap.h"], + exported_deps = [ + ":conv", + ":likely", + ":random", + ":scope_guard", + ":traits", + "//folly/detail:atomic_unordered_map_utils", + "//folly/lang:bits", + "//folly/portability:sys_mman", + "//folly/portability:unistd", + ], +) + +cpp_library( + name = "base64", + headers = ["base64.h"], + exported_deps = [ + ":c_portability", + ":portability", + "//folly/detail/base64_detail:base64_api", + "//folly/detail/base64_detail:base64_common", + "//folly/lang:exception", + "//folly/memory:uninitialized_memory_hacks", + ], +) + +cpp_library( + name = "benchmark_util", + headers = [ + "BenchmarkUtil.h", + ], + exported_deps = [ + ":portability", + "//folly/lang:hint", + ], +) + +cpp_library( + name = "benchmark", + srcs = ["Benchmark.cpp"], + headers = ["Benchmark.h"], + deps = [ + ":file_util", + ":map_util", + ":string", + "//folly/detail:perf_scoped", + "//folly/json:dynamic", + ], + exported_deps = [ + ":benchmark_util", + ":portability", + ":preprocessor", + ":range", + ":scope_guard", + ":traits", + "//folly/functional:invoke", + "//folly/lang:hint", + "//folly/portability:gflags", + ], + external_deps = [ + ("boost", None, "boost_regex"), + ], + exported_external_deps = [ + "boost", + "glog", + ], +) + +cpp_library( + # @shim + name = "bits", + headers = ["Bits.h"], + exported_deps = ["//folly/lang:bits"], +) + +cpp_library( + name = "c_portability", + headers = ["CPortability.h"], + exported_deps = [ + "//folly/portability:config", + ], +) + +cpp_library( + name = "cancellation_token", + srcs = ["CancellationToken.cpp"], + headers = [ + "CancellationToken.h", + "CancellationToken-inl.h", + ], + deps = [ + ":optional", + "//folly/synchronization/detail:sleeper", + ], + exported_deps = [ + ":cpp_attributes", + ":function", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "chrono", + headers = ["Chrono.h"], + exported_deps = [ + ":portability", + "//folly/lang:exception", + "//folly/portability:time", + ], +) + +cpp_library( + name = "clock_gettime_wrappers", + srcs = ["ClockGettimeWrappers.cpp"], + headers = ["ClockGettimeWrappers.h"], + deps = [ + ":c_portability", + ":likely", + ], + exported_deps = [ + "//folly/portability:time", + ], + external_deps = [ + ("glibc", None, "dl"), + ], + exported_external_deps = [ + ("glibc", None, "rt"), + ], +) + +cpp_library( + name = "concurrent_lazy", + headers = ["ConcurrentLazy.h"], + exported_deps = [ + "//folly/functional:invoke", + "//folly/synchronization:delayed_init", + ], +) + +cpp_library( + name = "concurrent_skip_list", + headers = [ + "ConcurrentSkipList.h", + "ConcurrentSkipList-inl.h", + ], + exported_deps = [ + ":constexpr_math", + ":likely", + ":memory", + ":thread_local", + "//folly/detail:iterators", + "//folly/synchronization:micro_spin_lock", + ], + exported_external_deps = [ + "glog", + ("boost", None, "boost_random"), + ], +) + +cpp_library( + name = "config", + headers = ["folly-config.h"], + os_deps = [( + "linux", + select({ + "DEFAULT": [], + "ovr_config//runtime:fbcode": ["fbsource//third-party/liburing:uring"], + }), + )], + exported_external_deps = [ + ("glibc", None, "rt"), + ], +) + +cpp_library( + name = "constexpr_math", + headers = ["ConstexprMath.h"], + exported_deps = [ + ":portability", + "//folly/lang:checked_math", + "//folly/portability:constexpr", + ], +) + +cpp_library( + name = "constructor_callback_list", + headers = [ + "ConstructorCallbackList.h", + ], + exported_deps = [ + ":format", + ":function", + ":shared_mutex", + "//folly/detail:static_singleton_manager", + ], +) + +cpp_library( + name = "conv", + srcs = ["Conv.cpp"], + headers = ["Conv.h"], + undefined_symbols = True, # TODO(T23121628): fix deps and remove + deps = [ + "//folly/lang:safe_assert", + ], + exported_deps = [ + ":c_portability", + ":demangle", + ":expected", + ":fbstring", + ":likely", + ":portability", + ":range", + ":traits", + ":unit", + ":utility", + "//folly/lang:exception", + "//folly/lang:pretty", + "//folly/lang:to_ascii", + "//folly/portability:math", + ], + exported_external_deps = [ + "double_conversion", + ], +) + +cpp_library( + name = "cpp_attributes", + headers = ["CppAttributes.h"], + exported_deps = [":portability"], +) + +cpp_library( + name = "cpu_id", + headers = ["CpuId.h"], + exported_deps = [":portability"], +) + +cpp_library( + name = "default_keep_alive_executor", + headers = [ + "DefaultKeepAliveExecutor.h", + ], + exported_deps = [ + ":executor", + "//folly/executors:sequenced_executor", + "//folly/synchronization:baton", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "demangle", + srcs = ["Demangle.cpp"], + headers = ["Demangle.h"], + os_deps = [( + "linux", + ["third-party//binutils:iberty"], + )], + deps = [ + ":cpp_attributes", + "//folly/functional:invoke", + "//folly/lang:c_string", + ], + exported_deps = [ + ":fbstring", + "//folly/portability:config", + ], +) + +cpp_library( + name = "discriminated_ptr", + headers = ["DiscriminatedPtr.h"], + exported_deps = [ + ":likely", + ":portability", + "//folly/detail:discriminated_ptr_detail", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "dynamic", + headers = [ + "DynamicConverter.h", + "dynamic.h", + "dynamic-inl.h", + "json.h", + ], + exported_deps = [ + "//folly/json:dynamic", + ], +) + +cpp_library( + name = "exception", + headers = ["Exception.h"], + exported_deps = [ + ":conv", + ":fbstring", + ":likely", + ":portability", + "//folly/portability:sys_types", + ], +) + +cpp_library( + name = "exception_string", + srcs = ["ExceptionString.cpp"], + headers = ["ExceptionString.h"], + deps = [ + ":demangle", + "//folly/lang:exception", + "//folly/lang:type_info", + ], + exported_deps = [ + ":fbstring", + ], +) + +cpp_library( + name = "exception_wrapper", + srcs = ["ExceptionWrapper.cpp"], + headers = [ + "ExceptionWrapper.h", + "ExceptionWrapper-inl.h", + ], + undefined_symbols = True, # TODO(T23121628): fix deps and remove + deps = [ + ":glog", + ], + exported_deps = [ + ":c_portability", + ":cpp_attributes", + ":demangle", + ":exception_string", + ":fbstring", + ":portability", + ":traits", + ":utility", + "//folly/functional:traits", + "//folly/lang:assume", + "//folly/lang:exception", + ], +) + +cpp_library( + name = "executor", + srcs = ["Executor.cpp"], + headers = [ + "Executor.h", + ], + deps = [ + ":exception_string", + ":portability", + ], + exported_deps = [ + ":function", + ":optional", + ":range", + ":utility", + "//folly/lang:exception", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "expected", + headers = ["Expected.h"], + exported_deps = [ + ":c_portability", + ":cpp_attributes", + ":likely", + ":portability", + ":preprocessor", + ":traits", + ":unit", + ":utility", + "//folly/experimental/coro:coroutine", + "//folly/lang:exception", + "//folly/lang:hint", + ], +) + +cpp_library( + name = "fbstring", + headers = ["FBString.h"], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + ":c_portability", + ":cpp_attributes", + ":likely", + ":portability", + ":traits", + "//folly/hash:hash", + "//folly/lang:assume", + "//folly/lang:checked_math", + "//folly/lang:exception", + "//folly/memory:malloc", + ], +) + +cpp_library( + name = "fbvector", + headers = ["FBVector.h"], + exported_deps = [ + ":format_traits", + ":likely", + ":scope_guard", + ":traits", + "//folly/lang:checked_math", + "//folly/lang:exception", + "//folly/lang:hint", + "//folly/memory:malloc", + ], +) + +cpp_library( + name = "file", + srcs = ["File.cpp"], + headers = ["File.h"], + deps = [ + ":exception", + ":file_util", + ":scope_guard", + "//folly/portability:fmt_compile", + "//folly/portability:sys_file", + ], + exported_deps = [ + ":exception_wrapper", + ":expected", + ":file_util", # @manual + ":portability", + ":range", + "//folly/portability:fcntl", + "//folly/portability:unistd", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "file_util", + srcs = ["FileUtil.cpp"], + headers = ["FileUtil.h"], + deps = [ + "//folly/detail:file_util_detail", + "//folly/detail:file_util_vector_detail", + "//folly/net:net_ops", + "//folly/portability:sockets", + "//folly/portability:stdlib", + "//folly/portability:sys_file", + "//folly/portability:sys_stat", + ], + exported_deps = [ + ":portability", + ":range", + ":scope_guard", + "//folly/net:network_socket", + "//folly/portability:fcntl", + "//folly/portability:sys_uio", + "//folly/portability:unistd", + ], +) + +cpp_library( + name = "fingerprint", + srcs = ["Fingerprint.cpp"], + headers = ["Fingerprint.h"], + deps = [ + ":portability", + ":utility", + "//folly/detail:fingerprint_polynomial", + ], + exported_deps = [ + ":range", + ], +) + +cpp_library( + name = "fixed_string", + headers = ["FixedString.h"], + exported_deps = [ + ":constexpr_math", + ":portability", + ":range", + ":utility", + "//folly/lang:exception", + "//folly/lang:ordering", + "//folly/portability:constexpr", + ], +) + +cpp_library( + name = "format", + srcs = [ + "Format.cpp", + ], + headers = [ + "Format.h", + "Format-inl.h", + "FormatArg.h", + ], + deps = [ + ":constexpr_math", + ":cpp_attributes", + "//folly/container:array", + ], + exported_deps = [ + ":c_portability", + ":conv", + ":exception", + ":format_traits", + ":likely", + ":map_util", + ":portability", + ":range", + ":string", + ":traits", + "//folly/lang:exception", + "//folly/lang:to_ascii", + "//folly/portability:windows", + ], + external_deps = [ + "double_conversion", + ], +) + +cpp_library( + name = "format_traits", + headers = ["FormatTraits.h"], +) + +cpp_library( + name = "function", + headers = ["Function.h"], + exported_deps = [ + ":cpp_attributes", + ":portability", + ":traits", + "//folly/functional:invoke", + "//folly/lang:align", + "//folly/lang:exception", + "//folly/lang:new", + ], +) + +cpp_library( + name = "group_varint", + srcs = [ + "GroupVarint.cpp", + ], + headers = ["GroupVarint.h"], + deps = [ + "//folly/container:array", + ], + exported_deps = [ + ":portability", + ":range", + "//folly/detail:group_varint_detail", + "//folly/lang:bits", + "//folly/portability:builtins", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "hash", + headers = ["Hash.h"], + exported_deps = [ + "//folly/hash:hash", + ], +) + +cpp_library( + name = "indestructible", + headers = ["Indestructible.h"], + exported_deps = [ + ":traits", + ":utility", + ], +) + +cpp_library( + name = "indexed_mem_pool", + headers = ["IndexedMemPool.h"], + exported_deps = [ + ":portability", + "//folly/concurrency:cache_locality", + "//folly/portability:sys_mman", + "//folly/portability:unistd", + "//folly/synchronization:atomic_struct", + ], +) + +cpp_library( + name = "intrusive_list", + headers = ["IntrusiveList.h"], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "json", + exported_deps = [ + ":dynamic", + ], +) + +cpp_library( + name = "json_pointer", + headers = [ + "json_pointer.h", + ], + exported_deps = [ + "//folly/json:json_pointer", + ], +) + +cpp_library( + name = "json_patch", + headers = [ + "json_patch.h", + ], + exported_deps = [ + "//folly/json:json_patch", + ], +) + +cpp_library( + name = "lazy", + headers = ["Lazy.h"], + exported_deps = [ + ":optional", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "likely", + headers = ["Likely.h"], + exported_deps = [ + "//folly/lang:builtin", + ], +) + +cpp_library( + name = "glog", + headers = ["GLog.h"], + exported_deps = [ + ":likely", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "map_util", + headers = ["MapUtil.h"], + exported_deps = [ + ":conv", + ":optional", + ":range", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "math", + headers = ["Math.h"], +) + +cpp_library( + name = "memset-impl", + srcs = [ + "FollyMemset.cpp", + "memset.S", + ], + auto_headers = AutoHeaders.NONE, + headers = [], + arch_preprocessor_flags = { + "x86_64": [ + "-mavx2", + ], + }, + modular_headers = False, +) + +# This exports the symbol __folly_memset to C++ via a header. +cpp_library( + name = "memset", + headers = ["FollyMemset.h"], + exported_deps = [ + ":memset-impl", # @manual + ], +) + +# This overrides the libc memset with __folly_memset. +cpp_library( + name = "memset-use", + srcs = [ + "FollyMemset.cpp", + "memset.S", + ], + auto_headers = AutoHeaders.NONE, + headers = [], + arch_preprocessor_flags = { + "x86_64": [ + "-DFOLLY_MEMSET_IS_MEMSET", + "-mavx2", + ], + }, + modular_headers = False, +) + +# This adds the symbol __folly_memcpy but does not replace the default memcpy. +cpp_library( + name = "memcpy-impl", + srcs = [ + "FollyMemcpy.cpp", + "memcpy.S", + ], + auto_headers = AutoHeaders.NONE, + headers = [], + arch_preprocessor_flags = { + "x86_64": [ + "-mavx2", + ], + }, + modular_headers = False, +) + +# This exports the symbol __folly_memcpy to C++ via a header. +cpp_library( + name = "memcpy", + headers = ["FollyMemcpy.h"], + exported_deps = [ + ":memcpy-impl", # @manual + ], +) + +# This overrides the libc memcpy with __folly_memcpy. +cpp_library( + name = "memcpy-use", + srcs = [ + "FollyMemcpy.cpp", + "memcpy.S", + ], + auto_headers = AutoHeaders.NONE, + headers = [], + arch_preprocessor_flags = { + "x86_64": [ + "-DFOLLY_MEMCPY_IS_MEMCPY", + "-mavx2", + "-march=haswell", + ], + }, + modular_headers = False, +) + +cpp_library( + name = "memory", + headers = ["Memory.h"], + exported_deps = [ + ":constexpr_math", + ":likely", + ":portability", + ":traits", + ":utility", + "//folly/functional:invoke", + "//folly/lang:align", + "//folly/lang:exception", + "//folly/lang:thunk", + "//folly/memory:malloc", + "//folly/portability:config", + "//folly/portability:malloc", + ], +) + +cpp_library( + name = "micro_lock", + srcs = ["MicroLock.cpp"], + headers = ["MicroLock.h"], + deps = [ + "//folly/portability:asm", + ], + exported_deps = [ + ":optional", + ":portability", + "//folly/detail:futex", + ], +) + +cpp_library( + # @shim + name = "micro_spin_lock", + headers = ["MicroSpinLock.h"], + exported_deps = ["//folly/synchronization:micro_spin_lock"], +) + +cpp_library( + name = "move_wrapper", + headers = ["MoveWrapper.h"], +) + +cpp_library( + name = "mpmc_pipeline", + headers = ["MPMCPipeline.h"], + exported_deps = [ + ":portability", + "//folly/detail:mpmc_pipeline_detail", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "mpmc_queue", + headers = ["MPMCQueue.h"], + exported_deps = [ + ":traits", + "//folly/concurrency:cache_locality", + "//folly/detail:turn_sequencer", + "//folly/portability:unistd", + ], +) + +cpp_library( + name = "network_address", + srcs = [ + "IPAddress.cpp", + "IPAddressV4.cpp", + "IPAddressV6.cpp", + "MacAddress.cpp", + "SocketAddress.cpp", + ], + headers = [ + "IPAddress.h", + "IPAddressException.h", + "IPAddressV4.h", + "IPAddressV6.h", + "MacAddress.h", + "SocketAddress.h", + ], + deps = [ + "fbsource//third-party/fmt:fmt", + ":exception", + ":format", + ":scope_guard", + ":small_vector", + ":string", + "//folly/detail:ip_address_source", + "//folly/net:net_ops", + ], + exported_deps = [ + ":c_portability", + ":constexpr_math", + ":conv", + ":expected", + ":fbstring", + ":optional", + ":portability", + ":range", + ":unit", + "//folly/detail:ip_address", + "//folly/hash:hash", + "//folly/lang:bits", + "//folly/lang:exception", + "//folly/net:network_socket", + "//folly/portability:sockets", + ], + external_deps = [ + "boost", + ], +) + +cpp_library( + name = "observer_container", + headers = [ + "ObserverContainer.h", + ], + exported_deps = [ + ":constructor_callback_list", + ":function", + ":optional", + ":scope_guard", + ":small_vector", + "//folly/io/async:destructor_check", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "optional", + headers = ["Optional.h"], + exported_deps = [ + ":portability", + ":traits", + ":utility", + "//folly/experimental/coro:coroutine", + "//folly/lang:exception", + ], +) + +cpp_library( + name = "replaceable", + headers = [ + "Replaceable.h", + ], + exported_deps = [ + ":portability", + ":traits", + ":utility", + ], +) + +cpp_library( + name = "overload", + headers = ["Overload.h"], + exported_deps = [ + ":portability", + ":traits", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "packed_sync_ptr", + headers = ["PackedSyncPtr.h"], + exported_deps = [ + ":portability", + "//folly/synchronization:small_locks", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "padded", + headers = ["Padded.h"], + exported_deps = [ + ":portability", + ":traits", + "//folly/functional:invoke", + "//folly/portability:sys_types", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "portability", + headers = ["Portability.h"], + exported_deps = [ + ":c_portability", + "//folly/portability:config", + ], +) + +cpp_library( + name = "preprocessor", + headers = ["Preprocessor.h"], + exported_deps = [ + ":c_portability", + ], +) + +cpp_library( + name = "poly", + headers = [ + "Poly.h", + "Poly-inl.h", + ], + exported_deps = [ + ":c_portability", + ":cpp_attributes", + ":poly_exception", + ":traits", + "//folly/detail:poly_detail", + "//folly/detail:typelist", + "//folly/lang:assume", + ], +) + +cpp_library( + name = "poly_exception", + headers = ["PolyException.h"], + exported_deps = [ + "//folly:c_portability", + ], +) + +cpp_library( + name = "producer_consumer_queue", + headers = ["ProducerConsumerQueue.h"], + exported_deps = [ + "//folly/concurrency:cache_locality", + ], +) + +cpp_library( + name = "random", + srcs = [ + "Random.cpp", + ], + headers = [ + "Random.h", + "Random-inl.h", + ], + os_deps = [( + "windows", + [ + "fbsource//third-party/toolchains/win:advapi32.lib", + ], + )], + deps = [ + ":cpp_attributes", + ":singleton_thread_local", + ":thread_local", + "//folly/detail:file_util_detail", + "//folly/portability:config", + "//folly/portability:sys_time", + "//folly/portability:unistd", + "//folly/synchronization:relaxed_atomic", + ], + exported_deps = [ + ":portability", + ":traits", + "//folly/functional:invoke", + "//folly/lang:bits", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "range", + headers = ["Range.h"], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + ":cpu_id", + ":likely", + ":portability", + ":traits", + "//folly/detail:range_common", + "//folly/detail:range_sse42", + "//folly/hash:spooky_hash_v2", + "//folly/lang:c_string", + "//folly/lang:exception", + "//folly/portability:constexpr", + ], +) + +cpp_library( + # @shim + name = "rw_spin_lock", + headers = ["RWSpinLock.h"], + exported_deps = ["//folly/synchronization:rw_spin_lock"], +) + +cpp_library( + name = "scope_guard", + srcs = ["ScopeGuard.cpp"], + headers = ["ScopeGuard.h"], + exported_deps = [ + ":portability", + ":preprocessor", + ":utility", + "//folly/lang:exception", + "//folly/lang:uncaught_exceptions", + ], +) + +cpp_library( + name = "shared_mutex", + srcs = ["SharedMutex.cpp"], + headers = ["SharedMutex.h"], + supports_python_dlopen = True, + deps = [ + ":indestructible", + "//folly/lang:exception", + "//folly/portability:sys_resource", + ], + exported_deps = [ + ":c_portability", + ":likely", + "//folly/chrono:hardware", + "//folly/concurrency:cache_locality", + "//folly/detail:futex", + "//folly/portability:asm", + "//folly/synchronization:lock", + "//folly/synchronization:relaxed_atomic", + "//folly/synchronization:sanitize_thread", + "//folly/system:thread_id", + ], +) + +cpp_library( + name = "singleton", + srcs = [ + "Singleton.cpp", + ], + headers = [ + "Singleton.h", + "Singleton-inl.h", + ], + deps = [ + "fbsource//third-party/fmt:fmt", + ":demangle", + ":scope_guard", + "//folly/experimental/symbolizer:symbolizer", + "//folly/lang:safe_assert", + "//folly/portability:config", + "//folly/portability:fmt_compile", + ], + exported_deps = [ + ":cancellation_token", + ":exception", + ":executor", + ":memory", + ":synchronized", + "//folly/concurrency:core_cached_shared_ptr", + "//folly/detail:singleton", + "//folly/detail:static_singleton_manager", + "//folly/experimental:read_mostly_shared_ptr", + "//folly/hash:hash", + "//folly/lang:exception", + "//folly/memory:sanitize_leak", + "//folly/synchronization:baton", + ], + external_deps = [ + ("glibc", None, "dl"), + ("glibc", None, "rt"), + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "singleton_thread_local", + srcs = ["SingletonThreadLocal.cpp"], + headers = ["SingletonThreadLocal.h"], + exported_deps = [ + ":scope_guard", + ":thread_local", + "//folly/detail:iterators", + "//folly/detail:singleton", + "//folly/detail:unique_instance", + "//folly/functional:invoke", + "//folly/lang:hint", + ], +) + +cpp_library( + name = "small_vector", + headers = ["small_vector.h"], + exported_deps = [ + ":constexpr_math", + ":format_traits", + ":likely", + ":portability", + ":scope_guard", + ":traits", + "//folly/functional:invoke", + "//folly/hash:hash", + "//folly/lang:align", + "//folly/lang:assume", + "//folly/lang:checked_math", + "//folly/lang:exception", + "//folly/memory:malloc", + "//folly/portability:malloc", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "sorted_vector_types", + headers = [ + "sorted_vector_types.h", + ], + exported_deps = [ + ":scope_guard", + ":traits", + ":utility", + "//folly/lang:access", + "//folly/lang:exception", + "//folly/memory:memory_resource", + ], +) + +cpp_library( + name = "spin_lock", + headers = [ + "SpinLock.h", + ], + exported_deps = [ + ":portability", + "//folly/synchronization:small_locks", + ], +) + +cpp_library( + name = "stop_watch", + headers = ["stop_watch.h"], + exported_deps = [ + ":chrono", + ":utility", + "//folly/portability:time", + ], +) + +cpp_library( + name = "string", + srcs = [ + "String.cpp", + ], + headers = [ + "String.h", + "String-inl.h", + ], + deps = [ + "//folly/container:array", + ], + exported_deps = [ + ":conv", + ":cpp_attributes", + ":exception_string", + ":optional", + ":portability", + ":range", + ":scope_guard", + ":traits", + ":unit", + "//folly/container:reserve", + "//folly/detail:simple_simd_string_utils", + "//folly/detail:split_string_simd", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "subprocess", + srcs = ["Subprocess.cpp"], + headers = ["Subprocess.h"], + deps = [ + ":conv", + ":scope_guard", + ":string", + "//folly/lang:assume", + "//folly/logging:logging", + "//folly/portability:dirent", + "//folly/portability:fcntl", + "//folly/portability:sockets", + "//folly/portability:stdlib", + "//folly/portability:sys_syscall", + "//folly/portability:unistd", + "//folly/system:at_fork", + "//folly/system:shell", + ], + exported_deps = [ + ":exception", + ":file", + ":file_util", + ":function", + ":map_util", + ":optional", + ":portability", + ":range", + "//folly/gen:string", + "//folly/io:iobuf", + "//folly/portability:sys_resource", + ], + external_deps = [ + ("boost", None, "boost_range"), + ], + exported_external_deps = [ + "boost", + ("boost", None, "boost_container"), + ], +) + +cpp_library( + name = "synchronized", + headers = ["Synchronized.h"], + exported_deps = [ + ":function", + ":likely", + ":preprocessor", + ":shared_mutex", + ":traits", + ":utility", + "//folly/container:foreach", + "//folly/functional:apply_tuple", + "//folly/synchronization:lock", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "synchronized_ptr", + headers = ["SynchronizedPtr.h"], + exported_deps = [":synchronized"], +) + +cpp_library( + name = "thread_cached_int", + headers = ["ThreadCachedInt.h"], + exported_deps = [ + ":likely", + ":thread_local", + ], +) + +cpp_library( + name = "thread_local", + headers = ["ThreadLocal.h"], + exported_deps = [ + ":likely", + ":portability", + ":scope_guard", + ":shared_mutex", + "//folly/detail:thread_local_detail", + ], +) + +cpp_library( + name = "timeout_queue", + srcs = ["TimeoutQueue.cpp"], + headers = ["TimeoutQueue.h"], + exported_external_deps = [ + "boost", + ("boost", None, "boost_multi_index"), + ], +) + +cpp_library( + name = "token_bucket", + headers = ["TokenBucket.h"], + exported_deps = [ + ":constexpr_math", + ":likely", + ":optional", + "//folly/concurrency:cache_locality", + ], +) + +cpp_library( + name = "traits", + headers = ["Traits.h"], + exported_deps = [":portability"], +) + +cpp_library( + name = "try", + srcs = [ + "Try.cpp", + ], + headers = [ + "Try.h", + "Try-inl.h", + ], + exported_deps = [ + ":exception_wrapper", + ":likely", + ":memory", + ":portability", + ":unit", + ":utility", + "//folly/functional:invoke", + "//folly/lang:exception", + ], +) + +cpp_library( + name = "unicode", + srcs = ["Unicode.cpp"], + headers = ["Unicode.h"], + deps = [ + ":conv", + ], + exported_deps = [ + "//folly/lang:exception", + ], +) + +cpp_library( + name = "unit", + headers = ["Unit.h"], +) + +cpp_library( + name = "uri", + srcs = [ + "Uri.cpp", + ], + headers = [ + "Uri.h", + "Uri-inl.h", + ], + exported_deps = [ + ":conv", + ":expected", + ":string", + "//folly/hash:hash", + ], + external_deps = [ + ("boost", None, "boost_regex"), + ], +) + +cpp_library( + name = "utf8_string", + headers = [ + "UTF8String.h", + ], + exported_deps = [ + ":range", + ], + exported_external_deps = [ + ("boost", None, "boost_regex"), + ], +) + +# For things that would go in c++ stdlib : +cpp_library( + name = "utility", + headers = [ + "Utility.h", + ], + exported_deps = [ + ":c_portability", + ":portability", + ":traits", + ], +) + +cpp_library( + name = "varint", + headers = ["Varint.h"], + exported_deps = [ + ":conv", + ":expected", + ":likely", + ":portability", + ":range", + ], +) + +cpp_library( + name = "virtual_executor", + headers = [ + "VirtualExecutor.h", + ], + exported_deps = [ + ":default_keep_alive_executor", + ], +) + +cpp_library( + name = "maybe_managed_ptr", + headers = ["MaybeManagedPtr.h"], + deps = [ + ], + exported_deps = [ + ], +) diff --git a/folly/BUILD_MODE.bzl b/folly/BUILD_MODE.bzl new file mode 100644 index 00000000000..0fb607dcd61 --- /dev/null +++ b/folly/BUILD_MODE.bzl @@ -0,0 +1,72 @@ +""" build mode definitions for folly """ + +load("@fbcode//:BUILD_MODE.bzl", get_parent_modes = "get_empty_modes") +load("@fbcode_macros//build_defs:create_build_mode.bzl", "extend_build_modes") + +_extra_cflags = [ + "-Wsign-compare", + "-Wunused-parameter", +] + +_extra_cxxflags = [ +] + +_extra_clang_flags = [ + "-Wconditional-uninitialized", + "-Wconstant-conversion", + "-Wdeprecated-declarations", + "-Wextra", + "-Wextra-semi", + "-Wexceptions", + "-Wfloat-conversion", + "-Wgnu-conditional-omitted-operand", + "-Wheader-hygiene", + "-Wimplicit-fallthrough", + "-Wmismatched-tags", + "-Wmissing-braces", + "-Wmissing-noreturn", + "-Wshadow", + "-Wshift-sign-overflow", + "-Wsometimes-uninitialized", + "-Wuninitialized", + "-Wuninitialized-const-reference", + "-Wunused-const-variable", + "-Wunused-exception-parameter", + "-Wunused-function", + "-Wunused-lambda-capture", + "-Wunused-value", + "-Wunused-variable", + "-Wswitch-enum", +] + +_extra_gcc_flags = [ + "-Wdeprecated-declarations", + "-Wmaybe-uninitialized", + "-Wmissing-braces", + "-Wshadow", + "-Wuninitialized", + "-Wunused-but-set-variable", +] + +_extra_asan_options = { + "detect_leaks": "1", + "detect_odr_violation": "2", +} + +_tags = [ +] + +_modes = extend_build_modes( + get_parent_modes(), + asan_options = _extra_asan_options, + c_flags = _extra_cflags, + clang_flags = _extra_clang_flags, + cxx_flags = _extra_cxxflags, + cxx_modular_headers = True, + gcc_flags = _extra_gcc_flags, + tags = _tags, +) + +def get_modes(): + """ Return modes for this file """ + return _modes diff --git a/folly/buck_config/BUCK b/folly/buck_config/BUCK new file mode 100644 index 00000000000..5c4f482b5ea --- /dev/null +++ b/folly/buck_config/BUCK @@ -0,0 +1 @@ +# This file needs to exist to avoid build system breakage, see https://fburl.com/workplace/jtdlgdmd diff --git a/folly/buck_config/constraints/BUCK b/folly/buck_config/constraints/BUCK new file mode 100644 index 00000000000..5c4f482b5ea --- /dev/null +++ b/folly/buck_config/constraints/BUCK @@ -0,0 +1 @@ +# This file needs to exist to avoid build system breakage, see https://fburl.com/workplace/jtdlgdmd diff --git a/folly/channels/BUCK b/folly/channels/BUCK new file mode 100644 index 00000000000..7d09b028cf5 --- /dev/null +++ b/folly/channels/BUCK @@ -0,0 +1,225 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "channel", + headers = [ + "Channel.h", + "Channel-fwd.h", + "Channel-inl.h", + ], + exported_deps = [ + "//folly:cancellation_token", + "//folly:synchronized", + "//folly/experimental/channels/detail:channel_bridge", + "//folly/experimental/coro:coroutine", + ], +) + +cpp_library( + name = "channel_callback_handle", + headers = [ + "ChannelCallbackHandle.h", + ], + exported_deps = [ + "//folly:intrusive_list", + "//folly:scope_guard", + "//folly/experimental/channels:channel", + ], +) + +cpp_library( + name = "channel_processor", + headers = [ + "ChannelProcessor.h", + "ChannelProcessor-inl.h", + ], + exported_deps = [ + "//folly:executor", + "//folly/executors:serial_executor", + "//folly/experimental/channels:consume_channel", + "//folly/experimental/channels:merge_channel", + "//folly/experimental/channels:rate_limiter", + "//folly/experimental/channels:transform", + "//folly/experimental/channels/detail:intrusive_ptr", + ], +) + +cpp_library( + name = "consume_channel", + headers = [ + "ConsumeChannel.h", + "ConsumeChannel-inl.h", + ], + exported_deps = [ + "//folly:executor", + "//folly:format", + "//folly:intrusive_list", + "//folly:scope_guard", + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:channel", + "//folly/experimental/channels:channel_callback_handle", + "//folly/experimental/channels/detail:utility", + "//folly/experimental/coro:task", + ], +) + +cpp_library( + name = "fanout_channel", + headers = [ + "FanoutChannel.h", + "FanoutChannel-inl.h", + ], + exported_deps = [ + "//folly/container:f14_hash", + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:channel", + "//folly/experimental/channels:fanout_sender", + "//folly/experimental/channels/detail:utility", + ], +) + +cpp_library( + name = "fanout_sender", + headers = [ + "FanoutSender.h", + "FanoutSender-inl.h", + ], + exported_deps = [ + "//folly/container:f14_hash", + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:channel", + "//folly/experimental/channels/detail:pointer_variant", + "//folly/experimental/channels/detail:utility", + ], +) + +cpp_library( + name = "merge", + headers = [ + "Merge.h", + "Merge-inl.h", + ], + exported_deps = [ + "//folly/container:f14_hash", + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:channel", + "//folly/experimental/channels/detail:utility", + ], +) + +cpp_library( + name = "merge_channel", + headers = [ + "MergeChannel.h", + "MergeChannel-inl.h", + ], + exported_deps = [ + "//folly/container:f14_hash", + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:channel", + "//folly/experimental/channels/detail:utility", + ], +) + +cpp_library( + name = "multiplex_channel", + headers = [ + "MultiplexChannel.h", + "MultiplexChannel-inl.h", + ], + exported_deps = [ + "fbsource//third-party/range-v3:range-v3", + "//folly/container:f14_hash", + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:channel", + "//folly/experimental/channels:fanout_sender", + "//folly/experimental/channels:on_closed_exception", + "//folly/experimental/channels:rate_limiter", + "//folly/experimental/channels/detail:multiplexer_traits", + "//folly/experimental/channels/detail:utility", + "//folly/experimental/coro:future_util", + "//folly/experimental/coro:mutex", + "//folly/experimental/coro:promise", + "//folly/experimental/coro:task", + ], +) + +cpp_library( + name = "on_closed_exception", + headers = [ + "OnClosedException.h", + ], +) + +cpp_library( + name = "producer", + headers = [ + "Producer.h", + "Producer-inl.h", + ], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:cancellation_token", + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:channel", + "//folly/experimental/channels:channel_callback_handle", + "//folly/experimental/channels:consume_channel", + "//folly/experimental/coro:task", + ], +) + +cpp_library( + name = "proxy_channel", + headers = [ + "ProxyChannel.h", + "ProxyChannel-inl.h", + ], + exported_deps = [ + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:channel", + "//folly/experimental/channels/detail:utility", + ], +) + +cpp_library( + name = "rate_limiter", + headers = [ + "RateLimiter.h", + ], + exported_deps = [ + "//folly:function", + "//folly/executors:sequenced_executor", + ], +) + +cpp_library( + name = "max_concurrent_rate_limiter", + srcs = [ + "MaxConcurrentRateLimiter.cpp", + ], + exported_deps = [ + "//folly:synchronized", + "//folly/concurrency:unbounded_queue", + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:rate_limiter", + ], +) + +cpp_library( + name = "transform", + headers = [ + "Transform.h", + "Transform-inl.h", + ], + exported_deps = [ + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:channel", + "//folly/experimental/channels:on_closed_exception", + "//folly/experimental/channels:rate_limiter", + "//folly/experimental/channels/detail:utility", + "//folly/experimental/coro:async_generator", + "//folly/experimental/coro:task", + ], +) diff --git a/folly/channels/test/BUCK b/folly/channels/test/BUCK new file mode 100644 index 00000000000..11a10143853 --- /dev/null +++ b/folly/channels/test/BUCK @@ -0,0 +1,156 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "channel_processor_test", + srcs = ["ChannelProcessorTest.cpp"], + deps = [ + "//folly/executors:manual_executor", + "//folly/experimental/channels:channel_processor", + "//folly/portability:gmock", + ], +) + +cpp_unittest( + name = "channel_test", + srcs = ["ChannelTest.cpp"], + supports_static_listing = False, + deps = [ + "//folly/executors:manual_executor", + "//folly/experimental/channels:channel", + "//folly/experimental/channels/test:channel_test_util", + "//folly/experimental/coro:blocking_wait", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "fanout_channel_test", + srcs = ["FanoutChannelTest.cpp"], + deps = [ + "//folly/executors:manual_executor", + "//folly/executors:serial_executor", + "//folly/experimental/channels:consume_channel", + "//folly/experimental/channels:fanout_channel", + "//folly/experimental/channels/test:channel_test_util", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "fanout_sender_test", + srcs = ["FanoutSenderTest.cpp"], + deps = [ + "//folly/executors:manual_executor", + "//folly/executors:serial_executor", + "//folly/experimental/channels:consume_channel", + "//folly/experimental/channels:fanout_sender", + "//folly/experimental/channels/test:channel_test_util", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "max_concurrent_rate_limiter_test", + srcs = [ + "MaxConcurrentRateLimiterTest.cpp", + ], + deps = [ + "//folly/executors:manual_executor", + "//folly/experimental/channels:max_concurrent_rate_limiter", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "merge_channel_test", + srcs = [ + "MergeChannelTest.cpp", + ], + deps = [ + "//folly/executors:manual_executor", + "//folly/executors:serial_executor", + "//folly/experimental/channels:consume_channel", + "//folly/experimental/channels:merge_channel", + "//folly/experimental/channels/test:channel_test_util", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "merge_test", + srcs = ["MergeTest.cpp"], + deps = [ + "//folly/executors:manual_executor", + "//folly/executors:serial_executor", + "//folly/experimental/channels:consume_channel", + "//folly/experimental/channels:merge", + "//folly/experimental/channels/test:channel_test_util", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "multiplex_channel_test", + srcs = ["MultiplexChannelTest.cpp"], + deps = [ + "//folly/executors:manual_executor", + "//folly/executors:serial_executor", + "//folly/experimental/channels:consume_channel", + "//folly/experimental/channels:max_concurrent_rate_limiter", + "//folly/experimental/channels:multiplex_channel", + "//folly/experimental/channels/test:channel_test_util", + "//folly/experimental/coro:blocking_wait", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "producer_test", + srcs = ["ProducerTest.cpp"], + deps = [ + "//folly/executors:manual_executor", + "//folly/experimental/channels:producer", + "//folly/experimental/channels/test:channel_test_util", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "proxy_channel_test", + srcs = ["ProxyChannelTest.cpp"], + deps = [ + "//folly/executors:manual_executor", + "//folly/experimental/channels:proxy_channel", + "//folly/experimental/channels/test:channel_test_util", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "transform_test", + srcs = ["TransformTest.cpp"], + deps = [ + "//folly:scope_guard", + "//folly:synchronized", + "//folly/executors:manual_executor", + "//folly/executors:serial_executor", + "//folly/experimental/channels:consume_channel", + "//folly/experimental/channels:max_concurrent_rate_limiter", + "//folly/experimental/channels:transform", + "//folly/experimental/channels/test:channel_test_util", + "//folly/experimental/coro:async_generator", + "//folly/experimental/coro:detach_on_cancel", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) diff --git a/folly/chrono/BUCK b/folly/chrono/BUCK new file mode 100644 index 00000000000..8ce03252345 --- /dev/null +++ b/folly/chrono/BUCK @@ -0,0 +1,29 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "clock", + headers = ["Clock.h"], +) + +cpp_library( + name = "conv", + headers = ["Conv.h"], + exported_deps = [ + "//folly:constexpr_math", + "//folly:conv", + "//folly:expected", + "//folly:utility", + "//folly/portability:sys_time", + "//folly/portability:sys_types", + ], +) + +cpp_library( + name = "hardware", + headers = ["Hardware.h"], + exported_deps = [ + "//folly:portability", + ], +) diff --git a/folly/chrono/test/BUCK b/folly/chrono/test/BUCK new file mode 100644 index 00000000000..df6b6a621b1 --- /dev/null +++ b/folly/chrono/test/BUCK @@ -0,0 +1,26 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "clock_test", + srcs = ["ClockTest.cpp"], + headers = [], + deps = [ + "//folly/chrono:clock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "conv_test", + srcs = ["ConvTest.cpp"], + headers = [], + deps = [ + "//folly/chrono:conv", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/cli/BUCK b/folly/cli/BUCK new file mode 100644 index 00000000000..5bd980d0d90 --- /dev/null +++ b/folly/cli/BUCK @@ -0,0 +1,36 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "program_options", + srcs = [ + "NestedCommandLineApp.cpp", + "ProgramOptions.cpp", + ], + headers = [ + "NestedCommandLineApp.h", + "ProgramOptions.h", + ], + deps = [ + "//folly:conv", + "//folly:file_util", + "//folly:format", + "//folly:portability", + "//folly/experimental/io:fs_util", + ], + exported_deps = [ + "//folly:c_portability", + "//folly:optional", + "//folly:string", + "//folly/portability:gflags", + ], + external_deps = [ + "boost", + "gflags", + "glog", + ], + exported_external_deps = [ + ("boost", None, "boost_program_options"), + ], +) diff --git a/folly/cli/test/BUCK b/folly/cli/test/BUCK new file mode 100644 index 00000000000..0f041dfcb74 --- /dev/null +++ b/folly/cli/test/BUCK @@ -0,0 +1,66 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "nested_command_line_app_test", + srcs = ["NestedCommandLineAppTest.cpp"], + headers = [], + env = { + "FOLLY_NESTED_CMDLINE_HELPER": "$(exe_target :nested_command_line_app_test_helper)", + }, + resources = [ + ], + deps = [ + "//folly:subprocess", + "//folly/experimental:program_options", + "//folly/experimental/io:fs_util", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_binary( + name = "nested_command_line_app_test_helper", + srcs = ["NestedCommandLineAppTestHelper.cpp"], + headers = [], + deps = [ + "//folly/experimental:program_options", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "program_options_test", + srcs = ["ProgramOptionsTest.cpp"], + headers = [], + env = { + "FOLLY_PROGRAM_OPTIONS_TEST_HELPER": "$(exe_target :program_options_test_helper)", + }, + deps = [ + "//folly:file_util", + "//folly:subprocess", + "//folly/experimental:program_options", + "//folly/experimental/io:fs_util", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_binary( + name = "program_options_test_helper", + srcs = ["ProgramOptionsTestHelper.cpp"], + headers = [], + deps = [ + "//folly:conv", + "//folly/experimental:program_options", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/compression/BUCK b/folly/compression/BUCK new file mode 100644 index 00000000000..ff4b2dd3243 --- /dev/null +++ b/folly/compression/BUCK @@ -0,0 +1,81 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "compression", + srcs = [ + "Compression.cpp", + "Zlib.cpp", + "Zstd.cpp", + ], + headers = [ + "Compression.h", + "Utils.h", + "Zlib.h", + "Zstd.h", + ], + compiler_flags = [ + "-DLZ4_STATIC_LINKING_ONLY", + "-DLZ4_HC_STATIC_LINKING_ONLY", + "-DLZ4F_STATIC_LINKING_ONLY", + ], + deps = [ + "fbsource//third-party/lz4:lz4", + ":compression_context_pool_singletons", + "//folly:conv", + "//folly:random", + "//folly:scope_guard", + "//folly:stop_watch", + "//folly:varint", + "//folly/portability:windows", + ], + exported_deps = [ + "fbsource//third-party/zstd:zstd", + "//folly:memory", + "//folly:optional", + "//folly:portability", + "//folly:range", + "//folly/io:iobuf", + "//folly/lang:bits", + ], + external_deps = [ + "glog", + "snappy", + ("bzip2", None, "bz2"), + ("xz", None, "lzma"), + ], + exported_external_deps = [ + ("zlib", None, "z"), + ], +) + +cpp_library( + name = "compression_context_pool", + srcs = [], + headers = [ + "CompressionContextPool.h", + "CompressionCoreLocalContextPool.h", + ], + exported_deps = [ + "//folly:memory", + "//folly:synchronized", + "//folly/concurrency:cache_locality", + ], +) + +cpp_library( + name = "compression_context_pool_singletons", + srcs = ["CompressionContextPoolSingletons.cpp"], + headers = ["CompressionContextPoolSingletons.h"], + deps = [ + "//folly:portability", + "//folly/experimental:jemalloc_huge_page_allocator", + "//folly/memory:malloc", + ], + exported_deps = [ + "fbsource//third-party/zstd:zstd", + ":compression_context_pool", + "//folly:config", + ], +) diff --git a/folly/compression/test/BUCK b/folly/compression/test/BUCK new file mode 100644 index 00000000000..44c51af0e73 --- /dev/null +++ b/folly/compression/test/BUCK @@ -0,0 +1,34 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "compression_test", + srcs = ["CompressionTest.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "fbsource//third-party/zstd:zstd", + "//folly:random", + "//folly:varint", + "//folly/compression:compression", + "//folly/hash:hash", + "//folly/io:iobuf", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "compression_context_pool_test", + srcs = [ + "CompressionContextPoolTest.cpp", + ], + deps = [ + "//folly/compression:compression_context_pool", + "//folly/compression:compression_context_pool_singletons", + "//folly/portability:gtest", + ], +) diff --git a/folly/compression/test/facebook/BUCK b/folly/compression/test/facebook/BUCK new file mode 100644 index 00000000000..6e9c7d588af --- /dev/null +++ b/folly/compression/test/facebook/BUCK @@ -0,0 +1,19 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") + +oncall("data_compression") + +cpp_binary( + name = "compression_fuzz_test.so", + srcs = ["CompressionFuzzTest.cpp"], + headers = [], + dlopen_enabled = True, + deps = [ + "//common/testing/fuzztest:fuzz_main", # @manual + "//common/testing/fuzztest:headers", + "//folly:range", + "//folly/compression:compression", + "//folly/hash:hash", + "//folly/io:iobuf", + "//folly/portability:gtest", + ], +) diff --git a/folly/concurrency/BUCK b/folly/concurrency/BUCK new file mode 100644 index 00000000000..8e1f242fe64 --- /dev/null +++ b/folly/concurrency/BUCK @@ -0,0 +1,156 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "cache_locality", + srcs = ["CacheLocality.cpp"], + headers = ["CacheLocality.h"], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:conv", + "//folly:exception", + "//folly:indestructible", + "//folly:memory", + "//folly:optional", + "//folly:scope_guard", + "//folly/detail:static_singleton_manager", + "//folly/hash:hash", + "//folly/portability:unistd", + "//folly/system:thread_id", + ], + exported_deps = [ + "//folly:likely", + "//folly:portability", + "//folly/lang:align", + "//folly/lang:exception", + "//folly/synchronization:atomic_ref", + ], + external_deps = [ + "glog", + ("glibc", None, "dl"), + ], +) + +cpp_library( + name = "atomic_shared_ptr", + headers = [ + "AtomicSharedPtr.h", + "detail/AtomicSharedPtr-detail.h", + ], + exported_deps = [ + "//folly:packed_sync_ptr", + "//folly/lang:safe_assert", + "//folly/memory:sanitize_leak", + "//folly/synchronization:atomic_struct", + "//folly/synchronization/detail:atomic_utils", + ], +) + +cpp_library( + name = "core_cached_shared_ptr", + headers = ["CoreCachedSharedPtr.h"], + exported_deps = [ + ":cache_locality", + "//folly:cpp_attributes", + "//folly:portability", + "//folly:unit", + "//folly/synchronization:hazptr", + ], +) + +cpp_library( + name = "concurrent_hash_map", + headers = [ + "ConcurrentHashMap.h", + "detail/ConcurrentHashMap-detail.h", + ], + exported_deps = [ + "//folly:optional", + "//folly/container:heterogeneous_access", + "//folly/container/detail:f14_mask", + "//folly/lang:exception", + "//folly/synchronization:hazptr", + ], +) + +cpp_library( + name = "dynamic_bounded_queue", + headers = [ + "DynamicBoundedQueue.h", + ], + exported_deps = [ + ":cache_locality", + ":unbounded_queue", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "priority_unbounded_queue_set", + headers = [ + "PriorityUnboundedQueueSet.h", + ], + exported_deps = [ + ":unbounded_queue", + "//folly:memory", + "//folly/lang:align", + ], +) + +cpp_library( + name = "unbounded_queue", + headers = [ + "UnboundedQueue.h", + ], + exported_deps = [ + ":cache_locality", + "//folly:constexpr_math", + "//folly:optional", + "//folly:traits", + "//folly/lang:align", + "//folly/synchronization:hazptr", + "//folly/synchronization:saturating_semaphore", + "//folly/synchronization:wait_options", + "//folly/synchronization/detail:spin", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "deadlock_detector", + srcs = ["DeadlockDetector.cpp"], + headers = [ + "DeadlockDetector.h", + ], + exported_deps = [ + "//folly:executor", + "//folly/executors:queue_observer", + ], +) + +cpp_library( + name = "thread_cached_synchronized", + headers = ["ThreadCachedSynchronized.h"], + exported_deps = [ + "//folly:shared_mutex", + "//folly:thread_local", + "//folly:utility", + "//folly/lang:access", + "//folly/synchronization:lock", + "//folly/synchronization:relaxed_atomic", + ], +) + +cpp_library( + name = "process_local_unique_id", + srcs = ["ProcessLocalUniqueId.cpp"], + deps = [ + "//folly:likely", + "//folly/synchronization:relaxed_atomic", + ], +) diff --git a/folly/concurrency/test/BUCK b/folly/concurrency/test/BUCK new file mode 100644 index 00000000000..f6fd50d6470 --- /dev/null +++ b/folly/concurrency/test/BUCK @@ -0,0 +1,178 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_binary( + name = "cache_locality_benchmark", + srcs = ["CacheLocalityBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/concurrency:cache_locality", + "//folly/lang:keep", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "cache_locality_test", + srcs = ["CacheLocalityTest.cpp"], + headers = [], + deps = [ + "//folly/concurrency:cache_locality", + "//folly/portability:gtest", + "//folly/portability:sys_resource", + "//folly/test:test_utils", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "atomic_shared_ptr_test", + srcs = ["AtomicSharedPtrTest.cpp"], + headers = ["AtomicSharedPtrCounted.h"], + deps = [ + "//folly:portability", + "//folly/concurrency:atomic_shared_ptr", + "//folly/portability:config", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/test:deterministic_schedule", + ], + external_deps = [ + "glog", + ], +) + +cpp_binary( + name = "atomic_shared_ptr_performance", + srcs = ["AtomicSharedPtrPerformance.cpp"], + deps = [ + "//folly/concurrency:atomic_shared_ptr", + "//folly/portability:config", + ], +) + +cpp_unittest( + name = "core_cached_shared_ptr_test", + srcs = ["CoreCachedSharedPtrTest.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:portability", + "//folly/concurrency:atomic_shared_ptr", + "//folly/concurrency:core_cached_shared_ptr", + "//folly/concurrency:thread_cached_synchronized", + "//folly/experimental:read_mostly_shared_ptr", + "//folly/portability:config", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "concurrent_hash_map_bench", + srcs = ["ConcurrentHashMapBench.cpp"], + headers = [], + deps = [ + "//folly/concurrency:concurrent_hash_map", + "//folly/synchronization/test:barrier", + ], +) + +cpp_unittest( + name = "concurrent_hash_map_test", + srcs = ["ConcurrentHashMapTest.cpp"], + supports_static_listing = False, + deps = [ + "//folly:portability", + "//folly:traits", + "//folly/concurrency:concurrent_hash_map", + "//folly/container/test:tracking_types", + "//folly/hash:hash", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/test:deterministic_schedule", + ], +) + +cpp_unittest( + name = "dynamic_bounded_queue_test", + srcs = ["DynamicBoundedQueueTest.cpp"], + headers = [], + deps = [ + "//folly:mpmc_queue", + "//folly:producer_consumer_queue", + "//folly/concurrency:dynamic_bounded_queue", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "priority_unbounded_queue_set_test", + srcs = ["PriorityUnboundedQueueSetTest.cpp"], + deps = [ + "//folly/concurrency:priority_unbounded_queue_set", + "//folly/container:enumerate", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "unbounded_queue_test", + srcs = ["UnboundedQueueTest.cpp"], + headers = [], + deps = [ + "//folly:mpmc_queue", + "//folly:producer_consumer_queue", + "//folly/concurrency:unbounded_queue", + "//folly/lang:keep", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + ("boost", None, "boost_thread"), + "glog", + ], +) + +cpp_benchmark( + name = "thread_cached_synchronized_bench", + srcs = ["ThreadCachedSynchronizedBench.cpp"], + deps = [ + "//folly:benchmark", + "//folly:synchronized", + "//folly/concurrency:thread_cached_synchronized", + "//folly/lang:keep", + ], +) + +cpp_unittest( + name = "thread_cached_synchronized_test", + srcs = ["ThreadCachedSynchronizedTest.cpp"], + deps = [ + "//folly/concurrency:thread_cached_synchronized", + "//folly/lang:keep", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "process_local_unique_id_test", + srcs = ["ProcessLocalUniqueIdTest.cpp"], + deps = [ + "//folly:synchronized", + "//folly/concurrency:process_local_unique_id", + "//folly/portability:gtest", + ], +) diff --git a/folly/container/BUCK b/folly/container/BUCK new file mode 100644 index 00000000000..9ad95329d68 --- /dev/null +++ b/folly/container/BUCK @@ -0,0 +1,238 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "access", + headers = ["Access.h"], + exported_deps = [ + "//folly:portability", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "array", + headers = ["Array.h"], + exported_deps = [ + "//folly:c_portability", + "//folly:traits", + "//folly:utility", + ], +) + +cpp_library( + name = "bit_iterator", + headers = ["BitIterator.h"], + exported_deps = [ + "//folly:portability", + "//folly/container/detail:bit_iterator_detail", + "//folly/lang:bits", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "iterator", + headers = ["Iterator.h"], + exported_deps = [ + ":access", + "//folly:traits", + "//folly:utility", + "//folly/lang:rvalue_reference_wrapper", + ], +) + +cpp_library( + name = "enumerate", + headers = ["Enumerate.h"], + exported_deps = [ + "//folly:c_portability", + "//folly/portability:sys_types", + ], +) + +cpp_library( + name = "evicting_cache_map", + headers = ["EvictingCacheMap.h"], + exported_deps = [ + "//folly/container:f14_hash", + "//folly/container:heterogeneous_access", + "//folly/lang:exception", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "f14_hash", + headers = [ + "F14Map.h", + "F14Set.h", + ], + exported_deps = [ + ":f14_hash_fwd", + ":iterator", + ":view", + "//folly:portability", + "//folly:range", + "//folly:traits", + "//folly/container/detail:f14_hash_detail", + "//folly/container/detail:util", + "//folly/lang:exception", + "//folly/lang:safe_assert", + ], +) + +cpp_library( + name = "f14_hash_fwd", + headers = [ + "F14Map-fwd.h", + "F14Set-fwd.h", + ], + exported_deps = [ + "//folly/container/detail:f14_defaults", + "//folly/memory:memory_resource", + ], +) + +cpp_library( + name = "heap_vector_types", + headers = [ + "heap_vector_types.h", + ], + exported_deps = [ + ":iterator", + "//folly:range", + "//folly:scope_guard", + "//folly:small_vector", + "//folly:traits", + "//folly:utility", + "//folly/functional:invoke", + "//folly/lang:exception", + "//folly/memory:memory_resource", + "//folly/portability:builtins", + ], +) + +cpp_library( + name = "foreach", + headers = [ + "Foreach.h", + "Foreach-inl.h", + ], + exported_deps = [ + ":access", + "//folly:portability", + "//folly:preprocessor", + "//folly:traits", + "//folly:utility", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "heterogeneous_access_fwd", + headers = [ + "HeterogeneousAccess-fwd.h", + ], +) + +cpp_library( + name = "heterogeneous_access", + headers = [ + "HeterogeneousAccess.h", + ], + exported_deps = [ + ":heterogeneous_access_fwd", + "//folly:range", + "//folly:traits", + "//folly/hash:hash", + ], +) + +cpp_library( + name = "merge", + headers = ["Merge.h"], +) + +cpp_library( + name = "range_traits", + headers = ["range_traits.h"], + exported_deps = [ + "//folly:traits", + "//folly:utility", + ], +) + +cpp_library( + name = "sparse_byte_set", + headers = ["SparseByteSet.h"], + exported_deps = [ + "//folly:c_portability", + ], +) + +cpp_library( + name = "tape", + headers = [ + "tape.h", + ], + exported_deps = [ + ":iterator", + "//folly:portability", + "//folly:range", + "//folly/container/detail:tape_detail", + "//folly/memory:uninitialized_memory_hacks", + ], +) + +cpp_library( + name = "view", + headers = ["View.h"], + exported_deps = [ + "//folly:portability", + "//folly/functional:invoke", + "//folly/lang:customization_point", + ], +) + +cpp_library( + name = "weighted_evicting_cache_map", + headers = [ + "WeightedEvictingCacheMap.h", + ], + exported_deps = [ + "//folly/container:evicting_cache_map", + ], +) + +cpp_library( + name = "intrusive_heap", + headers = [ + "IntrusiveHeap.h", + ], + exported_deps = [ + "//folly:portability", + ], + exported_external_deps = [ + "boost", + "glog", + ], +) + +cpp_library( + name = "reserve", + headers = [ + "Reserve.h", + ], + exported_deps = [ + "//folly:likely", + "//folly:traits", + "//folly:utility", + "//folly/lang:exception", + ], +) diff --git a/folly/container/detail/BUCK b/folly/container/detail/BUCK new file mode 100644 index 00000000000..8d016868009 --- /dev/null +++ b/folly/container/detail/BUCK @@ -0,0 +1,115 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "bit_iterator_detail", + headers = ["BitIteratorDetail.h"], + exported_deps = [ + "//folly/portability:sys_types", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "f14_intrinsics_availability", + headers = [ + "F14IntrinsicsAvailability.h", + ], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "f14_defaults", + headers = [ + "F14Defaults.h", + ], + exported_deps = [ + "//folly/container:heterogeneous_access_fwd", + ], +) + +cpp_library( + name = "f14_hash_detail", + srcs = [ + "F14Table.cpp", + ], + headers = [ + "F14MapFallback.h", + "F14Policy.h", + "F14SetFallback.h", + "F14Table.h", + ], + exported_deps = [ + ":f14_defaults", + ":f14_intrinsics_availability", + ":f14_mask", + ":util", + "//folly:bits", + "//folly:constexpr_math", + "//folly:likely", + "//folly:memory", + "//folly:optional", + "//folly:portability", + "//folly:scope_guard", + "//folly:traits", + "//folly:unit", + "//folly/container:heterogeneous_access", + "//folly/functional:invoke", + "//folly/hash:hash", + "//folly/lang:align", + "//folly/lang:assume", + "//folly/lang:exception", + "//folly/lang:pretty", + "//folly/lang:safe_assert", + "//folly/memory:malloc", + "//folly/portability:builtins", + ], +) + +cpp_library( + name = "f14_mask", + headers = [ + "F14Mask.h", + ], + exported_deps = [ + ":f14_intrinsics_availability", + "//folly:bits", + "//folly:constexpr_math", + "//folly:likely", + "//folly:portability", + "//folly/lang:assume", + "//folly/lang:safe_assert", + ], +) + +cpp_library( + name = "tape_detail", + headers = [ + "tape_detail.h", + ], + exported_deps = [ + "//folly:portability", + "//folly:range", + "//folly/container:iterator", + "//folly/container:range_traits", + "//folly/lang:hint", + "//folly/memory:uninitialized_memory_hacks", + ], +) + +cpp_library( + name = "util", + headers = [ + "Util.h", + ], + exported_deps = [ + "//folly:traits", + "//folly/container:iterator", + "//folly/functional:apply_tuple", + ], +) diff --git a/folly/container/detail/test/BUCK b/folly/container/detail/test/BUCK new file mode 100644 index 00000000000..9560cbb8c82 --- /dev/null +++ b/folly/container/detail/test/BUCK @@ -0,0 +1,14 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "f14_detail_test", + srcs = [ + "F14DetailTest.cpp", + ], + deps = [ + "//folly/container/detail:f14_hash_detail", + "//folly/portability:gtest", + ], +) diff --git a/folly/container/test/BUCK b/folly/container/test/BUCK new file mode 100644 index 00000000000..5fd1aad9c2a --- /dev/null +++ b/folly/container/test/BUCK @@ -0,0 +1,457 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "access_test", + srcs = ["AccessTest.cpp"], + headers = [], + deps = [ + "//folly/container:access", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "array_test", + srcs = ["ArrayTest.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "//folly/container:array", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "bit_iterator_bench", + srcs = ["BitIteratorBench.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:small_vector", + "//folly/container:bit_iterator", + "//folly/init:init", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "bit_iterator_test", + srcs = ["BitIteratorTest.cpp"], + headers = [], + deps = [ + "//folly/container:bit_iterator", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "enumerate_test", + srcs = ["EnumerateTest.cpp"], + headers = [], + deps = [ + "//folly:range", + "//folly/container:enumerate", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "evicting_cache_map_bench", + srcs = ["EvictingCacheMapBench.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/container:evicting_cache_map", + ], +) + +cpp_unittest( + name = "evicting_cache_map_test", + srcs = ["EvictingCacheMapTest.cpp"], + headers = [], + allocator = "jemalloc_debug", + deps = [ + "//folly/container:evicting_cache_map", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "f14_test_util", + headers = [ + "F14TestUtil.h", + ], + exported_deps = [ + "//folly/container/detail:f14_hash_detail", + ], +) + +cpp_unittest( + name = "f14_fwd_test", + srcs = [ + "F14FwdTest.cpp", + ], + deps = [ + "//folly/container:f14_hash_fwd", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "f14_map_test", + srcs = [ + "F14MapTest.cpp", + ], + deps = [ + ":f14_test_util", + ":tracking_types", + "//folly:benchmark", + "//folly:conv", + "//folly:fbstring", + "//folly:portability", + "//folly/container:f14_hash", + "//folly/hash:hash", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "f14_map_fallback_test", + srcs = [ + "F14MapTest.cpp", + ], + preprocessor_flags = ["-DFOLLY_F14_FORCE_FALLBACK=1"], + deps = [ + ":f14_test_util", + ":tracking_types", + "//folly:benchmark", + "//folly:conv", + "//folly:fbstring", + "//folly:portability", + "//folly/container:f14_hash", + "//folly/hash:hash", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "f14_policy_test", + srcs = [ + "F14PolicyTest.cpp", + ], + deps = [ + "//folly/container:f14_hash", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "f14_set_test", + srcs = [ + "F14SetTest.cpp", + ], + deps = [ + ":f14_test_util", + ":tracking_types", + "//folly:benchmark", + "//folly:conv", + "//folly:fbstring", + "//folly:portability", + "//folly/container:f14_hash", + "//folly/lang:keep", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "f14_set_fallback_test", + srcs = [ + "F14SetTest.cpp", + ], + preprocessor_flags = ["-DFOLLY_F14_FORCE_FALLBACK=1"], + deps = [ + ":f14_test_util", + ":tracking_types", + "//folly:benchmark", + "//folly:conv", + "//folly:fbstring", + "//folly:portability", + "//folly/container:f14_hash", + "//folly/lang:keep", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "heap_vector_types_test", + srcs = ["heap_vector_types_test.cpp"], + headers = [], + deps = [ + "//folly:random", + "//folly:range", + "//folly:small_vector", + "//folly:sorted_vector_types", + "//folly:utility", + "//folly/container:heap_vector_types", + "//folly/memory:malloc", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "f14_interprocess_test", + srcs = [ + "F14InterprocessTest.cpp", + ], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:random", + "//folly:traits", + "//folly/container:f14_hash", + "//folly/portability:gtest", + ], + external_deps = [ + ("boost", None, "boost_interprocess"), + ("glibc", None, "rt"), # @manual + ], +) + +cpp_binary( + name = "f14_small_overheads", + srcs = [ + "F14SmallOverheads.cpp", + ], + deps = [ + "//folly/container:f14_hash", + ], +) + +cpp_unittest( + name = "f14_asan_support_test", + srcs = [ + "F14AsanSupportTest.cpp", + ], + deps = [ + "//folly:portability", + "//folly/container:f14_hash", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "foreach_benchmark", + srcs = ["ForeachBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:random", + "//folly/container:enumerate", + "//folly/container:foreach", + "//folly/init:init", + ], +) + +cpp_unittest( + name = "foreach_test", + srcs = ["ForeachTest.cpp"], + headers = [], + deps = [ + "//folly/container:foreach", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "heterogeneous_access_test", + srcs = [ + "HeterogeneousAccessTest.cpp", + ], + deps = [ + "//folly:fbstring", + "//folly:portability", + "//folly:range", + "//folly:small_vector", + "//folly:traits", + "//folly/container:heterogeneous_access", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "iterator_test", + srcs = ["IteratorTest.cpp"], + headers = [], + deps = [ + "//folly/container:iterator", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "merge_test", + srcs = ["MergeTest.cpp"], + headers = [], + deps = [ + "//folly/container:merge", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "range_traits_test", + srcs = ["range_traits_test.cpp"], + headers = [], + deps = [ + "//folly/container:range_traits", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "sparse_byte_set_benchmark", + srcs = ["SparseByteSetBenchmark.cpp"], + headers = [], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:benchmark", + "//folly:format", + "//folly/container:sparse_byte_set", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "sparse_byte_set_test", + srcs = ["SparseByteSetTest.cpp"], + headers = [], + deps = [ + "//folly/container:sparse_byte_set", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "tracking_types", + headers = [ + "TrackingTypes.h", + ], + exported_deps = [ + "//folly:function", + "//folly/hash:hash", + "//folly/lang:safe_assert", + "//folly/portability:asm", + ], +) + +cpp_unittest( + name = "tape_test", + srcs = ["tape_test.cpp"], + deps = [ + "//folly:small_vector", + "//folly/container:tape", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "tape_bench", + srcs = ["tape_bench.cpp"], + deps = [ + "//folly:benchmark", + "//folly/container:tape", + "//folly/init:init", + ], +) + +cpp_unittest( + name = "util_test", + srcs = ["UtilTest.cpp"], + headers = [], + deps = [ + "//folly:optional", + "//folly:range", + "//folly/container/detail:util", + "//folly/container/test:tracking_types", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "weighted_evicting_cache_map_test", + srcs = ["WeightedEvictingCacheMapTest.cpp"], + headers = [], + allocator = "jemalloc_debug", + deps = [ + "//folly/container:weighted_evicting_cache_map", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "intrusive_heap_test", + srcs = ["IntrusiveHeapTest.cpp"], + headers = [], + deps = [ + "//folly:random", + "//folly/container:intrusive_heap", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "hash_maps_bench", + srcs = ["HashMapsBench.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:conv", + "//folly:format", + "//folly:function", + "//folly/container:f14_hash", + "//folly/hash:hash", + "//folly/init:init", + "//folly/portability:gflags", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "reserve_test", + srcs = ["ReserveTest.cpp"], + deps = [ + "//folly/container:f14_hash", + "//folly/container:reserve", + "//folly/portability:gtest", + ], +) diff --git a/folly/defs.bzl b/folly/defs.bzl new file mode 100644 index 00000000000..33defa3d2df --- /dev/null +++ b/folly/defs.bzl @@ -0,0 +1,235 @@ +"""Provides helper functions for the folly library + +[folly] + have_libgflags_override = {True|[False]} +""" + +load("@fbsource//tools/build_defs:buckconfig.bzl", "read_bool") +load( + "@fbsource//tools/build_defs:default_platform_defs.bzl", + "ANDROID", + "APPLE", + "CXX", + "FBCODE", + "IOS", + "MACOSX", + "VISIONOS", + "WATCHOS", + "WINDOWS", + "get_available_platforms", +) +load("@fbsource//tools/build_defs:fb_xplat_cxx_binary.bzl", "fb_xplat_cxx_binary") +load("@fbsource//tools/build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library") +load("@fbsource//tools/build_defs:fb_xplat_cxx_test.bzl", "fb_xplat_cxx_test") +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_arvr_mode") + +def should_enable_gflags(): + return read_bool("folly", "have_libgflags_override", False) + +def is_folly_mobile_flag(): + return native.read_config("cpp_flags", "preprocessing", "") == "DFOLLY_MOBILE" + +def cpp_flags(): + flags = [ + "-DFOLLY_HAVE_LIBJEMALLOC=0", + "-DFOLLY_HAVE_PREADV=0", + "-DFOLLY_HAVE_PWRITEV=0", + "-DFOLLY_HAVE_TFO=0", + ] + + if is_folly_mobile_flag(): + flags += select({ + "DEFAULT": [], + "ovr_config//os:linux": ["-DFOLLY_MOBILE=1"], + }) + + elif is_arvr_mode(): + flags += select({ + "DEFAULT": ["-DFOLLY_MOBILE=1"], + "ovr_config//os:linux": [], + "ovr_config//os:macos": [], + }) + + else: + flags += ["-DFOLLY_MOBILE=1"] + + return flags + +FBANDROID_CPPFLAGS = [ + "-DFOLLY_HAVE_IFUNC=0", + "-DFOLLY_HAVE_INT128_T=0", + "-DFOLLY_DISABLE_SDT=1", + "-DSSLCONTEXT_NO_REFCOUNT", + "-D__STDC_FORMAT_MACROS", + "-D__STDC_LIMIT_MACROS", + "-D__STDC_CONSTANT_MACROS", +] + +CLANG_CXX_FLAGS = [ + "-frtti", + "-fexceptions", + "-Wall", + "-Werror", + "-Wno-unused-local-typedefs", + "-Wno-unused-variable", + "-Wno-sign-compare", + "-Wno-comment", + "-Wno-return-type", + "-Wno-global-constructors", + "-Wno-missing-prototypes", + "-Wno-nullability-completeness", + "-Wno-c++17-extensions", + "-Wno-undef", + "-Wno-unreachable-code", +] +CXXFLAGS = select({ + "DEFAULT": [], + "ovr_config//compiler:clang": CLANG_CXX_FLAGS, +}) + +FBOBJC_CXXFLAGS = ["-Os"] + +FBANDROID_CXXFLAGS = [ + "-ffunction-sections", + "-Wno-uninitialized", +] + +WINDOWS_MSVC_CXXFLAGS = [ + "/EHs", + "/D_ENABLE_EXTENDED_ALIGNED_STORAGE", +] + +WINDOWS_CLANG_CXX_FLAGS = [ + "-Wno-deprecated-declarations", + "-Wno-microsoft-cast", + "-Wno-missing-braces", + "-Wno-unused-function", + "-Wno-undef", + "-DBOOST_HAS_THREADS", + "-D_ENABLE_EXTENDED_ALIGNED_STORAGE", +] + +DEFAULT_APPLE_SDKS = (IOS, MACOSX, VISIONOS, WATCHOS) +DEFAULT_PLATFORMS = (CXX, ANDROID, APPLE, FBCODE, WINDOWS) + +def _compute_include_directories(): + base_path = native.package_name() + if base_path == "xplat/folly": + return [".."] + thrift_path = base_path[6:] + return ["/".join(len(thrift_path.split("/")) * [".."])] + +def folly_library( + name, + srcs = (), + headers = (), + exported_headers = (), + raw_headers = (), + deps = (), + exported_deps = (), + force_static = True, + apple_sdks = None, + platforms = None, + enable_static_variant = True, + labels = (), + **kwargs): + """Translate a simpler declartion into the more complete library target""" + + # Set default platform settings. `()` means empty, whereas None + # means default + if apple_sdks == None: + apple_sdks = DEFAULT_APPLE_SDKS + if platforms == None: + platforms = DEFAULT_PLATFORMS + + # We use gflags on fbcode platforms, which don't mix well when mixing static + # and dynamic linking. + if not is_arvr_mode(): + force_static = select({ + "DEFAULT": force_static, + "ovr_config//runtime:fbcode": False, + }) + + fb_xplat_cxx_library( + name = name, + srcs = srcs, + header_namespace = "", + headers = headers, + exported_headers = exported_headers, + raw_headers = raw_headers, + public_include_directories = _compute_include_directories(), + deps = deps, + exported_deps = exported_deps, + force_static = force_static, + apple_sdks = apple_sdks, + platforms = platforms, + enable_static_variant = enable_static_variant, + labels = list(labels), + compiler_flags = CXXFLAGS + kwargs.pop("compiler_flags", []) + select({ + "DEFAULT": [], + "ovr_config//os:android": FBANDROID_CXXFLAGS, + "ovr_config//os:iphoneos": CLANG_CXX_FLAGS, + # TODO: Why iphoneos and macos are not marked as clang compilers? + "ovr_config//os:macos": CLANG_CXX_FLAGS, + }) + select({ + "DEFAULT": [], + "ovr_config//os:windows-cl": WINDOWS_MSVC_CXXFLAGS, + "ovr_config//os:windows-gcc-or-clang": WINDOWS_CLANG_CXX_FLAGS, + }), + fbobjc_compiler_flags = kwargs.pop("fbobjc_compiler_flags", []) + + FBOBJC_CXXFLAGS, + fbcode_compiler_flags_override = kwargs.pop("fbcode_compiler_flags", []), + windows_preferred_linkage = "static", + visibility = kwargs.pop("visibility", ["PUBLIC"]), + **kwargs + ) + +def folly_cxx_library(name, **kwargs): + folly_library( + name = name, + **kwargs + ) + +def folly_cxx_test( + name, + srcs, + raw_headers = [], + deps = [], + contacts = [], + **kwargs): + fb_xplat_cxx_test( + name = name, + srcs = srcs, + raw_headers = raw_headers, + include_directories = _compute_include_directories(), + deps = deps + [ + "//xplat/folly/test/common:test_main", + ], + contacts = contacts, + platforms = (CXX,), + ) + +def folly_cxx_binary( + name, + srcs, + raw_headers = [], + deps = [], + contacts = [], + **kwargs): + fb_xplat_cxx_binary( + name = name, + srcs = srcs, + raw_headers = raw_headers, + include_directories = _compute_include_directories(), + deps = deps, + contacts = contacts, + platforms = (CXX,), + ) + +def override_soname_if_needed(name): + # This is a hack to unblock rollout of platform suffix removal to xplat/folly. + # See T89357426. This only applies when using arvr build modes and can be removed when Hermes + # is built from source (or prebuilt using arvr build modes). + if is_arvr_mode() and ANDROID in get_available_platforms(): + return "libxplat_folly_{}Android.so".format(name) + return None diff --git a/folly/detail/BUCK b/folly/detail/BUCK new file mode 100644 index 00000000000..500461b500b --- /dev/null +++ b/folly/detail/BUCK @@ -0,0 +1,426 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "async_trace", + srcs = ["AsyncTrace.cpp"], + headers = ["AsyncTrace.h"], + deps = [ + "//folly:portability", + ], + exported_deps = [ + "//folly:optional", + ], +) + +cpp_library( + name = "atomic_hash_utils", + headers = ["AtomicHashUtils.h"], + exported_deps = [ + "//folly/portability:asm", + ], +) + +cpp_library( + name = "atomic_unordered_map_utils", + headers = ["AtomicUnorderedMapUtils.h"], + exported_deps = [ + "//folly:exception", + "//folly/portability:sys_mman", + "//folly/portability:unistd", + ], +) + +cpp_library( + name = "discriminated_ptr_detail", + headers = ["DiscriminatedPtrDetail.h"], + exported_deps = [ + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "file_util_detail", + srcs = ["FileUtilDetail.cpp"], + headers = ["FileUtilDetail.h"], + deps = [ + "//folly/portability:config", + ], + exported_deps = [ + "//folly/portability:sys_types", + ], +) + +cpp_library( + name = "file_util_vector_detail", + headers = ["FileUtilVectorDetail.h"], + exported_deps = [ + ":file_util_detail", + "//folly/portability:sys_uio", + "//folly/portability:unistd", + ], +) + +cpp_library( + name = "fingerprint_polynomial", + headers = ["FingerprintPolynomial.h"], +) + +cpp_library( + name = "futex", + srcs = ["Futex.cpp"], + headers = [ + "Futex.h", + "Futex-inl.h", + ], + deps = [ + "//folly:scope_guard", + "//folly/hash:hash", + "//folly/portability:sys_syscall", + ], + exported_deps = [ + "//folly/portability:unistd", + "//folly/synchronization:parking_lot", + ], +) + +cpp_library( + name = "group_varint_detail", + headers = ["GroupVarintDetail.h"], +) + +cpp_library( + name = "ip_address", + srcs = ["IPAddress.cpp"], + headers = ["IPAddress.h"], + deps = [ + "//folly/portability:fmt_compile", + ], + exported_deps = [ + "//folly/portability:sockets", + ], +) + +cpp_library( + name = "ip_address_source", + headers = ["IPAddressSource.h"], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + ":ip_address", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "iterators", + headers = ["Iterators.h"], +) + +cpp_library( + name = "memory_idler", + srcs = ["MemoryIdler.cpp"], + headers = ["MemoryIdler.h"], + deps = [ + "//folly:glog", + "//folly:portability", + "//folly:scope_guard", + "//folly/concurrency:cache_locality", + "//folly/memory:mallctl_helper", + "//folly/memory:malloc", + "//folly/portability:gflags", + "//folly/portability:pthread", + "//folly/portability:sys_mman", + "//folly/portability:unistd", + "//folly/system:pid", + ], + exported_deps = [ + ":futex", + "//folly/hash:hash", + "//folly/synchronization:atomic_struct", + "//folly/system:thread_id", + ], +) + +cpp_library( + name = "perf_scoped", + srcs = ["PerfScoped.cpp"], + headers = ["PerfScoped.h"], + # folly subprocess is not supported on windows + os_deps = [ + ( + "linux", + ["//folly:subprocess"], + ), + ], + deps = [ + "//folly:conv", + "//folly/experimental:test_util", + "//folly/system:pid", + ], +) + +cpp_library( + name = "mpmc_pipeline_detail", + headers = ["MPMCPipelineDetail.h"], + exported_deps = [ + "//folly:mpmc_queue", + ], +) + +cpp_library( + name = "poly_detail", + headers = ["PolyDetail.h"], + exported_deps = [ + ":typelist", + "//folly:poly_exception", + "//folly:portability", + "//folly:traits", + "//folly:utility", + "//folly/functional:invoke", + "//folly/lang:exception", + "//folly/lang:static_const", + ], +) + +cpp_library( + name = "range_common", + srcs = ["RangeCommon.cpp"], + headers = ["RangeCommon.h"], + undefined_symbols = True, # TODO(T23121628): fix deps and remove + deps = [ + "//folly/container:sparse_byte_set", + ], + exported_deps = [ + "//folly:likely", + ], +) + +cpp_library( + name = "range_sse42", + srcs = ["RangeSse42.cpp"], + headers = ["RangeSse42.h"], + undefined_symbols = True, # TODO(T23121628): fix deps and remove + deps = [ + ":sse", + "//folly:likely", + "//folly:portability", + ], + exported_deps = [ + ":range_common", + ], +) + +cpp_library( + name = "singleton", + headers = ["Singleton.h"], + exported_deps = [ + "//folly:traits", + ], +) + +cpp_library( + name = "slow_fingerprint", + headers = ["SlowFingerprint.h"], + exported_deps = [ + ":fingerprint_polynomial", + "//folly:fingerprint", + "//folly:range", + ], +) + +cpp_library( + name = "sse", + srcs = ["Sse.cpp"], + headers = ["Sse.h"], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "simd_char_platform", + headers = ["SimdCharPlatform.h"], + exported_deps = [ + ":simd_for_each", + "//folly:portability", + "//folly/lang:bits", + ], +) + +cpp_library( + name = "simd_any_of", + headers = ["SimdAnyOf.h"], + exported_deps = [ + ":simd_for_each", + ":unroll_utils", + "//folly:c_portability", + ], +) + +cpp_library( + name = "simd_for_each", + headers = ["SimdForEach.h"], + exported_deps = [ + ":unroll_utils", + "//folly:c_portability", + ], +) + +cpp_library( + name = "simple_simd_string_utils", + srcs = ["SimpleSimdStringUtils.cpp"], + headers = [ + "SimpleSimdStringUtils.h", + "SimpleSimdStringUtilsImpl.h", + ], + exported_deps = [ + ":simd_any_of", + ":simd_char_platform", + "//folly:range", + ], +) + +cpp_library( + name = "split_string_simd", + srcs = ["SplitStringSimd.cpp"], + headers = [ + "SplitStringSimd.h", + "SplitStringSimdImpl.h", + ], + deps = [ + "//folly:fbstring", + "//folly:fbvector", + "//folly:small_vector", + ], + exported_deps = [ + ":simd_char_platform", + ":simd_for_each", + "//folly:portability", + "//folly:range", + "//folly/lang:bits", + ], +) + +cpp_library( + name = "socket_fast_open", + srcs = ["SocketFastOpen.cpp"], + headers = ["SocketFastOpen.h"], + exported_deps = [ + "//folly/net:network_socket", + "//folly/portability:sockets", + ], +) + +cpp_library( + name = "static_singleton_manager", + srcs = ["StaticSingletonManager.cpp"], + headers = ["StaticSingletonManager.h"], + deps = [ + "//folly/memory:reentrant_allocator", + ], + exported_deps = [ + ":singleton", + "//folly:c_portability", + "//folly:indestructible", + "//folly:likely", + "//folly:utility", + "//folly/lang:thunk", + "//folly/lang:type_info", + ], +) + +cpp_library( + name = "thread_local_detail", + srcs = ["ThreadLocalDetail.cpp"], + headers = ["ThreadLocalDetail.h"], + deps = [ + "//folly/lang:hint", + "//folly/synchronization:call_once", + ], + exported_deps = [ + ":static_singleton_manager", + ":unique_instance", + "//folly:exception", + "//folly:function", + "//folly:map_util", + "//folly:portability", + "//folly:scope_guard", + "//folly:shared_mutex", + "//folly/container:foreach", + "//folly/lang:exception", + "//folly/memory:malloc", + "//folly/portability:pthread", + "//folly/synchronization:micro_spin_lock", + "//folly/synchronization:relaxed_atomic", + "//folly/system:at_fork", + "//folly/system:thread_id", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "turn_sequencer", + headers = ["TurnSequencer.h"], + exported_deps = [ + ":futex", + "//folly:portability", + "//folly/chrono:hardware", + "//folly/portability:asm", + "//folly/portability:unistd", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "typelist", + headers = ["TypeList.h"], + exported_deps = [ + "//folly:traits", + "//folly:utility", + ], +) + +cpp_library( + name = "unique_instance", + srcs = ["UniqueInstance.cpp"], + headers = ["UniqueInstance.h"], + deps = [ + "//folly:demangle", + "//folly/lang:exception", + ], + exported_deps = [ + ":static_singleton_manager", + "//folly:cpp_attributes", + ], +) + +cpp_library( + name = "unroll_utils", + headers = ["UnrollUtils.h"], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "traponavx512", + srcs = ["TrapOnAvx512.cpp"], + headers = ["TrapOnAvx512.h"], + arch_preprocessor_flags = { + "x86_64": [ + "-msse4.2", + "-mavx512f", + "-mavx512vl", + ], + }, + deps = [ + "//folly:portability", + ], +) diff --git a/folly/detail/base64_detail/BUCK b/folly/detail/base64_detail/BUCK new file mode 100644 index 00000000000..7d58d26b00c --- /dev/null +++ b/folly/detail/base64_detail/BUCK @@ -0,0 +1,102 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "base64_api", + srcs = ["Base64Api.cpp"], + headers = ["Base64Api.h"], + deps = [ + ":base64_sse4_2", + ":base64_swar", + "//folly:cpu_id", + ], + exported_deps = [ + ":base64_common", + ":base64_scalar", + "//folly:portability", + "//folly/portability:constexpr", + ], +) + +cpp_library( + name = "base64_common", + headers = ["Base64Common.h"], +) + +cpp_library( + name = "base64_constants", + headers = ["Base64Constants.h"], +) + +cpp_library( + name = "base64_hidden_constants", + headers = ["Base64HiddenConstants.h"], + exported_deps = [ + ":base64_constants", + ], +) + +cpp_library( + name = "base64_scalar", + headers = ["Base64Scalar.h"], + exported_deps = [ + ":base64_common", + ":base64_constants", + ], +) + +cpp_library( + name = "base64_simd", + headers = ["Base64Simd.h"], + exported_deps = [ + ":base64_common", + ":base64_constants", + ":base64_hidden_constants", + ":base64_scalar", + ":base64_swar", + "//folly:c_portability", + ], +) + +cpp_library( + name = "base64_sse4_2_platform", + headers = ["Base64_SSE4_2_Platform.h"], + exported_deps = [ + ":base64_hidden_constants", + "//folly:portability", + ], +) + +cpp_library( + name = "base64_sse4_2", + srcs = ["Base64_SSE4_2.cpp"], + headers = ["Base64_SSE4_2.h"], + compiler_flags = select({ + "DEFAULT": [], + "ovr_config//cpu:x86_64": ["-msse4.2"], + }), + deps = [ + ":base64_simd", + ":base64_sse4_2_platform", + ], + exported_deps = [ + ":base64_common", + "//folly:portability", + ], +) + +cpp_library( + name = "base64_swar", + srcs = ["Base64SWAR.cpp"], + headers = ["Base64SWAR.h"], + deps = [ + ":base64_constants", + ":base64_hidden_constants", + ":base64_scalar", + "//folly:portability", + ], + exported_deps = [ + ":base64_common", + ], +) diff --git a/folly/detail/base64_detail/tests/BUCK b/folly/detail/base64_detail/tests/BUCK new file mode 100644 index 00000000000..f881f822fdc --- /dev/null +++ b/folly/detail/base64_detail/tests/BUCK @@ -0,0 +1,36 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "base64_against_scalar_test", + srcs = ["Base64AgainstScalarTest.cpp"], + deps = [ + "//folly/detail/base64_detail:base64_common", + "//folly/detail/base64_detail:base64_scalar", + "//folly/detail/base64_detail:base64_sse4_2", + "//folly/detail/base64_detail:base64_swar", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "base64_platform_test", + srcs = ["Base64PlatformTest.cpp"], + deps = [ + "//folly/detail/base64_detail:base64_sse4_2_platform", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "base64_special_cases_test", + srcs = ["Base64SpecialCasesTest.cpp"], + deps = [ + "//folly/detail/base64_detail:base64_scalar", + "//folly/detail/base64_detail:base64_simd", + "//folly/detail/base64_detail:base64_sse4_2", + "//folly/portability:constexpr", + "//folly/portability:gtest", + ], +) diff --git a/folly/detail/test/BUCK b/folly/detail/test/BUCK new file mode 100644 index 00000000000..1590a027bd9 --- /dev/null +++ b/folly/detail/test/BUCK @@ -0,0 +1,153 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "async_trace_test", + srcs = ["AsyncTraceTest.cpp"], + deps = [ + "//folly/detail:async_trace", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "static_singleton_manager_test", + srcs = ["StaticSingletonManagerTest.cpp"], + supports_static_listing = False, + deps = [ + "//folly/detail:static_singleton_manager", + "//folly/lang:keep", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "unique_instance_test", + srcs = ["UniqueInstanceTest.cpp"], + deps = [ + "//folly:string", + "//folly:traits", + "//folly/detail:unique_instance", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "file_util_detail_test", + srcs = [ + "FileUtilDetailTest.cpp", + ], + deps = [ + "//folly/detail:file_util_detail", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "perf_scoped_test", + srcs = [ + "PerfScopedTest.cpp", + ], + deps = [ + "//folly/detail:perf_scoped", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/portability:unistd", + ], +) + +cpp_unittest( + name = "simd_any_of_test", + srcs = [ + "SimdAnyOfTest.cpp", + ], + deps = [ + "//folly:range", + "//folly/detail:simd_any_of", + "//folly/detail:simd_char_platform", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "simd_for_each_test", + srcs = [ + "SimdForEachTest.cpp", + ], + deps = [ + "//folly/detail:simd_for_each", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "simple_simd_string_utils_test", + srcs = [ + "SimpleSimdStringUtilsTest.cpp", + ], + deps = [ + "//folly/detail:simd_char_platform", + "//folly/detail:simple_simd_string_utils", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "split_string_simd_test", + srcs = [ + "SplitStringSimdTest.cpp", + ], + deps = [ + "//folly:fbstring", + "//folly:fbvector", + "//folly:range", + "//folly:small_vector", + "//folly/detail:split_string_simd", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "unroll_utils_test", + srcs = [ + "UnrollUtilsTest.cpp", + ], + deps = [ + "//folly/detail:unroll_utils", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "thread_local_detail_test", + srcs = [ + "ThreadLocalDetailTest.cpp", + ], + deps = [ + "//folly:synchronized", + "//folly:thread_local", + "//folly/portability:gtest", + "//folly/synchronization/test:barrier", + ], +) + +cpp_benchmark( + name = "thread_local_benchmark", + srcs = ["ThreadLocalBenchmark.cpp"], + deps = [ + "//folly:benchmark", + "//folly:thread_local", + "//folly/synchronization/test:barrier", + ], +) + +cpp_unittest( + name = "traponavx512_test_negative", + srcs = ["TrapOnAvx512TestNegative.cpp"], + deps = [ + "//folly/detail:traponavx512", + "//folly/portability:gtest", + ], +) diff --git a/folly/docs/BUCK b/folly/docs/BUCK new file mode 100644 index 00000000000..0f0fc4932d9 --- /dev/null +++ b/folly/docs/BUCK @@ -0,0 +1,48 @@ +load("//folly/docs:defs.bzl", "copy", "html") + +# +# Actual listing of source files +# + +oncall("fbcode_entropy_wardens_folly") + +html("AtomicHashMap.md") + +html("Benchmark.md") + +html("Conv.md") + +html("Dynamic.md") + +html("FBString.md") + +html( + "FBVector.md", + support = ["Fbvector--graphical_solutions.png"], +) + +html("Format.md") + +html("GroupVarint.md") + +html("Histogram.md") + +html("PackedSyncPtr.md") + +html("Poly.md") + +html("ProducerConsumerQueue.md") + +html("SmallLocks.md") + +html("small_vector.md") + +html("Synchronized.md") + +html("ThreadCachedInt.md") + +html("ThreadLocal.md") + +html("Traits.md") + +copy("style.css") diff --git a/folly/docs/defs.bzl b/folly/docs/defs.bzl new file mode 100644 index 00000000000..dbc28b1f88f --- /dev/null +++ b/folly/docs/defs.bzl @@ -0,0 +1,40 @@ +load("@bazel_skylib//lib:paths.bzl", "paths") +load("@bazel_skylib//lib:shell.bzl", "shell") +load("@fbcode_macros//build_defs:custom_rule.bzl", "custom_rule") + +# +# Helper functions to emit fbconfig rules +# + +# Helper function to copy a file to the output directory +def copy(path): + custom_rule( + name = path, + srcs = [path], + build_args = shell.quote(path), + build_script_dep = "//folly/docs/facebook:copy.py", + output_gen_files = [path], + strict = False, # Remove (https://fburl.com/strict-custom-rules) + ) + +# Helper function to define a custom_rule() that will emit the HTML output. +def html(src, support = None, style = "style.css", copy_support = True): + html = paths.split_extension(src)[0] + ".html" + + if support == None: + support = [] + + custom_rule( + name = html, + srcs = [src, style] + support, + build_args = + "--style %s %s" % (shell.quote(style), shell.quote(src)) + + " --pandoc-path $(exe fbsource//third-party/stackage-lts:pandoc)", + build_script_dep = "//folly/docs/facebook:build_html.py", + output_gen_files = [html], + strict = False, # Remove (https://fburl.com/strict-custom-rules) + ) + + if copy_support: + for path in support: + copy(path) diff --git a/folly/docs/examples/folly/BUCK b/folly/docs/examples/folly/BUCK new file mode 100644 index 00000000000..2be0e666d36 --- /dev/null +++ b/folly/docs/examples/folly/BUCK @@ -0,0 +1,195 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "baton_demo", + srcs = ["synchronization/Baton.cpp"], + headers = [], + deps = [ + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "dynamic_demo", + srcs = ["dynamic.cpp"], + headers = [], + deps = [ + "//folly/json:dynamic", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "dynamic_converter_demo", + srcs = ["DynamicConverter.cpp"], + headers = [], + deps = [ + "//folly/json:dynamic", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "executor_guide", + srcs = ["ExecutorGuide.cpp"], + headers = [], + deps = [ + "//folly:executor", + "//folly/executors:manual_executor", + "//folly/experimental/coro:baton", + "//folly/experimental/coro:task", + "//folly/futures:core", + ], +) + +cpp_unittest( + name = "file_demo", + srcs = ["File.cpp"], + headers = [], + deps = [ + "//folly:file", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "format_demo", + srcs = ["Format.cpp"], + headers = [], + deps = [ + "//folly:format", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "likely_demo", + srcs = ["Likely.cpp"], + headers = [], + deps = [ + "//folly:likely", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "function_demo", + srcs = ["Function.cpp"], + headers = [], + deps = [ + "//folly:function", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "map_util_demo", + srcs = ["MapUtil.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "//folly:map_util", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "scope_guard2_demo", + srcs = ["ScopeGuard2.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "//folly:scope_guard", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "scope_guard_demo", + srcs = ["ScopeGuard.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "//folly:scope_guard", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "synchronized_demo", + srcs = ["Synchronized.cpp"], + headers = [], + deps = [ + "//folly:synchronized", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "ipaddress_demo", + srcs = ["ipaddress.cpp"], + headers = [], + deps = [ + "//folly:network_address", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "scoped_event_base_thread_demo", + srcs = ["ScopedEventBaseThread.cpp"], + headers = [], + deps = [ + "//folly/io/async:scoped_event_base_thread", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "scoped_event_base_thread2_demo", + srcs = ["ScopedEventBaseThread2.cpp"], + headers = [], + deps = [ + "//folly:optional", + "//folly/io/async:event_base_manager", + "//folly/io/async:scoped_event_base_thread", + "//folly/portability:gtest", + "//folly/synchronization:baton", + "//folly/system:thread_name", + ], +) + +cpp_unittest( + name = "cancellation_token_demo", + srcs = ["CancellationToken.cpp"], + headers = [], + deps = [ + "//folly:cancellation_token", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "cancellation_source_demo", + srcs = ["CancellationSource.cpp"], + headers = [], + deps = [ + "//folly:cancellation_token", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "cancellation_callback_demo", + srcs = ["CancellationCallback.cpp"], + headers = [], + deps = [ + "//folly:cancellation_token", + "//folly/portability:gtest", + ], +) diff --git a/folly/docs/examples/folly/container/BUCK b/folly/docs/examples/folly/container/BUCK new file mode 100644 index 00000000000..be1ce145a91 --- /dev/null +++ b/folly/docs/examples/folly/container/BUCK @@ -0,0 +1,13 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "array_demo", + srcs = ["Array.cpp"], + headers = [], + deps = [ + "//folly/container:array", + "//folly/portability:gtest", + ], +) diff --git a/folly/docs/examples/folly/dynamic/BUCK b/folly/docs/examples/folly/dynamic/BUCK new file mode 100644 index 00000000000..a6cd4e833e3 --- /dev/null +++ b/folly/docs/examples/folly/dynamic/BUCK @@ -0,0 +1,23 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "array_demo", + srcs = ["array.cpp"], + headers = [], + deps = [ + "//folly/json:dynamic", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "object_demo", + srcs = ["object.cpp"], + headers = [], + deps = [ + "//folly/json:dynamic", + "//folly/portability:gtest", + ], +) diff --git a/folly/docs/examples/folly/experimental/coro/BUCK b/folly/docs/examples/folly/experimental/coro/BUCK new file mode 100644 index 00000000000..271c3ccf6b7 --- /dev/null +++ b/folly/docs/examples/folly/experimental/coro/BUCK @@ -0,0 +1,90 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "promise_demo", + srcs = ["Promise.cpp"], + headers = [], + deps = [ + "//folly/experimental/coro:gtest_helpers", + "//folly/experimental/coro:promise", + "//folly/experimental/coro:task", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "detach_on_cancel_demo", + srcs = ["DetachOnCancel.cpp"], + headers = [], + deps = [ + "//folly/experimental/coro:detach_on_cancel", + "//folly/experimental/coro:gtest_helpers", + "//folly/experimental/coro:promise", + "//folly/experimental/coro:task", + "//folly/experimental/coro:timeout", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "with_cancellation_demo", + srcs = ["WithCancellation.cpp"], + headers = [], + deps = [ + "//folly:cancellation_token", + "//folly/experimental/coro:gtest_helpers", + "//folly/experimental/coro:sleep", + "//folly/experimental/coro:task", + "//folly/experimental/coro:timeout", + "//folly/experimental/coro:with_cancellation", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "async_scope_demo", + srcs = ["AsyncScope.cpp"], + headers = [], + deps = [ + "//folly/executors:global_executor", + "//folly/experimental/coro:async_scope", + "//folly/experimental/coro:gtest_helpers", + ], +) + +cpp_unittest( + name = "cancellable_async_scope_demo", + srcs = ["CancellableAsyncScope.cpp"], + headers = [], + deps = [ + "//folly/executors:global_executor", + "//folly/experimental/coro:async_scope", + "//folly/experimental/coro:gtest_helpers", + ], +) + +cpp_unittest( + name = "task_demo", + srcs = ["Task.cpp"], + headers = [], + deps = [ + "//folly/executors:global_executor", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:task", + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "retry_demo", + srcs = ["Retry.cpp"], + headers = [], + deps = [ + "//folly/experimental/coro:gtest_helpers", + "//folly/experimental/coro:retry", + "//folly/portability:gtest", + ], +) diff --git a/folly/docs/examples/folly/hash/BUCK b/folly/docs/examples/folly/hash/BUCK new file mode 100644 index 00000000000..b346cc626ef --- /dev/null +++ b/folly/docs/examples/folly/hash/BUCK @@ -0,0 +1,13 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "hash_demo", + srcs = ["Hash.cpp"], + headers = [], + deps = [ + "//folly/hash:hash", + "//folly/portability:gtest", + ], +) diff --git a/folly/docs/examples/folly/io/BUCK b/folly/docs/examples/folly/io/BUCK new file mode 100644 index 00000000000..767c00e2178 --- /dev/null +++ b/folly/docs/examples/folly/io/BUCK @@ -0,0 +1,13 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "i_o_buf_demo", + srcs = ["IOBuf.cpp"], + headers = [], + deps = [ + "//folly/io:iobuf", + "//folly/portability:gtest", + ], +) diff --git a/folly/docs/examples/folly/test/BUCK b/folly/docs/examples/folly/test/BUCK new file mode 100644 index 00000000000..efc01ac24e2 --- /dev/null +++ b/folly/docs/examples/folly/test/BUCK @@ -0,0 +1,13 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "test_util_demo", + srcs = ["TestUtils.cpp"], + headers = [], + deps = [ + "//folly/portability:gtest", + "//folly/test:test_utils", + ], +) diff --git a/folly/docs/facebook/BUCK b/folly/docs/facebook/BUCK new file mode 100644 index 00000000000..8707f8cad10 --- /dev/null +++ b/folly/docs/facebook/BUCK @@ -0,0 +1,13 @@ +load("@fbcode_macros//build_defs:native_rules.bzl", "buck_sh_binary") + +oncall("fbcode_entropy_wardens_folly") + +buck_sh_binary( + name = "build_html.py", + main = "build_html.py", +) + +buck_sh_binary( + name = "copy.py", + main = "copy.py", +) diff --git a/folly/executors/BUCK b/folly/executors/BUCK new file mode 100644 index 00000000000..fbc913d0c2e --- /dev/null +++ b/folly/executors/BUCK @@ -0,0 +1,425 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "executors", + exported_deps = [ + ":async", # @manual + ":cpu_thread_pool_executor", # @manual + ":fiber_io_executor", # @manual + ":future_executor", # @manual + ":global_executor", # @manual + ":io_executor", # @manual + ":io_object_cache", # @manual + ":io_thread_pool_executor", # @manual + ":serial_executor", # @manual + ":thread_pool_executor", # @manual + ":threaded_executor", # @manual + "//folly/executors/task_queue:blocking_queue", # @manual + "//folly/executors/task_queue:lifo_sem_mpmc_queue", # @manual + "//folly/executors/task_queue:priority_lifo_sem_mpmc_queue", # @manual + "//folly/executors/task_queue:unbounded_blocking_queue", # @manual + "//folly/executors/thread_factory:named_thread_factory", # @manual + "//folly/executors/thread_factory:priority_thread_factory", # @manual + "//folly/executors/thread_factory:thread_factory", # @manual + ], +) + +cpp_library( + name = "async", + headers = ["Async.h"], + exported_deps = [ + ":global_executor", + "//folly/futures:core", + ], +) + +cpp_library( + name = "codel", + srcs = ["Codel.cpp"], + headers = ["Codel.h"], + deps = [ + "//folly/portability:gflags", + ], +) + +cpp_library( + name = "cpu_thread_pool_executor", + srcs = ["CPUThreadPoolExecutor.cpp"], + headers = ["CPUThreadPoolExecutor.h"], + deps = [ + "//folly:executor", + "//folly:memory", + "//folly:optional", + "//folly/executors/task_queue:priority_lifo_sem_mpmc_queue", + "//folly/executors/task_queue:priority_unbounded_blocking_queue", + "//folly/executors/task_queue:unbounded_blocking_queue", + "//folly/portability:gflags", + "//folly/synchronization:throttled_lifo_sem", + ], + exported_deps = [ + ":queue_observer", + ":thread_pool_executor", + ], +) + +cpp_library( + name = "drivable_executor", + headers = ["DrivableExecutor.h"], + exported_deps = [ + "//folly:executor", + ], +) + +cpp_library( + name = "edf_thread_pool_executor", + srcs = ["EDFThreadPoolExecutor.cpp"], + headers = ["EDFThreadPoolExecutor.h"], + deps = [ + "//folly:scope_guard", + "//folly/concurrency:process_local_unique_id", + "//folly/synchronization:lifo_sem", + "//folly/synchronization:throttled_lifo_sem", + "//folly/tracing:static_tracepoint", + ], + exported_deps = [ + ":soft_real_time_executor", + ":thread_pool_executor", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "fiber_io_executor", + headers = ["FiberIOExecutor.h"], + exported_deps = [ + ":io_executor", + "//folly/fibers:fiber_manager_map", + ], +) + +cpp_library( + name = "future_executor", + headers = ["FutureExecutor.h"], + exported_deps = [ + "//folly/functional:invoke", + "//folly/futures:core", + ], +) + +cpp_library( + name = "global_executor", + srcs = ["GlobalExecutor.cpp"], + headers = ["GlobalExecutor.h"], + deps = [ + ":cpu_thread_pool_executor", + ":inline_executor", + ":io_thread_pool_executor", + "//folly:function", + "//folly:shared_mutex", + "//folly:singleton", + "//folly/detail:async_trace", + "//folly/system:hardware_concurrency", + ], + exported_deps = [ + ":io_executor", + "//folly:executor", + "//folly/portability:gflags", + ], +) + +cpp_library( + name = "global_thread_pool_list", + srcs = ["GlobalThreadPoolList.cpp"], + headers = ["GlobalThreadPoolList.h"], + deps = [ + "//folly:cpp_attributes", + "//folly/system:thread_id", + ], + exported_deps = [ + "//folly:indestructible", + "//folly:synchronized", + "//folly:thread_local", + ], +) + +cpp_library( + name = "inline_executor", + srcs = ["InlineExecutor.cpp"], + headers = ["InlineExecutor.h"], + deps = [ + "//folly:indestructible", + ], + exported_deps = [ + "//folly:c_portability", + "//folly:cpp_attributes", + "//folly:executor", + ], +) + +cpp_library( + name = "manual_executor", + srcs = ["ManualExecutor.cpp"], + headers = ["ManualExecutor.h"], + exported_deps = [ + "//folly/executors:drivable_executor", + "//folly/executors:scheduled_executor", + "//folly/executors:sequenced_executor", + "//folly/synchronization:lifo_sem", + ], +) + +cpp_library( + name = "io_executor", + headers = ["IOExecutor.h"], + exported_deps = [ + "//folly:executor", + ], +) + +cpp_library( + name = "io_object_cache", + headers = ["IOObjectCache.h"], + exported_deps = [ + ":global_executor", + "//folly:thread_local", + "//folly/io/async:async_base", + ], +) + +cpp_library( + name = "io_thread_pool_executor", + srcs = ["IOThreadPoolExecutor.cpp"], + headers = ["IOThreadPoolExecutor.h"], + deps = [ + "//folly/detail:memory_idler", + "//folly/portability:gflags", + ], + exported_deps = [ + ":io_executor", + ":queue_observer", + ":thread_pool_executor", + "//folly:portability", + "//folly/io/async:event_base_manager", + "//folly/synchronization:relaxed_atomic", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "soft_real_time_executor", + srcs = ["SoftRealTimeExecutor.cpp"], + headers = ["SoftRealTimeExecutor.h"], + exported_deps = [ + "//folly:executor", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "scheduled_executor", + headers = ["ScheduledExecutor.h"], + exported_deps = [ + "//folly:executor", + "//folly/lang:exception", + ], +) + +cpp_library( + name = "serial_executor", + headers = [ + "SerialExecutor.h", + "SerialExecutor-inl.h", + ], + exported_deps = [ + ":global_executor", + ":serialized_executor", + "//folly:exception_string", + "//folly/concurrency:unbounded_queue", + "//folly/io/async:request_context", + "//folly/synchronization:distributed_mutex", + "//folly/synchronization:relaxed_atomic", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "sequenced_executor", + headers = ["SequencedExecutor.h"], + exported_deps = [ + "//folly:executor", + ], +) + +cpp_library( + name = "serialized_executor", + headers = ["SerializedExecutor.h"], + exported_deps = [ + ":sequenced_executor", + ], +) + +cpp_library( + name = "strand_executor", + srcs = ["StrandExecutor.cpp"], + headers = ["StrandExecutor.h"], + deps = [ + ":global_executor", + "//folly:exception_string", + ], + exported_deps = [ + ":serialized_executor", + "//folly:optional", + "//folly/concurrency:unbounded_queue", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "thread_pool_executor", + srcs = ["ThreadPoolExecutor.cpp"], + headers = ["ThreadPoolExecutor.h"], + deps = [ + "//folly/concurrency:process_local_unique_id", + "//folly/portability:pthread", + "//folly/synchronization:asymmetric_thread_fence", + "//folly/tracing:static_tracepoint", + ], + exported_deps = [ + ":global_thread_pool_list", + "//folly:default_keep_alive_executor", + "//folly:memory", + "//folly:shared_mutex", + "//folly/executors/task_queue:lifo_sem_mpmc_queue", + "//folly/executors/thread_factory:named_thread_factory", + "//folly/io/async:request_context", + "//folly/portability:gflags", + "//folly/synchronization:atomic_struct", + "//folly/synchronization:baton", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "threaded_executor", + srcs = ["ThreadedExecutor.cpp"], + headers = ["ThreadedExecutor.h"], + deps = [ + "//folly:scope_guard", + "//folly/executors/thread_factory:named_thread_factory", + "//folly/system:thread_name", + ], + exported_deps = [ + "//folly:executor", + "//folly/concurrency:unbounded_queue", + "//folly/container:f14_hash", + "//folly/executors/thread_factory:thread_factory", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "timed_drivable_executor", + srcs = ["TimedDrivableExecutor.cpp"], + headers = ["TimedDrivableExecutor.h"], + exported_deps = [ + ":drivable_executor", + "//folly/concurrency:unbounded_queue", + ], +) + +cpp_library( + name = "timekeeper_scheduled_executor", + srcs = ["TimekeeperScheduledExecutor.cpp"], + headers = ["TimekeeperScheduledExecutor.h"], + exported_deps = [ + ":scheduled_executor", + "//folly/futures:core", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "queued_immediate_executor", + srcs = ["QueuedImmediateExecutor.cpp"], + headers = ["QueuedImmediateExecutor.h"], + deps = [ + "//folly:indestructible", + ], + exported_deps = [ + ":inline_executor", + "//folly:executor", + "//folly:thread_local", + ], +) + +cpp_library( + name = "executor_with_priority", + srcs = ["ExecutorWithPriority.cpp"], + headers = [ + "ExecutorWithPriority.h", + "ExecutorWithPriority-inl.h", + ], + exported_deps = [ + "//folly:executor", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "metered_executor", + headers = [ + "MeteredExecutor.h", + "MeteredExecutor-inl.h", + ], + exported_deps = [ + ":queue_observer", + "//folly:default_keep_alive_executor", + "//folly/io/async:async_base", + ], +) + +cpp_library( + name = "io_thread_pool_deadlock_detector_observer", + srcs = ["IOThreadPoolDeadlockDetectorObserver.cpp"], + headers = ["IOThreadPoolDeadlockDetectorObserver.h"], + exported_deps = [ + "//folly:singleton", + "//folly/concurrency:deadlock_detector", + "//folly/executors:io_thread_pool_executor", + "//folly/executors:thread_pool_executor", + ], +) + +cpp_library( + name = "queue_observer", + srcs = ["QueueObserver.cpp"], + headers = [ + "QueueObserver.h", + ], + exported_deps = [ + "//folly:function", + "//folly:portability", + "//folly:synchronized", + "//folly/portability:sys_types", + ], +) diff --git a/folly/executors/task_queue/BUCK b/folly/executors/task_queue/BUCK new file mode 100644 index 00000000000..af17f2065ce --- /dev/null +++ b/folly/executors/task_queue/BUCK @@ -0,0 +1,63 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "blocking_queue", + headers = ["BlockingQueue.h"], + exported_deps = [ + "//folly:c_portability", + "//folly:optional", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "lifo_sem_mpmc_queue", + headers = ["LifoSemMPMCQueue.h"], + exported_deps = [ + ":blocking_queue", + "//folly:mpmc_queue", + "//folly/synchronization:lifo_sem", + ], +) + +cpp_library( + name = "priority_lifo_sem_mpmc_queue", + headers = ["PriorityLifoSemMPMCQueue.h"], + exported_deps = [ + ":blocking_queue", + "//folly:executor", + "//folly:mpmc_queue", + "//folly:range", + "//folly/synchronization:lifo_sem", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "priority_unbounded_blocking_queue", + headers = ["PriorityUnboundedBlockingQueue.h"], + exported_deps = [ + ":blocking_queue", + "//folly:constexpr_math", + "//folly:executor", + "//folly/concurrency:priority_unbounded_queue_set", + "//folly/lang:exception", + "//folly/synchronization:lifo_sem", + ], +) + +cpp_library( + name = "unbounded_blocking_queue", + headers = ["UnboundedBlockingQueue.h"], + exported_deps = [ + ":blocking_queue", + "//folly/concurrency:unbounded_queue", + "//folly/synchronization:lifo_sem", + ], +) diff --git a/folly/executors/task_queue/test/BUCK b/folly/executors/task_queue/test/BUCK new file mode 100644 index 00000000000..3e65b5ff4c1 --- /dev/null +++ b/folly/executors/task_queue/test/BUCK @@ -0,0 +1,50 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_benchmark( + name = "UnboundedBlockingQueueBench", + srcs = ["UnboundedBlockingQueueBench.cpp"], + deps = [ + "//folly:benchmark", + "//folly/executors/task_queue:unbounded_blocking_queue", + "//folly/init:init", + ], + external_deps = [ + "glog", + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "PriorityUnboundedBlockingQueueTest", + srcs = ["PriorityUnboundedBlockingQueueTest.cpp"], + deps = [ + "//folly/container:enumerate", + "//folly/executors/task_queue:priority_unbounded_blocking_queue", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "UnboundedBlockingQueueTest", + srcs = ["UnboundedBlockingQueueTest.cpp"], + deps = [ + "//folly/executors/task_queue:unbounded_blocking_queue", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "PriorityLifoSemMPMCQueueTest", + srcs = ["PriorityLifoSemMPMCQueueTest.cpp"], + deps = [ + "//folly:range", + "//folly/container:enumerate", + "//folly/executors/task_queue:priority_lifo_sem_mpmc_queue", + "//folly/portability:gtest", + ], +) diff --git a/folly/executors/test/BUCK b/folly/executors/test/BUCK new file mode 100644 index 00000000000..d8cfaec3cd9 --- /dev/null +++ b/folly/executors/test/BUCK @@ -0,0 +1,299 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "AsyncTest", + srcs = ["AsyncTest.cpp"], + deps = [ + "//folly/executors:async", + "//folly/executors:manual_executor", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "CodelTest", + srcs = ["CodelTest.cpp"], + deps = [ + "//folly/executors:codel", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "EDFThreadPoolExecutorBenchmark", + srcs = ["EDFThreadPoolExecutorBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:benchmark_util", + "//folly:mpmc_queue", + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:edf_thread_pool_executor", + "//folly/executors:soft_real_time_executor", + "//folly/executors:thread_pool_executor", + ], +) + +cpp_unittest( + name = "FiberIOExecutorTest", + srcs = ["FiberIOExecutorTest.cpp"], + deps = [ + "//folly/executors:fiber_io_executor", + "//folly/executors:io_thread_pool_executor", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "executor_test", + srcs = ["ExecutorTest.cpp"], + deps = [ + "//folly/executors:inline_executor", + "//folly/executors:manual_executor", + "//folly/executors:queued_immediate_executor", + "//folly/futures:core", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "GlobalExecutorTest", + srcs = ["GlobalExecutorTest.cpp"], + deps = [ + "//folly:virtual_executor", + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:global_executor", + "//folly/executors:io_executor", + "//folly/executors:io_thread_pool_executor", + "//folly/portability:gtest", + "//folly/synchronization:baton", + "//folly/synchronization:saturating_semaphore", + "//folly/system:hardware_concurrency", + ], +) + +cpp_unittest( + name = "GlobalCPUExecutorTest", + srcs = ["GlobalCPUExecutorTest.cpp"], + deps = [ + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:global_executor", + "//folly/executors:io_executor", + "//folly/executors:io_thread_pool_executor", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "GlobalIOExecutorTest", + srcs = ["GlobalCPUExecutorTest.cpp"], + deps = [ + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:global_executor", + "//folly/executors:io_executor", + "//folly/executors:io_thread_pool_executor", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "GlobalExecutorAssignmentTest", + srcs = ["GlobalExecutorAssignmentTest.cpp"], + deps = [ + "//folly:singleton", + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:global_executor", + "//folly/executors:inline_executor", + "//folly/executors:io_executor", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "SerialExecutorTest", + srcs = ["SerialExecutorTest.cpp"], + deps = [ + "//folly:random", + "//folly:scope_guard", + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:inline_executor", + "//folly/executors:serial_executor", + "//folly/io/async:request_context", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "SequencedExecutorTest", + srcs = ["SequencedExecutorTest.cpp"], + deps = [ + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:serial_executor", + "//folly/io/async:scoped_event_base_thread", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "StrandExecutorTest", + srcs = ["StrandExecutorTest.cpp"], + deps = [ + "//folly:cancellation_token", + "//folly/executors:global_executor", + "//folly/executors:manual_executor", + "//folly/executors:strand_executor", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "ThreadedExecutorTest", + srcs = ["ThreadedExecutorTest.cpp"], + deps = [ + "//folly:conv", + "//folly/executors:threaded_executor", + "//folly/futures:core", + "//folly/gen:base", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "ThreadPoolExecutorTest", + srcs = ["ThreadPoolExecutorTest.cpp"], + deps = [ + "//folly:c_portability", + "//folly:default_keep_alive_executor", + "//folly:exception", + "//folly:virtual_executor", + "//folly/container:f14_hash", + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:edf_thread_pool_executor", + "//folly/executors:future_executor", + "//folly/executors:io_thread_pool_executor", + "//folly/executors:thread_pool_executor", + "//folly/executors/task_queue:lifo_sem_mpmc_queue", + "//folly/executors/task_queue:unbounded_blocking_queue", + "//folly/executors/thread_factory:init_thread_factory", + "//folly/executors/thread_factory:priority_thread_factory", + "//folly/lang:keep", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/portability:pthread", + "//folly/portability:sys_resource", + "//folly/synchronization:latch", + "//folly/synchronization/detail:spin", + "//folly/system:thread_id", + ], + external_deps = [ + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "TimedDrivableExecutorTest", + srcs = ["TimedDrivableExecutorTest.cpp"], + deps = [ + "//folly/executors:timed_drivable_executor", + "//folly/futures:core", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "TimekeeperScheduledExecutorTest", + srcs = ["TimekeeperScheduledExecutorTest.cpp"], + deps = [ + "//folly/executors:inline_executor", + "//folly/executors:serial_executor", + "//folly/executors:threaded_executor", + "//folly/executors:timekeeper_scheduled_executor", + "//folly/futures:manual_timekeeper", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "ExecutorWithPriorityTest", + srcs = ["ExecutorWithPriorityTest.cpp"], + deps = [ + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:executor_with_priority", + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "MeteredExecutorTest", + srcs = ["MeteredExecutorTest.cpp"], + supports_static_listing = False, + deps = [ + "//folly:synchronized", + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:metered_executor", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:task", + "//folly/portability:gtest", + "//folly/synchronization:baton", + "//folly/synchronization:lifo_sem", + "//folly/test:deterministic_schedule", + ], +) + +cpp_unittest( + name = "IOThreadPoolDeadlockDetectorObserverTest", + srcs = ["IOThreadPoolDeadlockDetectorObserverTest.cpp"], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly/concurrency:deadlock_detector", + "//folly/executors:io_thread_pool_deadlock_detector_observer", + "//folly/executors:io_thread_pool_executor", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "IOThreadPoolExecutorBaseTestLib", + headers = [ + "IOThreadPoolExecutorBaseTestLib.h", + ], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:random", + "//folly/container:f14_hash", + "//folly/executors:io_thread_pool_executor", + "//folly/io/async:async_base", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "IOThreadPoolExecutorTest", + srcs = ["IOThreadPoolExecutorTest.cpp"], + supports_static_listing = False, + deps = [ + ":IOThreadPoolExecutorBaseTestLib", + "//folly/executors:io_thread_pool_executor", + ], +) diff --git a/folly/executors/thread_factory/BUCK b/folly/executors/thread_factory/BUCK new file mode 100644 index 00000000000..ed91afa590e --- /dev/null +++ b/folly/executors/thread_factory/BUCK @@ -0,0 +1,47 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "named_thread_factory", + headers = ["NamedThreadFactory.h"], + exported_deps = [ + ":thread_factory", + "//folly:conv", + "//folly:range", + "//folly/system:thread_name", + ], +) + +cpp_library( + name = "priority_thread_factory", + srcs = ["PriorityThreadFactory.cpp"], + deps = [ + "//folly:string", + "//folly/portability:sys_resource", + "//folly/portability:sys_time", + ], + exported_deps = [ + ":init_thread_factory", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "init_thread_factory", + headers = ["InitThreadFactory.h"], + exported_deps = [ + ":thread_factory", + "//folly:scope_guard", + ], +) + +cpp_library( + name = "thread_factory", + headers = ["ThreadFactory.h"], + exported_deps = [ + "//folly:executor", + ], +) diff --git a/folly/experimental/BUCK b/folly/experimental/BUCK new file mode 100644 index 00000000000..77e40f2aa6f --- /dev/null +++ b/folly/experimental/BUCK @@ -0,0 +1,464 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "atomic_read_mostly_main_ptr", + srcs = [ + "AtomicReadMostlyMainPtr.cpp", + ], + headers = [ + "AtomicReadMostlyMainPtr.h", + ], + deps = [ + "//folly/executors:inline_executor", + ], + exported_deps = [ + ":read_mostly_shared_ptr", + "//folly:indestructible", + "//folly/synchronization:rcu", + ], +) + +cpp_library( + name = "auto_timer", + headers = ["AutoTimer.h"], + exported_deps = [ + "//folly:conv", + "//folly:format", + "//folly:optional", + "//folly:string", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "bit_vector_coding", + headers = ["BitVectorCoding.h"], + exported_deps = [ + ":bits", + ":coding_detail", + ":instructions", + ":select64", + "//folly:likely", + "//folly:portability", + "//folly:range", + "//folly/lang:bits", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "bits", + headers = ["Bits.h"], + exported_deps = [ + "//folly:portability", + "//folly:range", + "//folly/lang:bits", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "coding_detail", + headers = ["CodingDetail.h"], +) + +cpp_library( + name = "dynamic_parser", + headers = [ + "DynamicParser.h", + "DynamicParser-inl.h", + ], + exported_deps = [ + "//folly/json:dynamic_parser", + ], +) + +cpp_library( + name = "elias_fano_coding", + headers = ["EliasFanoCoding.h"], + exported_deps = [ + ":coding_detail", + ":instructions", + ":select64", + "//folly:likely", + "//folly:portability", + "//folly:range", + "//folly/lang:assume", + "//folly/lang:bits", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "env_util", + srcs = ["EnvUtil.cpp"], + headers = ["EnvUtil.h"], + deps = [ + "//folly:string", + "//folly/portability:stdlib", + "//folly/portability:unistd", + ], + exported_deps = [ + "//folly:c_portability", + "//folly:memory", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "event_count", + headers = ["EventCount.h"], + exported_deps = [ + "//folly:likely", + "//folly/detail:futex", + "//folly/lang:bits", + "//folly/portability:sys_time", + "//folly/portability:unistd", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "execution_observer", + srcs = ["ExecutionObserver.cpp"], + headers = ["ExecutionObserver.h"], + deps = [ + "//folly/tracing:static_tracepoint", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "flat_combining_priority_queue", + headers = ["FlatCombiningPriorityQueue.h"], + exported_deps = [ + "//folly:optional", + "//folly/detail:futex", + "//folly/experimental/flat_combining:flat_combining", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "relaxed_concurrent_priority_queue", + headers = [ + "RelaxedConcurrentPriorityQueue.h", + ], + exported_deps = [ + "//folly:random", + "//folly:spin_lock", + "//folly:thread_local", + "//folly/detail:futex", + "//folly/lang:align", + "//folly/synchronization:hazptr", + "//folly/synchronization:wait_options", + "//folly/synchronization/detail:spin", + ], +) + +cpp_library( + name = "function_scheduler", + srcs = ["FunctionScheduler.cpp"], + headers = ["FunctionScheduler.h"], + deps = [ + "//folly:conv", + "//folly:random", + "//folly:string", + "//folly/system:thread_name", + ], + exported_deps = [ + "//folly:function", + "//folly:range", + "//folly/container:f14_hash", + "//folly/hash:hash", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "future_dag", + headers = ["FutureDAG.h"], + exported_deps = [ + "//folly:executor", + "//folly/futures:core", + "//folly/futures:shared_promise", + ], +) + +cpp_library( + name = "instructions", + headers = ["Instructions.h"], + exported_deps = [ + "//folly:cpu_id", + "//folly:portability", + "//folly/lang:assume", + "//folly/portability:builtins", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "jemalloc_nodump_allocator", + headers = [ + "JemallocNodumpAllocator.h", + ], + exported_deps = [ + "//folly/memory:jemalloc_nodump_allocator", + ], +) + +cpp_library( + name = "jemalloc_huge_page_allocator", + headers = [ + "JemallocHugePageAllocator.h", + ], + exported_deps = [ + "//folly/memory:jemalloc_huge_page_allocator", + ], +) + +cpp_library( + name = "json_schema", + headers = [ + "JSONSchema.h", + ], + exported_deps = [ + "//folly/json:json_schema", + ], +) + +cpp_library( + name = "lock_free_ring_buffer", + headers = ["LockFreeRingBuffer.h"], + exported_deps = [ + "//folly:portability", + "//folly:traits", + "//folly/detail:turn_sequencer", + "//folly/portability:unistd", + "//folly/synchronization:sanitize_thread", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "cleanup", + headers = ["Cleanup.h"], + exported_deps = [ + "//folly/futures:core", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "primary_ptr", + headers = ["PrimaryPtr.h"], + exported_deps = [ + ":cleanup", + "//folly:function", + "//folly/futures:core", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "program_options", + headers = [ + "NestedCommandLineApp.h", + "ProgramOptions.h", + ], + exported_deps = [ + "//folly/cli:program_options", + ], +) + +cpp_library( + name = "read_mostly_shared_ptr", + headers = ["ReadMostlySharedPtr.h"], + exported_deps = [ + ":tl_ref_count", + "//folly:function", + ], +) + +cpp_library( + name = "select64", + srcs = ["Select64.cpp"], + headers = ["Select64.h"], + deps = [ + "//folly:constexpr_math", + "//folly:utility", + ], + exported_deps = [ + ":instructions", + "//folly:portability", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "single_writer_fixed_hash_map", + headers = [ + "SingleWriterFixedHashMap.h", + ], + exported_deps = [ + "//folly/lang:bits", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "singleton_relaxed_counter", + headers = [ + "SingletonRelaxedCounter.h", + ], + exported_deps = [ + "//folly:likely", + "//folly:portability", + "//folly:synchronized", + "//folly:utility", + "//folly/detail:static_singleton_manager", + "//folly/detail:thread_local_detail", + ], +) + +cpp_library( + name = "test_util", + srcs = ["TestUtil.cpp"], + headers = ["TestUtil.h"], + deps = [ + "//folly:exception", + "//folly:file", + "//folly:file_util", + "//folly:memory", + "//folly:string", + "//folly/ext:test_ext", + "//folly/facebook:test_ext", + "//folly/portability:fcntl", + ], + exported_deps = [ + "//folly:range", + "//folly:scope_guard", + "//folly/experimental/io:fs_util", + ], + external_deps = [ + "glog", + ("boost", None, "boost_regex"), + ], +) + +cpp_library( + name = "timerfd", + srcs = [ + "STTimerFDTimeoutManager.cpp", + "TimerFD.cpp", + "TimerFDTimeoutManager.cpp", + ], + headers = [ + "STTimerFDTimeoutManager.h", + "TimerFD.h", + "TimerFDTimeoutManager.h", + ], + deps = [ + "//folly:file_util", + "//folly/io/async:event_util", + ], + exported_deps = [ + "//folly/io/async:async_base", + "//folly/io/async:delayed_destruction", + ], +) + +cpp_library( + name = "threaded_repeating_function_runner", + srcs = ["ThreadedRepeatingFunctionRunner.cpp"], + headers = ["ThreadedRepeatingFunctionRunner.h"], + deps = [ + "//folly/system:thread_name", + ], + exported_deps = [ + "//folly:function", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "tl_ref_count", + headers = ["TLRefCount.h"], + exported_deps = [ + "//folly:thread_local", + "//folly/synchronization:asymmetric_thread_fence", + "//folly/synchronization/detail:sleeper", + ], +) + +cpp_library( + name = "tuple_ops", + headers = ["TupleOps.h"], + exported_deps = [ + "//folly:constexpr_math", + "//folly:portability", + "//folly:utility", + ], +) + +cpp_library( + name = "quotient_multiset", + srcs = [ + "QuotientMultiSet.cpp", + ], + headers = [ + "QuotientMultiSet.h", + "QuotientMultiSet-inl.h", + ], + deps = [ + "//folly:math", + ], + exported_deps = [ + ":bits", + ":instructions", + ":select64", + "//folly:format", + "//folly:portability", + "//folly:range", + "//folly/io:iobuf", + "//folly/lang:bits", + "//folly/lang:safe_assert", + ], + exported_external_deps = [ + "glog", + ], +) diff --git a/folly/experimental/bser/BUCK b/folly/experimental/bser/BUCK new file mode 100644 index 00000000000..5d98345ed27 --- /dev/null +++ b/folly/experimental/bser/BUCK @@ -0,0 +1,13 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "bser", + headers = [ + "Bser.h", + ], + exported_deps = [ + "//folly/json/bser:bser", + ], +) diff --git a/folly/experimental/channels/BUCK b/folly/experimental/channels/BUCK new file mode 100644 index 00000000000..14d6df7044b --- /dev/null +++ b/folly/experimental/channels/BUCK @@ -0,0 +1,165 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "channel", + headers = [ + "Channel.h", + "Channel-fwd.h", + "Channel-inl.h", + ], + exported_deps = [ + "//folly/channels:channel", + ], +) + +cpp_library( + name = "channel_callback_handle", + headers = [ + "ChannelCallbackHandle.h", + ], + exported_deps = [ + "//folly/channels:channel_callback_handle", + ], +) + +cpp_library( + name = "channel_processor", + headers = [ + "ChannelProcessor.h", + "ChannelProcessor-inl.h", + ], + exported_deps = [ + "//folly/channels:channel_processor", + ], +) + +cpp_library( + name = "consume_channel", + headers = [ + "ConsumeChannel.h", + "ConsumeChannel-inl.h", + ], + exported_deps = [ + "//folly/channels:consume_channel", + ], +) + +cpp_library( + name = "fanout_channel", + headers = [ + "FanoutChannel.h", + "FanoutChannel-inl.h", + ], + exported_deps = [ + "//folly/channels:fanout_channel", + ], +) + +cpp_library( + name = "fanout_sender", + headers = [ + "FanoutSender.h", + "FanoutSender-inl.h", + ], + exported_deps = [ + "//folly/channels:fanout_sender", + ], +) + +cpp_library( + name = "merge", + headers = [ + "Merge.h", + "Merge-inl.h", + ], + exported_deps = [ + "//folly/channels:merge", + ], +) + +cpp_library( + name = "merge_channel", + headers = [ + "MergeChannel.h", + "MergeChannel-inl.h", + ], + exported_deps = [ + "//folly/channels:merge_channel", + ], +) + +cpp_library( + name = "multiplex_channel", + headers = [ + "MultiplexChannel.h", + "MultiplexChannel-inl.h", + ], + exported_deps = [ + "//folly/channels:multiplex_channel", + ], +) + +cpp_library( + name = "on_closed_exception", + headers = [ + "OnClosedException.h", + ], + exported_deps = [ + "//folly/channels:on_closed_exception", + ], +) + +cpp_library( + name = "producer", + headers = [ + "Producer.h", + "Producer-inl.h", + ], + exported_deps = [ + "//folly/channels:producer", + ], +) + +cpp_library( + name = "proxy_channel", + headers = [ + "ProxyChannel.h", + "ProxyChannel-inl.h", + ], + exported_deps = [ + "//folly/channels:proxy_channel", + ], +) + +cpp_library( + name = "rate_limiter", + headers = [ + "RateLimiter.h", + ], + exported_deps = [ + "//folly/channels:rate_limiter", + ], +) + +cpp_library( + name = "max_concurrent_rate_limiter", + headers = [ + "MaxConcurrentRateLimiter.h", + ], + exported_deps = [ + "//folly/channels:max_concurrent_rate_limiter", + ], +) + +cpp_library( + name = "transform", + headers = [ + "Transform.h", + "Transform-inl.h", + ], + exported_deps = [ + "//folly/channels:transform", + ], +) diff --git a/folly/experimental/channels/detail/BUCK b/folly/experimental/channels/detail/BUCK new file mode 100644 index 00000000000..6c809811d4e --- /dev/null +++ b/folly/experimental/channels/detail/BUCK @@ -0,0 +1,72 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "atomic_queue", + headers = [ + "AtomicQueue.h", + ], + exported_deps = [ + "//folly/lang:assume", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "channel_bridge", + headers = ["ChannelBridge.h"], + exported_deps = [ + "//folly:try", + "//folly/experimental/channels/detail:atomic_queue", + ], +) + +cpp_library( + name = "function_traits", + headers = ["FunctionTraits.h"], +) + +cpp_library( + name = "intrusive_ptr", + headers = ["IntrusivePtr.h"], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "multiplexer_traits", + headers = ["MultiplexerTraits.h"], + exported_deps = [ + ":function_traits", + ], +) + +cpp_library( + name = "pointer_variant", + headers = ["PointerVariant.h"], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:demangle", + ], +) + +cpp_library( + name = "utility", + headers = [ + "Utility.h", + ], + exported_deps = [ + "//folly:exception_wrapper", + "//folly:function", + "//folly:scope_guard", + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:channel", + "//folly/experimental/channels:rate_limiter", + "//folly/experimental/coro:promise", + "//folly/experimental/coro:task", + ], +) diff --git a/folly/experimental/channels/detail/test/BUCK b/folly/experimental/channels/detail/test/BUCK new file mode 100644 index 00000000000..8e8c016edf2 --- /dev/null +++ b/folly/experimental/channels/detail/test/BUCK @@ -0,0 +1,26 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "atomic_queue_test", + srcs = [ + "AtomicQueueTest.cpp", + ], + deps = [ + "//folly/experimental/channels/detail:atomic_queue", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "pointer_variant_test", + srcs = [ + "PointerVariantTest.cpp", + ], + deps = [ + "//folly/experimental/channels/detail:pointer_variant", + "//folly/portability:gtest", + ], +) diff --git a/folly/experimental/channels/test/BUCK b/folly/experimental/channels/test/BUCK new file mode 100644 index 00000000000..0efdc38683a --- /dev/null +++ b/folly/experimental/channels/test/BUCK @@ -0,0 +1,18 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "channel_test_util", + headers = ["ChannelTestUtil.h"], + exported_deps = [ + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:io_thread_pool_executor", + "//folly/executors:sequenced_executor", + "//folly/experimental/channels:consume_channel", + "//folly/experimental/coro:detach_on_cancel", + "//folly/experimental/coro:sleep", + "//folly/futures:shared_promise", + "//folly/portability:gmock", + ], +) diff --git a/folly/experimental/coro/BUCK b/folly/experimental/coro/BUCK new file mode 100644 index 00000000000..5351ced9f97 --- /dev/null +++ b/folly/experimental/coro/BUCK @@ -0,0 +1,710 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "accumulate", + headers = [ + "Accumulate.h", + "Accumulate-inl.h", + ], + exported_deps = [ + ":async_generator", + ":coroutine", + ":task", + ], +) + +cpp_library( + name = "async_generator", + srcs = [], + headers = ["AsyncGenerator.h"], + exported_deps = [ + ":auto_cleanup_fwd", + ":coroutine", + ":current_executor", + ":detail_malloc", + ":detail_manual_lifetime", + ":invoke", + ":result", + ":scope_exit", + ":via_if_async", + ":with_async_stack", + ":with_cancellation", + "//folly:cancellation_token", + "//folly:exception_wrapper", + "//folly:traits", + "//folly:try", + "//folly/tracing:async_stack", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "async_pipe", + srcs = [], + headers = ["AsyncPipe.h"], + exported_deps = [ + ":async_generator", + ":coroutine", + ":invoke", + ":small_unbounded_queue", + ":via_if_async", + "//folly:try", + "//folly/fibers:semaphore", + ], +) + +cpp_library( + name = "async_scope", + srcs = [], + headers = ["AsyncScope.h"], + exported_deps = [ + ":coroutine", + ":current_executor", + ":detail_barrier", + ":detail_barrier_task", + ":task", + "//folly:cancellation_token", + "//folly:exception_wrapper", + "//folly/futures:core", + "//folly/portability:source_location", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "async_stack", + headers = ["AsyncStack.h"], + exported_deps = [ + ":coroutine", + ":with_async_stack", + "//folly:executor", + "//folly/tracing:async_stack", + ], +) + +cpp_library( + name = "baton", + srcs = ["Baton.cpp"], + headers = ["Baton.h"], + deps = [ + "//folly/synchronization:atomic_util", + ], + exported_deps = [ + ":coroutine", + ], +) + +cpp_library( + name = "blocking_wait", + headers = ["BlockingWait.h"], + exported_deps = [ + ":coroutine", + ":detail_malloc", + ":detail_traits", + ":task", + ":traits", + ":via_if_async", + ":with_async_stack", + "//folly:try", + "//folly/executors:manual_executor", + "//folly/fibers:core", + "//folly/synchronization:baton", + "//folly/tracing:async_stack", + ], +) + +cpp_library( + name = "collect", + headers = [ + "Collect.h", + "Collect-inl.h", + ], + exported_deps = [ + ":async_generator", + ":async_pipe", + ":async_scope", + ":coroutine", + ":detail_barrier", + ":detail_barrier_task", + ":detail_current_async_frame", + ":detail_helpers", + ":detail_traits", + ":mutex", + ":task", + ":via_if_async", + "//folly:cancellation_token", + "//folly:exception_wrapper", + "//folly:try", + "//folly:unit", + "//folly/container:access", + "//folly/container:iterator", + ], +) + +cpp_library( + name = "concat", + headers = [ + "Concat.h", + "Concat-inl.h", + ], + exported_deps = [ + ":async_generator", + ":coroutine", + ], +) + +cpp_library( + name = "coroutine", + headers = ["Coroutine.h"], + exported_deps = [ + "//folly:portability", + "//folly:utility", + ], +) + +cpp_library( + name = "current_executor", + headers = ["CurrentExecutor.h"], + exported_deps = [ + ":coroutine", + ":via_if_async", + ":with_async_stack", + "//folly:executor", + "//folly/io/async:request_context", + ], +) + +cpp_library( + name = "detach_on_cancel", + headers = ["DetachOnCancel.h"], + exported_deps = [ + ":baton", + ":coroutine", + ":detail_helpers", + ":invoke", + ":task", + ":traits", + ], +) + +cpp_library( + name = "detail_barrier", + headers = ["detail/Barrier.h"], + exported_deps = [ + ":coroutine", + ":traits", + ":with_async_stack", + "//folly/tracing:async_stack", + ], +) + +cpp_library( + name = "detail_barrier_task", + headers = ["detail/BarrierTask.h"], + exported_deps = [ + ":coroutine", + ":detail_barrier", + ":detail_malloc", + ":with_async_stack", + ], +) + +cpp_library( + name = "detail_current_async_frame", + headers = ["detail/CurrentAsyncFrame.h"], + exported_deps = [ + ":coroutine", + ":with_async_stack", + "//folly:executor", + "//folly/tracing:async_stack", + ], +) + +cpp_library( + name = "detail_helpers", + headers = ["detail/Helpers.h"], + exported_deps = [ + ":coroutine", + "//folly:executor", + "//folly:singleton_thread_local", + "//folly/io/async:request_context", + "//folly/tracing:async_stack", + ], +) + +cpp_library( + name = "detail_malloc", + srcs = ["detail/Malloc.cpp"], + headers = ["detail/Malloc.h"], + deps = [ + "//folly/lang:hint", + "//folly/lang:new", + ], + exported_deps = [ + "//folly:c_portability", + ], +) + +cpp_library( + name = "detail_manual_lifetime", + headers = ["detail/ManualLifetime.h"], + exported_deps = [ + "//folly:scope_guard", + ], +) + +cpp_library( + name = "detail_traits", + headers = ["detail/Traits.h"], + exported_deps = [ + "//folly:traits", + ], +) + +cpp_library( + name = "filter", + headers = [ + "Filter.h", + "Filter-inl.h", + ], + exported_deps = [ + ":async_generator", + ":coroutine", + ], +) + +cpp_library( + name = "future_util", + headers = ["FutureUtil.h"], + exported_deps = [ + ":coroutine", + ":invoke", + ":task", + ":traits", + "//folly/futures:core", + ], +) + +cpp_library( + name = "generator", + headers = ["Generator.h"], + exported_deps = [ + ":coroutine", + ":invoke", + ], +) + +cpp_library( + name = "gmock_helpers", + headers = ["GmockHelpers.h"], + exported_deps = [ + ":coroutine", + ":gtest_helpers", + ":result", + ":task", + "//folly/portability:gmock", + ], +) + +cpp_library( + name = "gtest_helpers", + headers = ["GtestHelpers.h"], + exported_deps = [ + ":blocking_wait", + ":coroutine", + ":task", + "//folly/experimental/exception_tracer:smart_exception_stack_trace_hooks", # @manual + "//folly/experimental/exception_tracer:smart_exception_tracer", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "inline_task", + headers = ["detail/InlineTask.h"], + exported_deps = [ + ":coroutine", + ":detail_malloc", + ":with_async_stack", + "//folly:scope_guard", + "//folly:try", + "//folly/lang:assume", + "//folly/tracing:async_stack", + ], +) + +cpp_library( + name = "invoke", + headers = ["Invoke.h"], + exported_deps = [ + "//folly/functional:invoke", + "//folly/lang:customization_point", + ], +) + +cpp_library( + name = "merge", + headers = [ + "Merge.h", + "Merge-inl.h", + ], + exported_deps = [ + ":async_generator", + ":baton", + ":coroutine", + ":detail_barrier", + ":detail_barrier_task", + ":detail_current_async_frame", + ":detail_helpers", + ":mutex", + ":task", + ":via_if_async", + ":with_cancellation", + "//folly:cancellation_token", + "//folly:executor", + "//folly:scope_guard", + ], +) + +cpp_library( + name = "mutex", + srcs = ["Mutex.cpp"], + headers = ["Mutex.h"], + exported_deps = [ + ":coroutine", + ":via_if_async", + "//folly:executor", + ], +) + +cpp_library( + name = "promise", + headers = ["Promise.h"], + exported_deps = [ + ":baton", + ":coroutine", + "//folly:cancellation_token", + "//folly:try", + "//folly/futures:core", + "//folly/synchronization:relaxed_atomic", + ], +) + +cpp_library( + name = "result", + headers = ["Result.h"], + exported_deps = [ + "//folly:cancellation_token", + "//folly:exception_wrapper", + "//folly:try", + ], +) + +cpp_library( + name = "retry", + headers = ["Retry.h"], + exported_deps = [ + ":coroutine", + ":result", + ":sleep", + ":task", + ":traits", + "//folly:cancellation_token", + "//folly:constexpr_math", + "//folly:exception_wrapper", + "//folly:random", + "//folly:try", + ], +) + +cpp_library( + name = "rust_adaptors", + headers = ["RustAdaptors.h"], + exported_deps = [ + ":async_generator", + ":task", + "//folly:cancellation_token", + "//folly:executor", + "//folly:optional", + "//folly/futures:core", + "//folly/synchronization:baton", + ], +) + +cpp_library( + name = "scope_exit", + headers = ["ScopeExit.h"], + exported_deps = [ + ":coroutine", + ":traits", + ":via_if_async", + "//folly:exception_wrapper", + "//folly:executor", + "//folly:scope_guard", + "//folly/functional:invoke", + "//folly/lang:assume", + "//folly/lang:customization_point", + "//folly/tracing:async_stack", + ], +) + +cpp_library( + name = "shared_lock", + headers = ["SharedLock.h"], + exported_deps = [ + ":coroutine", + "//folly:portability", + ], + exported_external_deps = ["glog"], +) + +cpp_library( + name = "shared_mutex", + srcs = ["SharedMutex.cpp"], + headers = ["SharedMutex.h"], + exported_deps = [ + ":coroutine", + ":shared_lock", + ":via_if_async", + "//folly:executor", + "//folly:spin_lock", + "//folly:synchronized", + ], +) + +cpp_library( + name = "sleep", + headers = [ + "Sleep.h", + "Sleep-inl.h", + ], + exported_deps = [ + ":baton", + ":coroutine", + ":current_executor", + ":task", + "//folly:cancellation_token", + "//folly/futures:core", + ], +) + +cpp_library( + name = "small_unbounded_queue", + srcs = [], + headers = ["SmallUnboundedQueue.h"], + exported_deps = [ + ":baton", + ":coroutine", + ":mutex", + ":task", + "//folly/experimental/channels/detail:atomic_queue", + ], +) + +cpp_library( + name = "task", + headers = ["Task.h"], + exported_deps = [ + ":coroutine", + ":current_executor", + ":detail_malloc", + ":detail_traits", + ":inline_task", + ":invoke", + ":result", + ":scope_exit", + ":traits", + ":via_if_async", + ":with_async_stack", + ":with_cancellation", + "//folly:cancellation_token", + "//folly:executor", + "//folly:glog", + "//folly:portability", + "//folly:scope_guard", + "//folly:traits", + "//folly:try", + "//folly/futures:core", + "//folly/io/async:request_context", + "//folly/lang:assume", + "//folly/tracing:async_stack", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "timed_wait", + headers = ["TimedWait.h"], + exported_deps = [ + ":baton", + ":coroutine", + ":detail_helpers", + ":invoke", + ":task", + ":traits", + "//folly:optional", + "//folly/futures:core", + ], +) + +cpp_library( + name = "timeout", + headers = [ + "Timeout.h", + "Timeout-inl.h", + ], + exported_deps = [ + ":baton", + ":coroutine", + ":task", + ":traits", + ":with_cancellation", + "//folly:cancellation_token", + "//folly/futures:core", + ], +) + +cpp_library( + name = "traits", + headers = ["Traits.h"], + exported_deps = [ + ":coroutine", + "//folly:traits", + ], + exported_external_deps = [], +) + +cpp_library( + name = "transform", + headers = [ + "Transform.h", + "Transform-inl.h", + ], + exported_deps = [ + ":async_generator", + ":coroutine", + "//folly:traits", + ], +) + +cpp_library( + name = "unbounded_queue", + srcs = [], + headers = ["UnboundedQueue.h"], + exported_deps = [ + ":coroutine", + ":task", + "//folly/concurrency:unbounded_queue", + "//folly/fibers:semaphore", + ], +) + +cpp_library( + name = "via_if_async", + headers = ["ViaIfAsync.h"], + exported_deps = [ + ":coroutine", + ":detail_malloc", + ":traits", + ":with_async_stack", + ":with_cancellation", + "//folly:executor", + "//folly:traits", + "//folly/io/async:request_context", + "//folly/lang:customization_point", + "//folly/tracing:async_stack", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "with_async_stack", + headers = ["WithAsyncStack.h"], + exported_deps = [ + ":coroutine", + ":traits", + "//folly/functional:invoke", + "//folly/lang:assume", + "//folly/lang:customization_point", + "//folly/tracing:async_stack", + ], +) + +cpp_library( + name = "with_cancellation", + headers = ["WithCancellation.h"], + exported_deps = [ + ":coroutine", + "//folly:cancellation_token", + "//folly/lang:customization_point", + ], +) + +cpp_library( + name = "bounded_queue", + srcs = [], + headers = ["BoundedQueue.h"], + exported_deps = [ + ":task", + "//folly:mpmc_queue", + "//folly:producer_consumer_queue", + "//folly/fibers:semaphore", + ], +) + +cpp_library( + name = "shared_promise", + headers = [ + "SharedPromise.h", + ], + exported_deps = [ + ":promise", + "//folly:small_vector", + "//folly:synchronized", + "//folly:utility", + "//folly/futures:core", + ], +) + +cpp_library( + name = "cleanup", + headers = [ + "Cleanup.h", + ], + exported_deps = [ + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "auto_cleanup_fwd", + headers = [ + "AutoCleanup-fwd.h", + ], + exported_deps = [ + ":cleanup", + ":coroutine", + ], +) + +cpp_library( + name = "auto_cleanup", + headers = [ + "AutoCleanup.h", + ], + exported_deps = [ + ":auto_cleanup_fwd", + ":collect", + ":task", + ], +) diff --git a/folly/experimental/coro/scripts/BUCK b/folly/experimental/coro/scripts/BUCK new file mode 100644 index 00000000000..34280ce3928 --- /dev/null +++ b/folly/experimental/coro/scripts/BUCK @@ -0,0 +1,9 @@ +load("@fbcode_macros//build_defs:python_library.bzl", "python_library") + +oncall("fbcode_entropy_wardens_folly") + +python_library( + # @autodeps-skip + name = "co_bt", + srcs = ["co_bt.py"], +) diff --git a/folly/experimental/coro/scripts/test/BUCK b/folly/experimental/coro/scripts/test/BUCK new file mode 100644 index 00000000000..85464b87bb0 --- /dev/null +++ b/folly/experimental/coro/scripts/test/BUCK @@ -0,0 +1,11 @@ +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + +oncall("fbcode_entropy_wardens_folly") + +python_unittest( + name = "co_bt", + srcs = ["co_bt.py"], + deps = [ + "//folly/experimental/coro/scripts:co_bt", + ], +) diff --git a/folly/experimental/coro/test/BUCK b/folly/experimental/coro/test/BUCK new file mode 100644 index 00000000000..355e30e4b20 --- /dev/null +++ b/folly/experimental/coro/test/BUCK @@ -0,0 +1,326 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "async_stack_test", + srcs = [ + "AsyncStackTest.cpp", + ], + deps = [ + "//folly:portability", + "//folly/experimental/coro:async_stack", + "//folly/experimental/coro:baton", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:collect", + "//folly/experimental/coro:mutex", + "//folly/experimental/coro:task", + "//folly/portability:gtest", + "//folly/tracing:async_stack", + ], +) + +cpp_unittest( + name = "coro_test", + srcs = [ + "AccumulateTest.cpp", + "AsyncGeneratorTest.cpp", + "AsyncPipeTest.cpp", + "AsyncScopeTest.cpp", + "BatonTest.cpp", + "BlockingWaitTest.cpp", + "BoundedQueueTest.cpp", + "CollectTest.cpp", + "ConcatTest.cpp", + "CoroTest.cpp", + "CurrentExecutorTest.cpp", + "ErrorTest.cpp", + "FilterTest.cpp", + "FutureUtilTest.cpp", + "InlineTaskTest.cpp", + "MergeTest.cpp", + "MutexTest.cpp", + "ScopeExitTest.cpp", + "SharedMutexTest.cpp", + "SmallUnboundedQueueTest.cpp", + "TaskTest.cpp", + "TimeoutTest.cpp", + "TraitsTest.cpp", + "TransformTest.cpp", + "UnboundedQueueTest.cpp", + ], + deps = [ + "//folly:cancellation_token", + "//folly:chrono", + "//folly:conv", + "//folly:exception_wrapper", + "//folly:optional", + "//folly:portability", + "//folly:scope_guard", + "//folly:traits", + "//folly:utility", + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:global_executor", + "//folly/executors:inline_executor", + "//folly/executors:manual_executor", + "//folly/experimental/coro:accumulate", + "//folly/experimental/coro:async_generator", + "//folly/experimental/coro:async_pipe", + "//folly/experimental/coro:async_scope", + "//folly/experimental/coro:auto_cleanup", + "//folly/experimental/coro:baton", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:bounded_queue", + "//folly/experimental/coro:collect", + "//folly/experimental/coro:concat", + "//folly/experimental/coro:coroutine", + "//folly/experimental/coro:current_executor", + "//folly/experimental/coro:detach_on_cancel", + "//folly/experimental/coro:filter", + "//folly/experimental/coro:future_util", + "//folly/experimental/coro:generator", + "//folly/experimental/coro:gtest_helpers", + "//folly/experimental/coro:inline_task", + "//folly/experimental/coro:invoke", + "//folly/experimental/coro:merge", + "//folly/experimental/coro:mutex", + "//folly/experimental/coro:result", + "//folly/experimental/coro:shared_mutex", + "//folly/experimental/coro:sleep", + "//folly/experimental/coro:small_unbounded_queue", + "//folly/experimental/coro:task", + "//folly/experimental/coro:timed_wait", + "//folly/experimental/coro:timeout", + "//folly/experimental/coro:traits", + "//folly/experimental/coro:transform", + "//folly/experimental/coro:unbounded_queue", + "//folly/experimental/coro:with_cancellation", + "//folly/fibers:core_manager", + "//folly/fibers:fiber_manager_map", + "//folly/fibers:semaphore", + "//folly/futures:core", + "//folly/io/async:request_context", + "//folly/io/async:scoped_event_base_thread", + "//folly/lang:assume", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "coroutine_test", + srcs = ["CoroutineTest.cpp"], + deps = [ + "//folly/experimental/coro:coroutine", + "//folly/lang:keep", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "gmock_helpers_test", + srcs = [ + "GmockHelpersTest.cpp", + ], + deps = [ + "//folly:portability", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:gmock_helpers", + "//folly/experimental/coro:gtest_helpers", + "//folly/experimental/coro:task", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "gtest_helpers_test", + srcs = [ + "GtestHelpersTest.cpp", + ], + supports_static_listing = False, + deps = [ + "//folly/experimental/coro:gtest_helpers", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "async_generator_bench", + srcs = ["AsyncGeneratorBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:exception_wrapper", + "//folly:portability", + "//folly/experimental/coro:async_generator", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:generator", + "//folly/experimental/coro:task", + "//folly/experimental/coro:via_if_async", + ], +) + +cpp_benchmark( + name = "blocking_wait_bench", + srcs = ["BlockingWaitBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:portability", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:coroutine", + ], +) + +cpp_benchmark( + name = "task_bench", + srcs = ["TaskBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:portability", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:current_executor", + "//folly/experimental/coro:task", + ], +) + +cpp_benchmark( + name = "coro_benchmark_allocator", + srcs = ["CoroBenchmarkAllocator.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/experimental/coro:coroutine", + ], +) + +cpp_benchmark( + name = "coro_benchmark_nrvo", + srcs = ["CoroBenchmarkNRVO.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/experimental/coro:coroutine", + ], +) + +cpp_unittest( + name = "generator_test", + srcs = ["GeneratorTest.cpp"], + headers = [], + deps = [ + "//folly:portability", + "//folly:scope_guard", + "//folly/experimental/coro:generator", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "retry_test", + srcs = ["RetryTest.cpp"], + headers = [], + deps = [ + "//folly:portability", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:retry", + "//folly/experimental/coro:sleep", + "//folly/experimental/coro:task", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "collect_all_benchmark", + srcs = ["CollectAllBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/executors:cpu_thread_pool_executor", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:collect", + "//folly/experimental/coro:generator", + "//folly/experimental/coro:task", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "RustAdaptorsTest", + srcs = [ + "RustAdaptorsTest.cpp", + ], + deps = [ + "//folly:cancellation_token", + "//folly:portability", + "//folly/experimental/coro:baton", + "//folly/experimental/coro:rust_adaptors", + "//folly/experimental/coro:sleep", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "PromiseTest", + srcs = [ + "PromiseTest.cpp", + ], + deps = [ + "//folly:portability", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:collect", + "//folly/experimental/coro:gtest_helpers", + "//folly/experimental/coro:promise", + "//folly/experimental/coro:task", + "//folly/experimental/coro:with_cancellation", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "promise_benchmark", + srcs = ["PromiseBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:portability", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:collect", + "//folly/experimental/coro:future_util", + "//folly/experimental/coro:promise", + "//folly/experimental/coro:task", + "//folly/futures:core", + ], +) + +cpp_unittest( + name = "request_context_test", + srcs = ["RequestContextTest.cpp"], + deps = [ + "//folly/experimental/coro:async_generator", + "//folly/experimental/coro:async_scope", + "//folly/experimental/coro:baton", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:mutex", + "//folly/experimental/coro:task", + "//folly/experimental/coro:unbounded_queue", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "shared_promise_test", + srcs = [ + "SharedPromiseTest.cpp", + ], + deps = [ + "//folly/executors:cpu_thread_pool_executor", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:detach_on_cancel", + "//folly/experimental/coro:shared_promise", + "//folly/portability:gtest", + ], +) diff --git a/folly/experimental/crypto/BUCK b/folly/experimental/crypto/BUCK new file mode 100644 index 00000000000..780682eef77 --- /dev/null +++ b/folly/experimental/crypto/BUCK @@ -0,0 +1,109 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "blake2xb", + srcs = [ + "Blake2xb.cpp", + ], + headers = [ + "Blake2xb.h", + ], + deps = [ + "//folly/lang:bits", + ], + exported_deps = [ + "//folly:range", + ], + exported_external_deps = [ + ("libsodium", None, "sodium"), + ], +) + +cpp_library( + name = "lt_hash", + srcs = [ + "LtHash.cpp", + ], + headers = [ + "LtHash.h", + "LtHash-inl.h", + ], + deps = [ + "//folly:cpu_id", + "//folly:memory", + ], + exported_deps = [ + ":blake2xb", + "//folly:optional", + "//folly:range", + "//folly/experimental/crypto/detail:lt_hash_internal", + "//folly/experimental/crypto/detail:math_operation_avx2_disable", # @manual + "//folly/experimental/crypto/detail:math_operation_simple", # @manual + "//folly/experimental/crypto/detail:math_operation_sse2_disable", # @manual + "//folly/io:iobuf", + "//folly/lang:bits", + ], + exported_external_deps = [ + ("libsodium", None, "sodium"), + ], +) + +cpp_library( + name = "lt_hash_sse2", + srcs = [ + "LtHash.cpp", + ], + headers = [ + "LtHash.h", + "LtHash-inl.h", + ], + deps = [ + "//folly:cpu_id", + "//folly:memory", + ], + exported_deps = [ + ":blake2xb", + "//folly:optional", + "//folly:range", + "//folly/experimental/crypto/detail:lt_hash_internal", + "//folly/experimental/crypto/detail:math_operation_avx2_disable", # @manual + "//folly/experimental/crypto/detail:math_operation_simple", # @manual + "//folly/experimental/crypto/detail:math_operation_sse2", # @manual + "//folly/io:iobuf", + "//folly/lang:bits", + ], + exported_external_deps = [ + ("libsodium", None, "sodium"), + ], +) + +cpp_library( + name = "lt_hash_avx2", + srcs = [ + "LtHash.cpp", + ], + headers = [ + "LtHash.h", + "LtHash-inl.h", + ], + deps = [ + "//folly:cpu_id", + "//folly:memory", + ], + exported_deps = [ + ":blake2xb", + "//folly:optional", + "//folly:range", + "//folly/experimental/crypto/detail:lt_hash_internal", + "//folly/experimental/crypto/detail:math_operation_avx2", # @manual + "//folly/experimental/crypto/detail:math_operation_simple", # @manual + "//folly/experimental/crypto/detail:math_operation_sse2", # @manual + "//folly/io:iobuf", + "//folly/lang:bits", + ], + exported_external_deps = [ + ("libsodium", None, "sodium"), + ], +) diff --git a/folly/experimental/crypto/detail/BUCK b/folly/experimental/crypto/detail/BUCK new file mode 100644 index 00000000000..967de505e52 --- /dev/null +++ b/folly/experimental/crypto/detail/BUCK @@ -0,0 +1,127 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "lt_hash_internal", + headers = [ + "LtHashInternal.h", + ], + exported_deps = [ + "//folly:range", + ], +) + +cpp_library( + name = "math_operation_simple", + srcs = [ + "MathOperation_Simple.cpp", + ], + arch_compiler_flags = { + "x86_64": [ + "-mno-avx", + "-mno-avx2", + "-mno-sse2", + ], + }, + deps = [ + ":lt_hash_internal", + "//folly:memory", + "//folly/lang:bits", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "math_operation_sse2", + srcs = [ + "MathOperation_SSE2.cpp", + ], + arch_compiler_flags = { + "x86_64": [ + "-mno-avx", + "-mno-avx2", + "-msse2", + ], + }, + deps = [ + ":lt_hash_internal", + "//folly:memory", + "//folly/lang:bits", + ], + external_deps = [ + "glog", + ("libsodium", None, "sodium"), + ], +) + +cpp_library( + name = "math_operation_avx2", + srcs = [ + "MathOperation_AVX2.cpp", + ], + arch_compiler_flags = { + "x86_64": [ + "-mavx", + "-mavx2", + "-msse2", + ], + }, + deps = [ + ":lt_hash_internal", + "//folly:memory", + "//folly/lang:bits", + ], + external_deps = [ + "glog", + ("libsodium", None, "sodium"), + ], +) + +cpp_library( + name = "math_operation_sse2_disable", + srcs = [ + "MathOperation_SSE2.cpp", + ], + arch_compiler_flags = { + "x86_64": [ + "-mno-avx", + "-mno-avx2", + "-mno-sse2", + ], + }, + deps = [ + ":lt_hash_internal", + "//folly:memory", + "//folly/lang:bits", + ], + external_deps = [ + "glog", + ("libsodium", None, "sodium"), + ], +) + +cpp_library( + name = "math_operation_avx2_disable", + srcs = [ + "MathOperation_AVX2.cpp", + ], + arch_compiler_flags = { + "x86_64": [ + "-mno-avx", + "-mno-avx2", + "-mno-sse2", + ], + }, + deps = [ + ":lt_hash_internal", + "//folly:memory", + "//folly/lang:bits", + ], + external_deps = [ + "glog", + ("libsodium", None, "sodium"), + ], +) diff --git a/folly/experimental/crypto/test/BUCK b/folly/experimental/crypto/test/BUCK new file mode 100644 index 00000000000..a15ced4611d --- /dev/null +++ b/folly/experimental/crypto/test/BUCK @@ -0,0 +1,147 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_benchmark( + name = "blake2xb_benchmark", + srcs = ["Blake2xbBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:random", + "//folly/experimental/crypto:blake2xb", + "//folly/init:init", + "//folly/io:iobuf", + ], + external_deps = [ + "glog", + ("libsodium", None, "sodium"), + ], +) + +cpp_unittest( + name = "blake2xb_test", + srcs = ["Blake2xbTest.cpp"], + headers = [], + deps = [ + "//folly:string", + "//folly/experimental/crypto:blake2xb", + "//folly/io:iobuf", + "//folly/portability:gtest", + ], + external_deps = [ + ("libsodium", None, "sodium"), + ], +) + +cpp_benchmark( + name = "lt_hash_benchmark", + srcs = [ + "LtHashBenchmark.cpp", + ], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:random", + "//folly/experimental/crypto:lt_hash", + "//folly/init:init", + "//folly/io:iobuf", + ], + external_deps = [ + "glog", + ("libsodium", None, "sodium"), + ], +) + +cpp_benchmark( + name = "lt_hash_benchmark_sse2", + srcs = [ + "LtHashBenchmark.cpp", + ], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:random", + "//folly/experimental/crypto:lt_hash_sse2", # @manual + "//folly/init:init", + "//folly/io:iobuf", + ], + external_deps = [ + "glog", + ("libsodium", None, "sodium"), + ], +) + +cpp_benchmark( + name = "lt_hash_benchmark_avx2", + srcs = [ + "LtHashBenchmark.cpp", + ], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:random", + "//folly/experimental/crypto:lt_hash_avx2", # @manual + "//folly/init:init", + "//folly/io:iobuf", + ], + external_deps = [ + "glog", + ("libsodium", None, "sodium"), + ], +) + +cpp_unittest( + name = "lt_hash_test", + srcs = [ + "LtHashTest.cpp", + ], + headers = [], + deps = [ + "//folly:random", + "//folly:string", + "//folly/experimental/crypto:lt_hash", + "//folly/io:iobuf", + "//folly/portability:gtest", + ], + external_deps = [ + ("libsodium", None, "sodium"), + ], +) + +cpp_unittest( + name = "lt_hash_test_sse2", + srcs = [ + "LtHashTest.cpp", + ], + headers = [], + deps = [ + "//folly:random", + "//folly:string", + "//folly/experimental/crypto:lt_hash_sse2", # @manual + "//folly/io:iobuf", + "//folly/portability:gtest", + ], + external_deps = [ + ("libsodium", None, "sodium"), + ], +) + +cpp_unittest( + name = "lt_hash_test_avx2", + srcs = [ + "LtHashTest.cpp", + ], + headers = [], + deps = [ + "//folly:random", + "//folly:string", + "//folly/experimental/crypto:lt_hash_avx2", # @manual + "//folly/io:iobuf", + "//folly/portability:gtest", + ], + external_deps = [ + ("libsodium", None, "sodium"), + ], +) diff --git a/folly/experimental/exception_tracer/BUCK b/folly/experimental/exception_tracer/BUCK new file mode 100644 index 00000000000..7e7f83ff25a --- /dev/null +++ b/folly/experimental/exception_tracer/BUCK @@ -0,0 +1,167 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "exception_abi", + headers = ["ExceptionAbi.h"], +) + +cpp_library( + name = "exception_counter", + srcs = ["ExceptionCounterLib.cpp"], + headers = ["ExceptionCounterLib.h"], + link_whole = True, + deps = [ + ":exception_tracer_callbacks", + ":stacktrace", + "//folly:range", + "//folly:synchronized", + "//folly:thread_local", + "//folly/experimental/symbolizer:symbolizer", + "//folly/hash:spooky_hash_v2", + "//folly/synchronization:rw_spin_lock", + ], + exported_deps = [ + ":exception_tracer_base", + ":exception_tracer_callbacks", + ], +) + +cpp_library( + name = "exception_tracer", + srcs = ["ExceptionStackTraceLib.cpp"], + headers = [], + link_whole = True, + deps = [ + ":exception_abi", + ":exception_tracer_base", + ":exception_tracer_callbacks", + ":stacktrace", + "//folly/experimental/symbolizer:symbolizer", + ], + exported_deps = [ + ":exception_tracer_callbacks", + ], +) + +cpp_library( + name = "exception_tracer_base", + srcs = ["ExceptionTracer.cpp"], + headers = ["ExceptionTracer.h"], + # Usage of dlsym(RTLD_NEXT, "symbol") does not always work with link groups + # due to relying on link order. Excluding all libs with `RTLD_NEXT` usage from any link group. + tags = ["EXCLUDED_FROM_LINK_GROUPS"], + deps = [ + ":exception_abi", + ":stacktrace", + "//folly:cpp_attributes", + "//folly:portability", + "//folly:string", + "//folly/experimental/symbolizer:symbolizer", + ], + exported_deps = [ + "//folly/portability:config", + ], + external_deps = [ + "glog", + ("glibc", None, "dl"), + ], +) + +cpp_library( + name = "exception_tracer_callbacks", + srcs = ["ExceptionTracerLib.cpp"], + headers = ["ExceptionTracerLib.h"], + compiler_flags = select({ + "DEFAULT": [], + "ovr_config//third-party/libgcc:11.x": ["-DFOLLY_STATIC_LIBSTDCXX=1"], + }), + exported_linker_flags = select({ + "DEFAULT": [], + "ovr_config//third-party/libgcc:11.x": [ + "-Wl,--wrap=__cxa_throw", + "-Wl,--wrap=__cxa_rethrow", + "-Wl,--wrap=__cxa_begin_catch", + "-Wl,--wrap=__cxa_end_catch", + "-Wl,--wrap=_ZSt17rethrow_exceptionNSt15__exception_ptr13exception_ptrE", + ], + }), + link_whole = True, + supports_python_dlopen = True, + tags = ["EXCLUDED_FROM_LINK_GROUPS"], + deps = [ + "//folly:indestructible", + "//folly:portability", + "//folly:shared_mutex", + "//folly:synchronized", + ], + external_deps = [ + ("glibc", None, "dl"), + ], +) + +cpp_library( + name = "stacktrace", + srcs = ["StackTrace.cpp"], + headers = ["StackTrace.h"], + deps = [ + "//folly/experimental/symbolizer:stack_trace", + ], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "smart_exception_tracer_singleton", + srcs = [ + "SmartExceptionTracerSingleton.cpp", + ], + headers = [ + "SmartExceptionTracerSingleton.h", + ], + exported_deps = [ + ":stacktrace", + "//folly:synchronized", + "//folly/container:f14_hash", + ], +) + +cpp_library( + name = "smart_exception_stack_trace_hooks", + srcs = [ + "SmartExceptionStackTraceHooks.cpp", + ], + link_whole = True, + deps = [ + ":exception_tracer_callbacks", + ":smart_exception_tracer_singleton", + "//folly/experimental/symbolizer:symbolizer", + ], +) + +cpp_library( + name = "smart_exception_tracer", + srcs = ["SmartExceptionTracer.cpp"], + headers = ["SmartExceptionTracer.h"], + deps = [ + ":exception_tracer_callbacks", + ":smart_exception_tracer_singleton", + ":stacktrace", + "//folly:map_util", + "//folly:scope_guard", + "//folly:synchronized", + "//folly/container:f14_hash", + "//folly/experimental/symbolizer:symbolizer", + "//folly/lang:exception", + ], + exported_deps = [ + ":exception_tracer_base", + ":exception_tracer_callbacks", + "//folly:exception_wrapper", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/experimental/exception_tracer/test/BUCK b/folly/experimental/exception_tracer/test/BUCK new file mode 100644 index 00000000000..1feca758730 --- /dev/null +++ b/folly/experimental/exception_tracer/test/BUCK @@ -0,0 +1,78 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "exception_counter_test", + srcs = ["ExceptionCounterTest.cpp"], + deps = [ + "//folly/experimental/exception_tracer:exception_counter", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "exception_tracer_benchmark_main", + srcs = ["ExceptionTracerBenchmark.cpp"], + deps = [ + "//folly:benchmark", + "//folly/experimental/exception_tracer:exception_tracer_base", + "//folly/portability:gflags", + ], + external_deps = [ + "glog", + ], +) + +cpp_benchmark( + name = "exception_tracer_base_benchmark", + deps = [ + ":exception_tracer_benchmark_main", # @manual + ], +) + +cpp_benchmark( + name = "exception_tracer_benchmark", + deps = [ + ":exception_tracer_benchmark_main", # @manual + "//folly/experimental/exception_tracer:exception_tracer", # @manual # @manual + ], +) + +cpp_library( + name = "exception_tracer_test_main", + srcs = ["ExceptionTracerTest.cpp"], + deps = [ + "//folly/experimental/exception_tracer:exception_tracer_base", + ], +) + +cpp_binary( + name = "exception_tracer_base_test", + deps = [ + ":exception_tracer_test_main", # @manual + ], +) + +cpp_binary( + name = "exception_tracer_test", + deps = [ + ":exception_tracer_test_main", # @manual + "//folly/experimental/exception_tracer:exception_tracer", # @manual # @manual + ], +) + +cpp_unittest( + name = "smart_exception_tracer_test", + srcs = ["SmartExceptionTracerTest.cpp"], + deps = [ + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:task", + "//folly/experimental/exception_tracer:smart_exception_stack_trace_hooks", # @manual + "//folly/experimental/exception_tracer:smart_exception_tracer", + "//folly/portability:gtest", + ], +) diff --git a/folly/experimental/flat_combining/BUCK b/folly/experimental/flat_combining/BUCK new file mode 100644 index 00000000000..ac59ffde1d8 --- /dev/null +++ b/folly/experimental/flat_combining/BUCK @@ -0,0 +1,16 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "flat_combining", + headers = ["FlatCombining.h"], + exported_deps = [ + "//folly:function", + "//folly:indexed_mem_pool", + "//folly:portability", + "//folly/concurrency:cache_locality", + "//folly/synchronization:saturating_semaphore", + "//folly/system:thread_name", + ], +) diff --git a/folly/experimental/flat_combining/test/BUCK b/folly/experimental/flat_combining/test/BUCK new file mode 100644 index 00000000000..2831c1ae2aa --- /dev/null +++ b/folly/experimental/flat_combining/test/BUCK @@ -0,0 +1,51 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "flat_combining_examples", + headers = ["FlatCombiningExamples.h"], + exported_deps = [ + "//folly/experimental/flat_combining:flat_combining", + "//folly/synchronization:baton", + ], +) + +cpp_library( + name = "flat_combining_test_helpers", + headers = ["FlatCombiningTestHelpers.h"], + exported_deps = [ + ":flat_combining_examples", + "//folly:benchmark", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "flat_combining_test", + srcs = ["FlatCombiningTest.cpp"], + supports_static_listing = False, + deps = [ + ":flat_combining_test_helpers", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "flat_combining_benchmark", + srcs = ["FlatCombiningBenchmark.cpp"], + deps = [ + ":flat_combining_test_helpers", + "//folly:benchmark", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/experimental/io/BUCK b/folly/experimental/io/BUCK new file mode 100644 index 00000000000..f84327753bd --- /dev/null +++ b/folly/experimental/io/BUCK @@ -0,0 +1,378 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "async_base", + srcs = ["AsyncBase.cpp"], + headers = ["AsyncBase.h"], + deps = [ + "//folly:exception", + "//folly:format", + "//folly:likely", + "//folly:string", + "//folly/portability:filesystem", + "//folly/portability:unistd", + ], + exported_deps = [ + "//folly:function", + "//folly:portability", + "//folly:range", + "//folly/portability:sys_uio", + ], + external_deps = [ + "boost", + "glog", + ], +) + +cpp_library( + name = "async_io", + srcs = ["AsyncIO.cpp"], + headers = ["AsyncIO.h"], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:exception", + "//folly:likely", + "//folly:small_vector", + "//folly:string", + "//folly/portability:unistd", + ], + exported_deps = [ + ":async_base", + ], + external_deps = [ + "boost", + "glog", + ], + exported_external_deps = [ + ("libaio", None, "aio"), + ], +) + +cpp_library( + name = "liburing", + headers = ["Liburing.h"], + os_deps = [( + "linux", + select({ + "DEFAULT": ["fbsource//third-party/liburing:uring"], + "ovr_config//os:linux-sgx": [], + }), + )], +) + +cpp_library( + name = "async_io_uring_socket", + srcs = [ + "AsyncIoUringSocket.cpp", + ], + headers = [ + "AsyncIoUringSocket.h", + "AsyncIoUringSocketFactory.h", + ], + deps = [ + ":io_uring_event_base_local", + "//folly:conv", + "//folly/detail:socket_fast_open", + "//folly/memory:malloc", + "//folly/portability:sys_uio", + ], + exported_deps = [ + ":io_uring_backend", + ":liburing", + "//folly:network_address", + "//folly:optional", + "//folly:small_vector", + "//folly/futures:core", + "//folly/io:iobuf", + "//folly/io:socket_option_map", + "//folly/io/async:async_base", + "//folly/io/async:async_socket", + "//folly/io/async:async_socket_exception", + "//folly/io/async:async_transport", + "//folly/io/async:delayed_destruction", + "//folly/net:net_ops_dispatcher", + "//folly/portability:sockets", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "simple_async_io", + srcs = ["SimpleAsyncIO.cpp"], + headers = ["SimpleAsyncIO.h"], + deps = [ + ":async_io", + ":io_uring", + ":liburing", + "//folly:string", + "//folly/experimental/coro:baton", + "//folly/portability:sockets", + ], + exported_deps = [ + ":async_base", + "//folly:synchronized", + "//folly/executors:global_executor", + "//folly/experimental/coro:task", + "//folly/io/async:async_base", + "//folly/io/async:scoped_event_base_thread", + ], + exported_external_deps = [ + ], +) + +cpp_library( + name = "epoll", + headers = [ + "Epoll.h", + ], +) + +cpp_library( + name = "epoll_backend", + srcs = [ + "EpollBackend.cpp", + ], + headers = [ + "Epoll.h", + "EpollBackend.h", + ], + modular_headers = False, + deps = [ + "//folly:file_util", + "//folly:intrusive_list", + "//folly:map_util", + "//folly:string", + ], + exported_deps = [ + "//folly/container:intrusive_heap", + "//folly/io/async:async_base", + ], +) + +cpp_library( + name = "event_base_poller", + srcs = ["EventBasePoller.cpp"], + headers = ["EventBasePoller.h"], + deps = [ + "fbsource//third-party/fmt:fmt", + ":epoll", + ":liburing", + "//folly:file_util", + "//folly:string", + "//folly/lang:align", + "//folly/portability:gflags", + "//folly/synchronization:baton", + "//folly/system:thread_name", + ], + exported_deps = [ + "//folly:function", + "//folly:range", + "//folly:synchronized", + ], + external_deps = [ + "boost", + "glog", + ], +) + +cpp_library( + name = "mux_io_thread_pool_executor", + srcs = ["MuxIOThreadPoolExecutor.cpp"], + headers = ["MuxIOThreadPoolExecutor.h"], + deps = [ + "fbsource//third-party/fmt:fmt", + ":epoll_backend", + "//folly/container:enumerate", + "//folly/lang:align", + "//folly/synchronization:latch", + ], + exported_deps = [ + ":event_base_poller", + "//folly:portability", + "//folly/concurrency:unbounded_queue", + "//folly/executors:io_thread_pool_executor", + "//folly/executors:queue_observer", + "//folly/io/async:event_base_manager", + "//folly/synchronization:baton", + "//folly/synchronization:relaxed_atomic", + "//folly/synchronization:throttled_lifo_sem", + "//folly/synchronization:wait_options", + ], +) + +cpp_library( + name = "io_uring", + srcs = ["IoUring.cpp"], + headers = ["IoUring.h"], + modular_headers = False, + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:exception", + "//folly:likely", + "//folly:string", + "//folly/portability:unistd", + ], + exported_deps = [ + ":async_base", + ":liburing", + "//folly:shared_mutex", + ], + external_deps = [ + "boost", + "glog", + ], +) + +cpp_library( + name = "io_uring_backend", + srcs = [ + "IoUringBackend.cpp", + ], + headers = [ + "IoUringBackend.h", + "IoUringBase.h", + ], + modular_headers = False, + deps = [ + "//folly:demangle", + "//folly:file_util", + "//folly:glog", + "//folly:likely", + "//folly:spin_lock", + "//folly:string", + "//folly/container:f14_hash", + "//folly/experimental/io:io_uring_provided_buffer_ring", + "//folly/lang:bits", + "//folly/portability:gflags", + "//folly/portability:sockets", + "//folly/portability:sys_mman", + "//folly/portability:sys_syscall", + "//folly/synchronization:call_once", + ], + exported_deps = [ + ":liburing", + "//folly:c_portability", + "//folly:conv", + "//folly:cpp_attributes", + "//folly:exception_string", + "//folly:function", + "//folly:optional", + "//folly:range", + "//folly:small_vector", + "//folly/io:iobuf", + "//folly/io/async:async_base", + "//folly/io/async:delayed_destruction", + "//folly/portability:asm", + ], + exported_external_deps = [ + "boost", + "glog", + ], +) + +cpp_library( + name = "io_uring_provided_buffer_ring", + srcs = [ + "IoUringProvidedBufferRing.cpp", + ], + headers = [ + "IoUringBase.h", + "IoUringProvidedBufferRing.h", + ], + modular_headers = False, + deps = [ + "//folly:conv", + "//folly:exception_string", + "//folly:string", + ], + exported_deps = [ + ":liburing", + "//folly/io:iobuf", + "//folly/io/async:delayed_destruction", + "//folly/portability:sys_mman", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "io_uring_event", + srcs = [ + "IoUringEvent.cpp", + ], + headers = [ + "IoUringEvent.h", + ], + modular_headers = False, + exported_deps = [ + ":io_uring_backend", + ":liburing", + "//folly:file", + "//folly/io/async:async_base", + ], +) + +cpp_library( + name = "io_uring_event_base_local", + srcs = [ + "IoUringEventBaseLocal.cpp", + ], + headers = [ + "IoUringEventBaseLocal.h", + ], + modular_headers = False, + deps = [ + ":io_uring_event", + "//folly:singleton", + ], + exported_deps = [ + ":io_uring_backend", + ":liburing", + "//folly/io/async:async_base", + ], + exported_external_deps = [ + ], +) + +cpp_library( + name = "fs_util", + srcs = ["FsUtil.cpp"], + headers = ["FsUtil.h"], + deps = [ + "//folly:exception", + ], + exported_external_deps = [ + ("boost", None, "boost_filesystem"), + ], +) + +cpp_library( + name = "huge_pages", + srcs = ["HugePages.cpp"], + headers = ["HugePages.h"], + deps = [ + "//folly:conv", + "//folly:cpp_attributes", + "//folly:format", + "//folly:string", + "//folly/gen:base", + "//folly/gen:file", + "//folly/gen:string", + ], + exported_deps = [ + ":fs_util", + "//folly:range", + "//folly/portability:unistd", + ], + external_deps = [ + ("boost", None, "boost_regex"), + ], + exported_external_deps = [ + "boost", + ], +) diff --git a/folly/experimental/io/test/BUCK b/folly/experimental/io/test/BUCK new file mode 100644 index 00000000000..a1c3c4b7f8f --- /dev/null +++ b/folly/experimental/io/test/BUCK @@ -0,0 +1,280 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "io_test_temp_file_util_lib", + srcs = ["IoTestTempFileUtil.cpp"], + headers = ["IoTestTempFileUtil.h"], + deps = [ + "//folly:file_util", + "//folly:string", + ], + exported_deps = [ + "//folly/experimental:test_util", + "//folly/experimental/io:fs_util", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "async_base_test_lib", + srcs = ["AsyncBaseTestLib.cpp"], + headers = ["AsyncBaseTestLib.h"], + exported_deps = [ + ":io_test_temp_file_util_lib", + "//folly:scope_guard", + "//folly:string", + "//folly/experimental/io:async_base", + "//folly/experimental/io:fs_util", + "//folly/portability:gtest", + "//folly/portability:sockets", + "//folly/test:test_utils", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "async_io_test", + srcs = ["AsyncIOTest.cpp"], + supports_static_listing = False, + deps = [ + ":async_base_test_lib", + "//folly/experimental/io:async_io", + ], +) + +cpp_binary( + name = "io_uring_backend_bench", + srcs = ["IoUringBackendBench.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:file_util", + "//folly/experimental/io:epoll_backend", + "//folly/experimental/io:io_uring_backend", + "//folly/init:init", + "//folly/io/async:async_base", + "//folly/io/async:scoped_event_base_thread", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "io_uring_test", + srcs = ["IoUringTest.cpp"], + owner = "dmm@xmail.facebook.com", + supports_static_listing = False, + deps = [ + ":async_base_test_lib", + "//folly/experimental/io:io_uring", + "//folly/init:init", + ], +) + +cpp_unittest( + name = "io_uring_backend_setup_test", + srcs = ["IoUringBackendSetupTest.cpp"], + owner = "kvigor@xmail.facebook.com", + deps = [ + "//folly/experimental/io:io_uring_backend", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "io_benchmark", + srcs = ["IOBenchmark.cpp"], + headers = [], + deps = [ + ":async_base_test_lib", + ":io_test_temp_file_util_lib", + "//folly:benchmark", + "//folly:file_util", + "//folly/experimental/io:async_io", + "//folly/experimental/io:io_uring", + "//folly/portability:gflags", + ], +) + +cpp_library( + name = "mux_io_thread_pool_executor_test_lib", + srcs = ["MuxIOThreadPoolExecutorTest.cpp"], + link_whole = True, + deps = [ + "//folly/executors/test:IOThreadPoolExecutorBaseTestLib", + "//folly/experimental/io:epoll", + "//folly/experimental/io:mux_io_thread_pool_executor", + "//folly/portability:gtest", + "//folly/synchronization:latch", + ], +) + +cpp_unittest( + name = "mux_io_thread_pool_executor_test_epoll", + args = [ + "--folly_event_base_poller_backend=epoll", + "--folly_event_base_poller_epoll_rearm_inline=false", + ], + supports_static_listing = False, + deps = [ + ":mux_io_thread_pool_executor_test_lib", # @manual + ], +) + +cpp_unittest( + name = "mux_io_thread_pool_executor_test_epoll_rearm_inline", + args = [ + "--folly_event_base_poller_backend=epoll", + "--folly_event_base_poller_epoll_rearm_inline=true", + ], + supports_static_listing = False, + deps = [ + ":mux_io_thread_pool_executor_test_lib", # @manual + ], +) + +cpp_unittest( + name = "mux_io_thread_pool_executor_test_io_uring", + args = [ + "--folly_event_base_poller_backend=io_uring", + ], + supports_static_listing = False, + deps = [ + ":mux_io_thread_pool_executor_test_lib", # @manual + ], +) + +cpp_unittest( + name = "epoll_backend_test", + srcs = ["EpollBackendTest.cpp"], + owner = "dmm@xmail.facebook.com", + supports_static_listing = False, + deps = [ + "//folly/experimental/io:epoll_backend", + "//folly/io/async/test:async_signal_handler_test_lib", + "//folly/io/async/test:event_base_test_lib", + ], +) + +cpp_unittest( + name = "io_uring_backend_test", + srcs = ["IoUringBackendTest.cpp"], + headers = [], + owner = "dmm@xmail.facebook.com", + supports_static_listing = False, + deps = [ + ":io_test_temp_file_util_lib", + "//folly:file_util", + "//folly:function", + "//folly:string", + "//folly/experimental/io:io_uring_backend", + "//folly/init:init", + "//folly/io/async:async_base", + "//folly/io/async:async_udp_server_socket", + "//folly/io/async:async_udp_socket", + "//folly/io/async/test:async_signal_handler_test_lib", + "//folly/io/async/test:event_base_test_lib", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "io_uring_event_test", + srcs = ["IoUringEventTest.cpp"], + owner = "dylany@xmail.facebook.com", + supports_static_listing = False, + deps = [ + "//folly/experimental/io:io_uring_backend", + "//folly/experimental/io:io_uring_event", + "//folly/futures:core", + "//folly/io/async:async_base", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "io_uring_event_base_local_test", + srcs = ["IoUringEventBaseLocalTest.cpp"], + owner = "dylany@xmail.facebook.com", + deps = [ + "//folly/experimental/io:io_uring_backend", + "//folly/experimental/io:io_uring_event_base_local", + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "async_io_uring_socket_test", + srcs = ["AsyncIoUringSocketTest.cpp"], + supports_static_listing = False, + deps = [ + "//folly:file_util", + "//folly:subprocess", + "//folly/executors:global_executor", + "//folly/experimental/io:async_io_uring_socket", + "//folly/experimental/io:io_uring_backend", + "//folly/experimental/io:io_uring_event", + "//folly/futures:core", + "//folly/io/async:async_base", + "//folly/io/async:async_socket", + "//folly/io/async:server_socket", + "//folly/portability:gtest", + "//folly/system:shell", + "//folly/test:socket_address_test_helper", + ], +) + +cpp_binary( + name = "registered_fd_benchmark", + srcs = ["RegisteredFdBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:file_util", + "//folly/experimental/io:io_uring_backend", + "//folly/io/async:async_base", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "fs_util_test", + srcs = ["FsUtilTest.cpp"], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:string", + "//folly/experimental/io:fs_util", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "simple_async_io_test", + srcs = ["SimpleAsyncIOTest.cpp"], + supports_static_listing = False, + deps = [ + "//folly:file", + "//folly:random", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:collect", + "//folly/experimental/io:simple_async_io", + "//folly/io:iobuf", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/experimental/io/tool/BUCK b/folly/experimental/io/tool/BUCK new file mode 100644 index 00000000000..9528baad68f --- /dev/null +++ b/folly/experimental/io/tool/BUCK @@ -0,0 +1,18 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") + +oncall("fbcode_entropy_wardens_folly") + +cpp_binary( + name = "huge_page_util", + srcs = ["HugePageUtil.cpp"], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:range", + "//folly/experimental/io:huge_pages", + "//folly/portability:gflags", + "//folly/system:memory_mapping", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/experimental/observer/BUCK b/folly/experimental/observer/BUCK new file mode 100644 index 00000000000..e24c61ba74b --- /dev/null +++ b/folly/experimental/observer/BUCK @@ -0,0 +1,104 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "observable", + headers = [ + "Observable.h", + "Observable-inl.h", + ], + exported_deps = [ + ":observer", + "//folly/synchronization:baton", + ], +) + +cpp_library( + name = "observer", + headers = [ + "Observer.h", + "Observer-inl.h", + "Observer-pre.h", + ], + exported_deps = [ + "//folly:shared_mutex", + "//folly:synchronized", + "//folly:thread_local", + "//folly/experimental/observer/detail:observer_manager", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "hazptr_observer", + headers = [ + "HazptrObserver.h", + ], + exported_deps = [ + ":observer", + "//folly:synchronized", + "//folly/experimental/observer/detail:observer_manager", + "//folly/synchronization:hazptr", + ], +) + +cpp_library( + name = "read_mostly_tl_observer", + headers = [ + "ReadMostlyTLObserver.h", + ], + exported_deps = [ + ":observer", + "//folly/experimental:read_mostly_shared_ptr", + "//folly/experimental/observer/detail:observer_manager", + ], +) + +cpp_library( + name = "core_cached_observer", + headers = [ + "CoreCachedObserver.h", + ], + exported_deps = [ + ":observer", + "//folly/concurrency:core_cached_shared_ptr", + "//folly/experimental/observer/detail:observer_manager", + ], +) + +cpp_library( + name = "simple_observable", + headers = [ + "SimpleObservable.h", + "SimpleObservable-inl.h", + ], + exported_deps = [ + ":observable", + ":observer", + "//folly:function", + "//folly:synchronized", + "//folly/synchronization:delayed_init", + ], +) + +cpp_library( + name = "with_jitter", + headers = [ + "WithJitter.h", + "WithJitter-inl.h", + ], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + ":observable", + ":observer", + "//folly:default_keep_alive_executor", + "//folly:random", + "//folly:synchronized", + "//folly/executors:global_executor", + "//folly/futures:core", + ], + exported_external_deps = [ + "glog", + ], +) diff --git a/folly/experimental/observer/detail/BUCK b/folly/experimental/observer/detail/BUCK new file mode 100644 index 00000000000..2cb11473e41 --- /dev/null +++ b/folly/experimental/observer/detail/BUCK @@ -0,0 +1,45 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "graph_cycle_detector", + headers = ["GraphCycleDetector.h"], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "observer_manager", + srcs = [ + "Core.cpp", + "ObserverManager.cpp", + ], + headers = [ + "Core.h", + "ObserverManager.h", + ], + deps = [ + "//folly:exception_string", + "//folly:format", + "//folly:range", + "//folly:singleton", + "//folly/concurrency:unbounded_queue", + "//folly/portability:gflags", + "//folly/system:thread_name", + ], + exported_deps = [ + ":graph_cycle_detector", + "//folly:function", + "//folly:portability", + "//folly:synchronized", + "//folly/fibers:core_manager", + "//folly/functional:invoke", + "//folly/futures:core", + "//folly/synchronization:sanitize_thread", + ], + exported_external_deps = [ + "glog", + ], +) diff --git a/folly/experimental/observer/test/BUCK b/folly/experimental/observer/test/BUCK new file mode 100644 index 00000000000..9729ce53b08 --- /dev/null +++ b/folly/experimental/observer/test/BUCK @@ -0,0 +1,22 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "observer_test", + srcs = ["ObserverTest.cpp"], + headers = [], + deps = [ + "//folly:singleton", + "//folly/experimental/observer:core_cached_observer", + "//folly/experimental/observer:hazptr_observer", + "//folly/experimental/observer:observer", + "//folly/experimental/observer:read_mostly_tl_observer", + "//folly/experimental/observer:simple_observable", + "//folly/experimental/observer:with_jitter", + "//folly/fibers:core_manager", + "//folly/fibers:fiber_manager_map", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) diff --git a/folly/experimental/settings/BUCK b/folly/experimental/settings/BUCK new file mode 100644 index 00000000000..7f2ab485375 --- /dev/null +++ b/folly/experimental/settings/BUCK @@ -0,0 +1,62 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "settings", + srcs = [ + "Settings.cpp", + ], + headers = [ + "detail/SettingsImpl.h", + ], + deps = [ + "//folly:synchronized", + ], + exported_deps = [ + ":immutables", + ":types", + "//folly:conv", + "//folly:function", + "//folly:likely", + "//folly:optional", + "//folly:range", + "//folly:shared_mutex", + "//folly:thread_local", + "//folly:utility", + "//folly/container:f14_hash", + "//folly/lang:aligned", + ], +) + +cpp_library( + name = "types", + srcs = [ + "Types.cpp", + ], + headers = [ + ], + exported_deps = [ + "//folly:conv", + "//folly:expected", + "//folly:range", + "//folly:unit", + "//folly:utility", + ], +) + +cpp_library( + name = "immutables", + srcs = [ + "Immutables.cpp", + ], + headers = [ + ], + deps = [ + "//folly:indestructible", + "//folly:synchronized", + ], + exported_deps = [ + "//folly/container:f14_hash", + ], +) diff --git a/folly/experimental/settings/test/BUCK b/folly/experimental/settings/test/BUCK new file mode 100644 index 00000000000..3b8e0cbea30 --- /dev/null +++ b/folly/experimental/settings/test/BUCK @@ -0,0 +1,57 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "a", + srcs = [ + "a.cpp", + ], + headers = [ + "a.h", + ], + exported_deps = [ + "//folly/experimental/settings:settings", + ], +) + +cpp_library( + name = "b", + srcs = [ + "b.cpp", + ], + headers = [ + "b.h", + ], + exported_deps = [ + "//folly/experimental/settings:settings", + ], +) + +cpp_unittest( + name = "settings_test", + srcs = [ + "SettingsTest.cpp", + ], + deps = [ + ":a", + ":b", + "//folly:format", + "//folly:string", + "//folly/experimental/settings:settings", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "settings_bench", + srcs = ["SettingsBenchmarks.cpp"], + deps = [ + "//folly:benchmark", + "//folly/experimental/settings:settings", + "//folly/init:init", + ], +) diff --git a/folly/experimental/symbolizer/BUCK b/folly/experimental/symbolizer/BUCK new file mode 100644 index 00000000000..c275858b9bf --- /dev/null +++ b/folly/experimental/symbolizer/BUCK @@ -0,0 +1,209 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + # @autodeps-skip + name = "dwarf", + srcs = [ + "Dwarf.cpp", + "DwarfImpl.cpp", + "DwarfLineNumberVM.cpp", + "DwarfSection.cpp", + "DwarfUtil.cpp", + ], + headers = [ + "Dwarf.h", + "DwarfImpl.h", + "DwarfLineNumberVM.h", + "DwarfSection.h", + "DwarfUtil.h", + ], + deps = [ + "//folly:optional", + "//folly/lang:safe_assert", + "//folly/portability:config", + "//folly/portability:unistd", + ], + exported_deps = [ + "fbsource//third-party/libdwarf:dwarf", + ":elf", + ":elf_cache", + ":symbolized_frame", + "//folly:function", + "//folly:range", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "elf", + srcs = [ + "Elf.cpp", + ], + headers = [ + "Elf.h", + "Elf-inl.h", + ], + deps = [ + "//folly:exception", + "//folly:scope_guard", + "//folly/lang:c_string", + "//folly/portability:sys_mman", + ], + exported_deps = [ + "//folly:conv", + "//folly:likely", + "//folly:range", + "//folly/lang:safe_assert", + "//folly/portability:config", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "symbolized_frame", + srcs = ["SymbolizedFrame.cpp"], + headers = ["SymbolizedFrame.h"], + exported_deps = [ + "//folly:range", + ], +) + +cpp_library( + name = "line_reader", + srcs = ["LineReader.cpp"], + headers = ["LineReader.h"], + deps = [ + "//folly:file_util", + ], + exported_deps = [ + "//folly:range", + ], +) + +cpp_library( + name = "stack_trace", + srcs = ["StackTrace.cpp"], + headers = ["StackTrace.h"], + deps = [ + "//folly:cpp_attributes", + "//folly:portability", + "//folly/portability:config", + "//folly/portability:libunwind", + "//folly/tracing:async_stack", + ], + exported_deps = [ + "//folly/portability:sys_types", + ], +) + +cpp_library( + name = "elf_cache", + srcs = [ + "ElfCache.cpp", + ], + headers = [ + "ElfCache.h", + ], + deps = [ + "//folly:scope_guard", + "//folly/portability:sys_mman", + ], + exported_deps = [ + ":elf", + "//folly:optional", + "//folly:range", + "//folly/hash:hash", + "//folly/memory:reentrant_allocator", + "//folly/portability:config", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "symbolize_printer", + srcs = [ + "SymbolizePrinter.cpp", + ], + headers = [ + "SymbolizePrinter.h", + ], + deps = [ + "//folly:demangle", + "//folly:file_util", + "//folly:scope_guard", + "//folly/io:iobuf", + "//folly/lang:to_ascii", + ], + exported_deps = [ + ":symbolized_frame", + "//folly:fbstring", + "//folly:range", + ], +) + +cpp_library( + name = "symbolizer", + srcs = [ + "Symbolizer.cpp", + ], + headers = [ + "Symbolizer.h", + ], + deps = [ + ":elf", + ":line_reader", + "//folly:file_util", + "//folly:memory", + "//folly:scope_guard", + "//folly:synchronized", + "//folly/container:evicting_cache_map", + "//folly/experimental/symbolizer/detail:debug", + "//folly/lang:safe_assert", + "//folly/lang:to_ascii", + "//folly/memory:sanitize_address", + "//folly/portability:sys_mman", + "//folly/tracing:async_stack", + ], + exported_deps = [ + ":dwarf", + ":elf_cache", + ":stack_trace", + ":symbolize_printer", + ":symbolized_frame", + "//folly:fbstring", + "//folly:optional", + "//folly:range", + "//folly:string", + "//folly/io:iobuf", + "//folly/portability:config", + "//folly/portability:unistd", + ], +) + +cpp_library( + name = "signal_handler", + srcs = [ + "SignalHandler.cpp", + ], + headers = [ + "SignalHandler.h", + ], + deps = [ + ":symbolizer", + "//folly:scope_guard", + "//folly/lang:to_ascii", + "//folly/portability:sys_syscall", + "//folly/portability:unistd", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/experimental/symbolizer/detail/BUCK b/folly/experimental/symbolizer/detail/BUCK new file mode 100644 index 00000000000..937d58e2147 --- /dev/null +++ b/folly/experimental/symbolizer/detail/BUCK @@ -0,0 +1,11 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "debug", + headers = ["Debug.h"], + exported_deps = [ + "//folly:cpp_attributes", + ], +) diff --git a/folly/experimental/symbolizer/test/BUCK b/folly/experimental/symbolizer/test/BUCK new file mode 100644 index 00000000000..43ffd769b42 --- /dev/null +++ b/folly/experimental/symbolizer/test/BUCK @@ -0,0 +1,237 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") +load("@fbcode_macros//build_defs:custom_unittest.bzl", "custom_unittest") +load("@fbcode_macros//build_defs:native_rules.bzl", "buck_sh_binary") +load(":validate_folly_symbolizer.bzl", "SPLIT_DWARF_FLAGS", "customized_unittest", "validate_folly_symbolizer", "validate_symbolizer_dwp") + +oncall("fbcode_entropy_wardens_folly") + +cpp_binary( + name = "crash", + srcs = ["Crash.cpp"], + compiler_specific_flags = { + "clang": [ + "-gdwarf-aranges", + ], + }, + deps = [ + "//folly/experimental/symbolizer:signal_handler", + ], +) + +cpp_binary( + name = "dwarf_benchmark", + srcs = ["DwarfBenchmark.cpp"], + compiler_specific_flags = { + "clang": [ + "-g", + ], + }, + deps = [ + ":symbolizer_test_utils_dwarf4_dwarf32_noaaranges", + "//folly:benchmark", + "//folly:range", + "//folly/experimental/symbolizer:dwarf", + "//folly/experimental/symbolizer:symbolized_frame", + "//folly/experimental/symbolizer:symbolizer", + "//folly/portability:gflags", + ], +) + +cpp_binary( + name = "small_sigaltstack_crash", + srcs = ["SmallSigAltStackCrash.cpp"], + compiler_specific_flags = { + "clang": [ + "-gdwarf-aranges", + ], + }, + deps = [ + "//folly/experimental/symbolizer:signal_handler", + ], +) + +cpp_unittest( + name = "symbolized_frame_test", + srcs = ["SymbolizedFrameTest.cpp"], + deps = [ + "//folly/experimental/symbolizer:symbolized_frame", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "elf_test", + srcs = ["ElfTest.cpp"], + deps = [ + "//folly:file_util", + "//folly/experimental:test_util", + "//folly/experimental/symbolizer:elf", + "//folly/experimental/symbolizer/detail:debug", + "//folly/portability:gtest", + ], +) + +buck_sh_binary( + name = "gnu_debuglink_test.sh", + main = "gnu_debuglink_test.sh", +) + +custom_unittest( + name = "gnu_debuglink_test", + command = [ + "$(exe :gnu_debuglink_test.sh)", + "$(location :crash)", + ], + type = "json", + deps = [ + ":crash", + ], +) + +# This test consistently fails. +# See https://www.internalfb.com/diff/D9846902?dst_version_fbid=724209254597440&transaction_fbid=918539549011564 +# custom_unittest( +# name = "gnu_debuglink_test_small_sigaltstack", +# command = [ +# "folly/experimental/symbolizer/test/gnu_debuglink_test.sh", +# "$(location :small_sigaltstack_crash)", +# ], +# type = "json", +# deps = [ +# ":small_sigaltstack_crash", +# ], +# ) + +cpp_unittest( + name = "line_reader_test", + srcs = ["LineReaderTest.cpp"], + deps = [ + "//folly:file_util", + "//folly/experimental:test_util", + "//folly/experimental/symbolizer:line_reader", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "signal_handler_test", + srcs = ["SignalHandlerTest.cpp"], + headers = ["SignalHandlerTest.h"], + deps = [ + "//folly:c_portability", + "//folly:file_util", + "//folly:range", + "//folly/executors:io_thread_pool_executor", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:task", + "//folly/experimental/symbolizer:signal_handler", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_benchmark( + name = "stack_trace_benchmark", + srcs = ["StackTraceBenchmark.cpp"], + deps = [ + "//folly:benchmark", + "//folly/experimental/symbolizer:stack_trace", + "//folly/init:init", + ], +) + +cpp_unittest( + name = "stack_trace_size_limit_test", + srcs = ["StackTraceSizeLimitTest.cpp"], + deps = [ + "//folly/experimental/symbolizer:stack_trace", + "//folly/experimental/symbolizer:symbolizer", + "//folly/fibers:core_manager", + "//folly/fibers:simple_loop_controller", + "//folly/init:init", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "stack_trace_test", + srcs = ["StackTraceTest.cpp"], + deps = [ + "//folly/experimental:test_util", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:task", + "//folly/experimental/symbolizer:stack_trace", + "//folly/experimental/symbolizer:symbolizer", + "//folly/lang:hint", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], + external_deps = [ + "glog", + ("boost", None, "boost_regex"), + ], +) + +customized_unittest( + available_dwarf_sizes = [ + 32, + 64, + ], + available_dwarf_versions = [ + "dwarf4", + "dwarf5", + ], + avilable_split_dwarf_keys = SPLIT_DWARF_FLAGS.keys(), + custom_suffix = "", + extra_compiler_flags = [], +) + +customized_unittest( + available_dwarf_sizes = [ + 32, + ], + available_dwarf_versions = [ + "dwarf5", + ], + avilable_split_dwarf_keys = ["none"], + custom_suffix = "_split-dwarf4-by-default", + extra_compiler_flags = ["-gdwarf-5"], +) + +buck_sh_binary( + name = "compare-addr2line.sh", + main = "compare-addr2line.sh", +) + +validate_folly_symbolizer( + name = "compare-addr2line-symbolizer_test_dwarf4", + binary = ":symbolizer_test_dwarf4_dwarf32_aaranges", +) + +buck_sh_binary( + name = "symbolizer_dwp_compability.sh", + main = "symbolizer_dwp_compability.sh", +) + +validate_symbolizer_dwp( + name = "validate_symbolizer_dwp_dwarf4_dwarf32_single_inlining_aaranges", + binary = ":symbolizer_test_dwarf4_dwarf32_single_inlining_aaranges", +) + +validate_symbolizer_dwp( + name = "validate_symbolizer_dwp_dwarf5_dwarf32_single_inlining_aaranges", + # we cannot mix split-dwarf-4 with split-dwarf-5. fbcode enables split-dwarf4 by default + # unless -c fbcode.split-dwarf5=True is enabled, so let's disable split-dwarf in the test + # CU that is built with dwarf5 + binary = ":symbolizer_test_dwarf5_dwarf32_aaranges_split-dwarf4-by-default", +) diff --git a/folly/experimental/symbolizer/test/validate_folly_symbolizer.bzl b/folly/experimental/symbolizer/test/validate_folly_symbolizer.bzl new file mode 100644 index 00000000000..923149a50c7 --- /dev/null +++ b/folly/experimental/symbolizer/test/validate_folly_symbolizer.bzl @@ -0,0 +1,130 @@ +load("@fbcode_macros//build_defs:config.bzl", "config") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") +load("@fbcode_macros//build_defs:custom_unittest.bzl", "custom_unittest") +load("@fbsource//tools/build_defs/buck2:is_buck2.bzl", "is_buck2") + +SPLIT_DWARF_FLAGS = { + "none": ["-gno-split-dwarf"], + "single_inlining": ["-gsplit-dwarf=single", "-fsplit-dwarf-inlining"], + "single_no_inlining": ["-gsplit-dwarf=single", "-fno-split-dwarf-inlining"], + "split_no_inlining": ["-gsplit-dwarf=split", "-fno-split-dwarf-inlining"], +} + +def _dwarf_size_flag(size): + if size == 32: + return [] + else: + return ["-gdwarf{}".format(size)] + +def customized_unittest( + available_dwarf_versions = [], + avilable_split_dwarf_keys = [], + available_dwarf_sizes = [], + extra_compiler_flags = [], + custom_suffix = ""): + # Testing different combinations of the following options: + # 1. Dwarf4 or Dwarf5. + # 2. Dwarf32 or Dwarf 64. + # 3. Split dwarf options. + # 4. Use aaranges or not. + for dwarf_version in available_dwarf_versions: + for dwarf_size in available_dwarf_sizes: + for split_dwarf_option in avilable_split_dwarf_keys: + # buck2 doesn't support split version yet. + if split_dwarf_option == "none" or split_dwarf_option == "single_inlining" or not is_buck2(): + for use_aaranges in [False, True]: + cpp_library( + name = "symbolizer_test_utils_" + dwarf_version + + ("_dwarf{}".format(dwarf_size)) + + ("" if split_dwarf_option == "none" else "_" + split_dwarf_option) + + ("_aaranges" if use_aaranges else "_noaaranges") + custom_suffix, + srcs = ["SymbolizerTestUtils.cpp"], + headers = [ + "SymbolizerTestUtils.h", + "SymbolizerTestUtils-inl.h", + ], + # Tests rely on this library having full debug info, so use `-g` to override + # the platform default, and use `--emit-relocs` to prevent `--strip-debug-*` + # flags from dropping debug info. + compiler_flags = ["-g"] + + (["-gdwarf-5"] if dwarf_version == "dwarf5" else ["-gdwarf-4"]) + + (_dwarf_size_flag(dwarf_size)) + + SPLIT_DWARF_FLAGS[split_dwarf_option] + + (["-gdwarf-aranges"] if use_aaranges else []) + + extra_compiler_flags, + modular_headers = False, + private_linker_flags = [ + "--emit-relocs", # makes linker ignore `--strip-debug-*` flags + ], + ) + cpp_unittest( + name = "symbolizer_test_" + dwarf_version + + ("_dwarf{}".format(dwarf_size)) + + ("" if split_dwarf_option == "none" else "_" + split_dwarf_option) + + ("_aaranges" if use_aaranges else "_noaaranges") + custom_suffix, + srcs = ["SymbolizerTest.cpp"], + supports_static_listing = True, + tags = ["dwp"] if split_dwarf_option == "single_inlining" and use_aaranges else [], + # This tests requires full debug info, so use `-g` to override the platform + # default, and use `--emit-relocs` to prevent `--strip-debug-*` flags from + # dropping debug info. + compiler_flags = ["-g"] + + (["-gdwarf-5"] if dwarf_version == "dwarf5" else ["-gdwarf-4"]) + + (_dwarf_size_flag(dwarf_size)) + + SPLIT_DWARF_FLAGS[split_dwarf_option] + + (["-gdwarf-aranges"] if use_aaranges else []) + extra_compiler_flags, + linker_flags = [ + "--emit-relocs", # makes linker ignore `--strip-debug-*` flags + ], + deps = [ + ":symbolizer_test_utils_" + dwarf_version + + ("_dwarf{}".format(dwarf_size)) + + ("" if split_dwarf_option == "none" else "_" + split_dwarf_option) + + ("_aaranges" if use_aaranges else "_noaaranges"), # @manual + "//folly:demangle", + "//folly:range", + "//folly:scope_guard", + "//folly:string", + "//folly/experimental/symbolizer:elf_cache", + "//folly/experimental/symbolizer:symbolized_frame", + "//folly/experimental/symbolizer:symbolizer", + "//folly/experimental/symbolizer/detail:debug", + "//folly/portability:filesystem", + "//folly/portability:gtest", + "//folly/portability:unistd", + "//folly/synchronization:baton", + "//folly/test:test_utils", + ], + external_deps = [ + "glog", + ], + ) + +def validate_folly_symbolizer(name, binary): + custom_unittest( + name = name, + command = [ + "$(exe //folly/experimental/symbolizer/test:compare-addr2line.sh)", + "$(location //folly/experimental/symbolizer/tool:folly-addr2line)", + "$(location //third-party-buck/platform010/build/llvm-fb/15:bin/llvm-addr2line)", + "$(location {})".format(binary), + ], + type = "simple", + ) + +def validate_symbolizer_dwp(name, binary): + # Only test in opt mode. + # In dev mode, the test still depends on the shared libraries except + # binary + dwp file. + if config.get_build_mode().startswith("opt"): + custom_unittest( + name = name, + command = [ + "$(exe //folly/experimental/symbolizer/test:symbolizer_dwp_compability.sh)", + "$(location {})".format(binary), + "$(location {}[dwp])".format(binary), + config.get_build_mode(), + ], + type = "simple", + ) diff --git a/folly/experimental/symbolizer/tool/BUCK b/folly/experimental/symbolizer/tool/BUCK new file mode 100644 index 00000000000..c9a44fe36f9 --- /dev/null +++ b/folly/experimental/symbolizer/tool/BUCK @@ -0,0 +1,84 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:export_files.bzl", "export_file") +load("//antlir/fbpkg:fbpkg.bzl", "fbpkg") + +oncall("fbcode_entropy_wardens_folly") + +cpp_binary( + name = "folly-addr2line", + srcs = [ + "Addr2Line.cpp", + ], + deps = [ + "//folly:range", + "//folly/experimental/symbolizer:dwarf", + "//folly/experimental/symbolizer:elf", + "//folly/experimental/symbolizer:symbolized_frame", + "//folly/experimental/symbolizer:symbolizer", + "//folly/init:init", + "//folly/portability:gflags", + ], +) + +export_file( + name = "libFollySegFault.so.v", +) + +# Build a standlone DSO for use w/ `LD_PRELOAD`. +cpp_binary( + name = "libFollySegFault.so", + srcs = [ + "LibSegFault.cpp", + ], + compiler_flags = [ + # Allow using the elvis operator. + "-Wno-gnu-conditional-omitted-operand", + ], + dlopen_enabled = True, + linker_flags = [ + + # Trim runtime `DT_NEEDED` deps. + "--as-needed", + + # Use a version script to prevent exporting any symbols. + "--version-script=$(location :libFollySegFault.so.v)", + ] + select({ + "DEFAULT": [], + "ovr_config//runtime:fbcode": [ + # This how we can statically link `libstdc++.so` w/ the fbcode + # toolchain. + "--push-state", + "-Bstatic", + "-lstdc++_pic", + "--pop-state", + ], + }), + # Statically link libstdc++ to avoid an external dep which could make + # this less flexible. + os_linker_flags = [ + ( + "linux", + select({ + "DEFAULT": [ + "-static-libstdc++", + ], + "ovr_config//runtime:fbcode": [], + }), + ), + ], + deps = [ + "//folly:range", + "//folly/experimental/symbolizer:signal_handler", + ], +) + +fbpkg.builder( + name = "folly.symbolizer", + buck_opts = fbpkg.buck_opts( + config = {"fbcode.platform": "centos8"}, + ), + path_actions = { + "folly-addr2line": ":folly-addr2line", + "libFollySegFault.so": ":libFollySegFault.so", + }, +) diff --git a/folly/experimental/test/BUCK b/folly/experimental/test/BUCK new file mode 100644 index 00000000000..0b7b254f932 --- /dev/null +++ b/folly/experimental/test/BUCK @@ -0,0 +1,506 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_benchmark( + name = "atomic_read_mostly_main_ptr_benchmark", + srcs = ["AtomicReadMostlyMainPtrBenchmark.cpp"], + deps = [ + "//folly:benchmark", + "//folly/experimental:atomic_read_mostly_main_ptr", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "atomic_read_mostly_main_ptr_test", + srcs = ["AtomicReadMostlyMainPtrTest.cpp"], + deps = [ + "//folly/experimental:atomic_read_mostly_main_ptr", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "auto_timer_test", + srcs = ["AutoTimerTest.cpp"], + headers = [], + deps = [ + "//folly/experimental:auto_timer", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "bits_benchmark", + srcs = ["BitsBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/experimental:bits", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "bits_test", + srcs = ["BitsTest.cpp"], + headers = [], + deps = [ + "//folly/experimental:bits", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "cleanup_test", + srcs = ["CleanupTest.cpp"], + headers = [], + deps = [ + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:manual_executor", + "//folly/experimental:cleanup", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "bitvector_test", + srcs = ["BitVectorCodingTest.cpp"], + headers = [], + deps = [ + ":coding_test_utils", + "//folly:benchmark", + "//folly:portability", + "//folly/experimental:bit_vector_coding", + "//folly/experimental:select64", + "//folly/init:init", + ], +) + +cpp_library( + name = "coding_test_utils", + srcs = ["CodingTestUtils.cpp"], + headers = ["CodingTestUtils.h"], + deps = [ + "//folly/portability:gflags", + ], + exported_deps = [ + "//folly:benchmark", + "//folly:likely", + "//folly:optional", + "//folly/experimental:instructions", + "//folly/portability:gtest", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "eliasfano_test", + srcs = ["EliasFanoCodingTest.cpp"], + headers = [], + deps = [ + ":coding_test_utils", + "//folly:benchmark", + "//folly:random", + "//folly/experimental:elias_fano_coding", + "//folly/experimental:select64", + "//folly/init:init", + ], +) + +cpp_binary( + name = "env_util_subprocess", + srcs = ["EnvUtilSubprocess.cpp"], +) + +cpp_unittest( + name = "env_util_test", + srcs = ["EnvUtilTest.cpp"], + headers = [], + args = [ + "--env_util_subprocess_binary=$(location :env_util_subprocess)", + ], + deps = [ + "//folly:memory", + "//folly:subprocess", + "//folly/container:array", + "//folly/experimental:env_util", + "//folly/portability:fcntl", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/portability:stdlib", + ], + external_deps = [ + "glog", + ("boost", None, "boost_algorithm"), + ], +) + +cpp_unittest( + name = "event_count_test", + srcs = ["EventCountTest.cpp"], + headers = [], + deps = [ + "//folly:random", + "//folly/experimental:event_count", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "flat_combining_priority_queue_test", + srcs = ["FlatCombiningPriorityQueueTest.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/experimental:flat_combining_priority_queue", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "relaxed_concurrent_priority_queue_test", + srcs = ["RelaxedConcurrentPriorityQueueTest.cpp"], + headers = [], + deps = [ + "//folly:random", + "//folly:spin_lock", + "//folly/experimental:flat_combining_priority_queue", + "//folly/experimental:relaxed_concurrent_priority_queue", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/test:deterministic_schedule", + ], + external_deps = [ + "glog", + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "function_scheduler_test", + srcs = ["FunctionSchedulerTest.cpp"], + headers = [], + deps = [ + "//folly:random", + "//folly/experimental:function_scheduler", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], + external_deps = [ + "glog", + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "future_dag_test", + srcs = ["FutureDAGTest.cpp"], + headers = [], + deps = [ + "//folly/executors:global_executor", + "//folly/experimental:future_dag", + "//folly/portability:gtest", + ], + external_deps = [ + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "hhwheel_timer_high_res_test", + srcs = ["HHWheelTimerHighResTest.cpp"], + headers = [], + deps = [ + "//folly/experimental:timerfd", + "//folly/io/async:async_base", + "//folly/io/async/test:util", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "hhwheel_timer_high_res_benchmark", + srcs = ["HHWheelTimerHighResBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/experimental:timerfd", + "//folly/io/async/test:util", + ], +) + +cpp_unittest( + name = "instructions_test", + srcs = ["InstructionsTest.cpp"], + headers = [], + deps = [ + "//folly/experimental:instructions", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "lock_free_ring_buffer_test", + srcs = ["LockFreeRingBufferTest.cpp"], + headers = [], + deps = [ + "//folly/experimental:lock_free_ring_buffer", + "//folly/portability:gtest", + "//folly/test:deterministic_schedule", + ], +) + +cpp_unittest( + name = "primary_ptr_test", + srcs = ["PrimaryPtrTest.cpp"], + headers = [], + deps = [ + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:manual_executor", + "//folly/experimental:primary_ptr", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_binary( + name = "nested_command_line_app_example", + srcs = ["NestedCommandLineAppExample.cpp"], + headers = [], + deps = [ + "//folly:scope_guard", + "//folly:string", + "//folly/experimental:program_options", + ], +) + +cpp_benchmark( + name = "read_mostly_shared_ptr_benchmark", + srcs = ["ReadMostlySharedPtrBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly:memory", + "//folly/experimental:read_mostly_shared_ptr", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "read_mostly_shared_ptr_test", + srcs = ["ReadMostlySharedPtrTest.cpp"], + headers = [], + deps = [ + "//folly:memory", + "//folly/experimental:read_mostly_shared_ptr", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "read_mostly_shared_ptr_stress_test", + srcs = ["ReadMostlySharedPtrStressTest.cpp"], + headers = [], + deps = [ + "//folly/experimental:read_mostly_shared_ptr", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "ref_count_benchmark", + srcs = ["RefCountBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/experimental:tl_ref_count", + ], +) + +cpp_unittest( + name = "ref_count_test", + srcs = ["RefCountTest.cpp"], + headers = [], + deps = [ + "//folly/experimental:tl_ref_count", + "//folly/portability:gtest", + "//folly/synchronization:baton", + "//folly/synchronization/test:barrier", + ], +) + +cpp_unittest( + name = "select64_test", + srcs = ["Select64Test.cpp"], + deps = [ + "//folly/experimental:instructions", + "//folly/experimental:select64", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "single_writer_fixed_hash_map_test", + srcs = ["SingleWriterFixedHashMapTest.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/container:array", + "//folly/experimental:single_writer_fixed_hash_map", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/synchronization/test:barrier", + ], + external_deps = [ + ("boost", None, "boost_thread"), + "glog", + ], +) + +cpp_binary( + name = "singleton_relaxed_counter_bench", + srcs = [ + "SingletonRelaxedCounterBench.cpp", + ], + deps = [ + "//folly:benchmark", + "//folly/experimental:singleton_relaxed_counter", + "//folly/init:init", + "//folly/lang:keep", + "//folly/portability:gflags", + ], + external_deps = [ + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "singleton_relaxed_counter_test", + srcs = [ + "SingletonRelaxedCounterTest.cpp", + ], + deps = [ + "//folly:thread_local", + "//folly/experimental:singleton_relaxed_counter", + "//folly/portability:gtest", + ], + external_deps = [ + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "test_util_test", + srcs = ["TestUtilTest.cpp"], + headers = [], + deps = [ + "//folly:memory", + "//folly/experimental:test_util", + "//folly/portability:fcntl", + "//folly/portability:gtest", + "//folly/portability:stdlib", + ], + external_deps = [ + "glog", + ("boost", None, "boost_algorithm"), + ], +) + +cpp_unittest( + name = "threaded_repeating_function_runner_test", + srcs = ["ThreadedRepeatingFunctionRunnerTest.cpp"], + headers = [], + deps = [ + "//folly/experimental:threaded_repeating_function_runner", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "timerfd_timeout_manager_test", + srcs = ["TimerFDTimeoutManagerTest.cpp"], + headers = [], + deps = [ + "//folly/experimental:timerfd", + "//folly/io/async/test:util", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "tuple_ops_test", + srcs = ["TupleOpsTest.cpp"], + headers = [], + deps = [ + "//folly:conv", + "//folly/experimental:tuple_ops", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "quotient_multiset_test", + srcs = [ + "QuotientMultiSetTest.cpp", + ], + deps = [ + "//folly:format", + "//folly:random", + "//folly/container:enumerate", + "//folly/experimental:quotient_multiset", + "//folly/io:iobuf", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "quotient_multiset_benchmark", + srcs = [ + "QuotientMultiSetBenchmark.cpp", + ], + deps = [ + ":coding_test_utils", + "//folly:benchmark", + "//folly:format", + "//folly:random", + "//folly:string", + "//folly/container:enumerate", + "//folly/container:f14_hash", + "//folly/container:foreach", + "//folly/experimental:elias_fano_coding", + "//folly/experimental:quotient_multiset", + "//folly/init:init", + ], + external_deps = [ + ("boost", None, "boost_sort"), + ], +) diff --git a/folly/experimental/tool/BUCK b/folly/experimental/tool/BUCK new file mode 100644 index 00000000000..f820ba465b4 --- /dev/null +++ b/folly/experimental/tool/BUCK @@ -0,0 +1,13 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") + +oncall("fbcode_entropy_wardens_folly") + +cpp_binary( + name = "json_schema_tester", + srcs = ["JSONSchemaTester.cpp"], + headers = [], + deps = [ + "//folly/experimental:json_schema", + "//folly/json:dynamic", + ], +) diff --git a/folly/ext/BUCK b/folly/ext/BUCK new file mode 100644 index 00000000000..1cae787961a --- /dev/null +++ b/folly/ext/BUCK @@ -0,0 +1,9 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "test_ext", + srcs = ["test_ext.cpp"], + headers = ["test_ext.h"], +) diff --git a/folly/external/farmhash/BUCK b/folly/external/farmhash/BUCK new file mode 100644 index 00000000000..a1c82cd7a5b --- /dev/null +++ b/folly/external/farmhash/BUCK @@ -0,0 +1,12 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "farmhash", + srcs = ["farmhash.cpp"], + headers = ["farmhash.h"], + exported_deps = [ + "//folly/portability:config", + ], +) diff --git a/folly/external/farmhash/test/BUCK b/folly/external/farmhash/test/BUCK new file mode 100644 index 00000000000..69706ebe7b5 --- /dev/null +++ b/folly/external/farmhash/test/BUCK @@ -0,0 +1,13 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "farmhash_test", + srcs = ["farmhash_test.cpp"], + headers = [], + deps = [ + "//folly/external/farmhash:farmhash", + "//folly/portability:gtest", + ], +) diff --git a/folly/external/fast-crc32/BUCK b/folly/external/fast-crc32/BUCK new file mode 100644 index 00000000000..147cbb3a3e1 --- /dev/null +++ b/folly/external/fast-crc32/BUCK @@ -0,0 +1,36 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "avx512_crc32c_v8s3x4", + srcs = [ + "avx512_crc32c_v8s3x4.cpp", + ], + headers = [ + "avx512_crc32c_v8s3x4.h", + ], + arch_preprocessor_flags = { + "x86_64": [ + "-mavx512f", + "-mavx512vl", + "-mpclmul", + ], + }, + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "sse_crc32c_v8s3x3", + srcs = [ + "sse_crc32c_v8s3x3.cpp", + ], + headers = [ + "sse_crc32c_v8s3x3.h", + ], + exported_deps = [ + "//folly:portability", + ], +) diff --git a/folly/facebook/BUCK b/folly/facebook/BUCK new file mode 100644 index 00000000000..ebe263a1bf2 --- /dev/null +++ b/folly/facebook/BUCK @@ -0,0 +1,19 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "test_ext", + srcs = ["test_ext.cpp"], + autodeps_keep = True, + # @lint-ignore BUCKLINT + link_whole = True, + deps = [ + "//folly/experimental/io:fs_util", + "//folly/ext:test_ext", + "//folly/json:dynamic", + ], + external_deps = [ + ("boost", None, "boost_filesystem"), + ], +) diff --git a/folly/facebook/bench/BUCK b/folly/facebook/bench/BUCK new file mode 100644 index 00000000000..e761fad1abd --- /dev/null +++ b/folly/facebook/bench/BUCK @@ -0,0 +1,35 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") + +oncall("fbcode_entropy_wardens_folly") + +cpp_benchmark( + name = "simple_simd_string_utils_bench", + srcs = [ + "SimpleSimdStringUtilsBench.cpp", + ], + deps = [ + "//folly:benchmark", + "//folly:string", + "//folly/init:init", + ], +) + +cpp_benchmark( + name = "string_split_bench", + srcs = [ + "StringSplitBench.cpp", + ], + resources = [ + "aggregator_string_split_data.json", + ], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:benchmark", + "//folly:benchmark_util", + "//folly:singleton_thread_local", + "//folly:string", + "//folly/detail:split_string_simd", + "//folly/init:init", + "//folly/json:dynamic", + ], +) diff --git a/folly/facebook/fuzz/harness/BUCK b/folly/facebook/fuzz/harness/BUCK new file mode 100644 index 00000000000..b6cc6afc5d0 --- /dev/null +++ b/folly/facebook/fuzz/harness/BUCK @@ -0,0 +1,234 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbsource//xplat/security/lionhead:defs.bzl", "EXTERNAL_USERS", "Metadata", "Severity") +load("//security/lionhead/harnesses:defs.bzl", "cpp_lionhead_harness") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "lionhead_wrapper", + headers = ["lionhead_wrapper.h"], + exported_deps = [ + "fbsource//xplat/security/lionhead/utils/lib_ftest:lib", + ], +) + +cpp_library( + name = "fuzz_utils", + headers = [ + "FuzzUtils.h", + ], + exported_deps = [ + ":lionhead_wrapper", + ], +) + +cpp_lionhead_harness( + name = "FollyBase64EncodeDecode", + srcs = [ + "FollyBase64Fuzzer.cpp", + ], + context_task = "T131981406", #TODO: This is a template task. Please create your own copy and insert meaningful context for this fuzzer. Otherwise, security engineers will not know how to handle security issues found by this harness. + ftest_name = ("FollyBase64", "EncodeDecode"), + metadata = Metadata( + exposure = EXTERNAL_USERS, + project = "Folly", + severity_denial_of_service = Severity.FILE_SECURITY_TASK, + severity_service_takeover = Severity.FILE_SECURITY_TASK, + ), + deps = [ + ":lionhead_wrapper", + "//folly:base64", + "//folly:portability", + "//folly/detail/base64_detail:base64_scalar", + "//folly/detail/base64_detail:base64_sse4_2", + "//folly/detail/base64_detail:base64_swar", + ], +) + +cpp_lionhead_harness( + name = "FollySimpleStringUtils_HasSpaceOrCntrl", + srcs = [ + "FollySimpleStringUtilsFuzzer.cpp", + ], + context_task = "T153554388", + ftest_name = ("FollySimpleStringUtils", "HasSpaceOrCntrl"), + metadata = Metadata( + exposure = EXTERNAL_USERS, + project = "Folly", + severity_denial_of_service = Severity.FILE_SECURITY_TASK, + severity_service_takeover = Severity.FILE_SECURITY_TASK, + ), + deps = [ + ":fuzz_utils", + ":lionhead_wrapper", + "//folly:string", + "//folly/detail:simd_char_platform", + "//folly/detail:simple_simd_string_utils", + ], +) + +cpp_lionhead_harness( + name = "FollySplit_FuzzerSimple", + srcs = [ + "FollyStringSplitFuzzer.cpp", + ], + context_task = "T147142742", + ftest_name = ("FollySplit", "FuzzerSimple"), + metadata = Metadata( + exposure = EXTERNAL_USERS, + project = "Folly", + severity_denial_of_service = Severity.FILE_SECURITY_TASK, + severity_service_takeover = Severity.FILE_SECURITY_TASK, + ), + deps = [ + ":fuzz_utils", + ":lionhead_wrapper", + "//folly:string", + "//folly/detail:split_string_simd", + ], +) + +cpp_lionhead_harness( + name = "FollySplit_FuzzerLarge", + srcs = [ + "FollyStringSplitFuzzer.cpp", + ], + context_task = "T147142742", + ftest_name = ("FollySplit", "FuzzerLarge"), + metadata = Metadata( + exposure = EXTERNAL_USERS, + project = "Folly", + severity_denial_of_service = Severity.FILE_SECURITY_TASK, + severity_service_takeover = Severity.FILE_SECURITY_TASK, + ), + deps = [ + ":fuzz_utils", + ":lionhead_wrapper", + "//folly:string", + "//folly/detail:split_string_simd", + ], +) + +cpp_lionhead_harness( + name = "FollyBase64DecodeGarbage", + srcs = [ + "FollyBase64Fuzzer.cpp", + ], + context_task = "T131981406", #TODO: This is a template task. Please create your own copy and insert meaningful context for this fuzzer. Otherwise, security engineers will not know how to handle security issues found by this harness. + ftest_name = ("FollyBase64", "DecodeGarbage"), + metadata = Metadata( + exposure = EXTERNAL_USERS, + project = "Folly", + severity_denial_of_service = Severity.FILE_SECURITY_TASK, + severity_service_takeover = Severity.FILE_SECURITY_TASK, + ), + deps = [ + ":lionhead_wrapper", + "//folly:base64", + "//folly:portability", + "//folly/detail/base64_detail:base64_scalar", + "//folly/detail/base64_detail:base64_sse4_2", + "//folly/detail/base64_detail:base64_swar", + ], +) + +cpp_lionhead_harness( + name = "FollyConversion", + srcs = ["FollyConversionFuzzer.cpp"], + context_task = "T131981406", #TODO: This is a template task. Please create your own copy and insert meaningful context for this fuzzer. Otherwise, security engineers will not know how to handle security issues found by this harness. + metadata = Metadata( + exposure = EXTERNAL_USERS, + project = "Folly", + severity_denial_of_service = Severity.FILE_SECURITY_TASK, # missing severity, using default TODO: check and apply appropriate severity + severity_service_takeover = Severity.FILE_SECURITY_TASK, # missing severity, using default TODO: check and apply appropriate severity + ), + deps = [ + "fbsource//xplat/security/lionhead:utils", + "//folly:conv", + ], +) + +cpp_lionhead_harness( + name = "FollyCompression", + srcs = ["FollyCompressionFuzzer.cpp"], + context_task = "T131981406", #TODO: This is a template task. Please create your own copy and insert meaningful context for this fuzzer. Otherwise, security engineers will not know how to handle security issues found by this harness. + ftest_name = ("FollyCompression", "fuzz_compression"), + metadata = Metadata( + exposure = EXTERNAL_USERS, + project = "Folly", + severity_denial_of_service = Severity.FILE_SECURITY_TASK, # missing severity, using default TODO: check and apply appropriate severity + severity_service_takeover = Severity.FILE_SECURITY_TASK, # missing severity, using default TODO: check and apply appropriate severity + ), + deps = [ + "fbsource//xplat/security/lionhead:utils", + ":lionhead_wrapper", + "//folly/compression:compression", + "//folly/io:iobuf", + ], +) + +cpp_lionhead_harness( + name = "FollyUri", # keep this name for corpus continuity + srcs = ["FollyUriFuzzer.cpp"], + context_task = "T131981406", #TODO: This is a template task. Please create your own copy and insert meaningful context for this fuzzer. Otherwise, security engineers will not know how to handle security issues found by this harness. + ftest_name = ("FollyUri", "plain_buffer"), + metadata = Metadata( + exposure = EXTERNAL_USERS, + project = "Folly", + severity_denial_of_service = Severity.FILE_SECURITY_TASK, # missing severity, using default TODO: check and apply appropriate severity + severity_service_takeover = Severity.FILE_SECURITY_TASK, # missing severity, using default TODO: check and apply appropriate severity + ), + deps = [ + "fbsource//xplat/security/lionhead/utils/lib_ftest/fdp:lib", + ":lionhead_wrapper", + "//folly:uri", + ], +) + +cpp_lionhead_harness( + name = "FollyUriRegex", + srcs = ["FollyUriFuzzer.cpp"], + context_task = "T131981406", #TODO: This is a template task. Please create your own copy and insert meaningful context for this fuzzer. Otherwise, security engineers will not know how to handle security issues found by this harness. + ftest_name = ("FollyUri", "structured_fuzzing"), + metadata = Metadata( + exposure = EXTERNAL_USERS, + project = "Folly", + severity_denial_of_service = Severity.FILE_SECURITY_TASK, # missing severity, using default TODO: check and apply appropriate severity + severity_service_takeover = Severity.FILE_SECURITY_TASK, # missing severity, using default TODO: check and apply appropriate severity + ), + deps = [ + "fbsource//xplat/security/lionhead/utils/lib_ftest/fdp:lib", + ":lionhead_wrapper", + "//folly:uri", + ], +) + +cpp_lionhead_harness( + name = "FollyJson", + srcs = ["FollyJsonFuzzer.cpp"], + context_task = "T131981406", #TODO: This is a template task. Please create your own copy and insert meaningful context for this fuzzer. Otherwise, security engineers will not know how to handle security issues found by this harness. + dictionary = "//security/lionhead/dictionaries:json.dict", + enable_diff_time_signal = False, + metadata = Metadata( + exposure = EXTERNAL_USERS, + project = "Folly", + severity_denial_of_service = Severity.FILE_SECURITY_TASK, # missing severity, using default TODO: check and apply appropriate severity + severity_service_takeover = Severity.FILE_SECURITY_TASK, # missing severity, using default TODO: check and apply appropriate severity + ), + deps = [ + "//folly/json:dynamic", + "//security/lionhead/utils:FuzzDataProducerGenerator", + ], +) + +cpp_lionhead_harness( + name = "FollySocketAddress", + srcs = ["FollySocketAddressFuzzer.cpp"], + metadata = Metadata( + exposure = EXTERNAL_USERS, + project = "Folly", + severity_denial_of_service = Severity.FILE_LOW_PRI_TASK, + severity_service_takeover = Severity.FILE_HIGH_PRI_TASK, + ), + deps = ["//folly:network_address"], +) diff --git a/folly/fibers/BUCK b/folly/fibers/BUCK new file mode 100644 index 00000000000..4a6fe6b6122 --- /dev/null +++ b/folly/fibers/BUCK @@ -0,0 +1,341 @@ +load("@fbcode_macros//build_defs:auto_headers.bzl", "AutoHeaders") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "add_tasks", + headers = [ + "AddTasks.h", + "AddTasks-inl.h", + ], + exported_deps = [ + ":core", + "//folly:optional", + "//folly:try", + ], +) + +cpp_library( + name = "atomic_batch_dispatcher", + headers = [ + "AtomicBatchDispatcher.h", + "AtomicBatchDispatcher-inl.h", + ], + exported_deps = [ + "//folly:c_portability", + "//folly:function", + "//folly:optional", + "//folly/fibers/detail:atomic_batch_dispatcher", + "//folly/futures:core", + ], +) + +cpp_library( + name = "batch_dispatcher", + headers = ["BatchDispatcher.h"], + exported_deps = [ + "//folly:function", + "//folly/futures:core", + ], +) + +cpp_library( + name = "boost_context_compatibility", + headers = ["BoostContextCompatibility.h"], + exported_deps = [ + "//folly:function", + ], + exported_external_deps = [ + "glog", + ("boost", None, "boost_context"), + ], +) + +cpp_library( + name = "core", + srcs = [ + "Baton.cpp", + "Fiber.cpp", + "FiberManager.cpp", + ], + auto_headers = AutoHeaders.NONE, + headers = [ + "Baton.h", + "Baton-inl.h", + "Fiber.h", + "Fiber-inl.h", + "FiberManagerInternal.h", + "FiberManagerInternal-inl.h", + "Promise.h", + "Promise-inl.h", + ], + deps = [ + "//folly:constexpr_math", + "//folly:singleton_thread_local", + "//folly/detail:memory_idler", + "//folly/memory:sanitize_address", + "//folly/portability:asm", + "//folly/portability:config", + "//folly/portability:sys_syscall", + "//folly/portability:unistd", + "//folly/synchronization:sanitize_thread", + ], + exported_deps = [ + ":boost_context_compatibility", + ":guard_page_allocator", + ":loop_controller", + ":traits", + "//folly:atomic_linked_list", + "//folly:c_portability", + "//folly:executor", + "//folly:function", + "//folly:intrusive_list", + "//folly:likely", + "//folly:memory", + "//folly:optional", + "//folly:portability", + "//folly:scope_guard", + "//folly:try", + "//folly/detail:async_trace", + "//folly/detail:futex", + "//folly/experimental:execution_observer", + "//folly/experimental/coro:coroutine", + "//folly/functional:invoke", + "//folly/io/async:async_base", + "//folly/io/async:request_context", + "//folly/lang:thunk", + "//folly/portability:pthread", + "//folly/tracing:async_stack", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "core_manager", + headers = [ + "FiberManager.h", + "FiberManager-inl.h", + ], + exported_deps = [ + ":core", + "//folly/functional:invoke", + "//folly/futures:core", + ], +) + +cpp_library( + name = "event_base_loop_controller", + headers = [ + "EventBaseLoopController.h", + "EventBaseLoopController-inl.h", + ], + exported_deps = [ + ":core", + ":executor_based_loop_controller", + "//folly:cancellation_token", + "//folly:memory", + "//folly/io/async:async_base", + ], +) + +cpp_library( + name = "executor_loop_controller", + headers = [ + "ExecutorLoopController.h", + "ExecutorLoopController-inl.h", + ], + exported_deps = [ + ":core", + ":executor_based_loop_controller", + "//folly:executor", + "//folly:scope_guard", + "//folly/futures:core", + ], +) + +cpp_library( + name = "fiber_manager_map", + headers = [ + "FiberManagerMap.h", + "FiberManagerMap-inl.h", + ], + exported_deps = [ + ":core", + ":event_base_loop_controller", + "//folly:function", + "//folly:scope_guard", + "//folly:singleton_thread_local", + "//folly:synchronized", + "//folly/container:f14_hash", + "//folly/io/async:async_base", + "//folly/synchronization:relaxed_atomic", + ], +) + +cpp_library( + name = "fibers", + exported_deps = [ + ":add_tasks", # @manual + ":atomic_batch_dispatcher", # @manual + ":batch_dispatcher", # @manual + ":batch_semaphore", # @manual + ":boost_context_compatibility", # @manual + ":core", # @manual + ":core_manager", # @manual + ":event_base_loop_controller", # @manual + ":fiber_manager_map", # @manual + ":for_each", # @manual + ":generic_baton", # @manual + ":guard_page_allocator", # @manual + ":loop_controller", # @manual + ":semaphore", # @manual + ":semaphore_base", # @manual + ":simple_loop_controller", # @manual + ":timed_mutex", # @manual + ":traits", # @manual + ":when_n", # @manual + ], +) + +cpp_library( + name = "for_each", + headers = [ + "ForEach.h", + "ForEach-inl.h", + ], + exported_deps = [ + ":core", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "generic_baton", + headers = ["GenericBaton.h"], + exported_deps = [ + ":core", + "//folly/synchronization:baton", + ], +) + +cpp_library( + name = "guard_page_allocator", + srcs = ["GuardPageAllocator.cpp"], + headers = ["GuardPageAllocator.h"], + deps = [ + "//folly:singleton", + "//folly:spin_lock", + "//folly:synchronized", + "//folly/portability:sys_mman", + "//folly/portability:unistd", + ], + external_deps = [ + "glog", + ("glibc", None, "dl"), + ], +) + +cpp_library( + name = "loop_controller", + headers = ["LoopController.h"], + exported_deps = [ + "//folly/io/async:async_base_fwd", + ], +) + +cpp_library( + name = "executor_based_loop_controller", + headers = ["ExecutorBasedLoopController.h"], + exported_deps = [ + ":loop_controller", + "//folly:executor", + ], +) + +cpp_library( + name = "semaphore", + srcs = ["Semaphore.cpp"], + headers = ["Semaphore.h"], + exported_deps = [ + ":core", + "//folly:intrusive_list", + "//folly:synchronized", + "//folly/experimental/coro:task", + "//folly/futures:core", + ], +) + +cpp_library( + name = "batch_semaphore", + srcs = ["BatchSemaphore.cpp"], + headers = ["BatchSemaphore.h"], + exported_deps = [ + ":semaphore_base", + ], +) + +cpp_library( + name = "semaphore_base", + srcs = ["SemaphoreBase.cpp"], + headers = ["SemaphoreBase.h"], + exported_deps = [ + ":core", + "//folly:intrusive_list", + "//folly:synchronized", + "//folly/experimental/coro:task", + "//folly/futures:core", + ], +) + +cpp_library( + name = "simple_loop_controller", + srcs = ["SimpleLoopController.cpp"], + headers = ["SimpleLoopController.h"], + deps = [ + "//folly/io/async:async_base", + ], + exported_deps = [ + ":core_manager", + ":loop_controller", + "//folly:function", + "//folly:likely", + ], +) + +cpp_library( + name = "timed_mutex", + headers = [ + "CallOnce.h", + "TimedMutex.h", + "TimedMutex-inl.h", + ], + exported_deps = [ + ":generic_baton", + "//folly:intrusive_list", + "//folly:portability", + "//folly:spin_lock", + "//folly/synchronization:call_once", + ], +) + +cpp_library( + name = "traits", + headers = ["traits.h"], +) + +cpp_library( + name = "when_n", + headers = [ + "WhenN.h", + "WhenN-inl.h", + ], + exported_deps = [ + ":core", + ":for_each", + "//folly:optional", + "//folly/functional:invoke", + ], +) diff --git a/folly/fibers/async/BUCK b/folly/fibers/async/BUCK new file mode 100644 index 00000000000..3e2400298ee --- /dev/null +++ b/folly/fibers/async/BUCK @@ -0,0 +1,129 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "wait_utils", + headers = [ + "WaitUtils.h", + ], + exported_deps = [ + ":core", + ":fiber_manager", + "//folly/fibers:core", + "//folly/fibers:fiber_manager_map", + ], +) + +cpp_library( + name = "core", + srcs = ["Async.cpp"], + headers = [ + "Async.h", + ], + deps = [ + "//folly/fibers:core", + ], + exported_deps = [ + "//folly:traits", + "//folly:unit", + "//folly/functional:invoke", + "//folly/lang:customization_point", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "collect", + headers = [ + "Collect.h", + "Collect-inl.h", + ], + exported_deps = [ + ":baton", + ":core", + ":fiber_manager", + ":future", + "//folly:traits", + "//folly:try", + "//folly/fibers:core_manager", + "//folly/fibers:when_n", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "baton", + headers = ["Baton.h"], + exported_deps = [ + ":core", + "//folly/fibers:core", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "fiber_manager", + headers = [ + "FiberManager.h", + ], + exported_deps = [ + ":core", + "//folly/fibers:core_manager", + ], +) + +cpp_library( + name = "future", + headers = [ + "Future.h", + ], + exported_deps = [ + ":core", + "//folly/futures:core", + ], +) + +cpp_library( + name = "promise", + headers = [ + "Promise.h", + ], + exported_deps = [ + ":core", + "//folly/fibers:core_manager", + "//folly/fibers:traits", + ], +) + +cpp_library( + name = "task", + headers = [ + "Task.h", + ], + exported_deps = [ + ":core", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:task", + ], +) + +cpp_library( + name = "stack_tracing", + headers = [ + "AsyncStack.h", + ], + exported_deps = [ + ":core", + "//folly:c_portability", + "//folly:scope_guard", + "//folly/tracing:async_stack", + ], + exported_external_deps = [ + "glog", + ], +) diff --git a/folly/fibers/async/test/BUCK b/folly/fibers/async/test/BUCK new file mode 100644 index 00000000000..a6d8dd6df62 --- /dev/null +++ b/folly/fibers/async/test/BUCK @@ -0,0 +1,27 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "async_test", + srcs = ["AsyncTest.cpp"], + headers = [], + deps = [ + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:sleep", + "//folly/fibers:core_manager", + "//folly/fibers:fiber_manager_map", + "//folly/fibers/async:baton", + "//folly/fibers/async:collect", + "//folly/fibers/async:core", + "//folly/fibers/async:fiber_manager", + "//folly/fibers/async:future", + "//folly/fibers/async:promise", + "//folly/fibers/async:stack_tracing", + "//folly/fibers/async:task", + "//folly/fibers/async:wait_utils", + "//folly/io/async:async_base", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) diff --git a/folly/fibers/detail/BUCK b/folly/fibers/detail/BUCK new file mode 100644 index 00000000000..4e3df895ab3 --- /dev/null +++ b/folly/fibers/detail/BUCK @@ -0,0 +1,12 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "atomic_batch_dispatcher", + srcs = ["AtomicBatchDispatcher.cpp"], + headers = ["AtomicBatchDispatcher.h"], + deps = [ + "fbsource//third-party/fmt:fmt", + ], +) diff --git a/folly/fibers/test/BUCK b/folly/fibers/test/BUCK new file mode 100644 index 00000000000..01055d5eb08 --- /dev/null +++ b/folly/fibers/test/BUCK @@ -0,0 +1,71 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_benchmark( + name = "fibers_benchmark", + srcs = ["FibersBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/fibers:core_manager", + "//folly/fibers:fiber_manager_map", + "//folly/fibers:simple_loop_controller", + "//folly/init:init", + "//folly/io/async:async_base", + ], +) + +cpp_unittest( + name = "fibers_test", + srcs = ["FibersTest.cpp"], + headers = [], + deps = [ + "//folly:conv", + "//folly:memory", + "//folly:random", + "//folly/executors:cpu_thread_pool_executor", + "//folly/experimental/coro:blocking_wait", + "//folly/fibers:add_tasks", + "//folly/fibers:atomic_batch_dispatcher", + "//folly/fibers:batch_dispatcher", + "//folly/fibers:batch_semaphore", + "//folly/fibers:core_manager", + "//folly/fibers:event_base_loop_controller", + "//folly/fibers:executor_loop_controller", + "//folly/fibers:fiber_manager_map", + "//folly/fibers:generic_baton", + "//folly/fibers:semaphore", + "//folly/fibers:simple_loop_controller", + "//folly/fibers:timed_mutex", + "//folly/fibers:when_n", + "//folly/futures:core", + "//folly/io/async:scoped_event_base_thread", + "//folly/portability:gtest", + "//folly/tracing:async_stack", + ], +) + +cpp_binary( + name = "fibers_test_app", + srcs = ["FibersTestApp.cpp"], + headers = [], + deps = [ + "//folly:memory", + "//folly/fibers:core_manager", + "//folly/fibers:simple_loop_controller", + ], +) + +cpp_binary( + name = "stack_overflow", + srcs = ["StackOverflow.cpp"], + headers = [], + compiler_flags = ["-Wno-infinite-recursion"], + deps = [ + "//folly/fibers:fiber_manager_map", + "//folly/init:init", + ], +) diff --git a/folly/folly_extended_library.bzl b/folly/folly_extended_library.bzl new file mode 100644 index 00000000000..07007028a39 --- /dev/null +++ b/folly/folly_extended_library.bzl @@ -0,0 +1,29 @@ +load("@fbsource//tools/build_defs:default_platform_defs.bzl", "ANDROID", "APPLE", "CXX", "FBCODE", "WINDOWS") +load("@fbsource//xplat/folly:defs.bzl", "folly_library") + +def folly_extended_library(name, **kwargs): + folly_library( + name, + force_static = False, + enable_static_variant = True, + compiler_flags = [ + "-Wno-shadow", + ], + fbandroid_deps = [ + "fbsource//xplat/third-party/linker_lib:atomic", + "fbsource//third-party/toolchains:log", + ], + linker_flags = select({ + "DEFAULT": [], + "ovr_config//os:android": [ + "-Wl,--no-undefined", + ], + }), + platforms = (CXX, ANDROID, APPLE, FBCODE, WINDOWS), + xcode_public_headers_symlinks = True, + deps = [ + "fbsource//xplat/folly:memory", + "fbsource//third-party/glog:glog", + ], + **kwargs + ) diff --git a/folly/functional/BUCK b/folly/functional/BUCK new file mode 100644 index 00000000000..d7684de469d --- /dev/null +++ b/folly/functional/BUCK @@ -0,0 +1,57 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "apply_tuple", + headers = ["ApplyTuple.h"], + exported_deps = [ + ":invoke", + "//folly:traits", + "//folly:utility", + ], +) + +cpp_library( + name = "invoke", + headers = ["Invoke.h"], + exported_deps = [ + "//folly:cpp_attributes", + "//folly:portability", + "//folly:preprocessor", + "//folly:traits", + "//folly:utility", + "//folly/lang:customization_point", + ], + exported_external_deps = [ + ("boost", None, "boost_preprocessor"), + ], +) + +cpp_library( + name = "partial", + headers = ["Partial.h"], + exported_deps = [ + ":invoke", + "//folly:utility", + ], +) + +cpp_library( + name = "protocol", + headers = ["protocol.h"], + exported_deps = [ + ":invoke", + ":traits", + "//folly:portability", + "//folly:traits", + ], +) + +cpp_library( + name = "traits", + headers = ["traits.h"], + exported_deps = [ + "//folly:traits", + ], +) diff --git a/folly/functional/test/BUCK b/folly/functional/test/BUCK new file mode 100644 index 00000000000..35da5a9a269 --- /dev/null +++ b/folly/functional/test/BUCK @@ -0,0 +1,57 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "apply_tuple_test", + srcs = ["ApplyTupleTest.cpp"], + headers = [], + deps = [ + "//folly:overload", + "//folly/functional:apply_tuple", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "invoke_test", + srcs = ["InvokeTest.cpp"], + headers = [], + deps = [ + "//folly:cpp_attributes", + "//folly/functional:invoke", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "partial_test", + srcs = ["PartialTest.cpp"], + headers = [], + deps = [ + "//folly:function", + "//folly/functional:partial", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "protocol_test", + srcs = ["protocol_test.cpp"], + headers = [], + deps = [ + "//folly:traits", + "//folly/functional:protocol", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "traits_test", + srcs = ["traits_test.cpp"], + headers = [], + deps = [ + "//folly/functional:traits", + "//folly/portability:gtest", + ], +) diff --git a/folly/futures/BUCK b/folly/futures/BUCK new file mode 100644 index 00000000000..ee1d49c0e8d --- /dev/null +++ b/folly/futures/BUCK @@ -0,0 +1,137 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "barrier", + srcs = ["Barrier.cpp"], + headers = ["Barrier.h"], + deps = [ + "//folly:scope_guard", + "//folly/lang:new", + ], + exported_deps = [ + ":core", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "core", + srcs = [ + "Future.cpp", + "HeapTimekeeper.cpp", + "Promise.cpp", + "ThreadWheelTimekeeper.cpp", + ], + headers = [ + "Future.h", + "Future-inl.h", + "Future-pre.h", + "HeapTimekeeper.h", + "Promise.h", + "Promise-inl.h", + "Retrying.h", + "ThreadWheelTimekeeper.h", + "WTCallback.h", + ], + deps = [ + "//folly:likely", + "//folly:singleton", + "//folly/container:intrusive_heap", + "//folly/lang:safe_assert", + "//folly/portability:gflags", + "//folly/synchronization:distributed_mutex", + "//folly/synchronization:relaxed_atomic", + "//folly/synchronization:saturating_semaphore", + "//folly/synchronization:wait_options", + "//folly/system:thread_name", + ], + exported_deps = [ + ":portability", + "//folly:chrono", + "//folly:optional", + "//folly:portability", + "//folly:random", + "//folly:scope_guard", + "//folly:traits", + "//folly:try", + "//folly:unit", + "//folly:utility", + "//folly/container:foreach", + "//folly/detail:async_trace", + "//folly/executors:drivable_executor", + "//folly/executors:executor_with_priority", + "//folly/executors:global_executor", + "//folly/executors:inline_executor", + "//folly/executors:queued_immediate_executor", + "//folly/executors:timed_drivable_executor", + "//folly/experimental/coro:traits", + "//folly/fibers:core", + "//folly/functional:invoke", + "//folly/futures/detail:core", + "//folly/futures/detail:types", + "//folly/io/async:async_base", + "//folly/lang:exception", + "//folly/lang:pretty", + ], +) + +cpp_library( + name = "future_splitter", + headers = ["FutureSplitter.h"], + exported_deps = [ + ":core", + ":shared_promise", + "//folly/lang:exception", + ], +) + +cpp_library( + name = "futures", + exported_deps = [ + ":barrier", # @manual + ":core", # @manual + ":future_splitter", # @manual + ":shared_promise", # @manual + "//folly/executors:inline_executor", # @manual + "//folly/executors:manual_executor", # @manual + "//folly/executors:queued_immediate_executor", # @manual + "//folly/executors:scheduled_executor", # @manual + ], +) + +cpp_library( + name = "manual_timekeeper", + srcs = ["ManualTimekeeper.cpp"], + headers = ["ManualTimekeeper.h"], + exported_deps = [ + "//folly:synchronized", + "//folly/futures:core", + ], +) + +cpp_library( + name = "portability", + headers = ["Portability.h"], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "shared_promise", + srcs = ["SharedPromise.cpp"], + headers = [ + "SharedPromise.h", + "SharedPromise-inl.h", + ], + exported_deps = [ + ":core", + "//folly:portability", + "//folly/executors:inline_executor", + "//folly/lang:exception", + ], +) diff --git a/folly/futures/detail/BUCK b/folly/futures/detail/BUCK new file mode 100644 index 00000000000..2231d06e190 --- /dev/null +++ b/folly/futures/detail/BUCK @@ -0,0 +1,37 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "core", + srcs = [ + "Core.cpp", + ], + headers = [ + "Core.h", + "Types.h", + ], + deps = [ + "fbsource//third-party/fmt:fmt", + ], + exported_deps = [ + "//folly:executor", + "//folly:function", + "//folly:optional", + "//folly:scope_guard", + "//folly:try", + "//folly:utility", + "//folly/io/async:request_context", + "//folly/lang:assume", + "//folly/lang:exception", + "//folly/synchronization:atomic_util", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "types", + headers = ["Types.h"], +) diff --git a/folly/futures/test/BUCK b/folly/futures/test/BUCK new file mode 100644 index 00000000000..17e587ab3da --- /dev/null +++ b/folly/futures/test/BUCK @@ -0,0 +1,431 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "barrier_test", + srcs = ["BarrierTest.cpp"], + deps = [ + "//folly:random", + "//folly/futures:barrier", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "callback_lifetime_test", + srcs = ["CallbackLifetimeTest.cpp"], + deps = [ + ":test_executor", + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "collect_test", + srcs = ["CollectTest.cpp"], + deps = [ + "//folly:default_keep_alive_executor", + "//folly:random", + "//folly:small_vector", + "//folly/executors:cpu_thread_pool_executor", + "//folly/executors:manual_executor", + "//folly/futures:core", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], + external_deps = [ + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "context_test", + srcs = ["ContextTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "core_test", + srcs = ["CoreTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/futures/detail:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "ensure_test", + srcs = ["EnsureTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "filter_test", + srcs = ["FilterTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "future_splitter_test", + srcs = ["FutureSplitterTest.cpp"], + deps = [ + "//folly/executors:manual_executor", + "//folly/futures:future_splitter", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "future_test", + srcs = ["FutureTest.cpp"], + deps = [ + "//folly:executor", + "//folly:memory", + "//folly:unit", + "//folly/executors:manual_executor", + "//folly/futures:core", + "//folly/json:dynamic", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "semi_future_test", + srcs = ["SemiFutureTest.cpp"], + deps = [ + "//folly:executor", + "//folly:memory", + "//folly:unit", + "//folly/executors:manual_executor", + "//folly/futures:core", + "//folly/io/async:async_base", + "//folly/json:dynamic", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_benchmark( + name = "futures_benchmark", + srcs = ["Benchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + ":test_executor", + "//folly:benchmark", + "//folly/executors:inline_executor", + "//folly/futures:core", + "//folly/portability:gflags", + "//folly/synchronization:baton", + "//folly/synchronization:native_semaphore", + ], +) + +cpp_unittest( + name = "header_compile_test", + srcs = ["HeaderCompileTest.cpp"], + deps = [ + "//folly:try", + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "interrupt_test", + srcs = ["InterruptTest.cpp"], + deps = [ + ":test_executor", + "//folly/futures:core", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "manual_timekeeper_test", + srcs = ["ManualTimekeeperTest.cpp"], + deps = [ + "//folly/futures:manual_timekeeper", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "map_test", + srcs = ["MapTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "non_copyable_lambda_test", + srcs = ["NonCopyableLambdaTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "poll_test", + srcs = ["PollTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "promise_test", + srcs = ["PromiseTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "reduce_test", + srcs = ["ReduceTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "retrying_test", + srcs = ["RetryingTest.cpp"], + deps = [ + ":test_executor", + "//folly/futures:core", + "//folly/portability:gtest", + "//folly/portability:sys_resource", + ], +) + +cpp_unittest( + name = "self_destruct_test", + srcs = ["SelfDestructTest.cpp"], + deps = [ + "//folly/executors:inline_executor", + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "shared_promise_test", + srcs = ["SharedPromiseTest.cpp"], + deps = [ + "//folly/futures:shared_promise", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "test_executor", + srcs = ["TestExecutor.cpp"], + headers = ["TestExecutor.h"], + exported_deps = [ + "//folly:executor", + ], +) + +cpp_unittest( + name = "test_executor_test", + srcs = ["TestExecutorTest.cpp"], + deps = [ + ":test_executor", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "then_compile_test", + srcs = ["ThenCompileTest.cpp"], + headers = ["ThenCompileTest.h"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "then_test", + srcs = ["ThenTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "timekeeper_test", + srcs = ["TimekeeperTest.cpp"], + deps = [ + "//folly:singleton", + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "timekeeper_test_lib", + headers = ["TimekeeperTestLib.h"], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:default_keep_alive_executor", + "//folly:random", + "//folly:singleton", + "//folly:virtual_executor", + "//folly/executors:global_executor", + "//folly/executors:manual_executor", + "//folly/executors:serial_executor", + "//folly/futures:core", + "//folly/portability:gtest", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "thread_wheel_timekeeper_test", + srcs = ["ThreadWheelTimekeeperTest.cpp"], + supports_static_listing = False, + deps = [ + ":timekeeper_test_lib", + "//folly/futures:core", + ], +) + +cpp_unittest( + name = "heap_timekeeper_test", + srcs = ["HeapTimekeeperTest.cpp"], + supports_static_listing = False, + deps = [ + ":timekeeper_test_lib", + "//folly/futures:core", + ], +) + +cpp_unittest( + name = "times_test", + srcs = ["TimesTest.cpp"], + deps = [ + "//folly/executors:manual_executor", + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "unwrap_test", + srcs = ["UnwrapTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "via_test", + srcs = ["ViaTest.cpp"], + deps = [ + "//folly:mpmc_queue", + "//folly/executors:drivable_executor", + "//folly/executors:inline_executor", + "//folly/executors:manual_executor", + "//folly/futures:core", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "wait_test", + srcs = ["WaitTest.cpp"], + deps = [ + ":test_executor", + "//folly/executors:inline_executor", + "//folly/futures:core", + "//folly/io/async:async_base", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "when_test", + srcs = ["WhenTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "while_do_test", + srcs = ["WhileDoTest.cpp"], + deps = [ + "//folly/executors:manual_executor", + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "will_equal_test", + srcs = ["WillEqualTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "window_test", + srcs = ["WindowTest.cpp"], + deps = [ + "//folly:conv", + "//folly/executors:manual_executor", + "//folly/futures:core", + "//folly/portability:gtest", + ], + external_deps = [ + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "conversion_operator", + srcs = ["ConversionOperatorTest.cpp"], + deps = [ + "//folly/futures:core", + "//folly/portability:gtest", + ], +) diff --git a/folly/gen/BUCK b/folly/gen/BUCK new file mode 100644 index 00000000000..f8cd4c9dcc3 --- /dev/null +++ b/folly/gen/BUCK @@ -0,0 +1,112 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "base", + headers = [ + "Base.h", + "Base-inl.h", + ], + exported_deps = [ + "fbsource//third-party/range-v3:range-v3", + ":core", + "//folly:conv", + "//folly:function", + "//folly:optional", + "//folly:portability", + "//folly:range", + "//folly:utility", + "//folly/container:access", + "//folly/container:f14_hash", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "combine", + headers = [ + "Combine.h", + "Combine-inl.h", + ], + exported_deps = [":base"], +) + +cpp_library( + name = "core", + headers = [ + "Core.h", + "Core-inl.h", + ], + exported_deps = ["//folly:portability"], +) + +cpp_library( + name = "file", + headers = [ + "File.h", + "File-inl.h", + ], + exported_deps = [ + ":base", + ":string", + "//folly:exception", + "//folly:file", + "//folly/io:iobuf", + ], +) + +cpp_library( + name = "parallel", + headers = [ + "Parallel.h", + "Parallel-inl.h", + ], + exported_deps = [ + ":base", + "//folly:mpmc_queue", + "//folly:scope_guard", + "//folly/experimental:event_count", + ], +) + +cpp_library( + name = "parallel_map", + headers = [ + "ParallelMap.h", + "ParallelMap-inl.h", + ], + exported_deps = [ + ":core", + "//folly:expected", + "//folly:mpmc_pipeline", + "//folly/experimental:event_count", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "string", + headers = [ + "String.h", + "String-inl.h", + ], + exported_deps = [ + ":base", + "//folly:conv", + "//folly:portability", + "//folly:range", + "//folly:string", + "//folly/io:iobuf", + ], +) + +cpp_library( + name = "istream", + headers = [ + "IStream.h", + ], + exported_deps = [ + ":core", + ], +) diff --git a/folly/gen/test/BUCK b/folly/gen/test/BUCK new file mode 100644 index 00000000000..ac7d1b87bc2 --- /dev/null +++ b/folly/gen/test/BUCK @@ -0,0 +1,196 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_benchmark( + name = "base_benchmark", + srcs = ["BaseBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/gen:base", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "base_test", + srcs = ["BaseTest.cpp"], + headers = [], + tags = [ + "serialize_test_cases", + ], + deps = [ + "//folly:fbvector", + "//folly:map_util", + "//folly:memory", + "//folly:string", + "//folly/experimental:test_util", + "//folly/gen:base", + "//folly/json:dynamic", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "combine_test", + srcs = ["CombineTest.cpp"], + headers = [], + deps = [ + "//folly:fbvector", + "//folly:range", + "//folly/gen:base", + "//folly/gen:combine", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_benchmark( + name = "file_benchmark", + srcs = ["FileBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:file", + "//folly/gen:base", + "//folly/gen:file", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "file_test", + srcs = ["FileTest.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "//folly:file", + "//folly:range", + "//folly/container:array", + "//folly/experimental:test_util", + "//folly/gen:base", + "//folly/gen:file", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "parallel_benchmark", + srcs = ["ParallelBenchmark.cpp"], + headers = [], + deps = [ + ":util", + "//folly/gen:base", + "//folly/gen:parallel", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "parallel_test", + srcs = ["ParallelTest.cpp"], + headers = [], + tags = [ + "serialize", + ], + deps = [ + "//folly/gen:base", + "//folly/gen:parallel", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_benchmark( + name = "parallel_map_benchmark", + srcs = ["ParallelMapBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/gen:base", + "//folly/gen:parallel_map", + "//folly/portability:unistd", + ], +) + +cpp_unittest( + name = "parallel_map_test", + srcs = ["ParallelMapTest.cpp"], + headers = [], + deps = [ + "//folly:memory", + "//folly/gen:base", + "//folly/gen:parallel_map", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_benchmark( + name = "string_benchmark", + srcs = ["StringBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:string", + "//folly/container:foreach", + "//folly/gen:base", + "//folly/gen:string", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "string_test", + srcs = ["StringTest.cpp"], + headers = [], + deps = [ + "//folly/functional:apply_tuple", + "//folly/gen:string", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "istream_test", + srcs = ["IStreamTest.cpp"], + headers = [], + deps = [ + "//folly/gen:base", + "//folly/gen:istream", + "//folly/gen:string", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "util", + headers = ["Bench.h"], + exported_deps = [ + "//folly:benchmark", + ], +) diff --git a/folly/hash/BUCK b/folly/hash/BUCK new file mode 100644 index 00000000000..46203d61bee --- /dev/null +++ b/folly/hash/BUCK @@ -0,0 +1,60 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "checksum", + srcs = ["Checksum.cpp"], + headers = ["Checksum.h"], + deps = [ + "//folly:cpu_id", + "//folly/detail:traponavx512", + "//folly/external/fast-crc32:avx512_crc32c_v8s3x4", # @manual + "//folly/external/fast-crc32:sse_crc32c_v8s3x3", # @manual + "//folly/hash/detail:checksum_detail", + ], + external_deps = [ + "boost", + ], +) + +cpp_library( + name = "farm_hash", + headers = ["FarmHash.h"], + exported_deps = [ + "//folly/external/farmhash:farmhash", + ], +) + +cpp_library( + name = "hash", + headers = ["Hash.h"], + exported_deps = [ + ":spooky_hash_v1", + ":spooky_hash_v2", + "//folly:c_portability", + "//folly:traits", + "//folly:utility", + "//folly/functional:apply_tuple", + "//folly/lang:bits", + ], +) + +cpp_library( + name = "spooky_hash_v1", + srcs = ["SpookyHashV1.cpp"], + headers = ["SpookyHashV1.h"], + deps = [ + "//folly:cpp_attributes", + ], +) + +cpp_library( + name = "spooky_hash_v2", + srcs = ["SpookyHashV2.cpp"], + headers = ["SpookyHashV2.h"], + deps = [ + "//folly:cpp_attributes", + "//folly:portability", + ], +) diff --git a/folly/hash/detail/BUCK b/folly/hash/detail/BUCK new file mode 100644 index 00000000000..40ce703539c --- /dev/null +++ b/folly/hash/detail/BUCK @@ -0,0 +1,23 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "checksum_detail", + srcs = [ + "ChecksumDetail.cpp", + "Crc32CombineDetail.cpp", + "Crc32cDetail.cpp", + ], + headers = ["ChecksumDetail.h"], + deps = [ + "//folly:bits", + "//folly:cpp_attributes", + ], + exported_deps = [ + "//folly:portability", + ], + external_deps = [ + ("boost", None, "boost_preprocessor"), + ], +) diff --git a/folly/hash/test/BUCK b/folly/hash/test/BUCK new file mode 100644 index 00000000000..3213c530227 --- /dev/null +++ b/folly/hash/test/BUCK @@ -0,0 +1,107 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "checksum_test", + srcs = ["ChecksumTest.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:random", + "//folly/external/fast-crc32:avx512_crc32c_v8s3x4", + "//folly/external/fast-crc32:sse_crc32c_v8s3x3", + "//folly/hash:checksum", + "//folly/hash:hash", + "//folly/hash/detail:checksum_detail", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "boost", + ], +) + +cpp_benchmark( + name = "checksum_benchmark", + srcs = ["ChecksumBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:memory", + "//folly/hash:checksum", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "farm_hash_test", + srcs = ["FarmHashTest.cpp"], + headers = [], + deps = [ + "//folly/hash:farm_hash", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "hash_benchmark", + srcs = ["HashBenchmark.cpp"], + headers = [], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:benchmark", + "//folly:preprocessor", + "//folly/hash:hash", + "//folly/portability:gflags", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "hash_test", + srcs = ["HashTest.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "//folly:conv", + "//folly:map_util", + "//folly:random", + "//folly:range", + "//folly/hash:hash", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "spooky_hash_v1_test", + srcs = ["SpookyHashV1Test.cpp"], + headers = [], + deps = [ + "//folly/hash:spooky_hash_v1", + "//folly/portability:gtest", + "//folly/portability:time", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "spooky_hash_v2_test", + srcs = ["SpookyHashV2Test.cpp"], + headers = [], + deps = [ + "//folly/hash:spooky_hash_v2", + "//folly/portability:gtest", + "//folly/portability:time", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/init/BUCK b/folly/init/BUCK new file mode 100644 index 00000000000..33d4e7b9d6c --- /dev/null +++ b/folly/init/BUCK @@ -0,0 +1,43 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "init", + srcs = ["Init.cpp"], + headers = ["Init.h"], + os_deps = [ + ( + "linux", + ["//folly/experimental/symbolizer:signal_handler"], + ), + ( + "macos", + ["//folly/experimental/symbolizer:signal_handler"], + ), + ( + "linux-sgx", + ["//folly/experimental/symbolizer:signal_handler"], + ), + ], + deps = [ + ":phase", + "//folly:singleton", + "//folly/logging:init", + "//folly/portability:config", + "//folly/portability:gflags", + "//folly/synchronization:hazptr_thread_pool_executor", + ], + exported_deps = [ + "//folly:portability", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "phase", + srcs = ["Phase.cpp"], + headers = ["Phase.h"], +) diff --git a/folly/init/test/BUCK b/folly/init/test/BUCK new file mode 100644 index 00000000000..eb46edfbb83 --- /dev/null +++ b/folly/init/test/BUCK @@ -0,0 +1,16 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "phase_test", + srcs = ["PhaseTest.cpp"], + deps = [ + "//folly:singleton", + "//folly/init:phase", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/io/BUCK b/folly/io/BUCK new file mode 100644 index 00000000000..7cc87e5aea9 --- /dev/null +++ b/folly/io/BUCK @@ -0,0 +1,134 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "iobuf", + srcs = [ + "Cursor.cpp", + "IOBuf.cpp", + "IOBufIovecBuilder.cpp", + "IOBufQueue.cpp", + ], + headers = [ + "Cursor.h", + "Cursor-inl.h", + "IOBuf.h", + "IOBufIovecBuilder.h", + "IOBufQueue.h", + ], + deps = [ + "//folly:conv", + "//folly/hash:spooky_hash_v2", + "//folly/lang:align", + "//folly/memory:sanitize_address", + "//folly/portability:iovec", + ], + exported_deps = [ + "//folly:fbstring", + "//folly:fbvector", + "//folly:function", + "//folly:likely", + "//folly:memory", + "//folly:portability", + "//folly:range", + "//folly:scope_guard", + "//folly/detail:iterators", + "//folly/lang:bits", + "//folly/lang:checked_math", + "//folly/lang:exception", + "//folly/lang:ordering", + "//folly/memory:malloc", + "//folly/portability:sys_uio", + "//folly/synchronization:micro_spin_lock", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "global_shutdown_socket_set", + srcs = ["GlobalShutdownSocketSet.cpp"], + headers = ["GlobalShutdownSocketSet.h"], + deps = [ + "//folly:singleton", + ], + exported_deps = [ + ":shutdown_socket_set", + "//folly/experimental:read_mostly_shared_ptr", + ], +) + +cpp_library( + name = "record_io", + srcs = [ + "RecordIO.cpp", + ], + headers = [ + "RecordIO.h", + "RecordIO-inl.h", + ], + supports_python_dlopen = True, + deps = [ + "//folly:exception", + "//folly:file_util", + "//folly:memory", + "//folly:portability", + "//folly:scope_guard", + "//folly:string", + "//folly/portability:unistd", + ], + exported_deps = [ + ":iobuf", + "//folly:file", + "//folly:range", + "//folly/detail:iterators", + "//folly/hash:spooky_hash_v2", + "//folly/system:memory_mapping", + ], +) + +cpp_library( + name = "shutdown_socket_set", + srcs = ["ShutdownSocketSet.cpp"], + headers = ["ShutdownSocketSet.h"], + deps = [ + "//folly:file_util", + "//folly/net:net_ops", + "//folly/portability:sockets", + ], + exported_deps = [ + "//folly:file", + "//folly/net:network_socket", + "//folly/synchronization:relaxed_atomic", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "typed_io_buf", + headers = ["TypedIOBuf.h"], + exported_deps = [ + ":iobuf", + "//folly/memory:malloc", + ], +) + +cpp_library( + name = "socket_option_map", + srcs = [ + "SocketOptionMap.cpp", + "SocketOptionValue.cpp", + ], + headers = [ + "SocketOptionMap.h", + "SocketOptionValue.h", + ], + exported_deps = [ + "//folly/net:network_socket", + "//folly/portability:sockets", + ], +) diff --git a/folly/io/async/BUCK b/folly/io/async/BUCK new file mode 100644 index 00000000000..ca145619ac4 --- /dev/null +++ b/folly/io/async/BUCK @@ -0,0 +1,517 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "async_base_fwd", + headers = [ + "HHWheelTimer-fwd.h", + ], +) + +cpp_library( + name = "async_base", + srcs = [ + "AsyncTimeout.cpp", + "EventBase.cpp", + "EventBaseBackendBase.cpp", + "EventBaseLocal.cpp", + "EventHandler.cpp", + "HHWheelTimer.cpp", + "TimeoutManager.cpp", + "VirtualEventBase.cpp", + ], + headers = [ + "AsyncTimeout.h", + "AtomicNotificationQueue.h", + "AtomicNotificationQueue-inl.h", + "EventBase.h", + "EventBaseAtomicNotificationQueue.h", + "EventBaseAtomicNotificationQueue-inl.h", + "EventBaseBackendBase.h", + "EventBaseLocal.h", + "EventHandler.h", + "HHWheelTimer.h", + "NotificationQueue.h", + "TimeoutManager.h", + "VirtualEventBase.h", + ], + deps = [ + "//folly:chrono", + "//folly:map_util", + "//folly:string", + "//folly/container:bit_iterator", + "//folly/experimental:event_count", + "//folly/lang:assume", + "//folly/lang:bits", + "//folly/system:thread_id", + "//folly/system:thread_name", + ], + exported_deps = [ + ":async_base_fwd", + ":delayed_destruction", + ":event_util", + ":request_context", + "//folly:exception", + "//folly:exception_string", + "//folly:executor", + "//folly:file_util", + "//folly:function", + "//folly:likely", + "//folly:memory", + "//folly:optional", + "//folly:portability", + "//folly:scope_guard", + "//folly:spin_lock", + "//folly:synchronized", + "//folly/container:f14_hash", + "//folly/executors:drivable_executor", + "//folly/executors:io_executor", + "//folly/executors:queue_observer", + "//folly/executors:scheduled_executor", + "//folly/executors:sequenced_executor", + "//folly/experimental:execution_observer", + "//folly/io:iobuf", + "//folly/lang:align", + "//folly/lang:thunk", + "//folly/net:net_ops", + "//folly/net:network_socket", + "//folly/portability:config", + "//folly/portability:event", + "//folly/portability:fcntl", + "//folly/portability:iovec", + "//folly/portability:sockets", + "//folly/portability:unistd", + "//folly/synchronization:baton", + "//folly/synchronization:call_once", + "//folly/system:pid", + ], + exported_external_deps = [ + "boost", + "glog", + ], +) + +cpp_library( + name = "async_pipe", + srcs = ["AsyncPipe.cpp"], + headers = ["AsyncPipe.h"], + deps = [ + ":async_socket_exception", + "//folly:file_util", + "//folly:utility", + "//folly/detail:file_util_detail", + ], + exported_deps = [ + ":async_base", + ":async_transport", + ":delayed_destruction", + "//folly/io:iobuf", + ], +) + +cpp_library( + name = "async_signal_handler", + srcs = ["AsyncSignalHandler.cpp"], + headers = ["AsyncSignalHandler.h"], + deps = [ + "//folly:conv", + ], + exported_deps = [ + ":async_base", + "//folly/portability:event", + ], +) + +cpp_library( + name = "async_socket_transport", + srcs = ["AsyncSocketTransport.cpp"], + headers = ["AsyncSocketTransport.h"], + deps = [ + ], + exported_deps = [ + ":async_socket_exception", + ":async_transport", + "//folly:network_address", + "//folly/io:iobuf", + "//folly/io:socket_option_map", + "//folly/net:network_socket", + ], +) + +cpp_library( + name = "async_socket", + srcs = ["AsyncSocket.cpp"], + headers = ["AsyncSocket.h"], + deps = [ + "//folly:exception", + "//folly:exception_wrapper", + "//folly:format", + "//folly:portability", + "//folly:string", + "//folly/lang:checked_math", + "//folly/portability:fcntl", + "//folly/portability:sys_mman", + "//folly/portability:sys_uio", + "//folly/portability:unistd", + ], + exported_deps = [ + ":async_base", + ":async_socket_exception", + ":async_socket_transport", + ":async_transport", + ":delayed_destruction", + "//folly:constructor_callback_list", + "//folly:network_address", + "//folly:optional", + "//folly:small_vector", + "//folly/detail:socket_fast_open", + "//folly/io:iobuf", + "//folly/io:shutdown_socket_set", + "//folly/io:socket_option_map", + "//folly/io/async/observer:async_socket_observer_container", + "//folly/net:net_ops_dispatcher", + "//folly/net:tcpinfo", + "//folly/net:tcpinfo_dispatcher", + "//folly/portability:sockets", + ], + external_deps = [ + ("boost", None, "boost_preprocessor"), + ], +) + +cpp_library( + name = "async_socket_base", + headers = ["AsyncSocketBase.h"], + exported_deps = [ + ":async_base", + "//folly:network_address", + ], +) + +cpp_library( + name = "async_socket_exception", + srcs = ["AsyncSocketException.cpp"], + headers = ["AsyncSocketException.h"], + deps = [ + "//folly:format", + "//folly:string", + ], + exported_deps = [ + "//folly:c_portability", + "//folly:range", + ], +) + +cpp_library( + name = "async_ssl_socket", + srcs = ["AsyncSSLSocket.cpp"], + headers = ["AsyncSSLSocket.h"], + deps = [ + "//folly:format", + "//folly:indestructible", + "//folly:network_address", + "//folly:spin_lock", + "//folly/io/async/ssl:basic_transport_certificate", + ], + exported_deps = [ + ":async_base", + ":async_pipe", + ":async_socket", + ":certificate_identity_verifier", + ":ssl_context", + "//folly:optional", + "//folly:string", + "//folly/io:iobuf", + "//folly/io:socket_option_map", + "//folly/io/async/ssl:openssl_utils", + "//folly/io/async/ssl:ssl_errors", + "//folly/io/async/ssl:tls_definitions", + "//folly/lang:bits", + "//folly/portability:openssl", + "//folly/portability:sockets", + "//folly/ssl:openssl_ptr_types", + "//folly/ssl:ssl_session", + "//folly/ssl:ssl_session_manager", + ], +) + +cpp_library( + name = "async_transport", + headers = ["AsyncTransport.h"], + exported_deps = [ + ":async_base", + ":async_socket_base", + ":async_transport_certificate", + ":delayed_destruction", + ":write_flags", + "//folly:optional", + "//folly/io:iobuf", + "//folly/portability:openssl", + "//folly/portability:sys_uio", + "//folly/ssl:openssl_ptr_types", + ], +) + +cpp_library( + name = "async_transport_certificate", + headers = ["AsyncTransportCertificate.h"], + exported_deps = [], +) + +cpp_library( + name = "certificate_identity_verifier", + headers = ["CertificateIdentityVerifier.h"], + exported_deps = [ + ":async_transport_certificate", + "//folly:try", + "//folly:unit", + ], +) + +cpp_library( + name = "async_udp_server_socket", + headers = ["AsyncUDPServerSocket.h"], + exported_deps = [ + ":async_base", + ":async_udp_socket", + "//folly:memory", + "//folly/io:iobuf", + ], +) + +cpp_library( + name = "async_udp_socket", + srcs = ["AsyncUDPSocket.cpp"], + headers = ["AsyncUDPSocket.h"], + deps = [ + "//folly:likely", + "//folly:small_vector", + "//folly:utility", + "//folly/portability:fcntl", + "//folly/portability:sockets", + "//folly/portability:unistd", + ], + exported_deps = [ + ":async_base", + ":async_socket_base", + ":async_socket_exception", + "//folly:function", + "//folly:network_address", + "//folly:scope_guard", + "//folly/io:iobuf", + "//folly/io:socket_option_map", + "//folly/net:net_ops", + "//folly/net:net_ops_dispatcher", + "//folly/net:network_socket", + ], + external_deps = [ + ("boost", None, "boost_preprocessor"), + ], +) + +cpp_library( + name = "decorated_async_transport_wrapper", + headers = [ + "DecoratedAsyncTransportWrapper.h", + "WriteChainAsyncTransportWrapper.h", + ], + exported_deps = [ + ":async_transport", + "//folly/io:iobuf", + ], +) + +cpp_library( + name = "delayed_destruction", + srcs = [ + "DelayedDestruction.cpp", + ], + headers = [ + "DelayedDestruction.h", + "DelayedDestructionBase.h", + ], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "destructor_check", + headers = ["DestructorCheck.h"], +) + +cpp_library( + name = "event_base_manager", + srcs = ["EventBaseManager.cpp"], + headers = ["EventBaseManager.h"], + exported_deps = [ + ":async_base", + "//folly:optional", + "//folly:thread_local", + ], +) + +cpp_library( + name = "event_base_thread", + srcs = ["EventBaseThread.cpp"], + headers = ["EventBaseThread.h"], + deps = [ + ":scoped_event_base_thread", + "//folly:memory", + ], + exported_deps = [ + ":async_base", + "//folly:range", + ], +) + +cpp_library( + name = "event_util", + headers = ["EventUtil.h"], + exported_deps = [ + "//folly/portability:event", + ], +) + +cpp_library( + name = "request_context", + srcs = ["Request.cpp"], + headers = ["Request.h"], + deps = [ + "//folly:glog", + "//folly:map_util", + "//folly/experimental:single_writer_fixed_hash_map", + "//folly/tracing:static_tracepoint", + ], + exported_deps = [ + "//folly:shared_mutex", + "//folly:singleton_thread_local", + "//folly:synchronized", + "//folly/concurrency:process_local_unique_id", + "//folly/container:f14_hash", + "//folly/detail:iterators", + "//folly/synchronization:hazptr", + ], +) + +cpp_library( + name = "scoped_event_base_thread", + srcs = ["ScopedEventBaseThread.cpp"], + headers = ["ScopedEventBaseThread.h"], + deps = [ + ":event_base_manager", + "//folly:function", + "//folly:range", + "//folly/system:thread_name", + ], + exported_deps = [ + ":async_base", + "//folly/synchronization:baton", + ], +) + +cpp_library( + name = "terminate_cancellation_token", + srcs = ["TerminateCancellationToken.cpp"], + headers = ["TerminateCancellationToken.h"], + deps = [ + ":async_signal_handler", + ":scoped_event_base_thread", + "//folly:singleton", + ], + exported_deps = [ + "//folly:cancellation_token", + ], +) + +cpp_library( + name = "server_socket", + srcs = ["AsyncServerSocket.cpp"], + headers = ["AsyncServerSocket.h"], + deps = [ + "//folly:file_util", + "//folly:glog", + "//folly:portability", + "//folly/detail:socket_fast_open", + "//folly/portability:fcntl", + "//folly/portability:unistd", + ], + exported_deps = [ + ":async_base", + ":async_socket_base", + ":delayed_destruction", + "//folly:exception_wrapper", + "//folly:network_address", + "//folly:string", + "//folly/experimental/observer:observer", + "//folly/io:shutdown_socket_set", + "//folly/net:net_ops", + "//folly/net:network_socket", + "//folly/portability:sockets", + ], +) + +cpp_library( + name = "ssl_context", + srcs = ["SSLContext.cpp"], + headers = ["SSLContext.h"], + deps = [ + "//folly:format", + "//folly:memory", + "//folly:random", + "//folly:shared_mutex", + "//folly:spin_lock", + "//folly/ssl:openssl_ticket_handler", + "//folly/ssl:password_collector", + "//folly/ssl:ssl_session_manager", + "//folly/system:thread_id", + ], + exported_deps = [ + "//folly:function", + "//folly:portability", + "//folly:range", + "//folly:string", + "//folly/container:access", + "//folly/io/async/ssl:openssl_utils", + "//folly/portability:openssl", + "//folly/ssl:openssl_ptr_types", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "ssl_options", + srcs = ["SSLOptions.cpp"], + headers = ["SSLOptions.h"], + deps = [ + "//folly:format", + ], + exported_deps = [ + ":ssl_context", + "//folly/container:array", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "password_in_file", + srcs = ["PasswordInFile.cpp"], + headers = ["PasswordInFile.h"], + deps = [ + "//folly:file_util", + "//folly/portability:openssl", + ], + exported_deps = [ + "//folly/ssl:password_collector", + ], +) + +cpp_library( + name = "write_flags", + headers = ["WriteFlags.h"], +) diff --git a/folly/io/async/fdsock/BUCK b/folly/io/async/fdsock/BUCK new file mode 100644 index 00000000000..f462bdbfae0 --- /dev/null +++ b/folly/io/async/fdsock/BUCK @@ -0,0 +1,26 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "async_fd_socket", + srcs = ["AsyncFdSocket.cpp"], + headers = ["AsyncFdSocket.h"], + deps = [ + "fbsource//third-party/fmt:fmt", + ], + exported_deps = [ + ":socket_fds", + "//folly/io/async:async_socket", + ], +) + +cpp_library( + name = "socket_fds", + srcs = ["SocketFds.cpp"], + headers = ["SocketFds.h"], + exported_deps = ["//folly:file"], + exported_external_deps = [ + "glog", + ], +) diff --git a/folly/io/async/fdsock/test/BUCK b/folly/io/async/fdsock/test/BUCK new file mode 100644 index 00000000000..03b3e4a8bdc --- /dev/null +++ b/folly/io/async/fdsock/test/BUCK @@ -0,0 +1,15 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "async_fd_socket_test", + srcs = ["AsyncFdSocketTest.cpp"], + supports_static_listing = False, + deps = [ + "//folly/io/async/fdsock:async_fd_socket", + "//folly/io/async/test:async_socket_test_lib", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) diff --git a/folly/io/async/observer/BUCK b/folly/io/async/observer/BUCK new file mode 100644 index 00000000000..ac7ce1886ca --- /dev/null +++ b/folly/io/async/observer/BUCK @@ -0,0 +1,23 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "async_socket_observer_interface", + headers = ["AsyncSocketObserverInterface.h"], + exported_deps = [ + "//folly:cpp_attributes", + "//folly:glog", + "//folly:optional", + "//folly/io/async:write_flags", + ], +) + +cpp_library( + name = "async_socket_observer_container", + headers = ["AsyncSocketObserverContainer.h"], + exported_deps = [ + ":async_socket_observer_interface", + "//folly:observer_container", + ], +) diff --git a/folly/io/async/ssl/BUCK b/folly/io/async/ssl/BUCK new file mode 100644 index 00000000000..7889228a06f --- /dev/null +++ b/folly/io/async/ssl/BUCK @@ -0,0 +1,73 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "openssl", + exported_deps = [ + "//folly/io/async/ssl:openssl_utils", # @manual + "//folly/io/async/ssl:ssl_errors", # @manual + ], +) + +cpp_library( + name = "basic_transport_certificate", + headers = ["BasicTransportCertificate.h"], + exported_deps = [ + ":openssl_transport_certificate", + ], +) + +cpp_library( + name = "openssl_transport_certificate", + headers = ["OpenSSLTransportCertificate.h"], + exported_deps = [ + "//folly/io/async:async_transport_certificate", + "//folly/portability:openssl", + "//folly/ssl:openssl_ptr_types", + ], +) + +cpp_library( + name = "openssl_utils", + srcs = ["OpenSSLUtils.cpp"], + headers = ["OpenSSLUtils.h"], + deps = [ + "//folly:scope_guard", + "//folly/portability:unistd", + "//folly/ssl/detail:openssl_session", + ], + exported_deps = [ + "//folly:range", + "//folly/io/async:async_socket_exception", + "//folly/net:network_socket", + "//folly/portability:openssl", + "//folly/portability:sockets", + "//folly/ssl:openssl_ptr_types", + "//folly/ssl:ssl_session", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "ssl_errors", + srcs = ["SSLErrors.cpp"], + headers = ["SSLErrors.h"], + deps = [ + "//folly:range", + "//folly/portability:openssl", + ], + exported_deps = [ + "//folly/io/async:async_socket_exception", + ], +) + +cpp_library( + name = "tls_definitions", + headers = ["TLSDefinitions.h"], + exported_deps = [ + "//folly/io:iobuf", + ], +) diff --git a/folly/io/async/ssl/test/BUCK b/folly/io/async/ssl/test/BUCK new file mode 100644 index 00000000000..4ae060e3a96 --- /dev/null +++ b/folly/io/async/ssl/test/BUCK @@ -0,0 +1,51 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") +load("//folly/io/async/test/certs:defs.bzl", "alias_pem") + +oncall("fbcode_entropy_wardens_folly") + +alias_pem(pems = [ + "tests-cert.pem", +]) + +cpp_unittest( + name = "ssl_errors_test", + srcs = ["SSLErrorsTest.cpp"], + headers = [], + emails = ["oncall+secure_pipes@xmail.facebook.com"], + deps = [ + "//folly/io/async/ssl:ssl_errors", + "//folly/portability:gtest", + "//folly/portability:openssl", + ], +) + +cpp_unittest( + name = "basic_transport_certificate_test", + srcs = ["BasicTransportCertificateTest.cpp"], + headers = [], + emails = ["oncall+secure_pipes@xmail.facebook.com"], + resources = [ + ":tests-cert.pem", + ], + deps = [ + "//folly:file_util", + "//folly/experimental:test_util", + "//folly/io/async/ssl:basic_transport_certificate", + "//folly/portability:gtest", + "//folly/ssl:openssl_cert_utils", + ], +) + +cpp_unittest( + name = "openssl_utils_test", + srcs = ["OpenSSLUtilsTest.cpp"], + headers = [], + emails = ["oncall+secure_pipes@xmail.facebook.com"], + deps = [ + "//folly:string", + "//folly/io/async/ssl:openssl_utils", + "//folly/portability:gtest", + "//folly/portability:openssl", + "//folly/ssl:openssl_ptr_types", + ], +) diff --git a/folly/io/async/test/BUCK b/folly/io/async/test/BUCK new file mode 100644 index 00000000000..cd86bd81649 --- /dev/null +++ b/folly/io/async/test/BUCK @@ -0,0 +1,910 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") +load("//folly/io/async/test/certs:defs.bzl", "alias_pem") + +oncall("fbcode_entropy_wardens_folly") + +alias_pem(pems = [ + "tests-cert.pem", + "tests-key.pem", + "ca-cert.pem", + "client_cert.pem", + "client_key.pem", + "client_ca_cert.pem", + "client_chain.pem", + "clienti_key.pem", +]) + +cpp_library( + name = "test_ssl_server", + srcs = [ + "TestSSLServer.cpp", + ], + headers = [ + "TestSSLServer.h", + ], + preprocessor_flags = [ + "-DFOLLY_CERTS_DIR=\"folly/io/async/test\"", + ], + resources = [ + ":ca-cert.pem", + ":client_ca_cert.pem", + ":client_cert.pem", + ":client_chain.pem", + ":client_key.pem", + ":tests-cert.pem", + ":tests-key.pem", + ], + deps = [ + "//folly/portability:openssl", + ], + exported_deps = [ + ":callback_state_enum", + "//folly:network_address", + "//folly/experimental:test_util", + "//folly/io/async:async_base", + "//folly/io/async:async_socket", + "//folly/io/async:async_ssl_socket", + "//folly/io/async:async_transport", + "//folly/io/async:server_socket", + "//folly/io/async/ssl:ssl_errors", + "//folly/portability:gtest", + "//folly/portability:sockets", + "//folly/portability:unistd", + ], +) + +cpp_library( + name = "tfo_util", + srcs = [ + "TFOUtil.cpp", + ], + headers = [ + "TFOUtil.h", + ], + deps = [ + "//folly/detail:socket_fast_open", + ], +) + +cpp_library( + name = "async_signal_handler_test_lib", + headers = [ + "AsyncSignalHandlerTestLib.h", + ], + exported_deps = [ + ":util", + "//folly/io/async:async_base", + "//folly/io/async:async_signal_handler", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "async_pipe_test", + srcs = [ + "AsyncPipeTest.cpp", + ], + emails = ["oncall+secure_pipes@xmail.facebook.com"], + supports_static_listing = False, + deps = [ + "//folly:memory", + "//folly/io/async:async_base", + "//folly/io/async:async_pipe", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "async_ssl_socket_test_lib", + headers = [ + "AsyncSSLSocketTest.h", + ], + exported_deps = [ + ":test_ssl_server", + "//folly:exception_wrapper", + "//folly:network_address", + "//folly/experimental:test_util", + "//folly/fibers:fiber_manager_map", + "//folly/io:socket_option_map", + "//folly/io/async:async_base", + "//folly/io/async:async_socket", + "//folly/io/async:async_ssl_socket", + "//folly/io/async:async_transport", + "//folly/io/async:server_socket", + "//folly/io/async/ssl:ssl_errors", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/portability:pthread", + "//folly/portability:sockets", + "//folly/portability:string", + "//folly/portability:unistd", + ], +) + +cpp_unittest( + name = "async_ssl_socket_test", + srcs = [ + "AsyncSSLSocketTest.cpp", + "AsyncSSLSocketTest2.cpp", + ], + emails = ["oncall+secure_pipes@xmail.facebook.com"], + extract_helper_lib = False, + resources = [ + ":ca-cert.pem", + ":client_ca_cert.pem", + ":client_cert.pem", + ":client_key.pem", + ":tests-cert.pem", + ":tests-key.pem", + ], + supports_static_listing = False, + deps = [ + ":blocking_socket", + ":mocks", + ":test_ssl_server", + ":tfo_util", + "//folly:exception_wrapper", + "//folly:network_address", + "//folly:string", + "//folly/experimental:test_util", + "//folly/fibers:fiber_manager_map", + "//folly/futures:core", + "//folly/init:init", + "//folly/io:iobuf", + "//folly/io:socket_option_map", + "//folly/io/async:async_base", + "//folly/io/async:async_pipe", + "//folly/io/async:async_socket", + "//folly/io/async:async_ssl_socket", + "//folly/io/async:async_transport", + "//folly/io/async:event_base_thread", + "//folly/io/async:scoped_event_base_thread", + "//folly/io/async:server_socket", + "//folly/io/async:ssl_context", + "//folly/io/async:ssl_options", + "//folly/io/async/ssl:basic_transport_certificate", + "//folly/io/async/ssl:openssl_transport_certificate", + "//folly/io/async/ssl:ssl_errors", + "//folly/net:net_ops", + "//folly/net:network_socket", + "//folly/net/test:mock_net_ops_dispatcher", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/portability:openssl", + "//folly/portability:pthread", + "//folly/portability:sockets", + "//folly/portability:string", + "//folly/portability:unistd", + ], + external_deps = [ + ("glibc", None, "dl"), + ("openssl", None, "crypto"), + ], +) + +cpp_unittest( + name = "async_ssl_socket_write_test", + srcs = [ + "AsyncSSLSocketWriteTest.cpp", + ], + emails = ["oncall+secure_pipes@xmail.facebook.com"], + supports_static_listing = False, + deps = [ + "//folly/io:iobuf", + "//folly/io/async:async_base", + "//folly/io/async:async_socket", + "//folly/io/async:async_ssl_socket", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "async_socket_exception_test", + srcs = [ + "AsyncSocketExceptionTest.cpp", + ], + emails = ["oncall+secure_pipes@xmail.facebook.com"], + supports_static_listing = False, + deps = [ + "//folly:conv", + "//folly/io/async:async_socket_exception", + "//folly/io/async:ssl_context", + "//folly/io/async/ssl:ssl_errors", + "//folly/portability:gtest", + "//folly/portability:openssl", + ], +) + +cpp_unittest( + name = "async_socket_observer_test", + srcs = [ + "AsyncSocketObserverTest.cpp", + ], + supports_static_listing = False, + deps = [ + ":async_socket_test_lib", + ":mocks", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "async_socket_test_lib", + headers = [ + "AsyncSocketTest.h", + "AsyncSocketTest2.h", + ], + exported_deps = [ + ":blocking_socket", + ":callback_state_enum", + ":conn_callback", + "//folly/io/async:async_socket", + "//folly/io/async:server_socket", + "//folly/net:net_ops", + "//folly/net:network_socket", + "//folly/portability:sockets", + "//folly/synchronization:rw_spin_lock", + ], +) + +cpp_unittest( + name = "async_socket_test", + srcs = [ + "AsyncSocketTest.cpp", + "AsyncSocketTest2.cpp", + ], + supports_static_listing = False, + deps = [ + ":blocking_socket", + ":callback_state_enum", + ":conn_callback", + ":mocks", + ":tfo_util", + ":util", + "//folly:exception_wrapper", + "//folly:network_address", + "//folly:random", + "//folly/experimental:test_util", + "//folly/io:iobuf", + "//folly/io:socket_option_map", + "//folly/io/async:async_base", + "//folly/io/async:async_socket", + "//folly/io/async:scoped_event_base_thread", + "//folly/io/async:server_socket", + "//folly/net:net_ops", + "//folly/net:network_socket", + "//folly/net/test:mock_net_ops_dispatcher", + "//folly/net/test:mock_tcpinfo_dispatcher", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/portability:sockets", + "//folly/portability:unistd", + "//folly/synchronization:baton", + "//folly/synchronization:rw_spin_lock", + "//folly/test:socket_address_test_helper", + ], + external_deps = [ + ("glibc", None, "rt"), + ], +) + +cpp_unittest( + name = "async_transport_test", + srcs = [ + "AsyncTransportTest.cpp", + ], + supports_static_listing = False, + deps = [ + ":mocks", + "//folly/io/async:async_socket", + "//folly/io/async:async_transport", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "event_handler_test", + srcs = [ + "EventHandlerTest.cpp", + ], + supports_static_listing = False, + deps = [ + "//folly:mpmc_queue", + "//folly:scope_guard", + "//folly/io/async:async_base", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/portability:sockets", + ], +) + +cpp_unittest( + name = "async_timeout_test", + srcs = ["AsyncTimeoutTest.cpp"], + headers = [], + emails = ["oncall+thrift@xmail.facebook.com"], + deps = [ + "//folly/io/async:async_base", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "async_udp_socket_test", + srcs = ["AsyncUDPSocketTest.cpp"], + headers = [], + emails = ["oncall+thrift@xmail.facebook.com"], + supports_static_listing = False, + deps = [ + "//folly:conv", + "//folly:network_address", + "//folly:string", + "//folly/experimental:test_util", + "//folly/io:iobuf", + "//folly/io:socket_option_map", + "//folly/io/async:async_base", + "//folly/io/async:async_udp_server_socket", + "//folly/io/async:async_udp_socket", + "//folly/net/test:mock_net_ops_dispatcher", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/portability:sockets", + ], +) + +cpp_unittest( + name = "async_udp_socket_gso_gro_test", + srcs = ["AsyncUDPSocketGSOGROTest.cpp"], + headers = [], + emails = ["oncall+thrift@xmail.facebook.com"], + deps = [ + "//folly:conv", + "//folly:network_address", + "//folly/io:iobuf", + "//folly/io/async:async_base", + "//folly/io/async:async_udp_server_socket", + "//folly/io/async:async_udp_socket", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "async_udp_socket_sendmmsg_test", + srcs = ["AsyncUDPSocketSendmmsgTest.cpp"], + headers = [], + emails = ["oncall+thrift@xmail.facebook.com"], + deps = [ + "//folly:conv", + "//folly:network_address", + "//folly/io:iobuf", + "//folly/io/async:async_base", + "//folly/io/async:async_udp_server_socket", + "//folly/io/async:async_udp_socket", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "decorated_async_transport_wrapper_test", + srcs = ["DecoratedAsyncTransportWrapperTest.cpp"], + deps = [ + "//folly/io/async:async_socket", + "//folly/io/async:async_transport", + "//folly/io/async:decorated_async_transport_wrapper", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "blocking_socket", + headers = ["BlockingSocket.h"], + exported_deps = [ + "//folly:optional", + "//folly/io/async:async_socket", + "//folly/io/async:async_ssl_socket", + "//folly/io/async:ssl_context", + "//folly/net:network_socket", + ], +) + +cpp_library( + name = "callback_state_enum", + headers = [ + "CallbackStateEnum.h", + ], +) + +cpp_library( + name = "conn_callback", + headers = [ + "ConnCallback.h", + ], + exported_deps = [ + ":callback_state_enum", + "//folly/io/async:async_socket", + ], +) + +cpp_unittest( + name = "delayed_destruction_base_test", + srcs = ["DelayedDestructionBaseTest.cpp"], + headers = [], + emails = ["oncall+thrift@xmail.facebook.com"], + deps = [ + "//folly/io/async:delayed_destruction", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "delayed_destruction_test", + srcs = ["DelayedDestructionTest.cpp"], + headers = [], + emails = ["oncall+thrift@xmail.facebook.com"], + deps = [ + "//folly/io/async:delayed_destruction", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "destructor_check_test", + srcs = ["DestructorCheckTest.cpp"], + headers = [], + emails = ["oncall+thrift@xmail.facebook.com"], + deps = [ + "//folly:memory", + "//folly/io/async:destructor_check", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "event_base_benchmark", + srcs = ["EventBaseBenchmark.cpp"], + headers = [], + allocator = "malloc", + deps = [ + "//folly:benchmark", + "//folly/io/async:async_base", + "//folly/portability:gflags", + ], +) + +cpp_library( + name = "event_base_test_lib", + headers = [ + "EventBaseTestLib.h", + ], + exported_deps = [ + ":util", + "//folly:memory", + "//folly:scope_guard", + "//folly/futures:core", + "//folly/io/async:async_base", + "//folly/portability:gmock", + "//folly/portability:stdlib", + "//folly/portability:unistd", + "//folly/synchronization:baton", + "//folly/system:thread_id", + "//folly/system:thread_name", + ], +) + +cpp_unittest( + name = "event_base_test", + srcs = ["EventBaseTest.cpp"], + headers = [], + allocator = "malloc", + emails = ["oncall+thrift@xmail.facebook.com"], + supports_static_listing = False, + deps = [ + ":async_signal_handler_test_lib", + ":event_base_test_lib", + "//folly/init:init", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "event_base_local_test", + srcs = ["EventBaseLocalTest.cpp"], + headers = [], + allocator = "malloc", + emails = ["oncall+thrift@xmail.facebook.com"], + deps = [ + "//folly/io/async:async_base", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "event_base_thread_test", + srcs = ["EventBaseThreadTest.cpp"], + headers = [], + deps = [ + "//folly/io/async:event_base_manager", + "//folly/io/async:event_base_thread", + "//folly/portability:gtest", + "//folly/synchronization:baton", + "//folly/system:thread_name", + ], +) + +cpp_unittest( + name = "hhwheel_timer_slow_test", + srcs = ["HHWheelTimerSlowTests.cpp"], + headers = [], + emails = ["oncall+thrift@xmail.facebook.com"], + tags = [ + "extended", + ], + deps = [ + ":util", + "//folly:random", + "//folly/io/async:async_base", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "hhwheel_timer_test", + srcs = ["HHWheelTimerTest.cpp"], + headers = [], + emails = ["oncall+thrift@xmail.facebook.com"], + deps = [ + ":util", + "//folly/io/async:async_base", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "mocks", + headers = [ + "MockAsyncSSLSocket.h", + "MockAsyncSocket.h", + "MockAsyncSocketLegacyObserver.h", + "MockAsyncSocketObserver.h", + "MockAsyncTransport.h", + "MockAsyncUDPSocket.h", + "MockTimeoutManager.h", + ], + exported_deps = [ + "//folly:memory", + "//folly/io/async:async_base", + "//folly/io/async:async_socket", + "//folly/io/async:async_socket_exception", + "//folly/io/async:async_ssl_socket", + "//folly/io/async:async_transport", + "//folly/io/async:async_udp_socket", + "//folly/portability:gmock", + ], +) + +cpp_library( + name = "mock_server_socket", + headers = ["MockAsyncServerSocket.h"], + exported_deps = [ + "//folly/io/async:async_base", + "//folly/io/async:server_socket", + "//folly/portability:gmock", + ], +) + +cpp_unittest( + name = "notification_queue_test", + srcs = ["NotificationQueueTest.cpp"], + headers = [], + deps = [ + "//folly/io/async:async_base", + "//folly/io/async:scoped_event_base_thread", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "atomic_notification_queue_test", + srcs = ["AtomicNotificationQueueTest.cpp"], + headers = [], + deps = [ + "//folly/io/async:async_base", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "notification_queue_benchmark", + srcs = ["NotificationQueueBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/io/async:async_base", + "//folly/synchronization:baton", + ], +) + +cpp_benchmark( + name = "request_context_benchmark", + srcs = ["RequestContextBenchmark.cpp"], + headers = ["RequestContextHelper.h"], + deps = [ + "//folly:conv", + "//folly/container:array", + "//folly/io/async:request_context", + "//folly/portability:gflags", + "//folly/synchronization/test:barrier", + ], +) + +cpp_unittest( + name = "request_context_test", + srcs = ["RequestContextTest.cpp"], + headers = ["RequestContextHelper.h"], + deps = [ + "//folly:memory", + "//folly/io/async:async_base", + "//folly/io/async:request_context", + "//folly/portability:gtest", + "//folly/system:thread_name", + ], + external_deps = [ + ("boost", None, "boost_thread"), + ], +) + +cpp_library( + name = "scoped_bound_port", + srcs = ["ScopedBoundPort.cpp"], + headers = ["ScopedBoundPort.h"], + deps = [ + "//folly:memory", + "//folly/io/async:scoped_event_base_thread", + "//folly/io/async:server_socket", + ], + exported_deps = [ + "//folly:network_address", + ], +) + +cpp_unittest( + name = "scoped_event_base_thread_test", + srcs = ["ScopedEventBaseThreadTest.cpp"], + deps = [ + "//folly:optional", + "//folly/futures:core", + "//folly/io/async:event_base_manager", + "//folly/io/async:scoped_event_base_thread", + "//folly/portability:gtest", + "//folly/synchronization:baton", + "//folly/system:thread_name", + ], +) + +cpp_unittest( + name = "terminate_cancellation_token_test", + srcs = ["TerminateCancellationTokenTest.cpp"], + deps = [ + "//folly/io/async:terminate_cancellation_token", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_binary( + name = "socket_client", + srcs = ["SocketClient.cpp"], + headers = [], + deps = [ + ":blocking_socket", + "//folly:exception_wrapper", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "ssl_session_test", + srcs = ["SSLSessionTest.cpp"], + headers = [], + emails = ["oncall+secure_pipes@xmail.facebook.com"], + preprocessor_flags = [ + "-DFOLLY_TEST_USE_RESOURCES=1", + ], + resources = [ + ":ca-cert.pem", + ":tests-cert.pem", + ":tests-key.pem", + ], + deps = [ + ":async_ssl_socket_test_lib", + "//folly/experimental:test_util", + "//folly/net:net_ops", + "//folly/net:network_socket", + "//folly/portability:gtest", + "//folly/portability:openssl", + "//folly/portability:sockets", + "//folly/ssl:ssl_session", + "//folly/ssl/detail:openssl_session", + ], +) + +cpp_unittest( + name = "time_util_test", + srcs = ["TimeUtilTest.cpp"], + deps = [ + ":util", + "//folly/portability:gtest", + "//folly/portability:unistd", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "ssl_context_test", + srcs = ["SSLContextTest.cpp"], + headers = [], + emails = ["oncall+secure_pipes@xmail.facebook.com"], + resources = [ + ":client_chain.pem", + ":client_key.pem", + ":clienti_key.pem", + ":tests-cert.pem", + ":tests-key.pem", + ], + deps = [ + ":ssl_util", + "//folly:file_util", + "//folly/experimental:test_util", + "//folly/io/async:ssl_context", + "//folly/portability:gtest", + "//folly/portability:openssl", + "//folly/ssl:openssl_cert_utils", + "//folly/ssl:openssl_key_utils", + "//folly/ssl:openssl_ptr_types", + ], +) + +cpp_unittest( + name = "ssl_context_regression_test", + srcs = ["SSLContextRegressionTest.cpp"], + headers = [], + emails = ["oncall+secure_pipes@xmail.facebook.com"], + deps = [ + "//folly:file_util", + "//folly/experimental:test_util", + "//folly/io/async:ssl_context", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "ssl_options_test", + srcs = ["SSLOptionsTest.cpp"], + headers = [], + emails = ["oncall+secure_pipes@xmail.facebook.com"], + deps = [ + ":ssl_util", + "//folly/io/async:ssl_context", + "//folly/io/async:ssl_options", + "//folly/portability:gtest", + "//folly/ssl:openssl_ptr_types", + ], +) + +cpp_library( + name = "ssl_util", + srcs = [ + "SSLUtil.cpp", + ], + headers = [ + "SSLUtil.h", + ], + exported_deps = [ + "//folly/ssl:openssl_ptr_types", + ], +) + +cpp_library( + name = "util", + srcs = [ + "SocketPair.cpp", + "TimeUtil.cpp", + ], + headers = [ + "SocketPair.h", + "TimeUtil.h", + "UndelayedDestruction.h", + "Util.h", + ], + deps = [ + "//folly:conv", + "//folly:portability", + "//folly:scope_guard", + "//folly:string", + "//folly/net:net_ops", + "//folly/portability:fcntl", + "//folly/portability:sockets", + "//folly/portability:unistd", + "//folly/system:thread_id", + ], + exported_deps = [ + "//folly/net:network_socket", + "//folly/portability:gtest", + "//folly/portability:sys_types", + "//folly/test:test_utils", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "write_chain_async_transport_wrapper_test", + srcs = ["WriteChainAsyncTransportWrapperTest.cpp"], + headers = [], + deps = [ + "//folly/io/async:async_transport", + "//folly/io/async:decorated_async_transport_wrapper", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "write_flags_test", + srcs = ["WriteFlagsTest.cpp"], + headers = [], + deps = [ + "//folly/io/async:async_transport", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "zero_copy_lib", + srcs = ["ZeroCopy.cpp"], + headers = ["ZeroCopy.h"], + exported_deps = [ + "//folly:exception_wrapper", + "//folly:network_address", + "//folly/io:iobuf", + "//folly/io/async:async_base", + "//folly/io/async:async_socket", + "//folly/io/async:server_socket", + ], +) + +cpp_unittest( + name = "zero_copy_test", + srcs = ["ZeroCopyTest.cpp"], + headers = [], + deps = [ + ":zero_copy_lib", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "zero_copy_benchmark", + srcs = ["ZeroCopyBenchmark.cpp"], + headers = [], + deps = [ + ":zero_copy_lib", + "//folly:benchmark", + "//folly/portability:gflags", + ], +) diff --git a/folly/io/async/test/certs/BUCK b/folly/io/async/test/certs/BUCK new file mode 100644 index 00000000000..490b5c198e7 --- /dev/null +++ b/folly/io/async/test/certs/BUCK @@ -0,0 +1,5 @@ +load("@fbcode_macros//build_defs:export_files.bzl", "export_files") + +oncall("fbcode_entropy_wardens_folly") + +export_files(files = glob(["*.pem"])) diff --git a/folly/io/async/test/certs/defs.bzl b/folly/io/async/test/certs/defs.bzl new file mode 100644 index 00000000000..631ab53ff8e --- /dev/null +++ b/folly/io/async/test/certs/defs.bzl @@ -0,0 +1,8 @@ +load("@fbcode_macros//build_defs:native_rules.bzl", "alias") + +def alias_pem(pems: list[str]): + for pem in pems: + alias( + name = pem, + actual = "//folly/io/async/test/certs:{pem}".format(pem = pem), + ) diff --git a/folly/io/coro/BUCK b/folly/io/coro/BUCK new file mode 100644 index 00000000000..720e894bf64 --- /dev/null +++ b/folly/io/coro/BUCK @@ -0,0 +1,45 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "transport_callback_base", + headers = [ + "TransportCallbackBase.h", + ], + exported_deps = [ + "//folly:portability", + "//folly/experimental/coro:baton", + "//folly/experimental/coro:task", + "//folly/io/async:async_transport", + "//folly/io/async/ssl:ssl_errors", + ], +) + +cpp_library( + name = "socket", + srcs = [ + "ServerSocket.cpp", + "Transport.cpp", + ], + headers = [ + "ServerSocket.h", + "Transport.h", + ], + deps = [ + ":transport_callback_base", + "//folly:portability", + "//folly/experimental/coro:baton", + ], + exported_deps = [ + "//folly:exception_wrapper", + "//folly:expected", + "//folly:network_address", + "//folly:range", + "//folly/experimental/coro:task", + "//folly/io:iobuf", + "//folly/io/async:async_socket", + "//folly/io/async:async_socket_exception", + "//folly/io/async:server_socket", + ], +) diff --git a/folly/io/coro/test/BUCK b/folly/io/coro/test/BUCK new file mode 100644 index 00000000000..e902c0ed1f8 --- /dev/null +++ b/folly/io/coro/test/BUCK @@ -0,0 +1,20 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "transport_test", + srcs = [ + "TransportTest.cpp", + ], + deps = [ + "//folly:portability", + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:collect", + "//folly/io/async/test:async_socket_test_lib", + "//folly/io/async/test:mocks", + "//folly/io/async/test:scoped_bound_port", + "//folly/io/coro:socket", + "//folly/portability:gtest", + ], +) diff --git a/folly/io/test/BUCK b/folly/io/test/BUCK new file mode 100644 index 00000000000..83265583b3e --- /dev/null +++ b/folly/io/test/BUCK @@ -0,0 +1,162 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_binary( + name = "iobuf_benchmark", + srcs = ["IOBufBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/io:iobuf", + ], +) + +cpp_unittest( + name = "iobuf_test", + srcs = ["IOBufTest.cpp"], + headers = [], + allocator = "jemalloc_debug", + emails = ["simpkins@fb.com"], + supports_static_listing = False, + deps = [ + "//folly:range", + "//folly/io:iobuf", + "//folly/io:typed_io_buf", + "//folly/memory:malloc", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "iobuf_cb_test", + srcs = ["IOBufCBTest.cpp"], + headers = [], + allocator = "jemalloc_debug", + emails = ["dmm@fb.com"], + deps = [ + "//folly/io:iobuf", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "iobuf_cursor_benchmark", + srcs = ["IOBufCursorBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:format", + "//folly:range", + "//folly/io:iobuf", + ], +) + +cpp_unittest( + name = "iobuf_cursor_test", + srcs = ["IOBufCursorTest.cpp"], + headers = [], + deps = [ + "//folly:format", + "//folly:range", + "//folly/io:iobuf", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "iobuf_network_bench", + srcs = ["NetworkBenchmark.cpp"], + headers = [], + allocator = "jemalloc", + deps = [ + "//folly:benchmark", + "//folly/io:iobuf", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "iobuf_queue_test", + srcs = ["IOBufQueueTest.cpp"], + headers = [], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:range", + "//folly/io:iobuf", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "iobuf_iovec_builder_test", + srcs = ["IOBufIovecBuilderTest.cpp"], + headers = [], + deps = [ + "//folly/io:iobuf", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "queueappender_benchmark", + srcs = ["QueueAppenderBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:format", + "//folly:range", + "//folly/io:iobuf", + ], +) + +cpp_unittest( + name = "record_io_test", + srcs = ["RecordIOTest.cpp"], + headers = [], + deps = [ + "//folly:conv", + "//folly:fbstring", + "//folly:random", + "//folly/experimental:test_util", + "//folly/io:iobuf", + "//folly/io:record_io", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/portability:unistd", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "shutdown_socket_set_test", + srcs = ["ShutdownSocketSetTest.cpp"], + headers = [], + deps = [ + "//folly/io:shutdown_socket_set", + "//folly/net:net_ops", + "//folly/net:network_socket", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "socket_option_value_test", + srcs = ["SocketOptionValueTest.cpp"], + headers = [], + deps = [ + "//folly:conv", + "//folly/io:socket_option_map", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/json/BUCK b/folly/json/BUCK new file mode 100644 index 00000000000..86f075afba1 --- /dev/null +++ b/folly/json/BUCK @@ -0,0 +1,154 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "dynamic", + srcs = [ + "dynamic.cpp", + "json.cpp", + ], + headers = [ + "DynamicConverter.h", + "dynamic.h", + "dynamic-inl.h", + "json.h", + ], + deps = [ + "//folly:unicode", + "//folly/container:enumerate", + "//folly/hash:hash", + "//folly/lang:assume", + "//folly/lang:bits", + "//folly/portability:constexpr", + ], + exported_deps = [ + "//folly:c_portability", + "//folly:conv", + "//folly:expected", + "//folly:format", + "//folly:function", + "//folly:json_pointer", + "//folly:likely", + "//folly:optional", + "//folly:portability", + "//folly:range", + "//folly:traits", + "//folly:utility", + "//folly/container:f14_hash", + "//folly/detail:iterators", + "//folly/lang:exception", + ], + external_deps = [ + "glog", + ("boost", None, "boost_algorithm"), + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "json_pointer", + srcs = ["json_pointer.cpp"], + headers = ["json_pointer.h"], + deps = [ + "//folly:string", + ], + exported_deps = [ + "//folly:expected", + "//folly:range", + ], +) + +cpp_library( + name = "json_patch", + srcs = ["json_patch.cpp"], + headers = ["json_patch.h"], + deps = [ + "//folly/container:enumerate", + ], + exported_deps = [ + "//folly:expected", + "//folly:json_pointer", + "//folly:optional", + "//folly/json:dynamic", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "json_schema", + srcs = ["JSONSchema.cpp"], + headers = ["JSONSchema.h"], + deps = [ + "//folly:c_portability", + "//folly:conv", + "//folly:memory", + "//folly:optional", + "//folly:singleton", + "//folly:string", + "//folly/portability:math", + ], + exported_deps = [ + "//folly:exception_wrapper", + "//folly:range", + "//folly/json:dynamic", + ], + external_deps = [ + ("boost", None, "boost_algorithm"), + ("boost", None, "boost_regex"), + ], +) + +cpp_library( + name = "dynamic_parser", + srcs = ["DynamicParser.cpp"], + headers = [ + "DynamicParser.h", + "DynamicParser-inl.h", + ], + deps = [ + "//folly:optional", + ], + exported_deps = [ + "//folly:c_portability", + "//folly:conv", + "//folly/json:dynamic", + # for toPseudoJson(), since print_as_pseudo_json() is in json.cpp + "//folly:json", # @manual + "//folly:scope_guard", + "//folly:traits", + ], + external_deps = [ + "glog", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "json_mock_util", + headers = ["JsonMockUtil.h"], + exported_deps = [ + "//folly/portability:gmock", + "//folly/test:json_test_util", + ], +) + +cpp_library( + name = "json_test_util", + srcs = ["JsonTestUtil.cpp"], + headers = ["JsonTestUtil.h"], + deps = [ + "//folly:conv", + "//folly/lang:assume", + ], + exported_deps = [ + "//folly:range", + "//folly/json:dynamic", + ], +) diff --git a/folly/json/bser/BUCK b/folly/json/bser/BUCK new file mode 100644 index 00000000000..9220d0ecd25 --- /dev/null +++ b/folly/json/bser/BUCK @@ -0,0 +1,24 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "bser", + srcs = [ + "Dump.cpp", + "Load.cpp", + ], + headers = [ + "Bser.h", + ], + deps = [ + "//folly:string", + ], + exported_deps = [ + "//folly:c_portability", + "//folly:json", # @manual + "//folly:optional", + "//folly/io:iobuf", + "//folly/json:dynamic", + ], +) diff --git a/folly/json/bser/test/BUCK b/folly/json/bser/test/BUCK new file mode 100644 index 00000000000..d6fcbc26d1b --- /dev/null +++ b/folly/json/bser/test/BUCK @@ -0,0 +1,14 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "testbser", + srcs = ["BserTest.cpp"], + headers = [], + deps = [ + "//folly:string", + "//folly/experimental/bser:bser", + "//folly/portability:gtest", + ], +) diff --git a/folly/json/test/BUCK b/folly/json/test/BUCK new file mode 100644 index 00000000000..397ff9b3f74 --- /dev/null +++ b/folly/json/test/BUCK @@ -0,0 +1,147 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_benchmark( + name = "dynamic_benchmark", + srcs = ["DynamicBenchmark.cpp"], + deps = [ + "//folly:benchmark", + "//folly/init:init", + "//folly/json:dynamic", + ], +) + +cpp_unittest( + name = "dynamic_converter_test", + srcs = ["DynamicConverterTest.cpp"], + headers = [], + deps = [ + "//folly:expected", + "//folly:fbvector", + "//folly:optional", + "//folly/json:dynamic", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "dynamic_other_test", + srcs = ["DynamicOtherTest.cpp"], + headers = [], + deps = [ + "//folly/gen:base", + "//folly/json:dynamic", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "dynamic_test", + srcs = ["DynamicTest.cpp"], + headers = [], + deps = [ + "//folly:range", + "//folly/hash:hash", + "//folly/json:dynamic", + "//folly/portability:gtest", + "//folly/test:comparison_operator_test_util", + ], + external_deps = [ + "glog", + ], +) + +cpp_benchmark( + name = "json_benchmark", + srcs = ["JsonBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/json:dynamic", + ], +) + +cpp_unittest( + name = "json_other_test", + srcs = ["JsonOtherTest.cpp"], + headers = [], + deps = [ + "//folly/json:dynamic", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "json_patch_test", + srcs = ["json_patch_test.cpp"], + headers = [], + deps = [ + "//folly:json_patch", + "//folly:json_pointer", + "//folly/json:dynamic", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "json_test", + srcs = ["JsonTest.cpp"], + headers = [], + deps = [ + "//folly/json:dynamic", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "json_pointer_test", + srcs = ["json_pointer_test.cpp"], + headers = [], + deps = [ + "//folly:json_pointer", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "json_schema_test", + srcs = ["JSONSchemaTest.cpp"], + headers = [], + deps = [ + "//folly/experimental:json_schema", + "//folly/json:dynamic", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "dynamic_parser_test", + srcs = ["DynamicParserTest.cpp"], + headers = [], + deps = [ + "//folly:optional", + "//folly/experimental:dynamic_parser", + "//folly/experimental:test_util", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "json_test_util_test", + srcs = ["JsonTestUtilTest.cpp"], + headers = [], + deps = [ + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/test:json_mock_util", + "//folly/test:json_test_util", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/lang/BUCK b/folly/lang/BUCK new file mode 100644 index 00000000000..2376d3adf0e --- /dev/null +++ b/folly/lang/BUCK @@ -0,0 +1,270 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "access", + headers = ["Access.h"], + exported_deps = [ + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "align", + headers = ["Align.h"], + exported_deps = [ + "//folly:portability", + "//folly:traits", + ], +) + +cpp_library( + name = "aligned", + headers = ["Aligned.h"], + exported_deps = [ + ":align", + "//folly:utility", + ], +) + +cpp_library( + name = "assume", + headers = ["Assume.h"], + exported_deps = [ + ":hint", + "//folly:portability", + ], +) + +cpp_library( + name = "badge", + headers = ["Badge.h"], + exported_deps = [ + "//folly:traits", + ], +) + +cpp_library( + name = "bits", + headers = ["Bits.h"], + exported_deps = [ + ":assume", + "//folly:constexpr_math", + "//folly:portability", + "//folly:traits", + "//folly:utility", + "//folly/portability:builtins", + ], +) + +cpp_library( + name = "builtin", + headers = ["Builtin.h"], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "c_array", + headers = ["CArray.h"], +) + +cpp_library( + name = "c_string", + srcs = ["CString.cpp"], + headers = ["CString.h"], + deps = [ + "//folly:cpp_attributes", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "cast", + headers = ["Cast.h"], + exported_deps = [ + ":safe_assert", + "//folly:portability", + "//folly:traits", + ], +) + +cpp_library( + name = "checked_math", + headers = ["CheckedMath.h"], + exported_deps = [ + "//folly:c_portability", + "//folly:likely", + ], +) + +cpp_library( + name = "customization_point", + headers = ["CustomizationPoint.h"], + exported_deps = [ + ":static_const", + "//folly:portability", + ], +) + +cpp_library( + name = "exception", + srcs = ["Exception.cpp"], + headers = ["Exception.h"], + linker_flags = select({ + "DEFAULT": [], + "ovr_config//os:macos": ["-lc++abi"], + }), + deps = [ + ":new", + ], + exported_deps = [ + ":safe_assert", + ":type_info", + "//folly:c_portability", + "//folly:cpp_attributes", + "//folly:likely", + "//folly:portability", + "//folly:traits", + "//folly:utility", + ], +) + +cpp_library( + name = "extern", + headers = ["Extern.h"], +) + +cpp_library( + name = "keep", + headers = ["Keep.h"], + exported_deps = [ + "//folly:c_portability", + ], +) + +cpp_library( + name = "hint", + headers = [ + "Hint.h", + "Hint-inl.h", + ], + exported_deps = [ + ":safe_assert", + "//folly:portability", + "//folly:traits", + ], +) + +cpp_library( + name = "new", + headers = ["New.h"], + exported_deps = [ + "//folly:cpp_attributes", + "//folly:portability", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "ordering", + headers = ["Ordering.h"], + exported_deps = [ + ":exception", + ], +) + +cpp_library( + name = "propagate_const", + headers = ["PropagateConst.h"], + exported_deps = [ + "//folly:traits", + "//folly:utility", + ], +) + +cpp_library( + name = "rvalue_reference_wrapper", + headers = ["RValueReferenceWrapper.h"], +) + +cpp_library( + name = "safe_assert", + srcs = ["SafeAssert.cpp"], + headers = ["SafeAssert.h"], + deps = [ + ":to_ascii", + "//folly/detail:file_util_detail", + "//folly/portability:sys_types", + "//folly/portability:windows", + ], + exported_deps = [ + ":c_array", + "//folly:cpp_attributes", + "//folly:portability", + "//folly:preprocessor", + ], +) + +cpp_library( + name = "static_const", + headers = ["StaticConst.h"], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "thunk", + headers = ["Thunk.h"], + exported_deps = [ + ":new", + "//folly:utility", + ], +) + +cpp_library( + name = "to_ascii", + srcs = ["ToAscii.cpp"], + headers = ["ToAscii.h"], + exported_deps = [ + ":align", + ":c_array", + "//folly:constexpr_math", + "//folly:likely", + "//folly:portability", + "//folly:utility", + "//folly/portability:builtins", + ], +) + +cpp_library( + name = "type_info", + headers = ["TypeInfo.h"], + exported_deps = [ + "//folly:cpp_attributes", + "//folly:portability", + ], +) + +cpp_library( + name = "pretty", + headers = ["Pretty.h"], + exported_deps = [ + ":c_array", + "//folly:portability", + ], +) + +cpp_library( + name = "uncaught_exceptions", + srcs = ["UncaughtExceptions.cpp"], + headers = ["UncaughtExceptions.h"], + exported_deps = [ + "//folly:cpp_attributes", + "//folly:likely", + "//folly:portability", + ], +) diff --git a/folly/lang/test/BUCK b/folly/lang/test/BUCK new file mode 100644 index 00000000000..e1985dd1acb --- /dev/null +++ b/folly/lang/test/BUCK @@ -0,0 +1,233 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "aligned_test", + srcs = ["AlignedTest.cpp"], + deps = [ + "//folly/lang:align", + "//folly/lang:aligned", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "badge_test", + srcs = ["BadgeTest.cpp"], + deps = [ + "//folly/lang:badge", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "bits_benchmark", + srcs = ["BitsBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:cpp_attributes", + "//folly:random", + "//folly/lang:assume", + "//folly/lang:bits", + ], +) + +cpp_unittest( + name = "bits_test", + srcs = ["BitsTest.cpp"], + headers = [], + deps = [ + "//folly:random", + "//folly/lang:bits", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "c_string_test", + srcs = ["CStringTest.cpp"], + deps = [ + "//folly/lang:c_string", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "cast_test", + srcs = ["CastTest.cpp"], + deps = [ + "//folly:utility", + "//folly/lang:cast", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "checked_math_test", + srcs = ["CheckedMathTest.cpp"], + deps = [ + "//folly/lang:checked_math", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "exception_test", + srcs = ["ExceptionTest.cpp"], + deps = [ + "//folly:portability", + "//folly/lang:exception", + "//folly/lang:keep", + "//folly/lang:pretty", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "extern_test", + srcs = ["ExternTest.cpp"], + deps = [ + "//folly/lang:extern", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "hint_test", + srcs = ["HintTest.cpp"], + deps = [ + "//folly/lang:hint", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "new_test", + srcs = ["NewTest.cpp"], + deps = [ + "//folly/lang:align", + "//folly/lang:new", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "ordering_test", + srcs = ["OrderingTest.cpp"], + deps = [ + "//folly/lang:ordering", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "propagate_const_test", + srcs = ["PropagateConstTest.cpp"], + deps = [ + "//folly/lang:propagate_const", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "rvalue_reference_wrapper_test", + srcs = ["RValueReferenceWrapperTest.cpp"], + headers = [], + deps = [ + "//folly/lang:rvalue_reference_wrapper", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "safe_assert_test", + srcs = ["SafeAssertTest.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:conv", + "//folly/lang:keep", + "//folly/lang:safe_assert", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "thunk_test", + srcs = ["ThunkTest.cpp"], + deps = [ + "//folly:traits", + "//folly/lang:thunk", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "to_ascii_bench", + srcs = ["ToAsciiBench.cpp"], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:benchmark", + "//folly/lang:keep", + "//folly/lang:to_ascii", + "//folly/portability:fmt_compile", + ], +) + +cpp_unittest( + name = "to_ascii_test", + srcs = ["ToAsciiTest.cpp"], + deps = [ + "//folly/lang:to_ascii", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "type_info_test", + srcs = ["TypeInfoTest.cpp"], + deps = [ + "//folly/lang:type_info", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "pretty_test", + srcs = ["PrettyTest.cpp"], + deps = [ + "//folly/lang:pretty", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "uncaught_exceptions_bench", + srcs = ["UncaughtExceptionsBench.cpp"], + deps = [ + "//folly:benchmark", + "//folly/lang:hint", + "//folly/lang:keep", + "//folly/lang:uncaught_exceptions", + ], +) + +cpp_unittest( + name = "uncaught_exceptions_test", + srcs = ["UncaughtExceptionsTest.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "//folly:conv", + "//folly/functional:invoke", + "//folly/lang:uncaught_exceptions", + "//folly/portability:gtest", + ], +) diff --git a/folly/logging/BUCK b/folly/logging/BUCK new file mode 100644 index 00000000000..879d08fd703 --- /dev/null +++ b/folly/logging/BUCK @@ -0,0 +1,208 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbsource//tools/build_defs/buck2:is_buck2.bzl", "is_buck2") + +oncall("fbcode_entropy_wardens_folly") + +# "logging" is the core of the logging library +# If you want to log messages from your code, this is the library you should +# depend on. +cpp_library( + name = "logging", + srcs = [ + "AsyncFileWriter.cpp", + "AsyncLogWriter.cpp", + "CustomLogFormatter.cpp", + "FileWriterFactory.cpp", + "GlogStyleFormatter.cpp", + "ImmediateFileWriter.cpp", + "LogCategory.cpp", + "LogCategoryConfig.cpp", + "LogConfig.cpp", + "LogMessage.cpp", + "LogStream.cpp", + "LogStreamProcessor.cpp", + "Logger.cpp", + "LoggerDB.cpp", + "ObjectToString.cpp", + "StandardLogHandler.cpp", + "StandardLogHandlerFactory.cpp", + "StreamHandlerFactory.cpp", + "xlog.cpp", + ], + headers = [ + "AsyncFileWriter.h", + "AsyncLogWriter.h", + "CustomLogFormatter.h", + "FileWriterFactory.h", + "GlogStyleFormatter.h", + "ImmediateFileWriter.h", + "LogCategory.h", + "LogCategoryConfig.h", + "LogConfig.h", + "LogFormatter.h", + "LogMessage.h", + "LogStream.h", + "LogStreamProcessor.h", + "LogWriter.h", + "Logger.h", + "LoggerDB.h", + "ObjectToString.h", + "StandardLogHandler.h", + "StandardLogHandlerFactory.h", + "StreamHandlerFactory.h", + "xlog.h", + ], + preprocessor_flags = [ + "-DFOLLY_XLOG_SUPPORT_BUCK2" if is_buck2() else "-DFOLLY_XLOG_SUPPORT_BUCK1", + ], + deps = [ + "//folly:constexpr_math", + "//folly:demangle", + "//folly:exception", + "//folly:file_util", + "//folly:format", + "//folly:map_util", + "//folly:string", + "//folly/portability:fcntl", + "//folly/portability:pthread", + "//folly/portability:time", + "//folly/portability:unistd", + "//folly/system:at_fork", + "//folly/system:thread_id", + "//folly/system:thread_name", + ], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + ":log_handler", + ":log_level", + ":log_name", + ":rate_limiter", + "//folly:c_portability", + "//folly:conv", + "//folly:cpp_attributes", + "//folly:exception_string", + "//folly:file", + "//folly:likely", + "//folly:optional", + "//folly:portability", + "//folly:range", + "//folly:scope_guard", + "//folly:synchronized", + "//folly/detail:static_singleton_manager", + "//folly/lang:exception", + "//folly/lang:type_info", + ], +) + +# "init" contains code needed to configure the logging library. +# The main initialization code in your program should normally depend +# on this to initialize the logging library. +cpp_library( + name = "init", + srcs = [ + "Init.cpp", + "LogConfigParser.cpp", + ], + headers = [ + "Init.h", + "LogConfigParser.h", + ], + deps = [ + ":log_name", + "//folly:conv", + "//folly:string", + "//folly/json:dynamic", + "//folly/lang:safe_assert", + ], + exported_deps = [ + ":init_weak", # @manual + ":logging", + "//folly:c_portability", + "//folly:range", + ], +) + +cpp_library( + name = "init_weak", + srcs = [ + "InitWeak.cpp", + ], + deps = [ + "//folly:c_portability", + ], +) + +cpp_library( + name = "file_handler_factory", + srcs = ["FileHandlerFactory.cpp"], + headers = ["FileHandlerFactory.h"], + deps = [ + ":logging", + ], + exported_deps = [ + ":log_handler", + ], +) + +cpp_library( + name = "log_handler", + srcs = [ + "LogHandlerConfig.cpp", + ], + headers = [ + "LogHandler.h", + "LogHandlerConfig.h", + "LogHandlerFactory.h", + ], + deps = [ + "//folly/lang:safe_assert", + ], + exported_deps = [ + ":log_level", + "//folly:cpp_attributes", + "//folly:optional", + "//folly:range", + ], +) + +cpp_library( + name = "log_level", + srcs = ["LogLevel.cpp"], + headers = ["LogLevel.h"], + deps = [ + "//folly:conv", + ], + exported_deps = [ + "//folly:portability", + "//folly:range", + ], +) + +cpp_library( + name = "log_name", + srcs = ["LogName.cpp"], + headers = ["LogName.h"], + exported_deps = [ + "//folly:range", + ], +) + +cpp_library( + name = "rate_limiter", + srcs = ["RateLimiter.cpp"], + headers = ["RateLimiter.h"], + exported_deps = [ + "//folly:chrono", + ], +) + +cpp_library( + name = "glog_bridge", + srcs = ["BridgeFromGoogleLogging.cpp"], + headers = ["BridgeFromGoogleLogging.h"], + deps = [ + ":logging", + "//folly:utility", + ], + exported_external_deps = ["glog"], +) diff --git a/folly/logging/example/BUCK b/folly/logging/example/BUCK new file mode 100644 index 00000000000..249aaa4f301 --- /dev/null +++ b/folly/logging/example/BUCK @@ -0,0 +1,26 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_binary( + name = "example", + srcs = ["main.cpp"], + deps = [ + ":lib", + "//folly/init:init", + "//folly/logging:init", + "//folly/logging:logging", + ], +) + +cpp_library( + name = "lib", + srcs = ["lib.cpp"], + headers = ["lib.h"], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:range", + "//folly/logging:logging", + ], +) diff --git a/folly/logging/test/BUCK b/folly/logging/test/BUCK new file mode 100644 index 00000000000..7425aebba35 --- /dev/null +++ b/folly/logging/test/BUCK @@ -0,0 +1,368 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") +load("@fbsource//tools/build_defs/buck2:is_buck2.bzl", "is_buck2") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "async_file_writer_test", + srcs = ["AsyncFileWriterTest.cpp"], + deps = [ + "//folly:conv", + "//folly:exception", + "//folly:file", + "//folly:file_util", + "//folly:string", + "//folly:synchronized", + "//folly/experimental:test_util", + "//folly/futures:core", + "//folly/init:init", + "//folly/lang:safe_assert", + "//folly/logging:init", + "//folly/logging:logging", + "//folly/portability:config", + "//folly/portability:gflags", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/portability:unistd", + "//folly/system:thread_id", + "//folly/system:thread_name", + "//folly/test:test_utils", + ], +) + +cpp_unittest( + name = "async_log_writer_test", + srcs = ["AsyncLogWriterTest.cpp"], + deps = [ + "//folly/logging:logging", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], +) + +cpp_unittest( + name = "config_parser_test", + srcs = ["ConfigParserTest.cpp"], + deps = [ + ":config_helpers", + "//folly:string", + "//folly/json:dynamic", + "//folly/logging:init", + "//folly/logging:logging", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], +) + +cpp_unittest( + name = "config_update_test", + srcs = ["ConfigUpdateTest.cpp"], + deps = [ + ":config_helpers", + ":test_handler", + "//folly/json:dynamic", + "//folly/logging:init", + "//folly/logging:log_handler", + "//folly/logging:logging", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], +) + +python_unittest( + name = "fatal_test", + srcs = ["fatal_test.py"], + env = { + "FOLLY_FATAL_HELPER": "$(location //folly/logging/test/helpers:fatal_helper)", + }, +) + +python_unittest( + name = "log_after_main", + srcs = ["log_after_main.py"], + env = { + "FOLLY_LOG_AFTER_MAIN_HELPER": "$(location //folly/logging/test/helpers:log_after_main)", + "FOLLY_LOG_AFTER_MAIN_NO_INIT_HELPER": "$(location //folly/logging/test/helpers:log_after_main_no_init)", + }, +) + +cpp_unittest( + name = "file_handler_factory_test", + srcs = ["FileHandlerFactoryTest.cpp"], + deps = [ + "//folly:exception", + "//folly/experimental:test_util", + "//folly/logging:file_handler_factory", + "//folly/logging:logging", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], +) + +cpp_unittest( + name = "custom_log_formatter_test", + srcs = ["CustomLogFormatterTest.cpp"], + deps = [ + "//folly:format", + "//folly/init:init", + "//folly/logging:logging", + "//folly/portability:gtest", + "//folly/portability:stdlib", + ], +) + +cpp_unittest( + name = "glog_formatter_test", + srcs = ["GlogFormatterTest.cpp"], + deps = [ + "//folly:format", + "//folly/init:init", + "//folly/logging:logging", + "//folly/portability:gtest", + "//folly/portability:stdlib", + "//folly/system:thread_name", + ], +) + +cpp_unittest( + name = "immediate_file_writer_test", + srcs = ["ImmediateFileWriterTest.cpp"], + deps = [ + "//folly:conv", + "//folly:exception", + "//folly:file_util", + "//folly/experimental:test_util", + "//folly/logging:logging", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "init_test", + srcs = ["InitTest.cpp"], + deps = [ + ":config_helpers", + "//folly/logging:init", + "//folly/logging:logging", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], +) + +cpp_unittest( + name = "log_category_test", + srcs = ["LogCategoryTest.cpp"], + deps = [ + ":test_handler", + "//folly:conv", + "//folly/logging:logging", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "logger_db_test", + srcs = ["LoggerDBTest.cpp"], + deps = [ + ":test_handler", + "//folly/logging:logging", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "logger_test", + srcs = ["LoggerTest.cpp"], + deps = [ + "fbsource//third-party/fmt:fmt", + ":test_handler", + "//folly/logging:log_handler", + "//folly/logging:logging", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], +) + +cpp_unittest( + name = "log_level_test", + srcs = ["LogLevelTest.cpp"], + deps = [ + "//folly:conv", + "//folly:random", + "//folly/logging:log_level", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "log_message_test", + srcs = ["LogMessageTest.cpp"], + deps = [ + "//folly:string", + "//folly/logging:logging", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "log_name_test", + srcs = ["LogNameTest.cpp"], + deps = [ + "//folly/logging:log_name", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "log_stream_test", + srcs = ["LogStreamTest.cpp"], + deps = [ + "//folly/logging:logging", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "rate_limiter_test", + srcs = ["RateLimiterTest.cpp"], + deps = [ + "//folly:conv", + "//folly/logging:rate_limiter", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "standard_log_handler_test", + srcs = ["StandardLogHandlerTest.cpp"], + deps = [ + "//folly:conv", + "//folly/logging:log_handler", + "//folly/logging:log_level", + "//folly/logging:logging", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "config_helpers", + srcs = ["ConfigHelpers.cpp"], + headers = ["ConfigHelpers.h"], + deps = [ + "//folly:string", + "//folly/logging:init", + "//folly/logging:log_handler", + "//folly/logging:logging", + ], +) + +cpp_unittest( + name = "sync_level_test", + srcs = ["SyncLevelTest.cpp"], + deps = [ + "//folly/logging:init", + "//folly/logging:log_handler", + "//folly/logging:logging", + "//folly/test:test_utils", + ], +) + +cpp_library( + name = "test_handler", + srcs = ["TestLogHandler.cpp"], + headers = ["TestLogHandler.h"], + deps = [ + "//folly:map_util", + ], + exported_deps = [ + "//folly/logging:log_handler", + "//folly/logging:logging", + ], +) + +cpp_library( + name = "xlog_test_lib", + srcs = [ + "XlogFile1.cpp", + "XlogFile2.cpp", + ], + headers = [ + "XlogHeader1.h", + "XlogHeader2.h", + ], + exported_deps = [ + "//folly:range", + "//folly/logging:logging", + ], +) + +cpp_binary( + name = "xlog_bench", + srcs = ["XlogBench.cpp"], + deps = [ + "//folly:benchmark", + "//folly/init:init", + "//folly/logging:init", + "//folly/logging:log_handler", + "//folly/logging:logging", + "//folly/portability:gflags", + ], + external_deps = [ + ("boost", None, "boost_preprocessor"), + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "xlog_test", + srcs = ["XlogTest.cpp"], + preprocessor_flags = [ + "-DFOLLY_XLOG_SUPPORT_BUCK2" if is_buck2() else "-DFOLLY_XLOG_SUPPORT_BUCK1", + ], + deps = [ + ":test_handler", + ":xlog_test_lib", + "//folly/logging:init", + "//folly/logging:log_handler", + "//folly/logging:logging", + "//folly/portability:constexpr", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], +) + +cpp_unittest( + name = "standard_log_handler_factory_test", + srcs = ["StandardLogHandlerFactoryTest.cpp"], + deps = [ + "//folly/logging:init", + "//folly/logging:log_handler", + "//folly/logging:logging", + "//folly/portability:gmock", + "//folly/test:test_utils", + ], +) + +cpp_unittest( + name = "bridge_from_google_logging_test", + srcs = ["BridgeFromGoogleLoggingTest.cpp"], + deps = [ + ":test_handler", + "//folly/logging:glog_bridge", + "//folly/logging:init", + "//folly/logging:log_handler", + "//folly/logging:logging", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], +) diff --git a/folly/logging/test/helpers/BUCK b/folly/logging/test/helpers/BUCK new file mode 100644 index 00000000000..496f9bc8d7f --- /dev/null +++ b/folly/logging/test/helpers/BUCK @@ -0,0 +1,49 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_binary( + name = "fatal_helper", + srcs = ["FatalHelper.cpp"], + deps = [ + "//folly/init:init", + "//folly/logging:logging", + "//folly/portability:stdlib", + ], +) + +cpp_binary( + name = "log_after_main", + srcs = ["LogAfterMain.cpp"], + deps = [ + ":helpers", + ":log_on_shutdown", + "//folly/init:init", + "//folly/logging:logging", + ], +) + +cpp_binary( + name = "log_after_main_no_init", + srcs = ["LogAfterMainNoInit.cpp"], + deps = [ + ":helpers", + ], +) + +cpp_library( + name = "helpers", + headers = ["helpers.h"], + exported_deps = [ + "//folly/logging:logging", + ], +) + +cpp_library( + name = "log_on_shutdown", + srcs = ["LogOnShutdownLib.cpp"], + deps = [ + ":helpers", + ], +) diff --git a/folly/memory/BUCK b/folly/memory/BUCK new file mode 100644 index 00000000000..e33e45040fd --- /dev/null +++ b/folly/memory/BUCK @@ -0,0 +1,191 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "arena", + headers = [ + "Arena.h", + "Arena-inl.h", + ], + exported_deps = [ + ":malloc", + "//folly:conv", + "//folly:likely", + "//folly:memory", + "//folly/lang:align", + "//folly/lang:checked_math", + "//folly/lang:exception", + "//folly/lang:safe_assert", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_library( + name = "mallctl_helper", + srcs = ["MallctlHelper.cpp"], + headers = ["MallctlHelper.h"], + deps = [ + "//folly:format", + "//folly:string", + ], + exported_deps = [ + ":malloc", + ], +) + +cpp_library( + name = "malloc", + headers = ["Malloc.h"], + os_deps = [( + "linux", + ["third-party//jemalloc:headers"], + )], + exported_deps = [ + "//folly:portability", + "//folly/lang:bits", + "//folly/lang:exception", + "//folly/memory/detail:malloc_impl", + "//folly/portability:malloc", + ], +) + +cpp_library( + name = "memory_resource", + headers = ["MemoryResource.h"], +) + +cpp_library( + name = "not_null", + srcs = [], + headers = [ + "not_null.h", + "not_null-inl.h", + ], + exported_deps = [ + "//folly:memory", + "//folly:portability", + "//folly/lang:exception", + ], +) + +cpp_library( + name = "reentrant_allocator", + srcs = ["ReentrantAllocator.cpp"], + headers = ["ReentrantAllocator.h"], + deps = [ + "//folly/lang:bits", + "//folly/lang:safe_assert", + "//folly/portability:sys_mman", + ], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "sanitize_address", + srcs = ["SanitizeAddress.cpp"], + headers = ["SanitizeAddress.h"], + deps = [ + "//folly/lang:extern", + ], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "sanitize_leak", + srcs = ["SanitizeLeak.cpp"], + headers = ["SanitizeLeak.h"], + deps = [ + "//folly/lang:extern", + ], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "thread_cached_arena", + srcs = ["ThreadCachedArena.cpp"], + headers = ["ThreadCachedArena.h"], + exported_deps = [ + "//folly:likely", + "//folly:synchronized", + "//folly:thread_local", + "//folly/memory:arena", + ], +) + +cpp_library( + name = "uninitialized_memory_hacks", + headers = ["UninitializedMemoryHacks.h"], +) + +cpp_library( + name = "jemalloc_nodump_allocator", + srcs = ["JemallocNodumpAllocator.cpp"], + headers = ["JemallocNodumpAllocator.h"], + deps = [ + "//folly:conv", + "//folly:string", + "//folly/memory:malloc", + ], + exported_deps = [ + "//folly:c_portability", + "//folly/portability:config", + "//folly/portability:malloc", + "//folly/portability:sys_mman", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "jemalloc_huge_page_allocator", + srcs = ["JemallocHugePageAllocator.cpp"], + headers = ["JemallocHugePageAllocator.h"], + deps = [ + "//folly:c_portability", + "//folly/memory:malloc", + "//folly/portability:malloc", + "//folly/portability:string", + "//folly/portability:sys_mman", + "//folly/portability:sys_types", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "jemalloc_huge_page_allocator_test", + srcs = ["JemallocHugePageAllocatorTest.cpp"], + headers = [], + allocator = "jemalloc", + deps = [ + "//folly/container:f14_hash", + "//folly/experimental:jemalloc_huge_page_allocator", + "//folly/memory:malloc", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "jemalloc_nodump_allocator_test", + srcs = ["JemallocNodumpAllocatorTest.cpp"], + headers = [], + allocator = "jemalloc", + deps = [ + "//folly/experimental:jemalloc_nodump_allocator", + "//folly/io:iobuf", + "//folly/memory:malloc", + "//folly/portability:gtest", + ], +) diff --git a/folly/memory/detail/BUCK b/folly/memory/detail/BUCK new file mode 100644 index 00000000000..51fedcd13eb --- /dev/null +++ b/folly/memory/detail/BUCK @@ -0,0 +1,10 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "malloc_impl", + srcs = ["MallocImpl.cpp"], + headers = ["MallocImpl.h"], + exported_deps = ["//folly:portability"], +) diff --git a/folly/memory/test/BUCK b/folly/memory/test/BUCK new file mode 100644 index 00000000000..a285408ef57 --- /dev/null +++ b/folly/memory/test/BUCK @@ -0,0 +1,144 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "arena_test", + srcs = ["ArenaTest.cpp"], + headers = [], + deps = [ + "//folly:memory", + "//folly/memory:arena", + "//folly/memory:mallctl_helper", + "//folly/memory:malloc", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "mallctl_helper_test", + srcs = ["MallctlHelperTest.cpp"], + headers = [], + allocator = "jemalloc_debug", + supports_static_listing = False, + deps = [ + "fbsource//third-party/jemalloc:headers", + "//folly:c_portability", + "//folly/init:init", + "//folly/memory:mallctl_helper", + "//folly/memory:malloc", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "malloc_test", + srcs = ["MallocTest.cpp"], + headers = [], + deps = [ + "//folly/memory:malloc", + "//folly/portability:gtest", + "//folly/portability:malloc", + "//folly/test:test_utils", + ], +) + +cpp_benchmark( + name = "malloc_benchmark", + srcs = ["MallocBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:random", + "//folly/memory:malloc", + ], +) + +cpp_unittest( + name = "memory_resource_test", + srcs = ["MemoryResourceTest.cpp"], + headers = [], + deps = [ + "//folly/memory:memory_resource", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "not_null_test", + srcs = [ + "not_null_test.cpp", + ], + supports_static_listing = False, + deps = [ + "//folly/memory:not_null", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "reentrant_allocator_test", + srcs = ["ReentrantAllocatorTest.cpp"], + deps = [ + "//folly:utility", + "//folly/functional:invoke", + "//folly/memory:reentrant_allocator", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "sanitize_address_test", + srcs = ["SanitizeAddressTest.cpp"], + deps = [ + "//folly/memory:sanitize_address", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "sanitize_leak_test", + srcs = ["SanitizeLeakTest.cpp"], + deps = [ + "//folly/memory:sanitize_leak", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "thread_cached_arena_test", + srcs = ["ThreadCachedArenaTest.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:memory", + "//folly:range", + "//folly/lang:align", + "//folly/memory:thread_cached_arena", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "uninitialized_memory_hacks_test", + srcs = [ + "UninitializedMemoryHacksODR.cpp", + "UninitializedMemoryHacksTest.cpp", + ], + deps = [ + "//folly:random", + "//folly/memory:uninitialized_memory_hacks", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/net/BUCK b/folly/net/BUCK new file mode 100644 index 00000000000..43cf184918a --- /dev/null +++ b/folly/net/BUCK @@ -0,0 +1,72 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "net_ops", + srcs = ["NetOps.cpp"], + headers = ["NetOps.h"], + deps = [ + "//folly:scope_guard", + "//folly/net/detail:socket_file_descriptor_map", + ], + exported_deps = [ + ":network_socket", + "//folly:portability", + "//folly/portability:iovec", + "//folly/portability:sys_types", + "//folly/portability:time", + "//folly/portability:windows", + ], +) + +cpp_library( + name = "net_ops_dispatcher", + srcs = ["NetOpsDispatcher.cpp"], + headers = ["NetOpsDispatcher.h"], + exported_deps = [ + ":net_ops", + ], +) + +cpp_library( + name = "network_socket", + headers = ["NetworkSocket.h"], + exported_deps = [ + "//folly/net/detail:socket_file_descriptor_map", + "//folly/portability:windows", + ], +) + +cpp_library( + name = "tcpinfo", + srcs = ["TcpInfo.cpp"], + headers = [ + "TcpInfo.h", + "TcpInfoTypes.h", + ], + deps = [ + "//folly/portability:sockets", + ], + exported_deps = [ + ":net_ops_dispatcher", + ":network_socket", + "//folly:expected", + "//folly:optional", + "//folly:string", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "tcpinfo_dispatcher", + srcs = ["TcpInfoDispatcher.cpp"], + headers = ["TcpInfoDispatcher.h"], + exported_deps = [ + ":net_ops_dispatcher", + ":tcpinfo", + "//folly:expected", + ], +) diff --git a/folly/net/detail/BUCK b/folly/net/detail/BUCK new file mode 100644 index 00000000000..e68ad483f48 --- /dev/null +++ b/folly/net/detail/BUCK @@ -0,0 +1,12 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "socket_file_descriptor_map", + srcs = ["SocketFileDescriptorMap.cpp"], + headers = ["SocketFileDescriptorMap.h"], + exported_deps = [ + "//folly/portability:windows", + ], +) diff --git a/folly/net/detail/test/BUCK b/folly/net/detail/test/BUCK new file mode 100644 index 00000000000..65db29aec24 --- /dev/null +++ b/folly/net/detail/test/BUCK @@ -0,0 +1,16 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "socket_file_descriptor_map_test", + srcs = ["SocketFileDescriptorMapTest.cpp"], + deps = [ + "//folly:portability", + "//folly/net/detail:socket_file_descriptor_map", + "//folly/portability:fcntl", + "//folly/portability:gtest", + "//folly/portability:sockets", + "//folly/portability:windows", + ], +) diff --git a/folly/net/test/BUCK b/folly/net/test/BUCK new file mode 100644 index 00000000000..cf6a1a91881 --- /dev/null +++ b/folly/net/test/BUCK @@ -0,0 +1,65 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "mock_net_ops_dispatcher", + headers = [ + "MockNetOpsDispatcher.h", + ], + exported_deps = [ + "//folly/net:net_ops_dispatcher", + "//folly/portability:gmock", + ], +) + +cpp_library( + name = "mock_tcpinfo_dispatcher", + headers = [ + "MockTcpInfoDispatcher.h", + ], + exported_deps = [ + "//folly/net:tcpinfo_dispatcher", + "//folly/portability:gmock", + ], +) + +cpp_unittest( + name = "net_ops_test", + srcs = ["NetOpsTest.cpp"], + deps = [ + "//folly/net:net_ops", + "//folly/net:network_socket", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "tcpinfo_test", + srcs = ["TcpInfoTest.cpp"], + supports_static_listing = False, + deps = [ + ":tcpinfo_test_util", + "//folly/net:tcpinfo", + "//folly/net/test:mock_net_ops_dispatcher", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "tcpinfo_test_util", + headers = [ + "TcpInfoTestUtil.h", + ], + exported_deps = [ + "//folly/net:tcpinfo", + "//folly/net/test:mock_net_ops_dispatcher", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) diff --git a/folly/poly/BUCK b/folly/poly/BUCK new file mode 100644 index 00000000000..4b67cbf6401 --- /dev/null +++ b/folly/poly/BUCK @@ -0,0 +1,14 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "basic_interfaces", + headers = [ + "Nullable.h", + "Regular.h", + ], + exported_deps = [ + "//folly:poly", + ], +) diff --git a/folly/portability/BUCK b/folly/portability/BUCK new file mode 100755 index 00000000000..9c5891de5fd --- /dev/null +++ b/folly/portability/BUCK @@ -0,0 +1,437 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "asm", + headers = ["Asm.h"], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "atomic", + headers = ["Atomic.h"], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "builtins", + srcs = ["Builtins.cpp"], + headers = ["Builtins.h"], + deps = [ + ":windows", + ], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "config", + headers = ["Config.h"], + exported_deps = [ + "//folly:config", + ], +) + +cpp_library( + name = "constexpr", + headers = ["Constexpr.h"], + exported_deps = [ + "//folly:c_portability", + "//folly:portability", + ], +) + +cpp_library( + name = "dirent", + srcs = ["Dirent.cpp"], + headers = ["Dirent.h"], + deps = [ + ":windows", + ], +) + +cpp_library( + name = "event", + headers = ["Event.h"], + exported_deps = [ + ":fcntl", + ":windows", + "//folly/net/detail:socket_file_descriptor_map", + ], + exported_external_deps = [ + "libevent", + ], +) + +cpp_library( + name = "fcntl", + srcs = ["Fcntl.cpp"], + headers = ["Fcntl.h"], + deps = [ + ":sockets", + ":sys_stat", + ], + exported_deps = [ + ":windows", + "//folly:portability", + ], +) + +cpp_library( + name = "filesystem", + srcs = ["Filesystem.cpp"], + headers = ["Filesystem.h"], + exported_deps = [ + "fbsource//third-party/libgcc:stdc++fs", + ], +) + +cpp_library( + name = "fmt_compile", + headers = ["FmtCompile.h"], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + ], +) + +cpp_library( + name = "gflags", + headers = ["GFlags.h"], + exported_deps = [ + ":config", + ], + exported_external_deps = [ + "gflags", + ], +) + +cpp_library( + name = "gmock", + headers = ["GMock.h"], + exported_deps = [ + "fbsource//third-party/googletest:gmock", + ":unistd", + ":windows", + "//folly:portability", + ], +) + +cpp_library( + name = "gtest", + headers = ["GTest.h"], + exported_deps = [ + "fbsource//third-party/googletest:gtest", + ":unistd", + ":windows", + "//folly:portability", + ], +) + +cpp_library( + name = "iovec", + headers = ["IOVec.h"], +) + +cpp_library( + name = "libgen", + srcs = ["Libgen.cpp"], + headers = ["Libgen.h"], +) + +cpp_library( + name = "libunwind", + headers = ["Libunwind.h"], + os_deps = [ + ( + "linux", + ["fbsource//third-party/libunwind:unwind"], + ), + ], +) + +cpp_library( + name = "malloc", + srcs = ["Malloc.cpp"], + headers = ["Malloc.h"], + os_deps = [ + ( + "linux", + ["third-party//jemalloc:headers"], + ), + ( + "linux-sgx", + ["third-party//jemalloc:headers"], + ), + ], + exported_deps = [ + ":config", + "//folly:c_portability", + ], +) + +cpp_library( + name = "math", + headers = ["Math.h"], +) + +cpp_library( + # @shim + name = "memory", + headers = ["Memory.h"], + exported_deps = ["//folly:memory"], +) + +cpp_library( + name = "openat2", + srcs = ["openat2.c"], + headers = ["openat2.h"], + exported_deps = [ + "//folly:config", + ], +) + +cpp_library( + name = "openssl", + srcs = ["OpenSSL.cpp"], + headers = ["OpenSSL.h"], + exported_deps = [ + ":windows", + "//folly:portability", + ], + exported_external_deps = [ + ("openssl", None, "ssl"), + ("openssl", None, "crypto"), + ], +) + +cpp_library( + name = "sched", + srcs = ["Sched.cpp"], + headers = ["Sched.h"], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "pthread", + srcs = ["PThread.cpp"], + headers = ["PThread.h"], + deps = [ + "//folly/lang:assume", + ], + exported_deps = [ + ":config", + ":sched", + ":time", + ":windows", + "//folly:portability", + ], + external_deps = [ + "boost", + ("boost", None, "boost_thread"), + ], + exported_external_deps = [ + ("glibc", None, "pthread"), + ], +) + +cpp_library( + name = "sockets", + srcs = ["Sockets.cpp"], + headers = ["Sockets.h"], + deps = [ + "//folly:scope_guard", + "//folly/net:network_socket", + "//folly/net/detail:socket_file_descriptor_map", + ], + exported_deps = [ + "//folly:portability", + "//folly/net:net_ops", + ], +) + +cpp_library( + name = "source_location", + headers = ["SourceLocation.h"], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + ], +) + +cpp_library( + name = "stdio", + srcs = ["Stdio.cpp"], + headers = ["Stdio.h"], + deps = [ + ":unistd", + "//folly:scope_guard", + ], +) + +cpp_library( + name = "stdlib", + srcs = ["Stdlib.cpp"], + headers = ["Stdlib.h"], + deps = [ + ":fcntl", + ":sys_stat", + ":windows", + ], + exported_deps = [ + ":config", + ], +) + +cpp_library( + name = "string", + srcs = ["String.cpp"], + headers = ["String.h"], + exported_deps = [":config"], +) + +cpp_library( + name = "sys_file", + srcs = ["SysFile.cpp"], + headers = ["SysFile.h"], + deps = [ + ":windows", + ], +) + +cpp_library( + name = "sys_membarrier", + srcs = ["SysMembarrier.cpp"], + headers = ["SysMembarrier.h"], + deps = [ + ":sys_syscall", + "//folly:portability", + ], +) + +cpp_library( + name = "sys_mman", + srcs = ["SysMman.cpp"], + headers = [ + "SysMman.h", + ], + deps = [ + ":windows", + "//folly:portability", + ], + exported_external_deps = [ + ("glibc", None, "rt"), + ], +) + +cpp_library( + name = "sys_resource", + srcs = ["SysResource.cpp"], + headers = ["SysResource.h"], + deps = [ + ":windows", + ], + exported_deps = [ + ":sys_time", + ], +) + +cpp_library( + name = "sys_stat", + srcs = ["SysStat.cpp"], + headers = ["SysStat.h"], + deps = [ + ":windows", + ], + exported_deps = [ + ":sys_types", + ], +) + +cpp_library( + name = "sys_syscall", + headers = ["SysSyscall.h"], + exported_deps = [ + "//folly:c_portability", + "//folly:portability", + ], +) + +cpp_library( + name = "sys_time", + srcs = ["SysTime.cpp"], + headers = ["SysTime.h"], + exported_deps = [":windows"], +) + +cpp_library( + name = "sys_types", + headers = ["SysTypes.h"], +) + +cpp_library( + name = "sys_uio", + srcs = ["SysUio.cpp"], + headers = ["SysUio.h"], + deps = [ + ":sockets", + ":sys_file", + ":unistd", + "//folly:scope_guard", + ], + exported_deps = [ + ":config", + ":iovec", + ":sys_types", + ], +) + +cpp_library( + name = "syslog", + headers = ["Syslog.h"], +) + +cpp_library( + name = "time", + srcs = ["Time.cpp"], + headers = ["Time.h"], + deps = [ + ":windows", + "//folly:c_portability", + "//folly:likely", + "//folly:utility", + ], + exported_deps = [ + ":config", + ], + exported_external_deps = [ + ("glibc", None, "rt"), + ], +) + +cpp_library( + name = "unistd", + srcs = ["Unistd.cpp"], + headers = ["Unistd.h"], + deps = [ + ":sockets", + ":windows", + "//folly:scope_guard", + "//folly/net/detail:socket_file_descriptor_map", + ], + exported_deps = [ + ":sys_types", + "//folly:portability", + ], +) + +cpp_library( + name = "windows", + headers = ["Windows.h"], +) diff --git a/folly/portability/test/BUCK b/folly/portability/test/BUCK new file mode 100644 index 00000000000..d53bcae6267 --- /dev/null +++ b/folly/portability/test/BUCK @@ -0,0 +1,59 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "constexpr_test", + srcs = ["ConstexprTest.cpp"], + deps = [ + "//folly/portability:constexpr", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "filesystem_test", + srcs = ["FilesystemTest.cpp"], + deps = [ + "//folly/portability:filesystem", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "libgen_test", + srcs = ["LibgenTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/portability:libgen", + ], +) + +cpp_unittest( + name = "openssl_portability_test", + srcs = ["OpenSSLPortabilityTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/ssl:openssl_ptr_types", + ], +) + +cpp_unittest( + name = "pthread_test", + srcs = ["PThreadTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/portability:pthread", + ], +) + +cpp_unittest( + name = "time_test", + srcs = ["TimeTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/portability:time", + "//folly/test:test_utils", + ], +) diff --git a/folly/python/BUCK b/folly/python/BUCK new file mode 100644 index 00000000000..fcb8344a5c5 --- /dev/null +++ b/folly/python/BUCK @@ -0,0 +1,406 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cython_library.bzl", "cython_library") + +cpp_library( + name = "asyncio_executor", + headers = [ + "AsyncioExecutor.h", + ], + modular_headers = False, + exported_deps = [ + "fbsource//third-party/python:python", # Python.h + "//folly:exception_string", + "//folly:function", + "//folly/executors:drivable_executor", + "//folly/executors:sequenced_executor", + "//folly/io/async:async_base", + ], +) + +cpp_library( + name = "gil_aware_manual_executor", + srcs = ["GILAwareManualExecutor.cpp"], + headers = ["GILAwareManualExecutor.h"], + deps = [ + "fbsource//third-party/python:python", + "//folly:scope_guard", + ], + exported_deps = [ + "//folly/executors:drivable_executor", + "//folly/executors:sequenced_executor", + ], +) + +cython_library( + name = "folly", + headers = ["__init__.pxd"], + cpp_deps = [ + "//folly/futures:core", + "//folly:exception_wrapper", + "//folly:executor", + "//folly:try", + "//folly:portability", + "//folly:unit", + ], + package = "folly", +) + +cpp_library( + name = "executor_lib", + srcs = [ + "executor.cpp", + ], + headers = [ + "executor.h", + ":executor__executor_api.h", + ], + # TODO(T36778537): Cython-generated `*_api.h` headers aren't modular. + modular_headers = False, + deps = [ + ":import", + ], + exported_deps = [ + ":asyncio_executor", + "//folly:executor", + ], +) + +cpp_library( + name = "proactor_executor", + srcs = [ + "ProactorExecutor.cpp", + ], + headers = [ + "ProactorExecutor.h", + ], + exported_deps = [ + ":asyncio_executor", + "//folly/concurrency:concurrent_hash_map", + "//folly/portability:windows", + ], +) + +cython_library( + # @autodeps-skip + name = "executor", + srcs = [ + "executor.pyx", + ], + headers = [ + "executor.pxd", + ], + api = ["executor"], + cpp_deps = [ + ":asyncio_executor", + ":proactor_executor", + ":executor_lib", + ], + package = "folly", + deps = [ + ":folly", + ], +) + +cython_library( + name = "function", + headers = ["function.pxd"], + cpp_deps = [ + "//folly:function", + ], + package = "folly", + deps = [ + ":folly", + ], +) + +cpp_library( + # @autodeps-skip + name = "futures_lib", + headers = [ + "futures.h", + ], + # TODO(T36778537): Cython-generated `*_api.h` headers aren't modular. + modular_headers = False, + exported_deps = [ + "fbsource//third-party/python:python", # Python.h + ":asyncio_executor", + ":executor__cython-lib", + "//folly:executor", + "//folly/futures:core", + ], +) + +cython_library( + name = "futures", + headers = [ + "futures.pxd", + ], + cpp_deps = [ + ":futures_lib", + ], + package = "folly", + deps = [ + ":executor", + ], +) + +cpp_library( + # @autodeps-skip + name = "coro_lib", + headers = [ + "coro.h", + ], + # TODO(T36778537): Cython-generated `*_api.h` headers aren't modular. + modular_headers = False, + exported_deps = [ + "fbsource//third-party/python:python", # Python.h + ":asyncio_executor", + ":executor__cython-lib", + "//folly:cancellation_token", + "//folly:executor", + "//folly/experimental/coro:task", + ], +) + +cython_library( + name = "coro", + headers = [ + "coro.pxd", + ], + cpp_deps = [ + "//folly:cancellation_token", + ":coro_lib", + ], + package = "folly", + deps = [ + ":executor", + ], +) + +cpp_library( + name = "fibers_lib", + srcs = ["fibers.cpp"], + headers = [ + "fibers.h", + ":fibers__fiber_manager_api.h", + ], + # TODO(T36778537): Cython-generated `*_api.h` headers aren't modular. + modular_headers = False, + deps = [ + ":import", + ], + exported_deps = [ + "fbsource//third-party/python:python", # Python.h + "//folly:function", + "//folly/fibers:core", + ], +) + +cython_library( + name = "fibers", + srcs = ["fiber_manager.pyx"], + headers = [ + "fiber_manager.pxd", + "fibers.pxd", + ], + api = ["fiber_manager"], + cpp_deps = [ + "//folly/fibers:core", + "//folly/fibers:executor_loop_controller", + "//folly/fibers:loop_controller", + ":fibers_lib", + ], + package = "folly", + deps = [ + ":folly", + ":futures", + ], +) + +cpp_library( + name = "import", + headers = [ + "import.h", + ], + exported_deps = [ + "fbsource//third-party/fmt:fmt", + ":error", + "//folly:likely", + "//folly:portability", + ], +) + +cpp_library( + name = "iobuf_ext", + srcs = ["iobuf_ext.cpp"], + headers = ["iobuf_ext.h"], + exported_deps = [ + "fbsource//third-party/python:python", # Python.h + "//folly:executor", + "//folly/io:iobuf", + ], +) + +cpp_library( + name = "iobuf_lib", + srcs = ["iobuf.cpp"], + headers = [ + "iobuf.h", + ":iobuf__iobuf_api.h", + ], + # TODO(T36778537): Cython-generated `*_api.h` headers aren't modular. + modular_headers = False, + deps = [ + ":import", + ], + exported_deps = [ + "fbsource//third-party/python:python", # Python.h + "//folly/io:iobuf", + ], +) + +cython_library( + # @autodeps-skip + name = "iobuf", + srcs = ["iobuf.pyx"], + headers = [ + "iobuf.pxd", + ], + api = ["iobuf"], + cpp_deps = [ + ":iobuf_lib", + ":iobuf_ext", + ], + package = "folly", + tests = [ + "//folly/python/test:iobuf", + ], + types = [ + "iobuf.pyi", + ], + deps = [ + ":folly", + ":futures", + ], +) + +cython_library( + name = "range", + headers = ["range.pxd"], + cpp_deps = [ + "//folly:range", + ], + package = "folly", + deps = [ + ":folly", + ], +) + +cython_library( + name = "optional", + headers = ["optional.pxd"], + cpp_deps = ["//folly:optional"], + package = "folly", + deps = [ + ":folly", # So we don't squash the "folly" package + ], +) + +cython_library( + name = "expected", + headers = ["expected.pxd"], + cpp_deps = ["//folly:expected"], + package = "folly", + deps = [ + ":folly", + ], +) + +cpp_library( + name = "async_generator_lib", + headers = [ + "async_generator.h", + ], + exported_deps = [ + "//folly:portability", + "//folly/experimental/coro:async_generator", + "//folly/experimental/coro:task", + ], +) + +cython_library( + name = "async_generator", + headers = [ + "async_generator.pxd", + ], + cpp_deps = [ + ":async_generator_lib", + ], + package = "folly", + deps = [ + ":coro", + ":optional", + ], +) + +cython_library( + name = "cast", + headers = ["cast.pxd"], + cpp_deps = [ + "//folly/lang:cast", + ], + package = "folly", +) + +cython_library( + name = "memory", + headers = ["memory.pxd"], + cpp_deps = [ + "//folly:memory", + ], + package = "folly", +) + +cpp_library( + name = "error", + srcs = [ + "error.cpp", + ], + headers = [ + "error.h", + ], + deps = [ + "fbsource//third-party/python:python", # Python.h + "//folly:conv", + "//folly:scope_guard", + ], + exported_deps = [ + "//folly:range", + ], +) + +cython_library( + name = "fbstring", + headers = ["fbstring.pxd"], + cpp_deps = [ + "//folly:fbstring", + ], + package = "folly", + deps = [ + ":folly", + ], +) + +cython_library( + name = "build_mode", + srcs = [ + "build_mode.pyx", + ], + package = "folly", + types = [ + "build_mode.pyi", + ], + deps = [ + ":folly", + ], +) diff --git a/folly/python/test/BUCK b/folly/python/test/BUCK new file mode 100644 index 00000000000..d9b0c39aa10 --- /dev/null +++ b/folly/python/test/BUCK @@ -0,0 +1,178 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") +load("@fbcode_macros//build_defs:cython_library.bzl", "cython_library") +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + +oncall("fbcode_entropy_wardens_folly") + +python_unittest( + # @autodeps-skip + name = "futures", + srcs = ["futures.py"], + deps = [ + ":simple_bridge", + ], +) + +python_unittest( + # @autodeps-skip + name = "coro", + srcs = ["coro.py"], + deps = [ + ":simple_bridge_coro", + ], +) + +cython_library( + name = "simple_bridge", + srcs = ["simplebridge.pyx"], + headers = ["simple.h"], + cpp_deps = [ + "//folly/futures:core", + ], + deps = [ + "//folly/python:fibers", + "//folly/python:futures", + ], +) + +cpp_library( + name = "iobuf_test_utils", + srcs = ["IOBufTestUtils.cpp"], + headers = ["IOBufTestUtils.h"], + deps = [ + "//folly/python:iobuf_lib", + ], + exported_deps = [ + "fbsource//third-party/python:python", # Python.h + "//folly/io:iobuf", + ], +) + +cython_library( + name = "iobuf_helper", + srcs = [ + "iobuf_helper.pyx", + ], + headers = ["iobuf_helper.pxd"], + cpp_deps = [":iobuf_test_utils"], + types = [ + "iobuf_helper.pyi", + ], + deps = [ + "//folly/python:iobuf", + ], +) + +python_unittest( + name = "iobuf", + srcs = [ + "iobuf.py", + ], + deps = [ + ":iobuf_helper", + "//folly/python:iobuf", + ], +) + +cython_library( + name = "simple_bridge_coro", + srcs = ["simplebridgecoro.pyx"], + headers = ["simplecoro.h"], + cpp_deps = [ + "//folly/experimental/coro:baton", + "//folly/experimental/coro:task", + "//folly/futures:core", + "//folly:cancellation_token", + ], + deps = [ + "//folly/python:coro", + ], +) + +cython_library( + name = "simple_generator", + srcs = ["simplegenerator.pyx"], + headers = ["simplegenerator.h"], + cpp_deps = [ + "//folly/experimental/coro:async_generator", + ], + deps = [ + "//folly/python:async_generator", + "//folly/python:executor", + ], +) + +python_unittest( + # @autodeps-skip + name = "generator", + srcs = ["generator.py"], + deps = [ + ":simple_generator", + ], +) + +cpp_unittest( + name = "AsyncGeneratorTest", + srcs = [ + "AsyncGeneratorTest.cpp", + ], + deps = [ + "//folly/experimental/coro:blocking_wait", + "//folly/experimental/coro:task", + "//folly/portability:gtest", + "//folly/python:async_generator_lib", + ], +) + +cpp_unittest( + name = "ErrorTest", + srcs = [ + "ErrorTest.cpp", + ], + deps = [ + "fbsource//third-party/python:python", + "//folly:scope_guard", + "//folly/portability:gtest", + "//folly/python:error", + ], +) + +python_unittest( + # @autodeps-skip + name = "teardown", + srcs = ["teardown.py"], + deps = [ + ":simple_bridge", + ":simple_bridge_coro", + ], +) + +python_unittest( + # @autodeps-skip + name = "test_set_executor", + srcs = ["test_set_executor.py"], + deps = [ + ":test_set_executor_cython", + ], +) + +cython_library( + name = "test_set_executor_cython", + srcs = ["test_set_executor_cython.pyx"], + cpp_deps = [ + ":test_set_executor_cpplib", + ], + deps = [ + "//folly/python:executor", + ], +) + +cpp_library( + name = "test_set_executor_cpplib", + headers = ["test_set_executor.h"], + modular_headers = False, + exported_deps = [ + "//folly/python:asyncio_executor", + ], +) diff --git a/folly/somerge_defs.bzl b/folly/somerge_defs.bzl new file mode 100644 index 00000000000..aff831a3be7 --- /dev/null +++ b/folly/somerge_defs.bzl @@ -0,0 +1,378 @@ +"""Native library merge map for folly. + +Generated by xplat/cross_plat_devx/somerge_maps/compute_merge_maps.py + +@generated SignedSource<<0d4409684bcf71e48dba097a8b606969>> +""" + +# Entry Points: +# //xplat/folly/memory:malloc +# //xplat/folly:assume +# //xplat/folly:hash +# //xplat/folly:headers_only_do_not_use +# //xplat/folly:memory +# //xplat/folly:optional +# //xplat/folly:range +# //xplat/folly:scope_guard +FOLLY_NATIVE_LIBRARY_MERGE_MAP = [ + "//xplat/folly/container:accessAndroid", + "//xplat/folly/container:enumerateAndroid", + "//xplat/folly/container:foreachAndroid", + "//xplat/folly/container:sparse_byte_setAndroid", + "//xplat/folly/detail:file_util_detailAndroid", + "//xplat/folly/detail:range_commonAndroid", + "//xplat/folly/detail:range_sse42Android", + "//xplat/folly/detail:sseAndroid", + "//xplat/folly/experimental/coro:coroutineAndroid", + "//xplat/folly/lang:alignAndroid", + "//xplat/folly/lang:assumeAndroid", + "//xplat/folly/lang:bitsAndroid", + "//xplat/folly/lang:builtinAndroid", + "//xplat/folly/lang:c_arrayAndroid", + "//xplat/folly/lang:c_stringAndroid", + "//xplat/folly/lang:checked_mathAndroid", + "//xplat/folly/lang:customization_pointAndroid", + "//xplat/folly/lang:exceptionAndroid", + "//xplat/folly/lang:hintAndroid", + "//xplat/folly/lang:newAndroid", + "//xplat/folly/lang:safe_assertAndroid", + "//xplat/folly/lang:static_constAndroid", + "//xplat/folly/lang:thunkAndroid", + "//xplat/folly/lang:to_asciiAndroid", + "//xplat/folly/lang:type_infoAndroid", + "//xplat/folly/lang:uncaught_exceptionsAndroid", + "//xplat/folly/memory/detail:malloc_implAndroid", + "//xplat/folly/memory:mallocAndroid", + "//xplat/folly:assumeAndroid", + "//xplat/folly:bitsAndroid", + "//xplat/folly:c_portabilityAndroid", + "//xplat/folly:configAndroid", + "//xplat/folly:constexpr_mathAndroid", + "//xplat/folly:cpp_attributesAndroid", + "//xplat/folly:cpu_idAndroid", + "//xplat/folly:functionAndroid", + "//xplat/folly:functional_apply_tupleAndroid", + "//xplat/folly:functional_invokeAndroid", + "//xplat/folly:functional_partialAndroid", + "//xplat/folly:hashAndroid", + "//xplat/folly:hash_hashAndroid", + "//xplat/folly:hash_spooky_hash_v1Android", + "//xplat/folly:hash_spooky_hash_v2Android", + "//xplat/folly:headers_only_do_not_useAndroid", + "//xplat/folly:likelyAndroid", + "//xplat/folly:mathAndroid", + "//xplat/folly:memoryAndroid", + "//xplat/folly:move_wrapperAndroid", + "//xplat/folly:optionalAndroid", + "//xplat/folly:portabilityAndroid", + "//xplat/folly:portability_builtinsAndroid", + "//xplat/folly:portability_configAndroid", + "//xplat/folly:portability_constexprAndroid", + "//xplat/folly:portability_iovecAndroid", + "//xplat/folly:portability_mallocAndroid", + "//xplat/folly:portability_mathAndroid", + "//xplat/folly:portability_sys_typesAndroid", + "//xplat/folly:portability_windowsAndroid", + "//xplat/folly:preprocessorAndroid", + "//xplat/folly:rangeAndroid", + "//xplat/folly:scope_guardAndroid", + "//xplat/folly:traitsAndroid", + "//xplat/folly:unitAndroid", + "//xplat/folly:utilityAndroid", +] + +# Entry Points: +# //xplat/folly/compression:compression +# //xplat/folly:concurrent_lazy +# //xplat/folly:futures +# //xplat/folly:logging_init +# //xplat/folly:uri +FOLLY_BASE_NATIVE_LIBRARY_MERGE_MAP = [ + "//xplat/folly/buck_config/constraints:singletonAndroid", + "//xplat/folly/buck_config/constraints:singleton-schedule-at-exit-disabledAndroid", + "//xplat/folly/buck_config:folly-singleton-schedule-at-exit-disabledAndroid", + "//xplat/folly/chrono:hardwareAndroid", + "//xplat/folly/compression:compressionAndroid", + "//xplat/folly/compression:compression_context_poolAndroid", + "//xplat/folly/compression:compression_context_pool_singletonsAndroid", + "//xplat/folly/concurrency:cache_localityAndroid", + "//xplat/folly/concurrency:concurrent_hash_mapAndroid", + "//xplat/folly/concurrency:core_cached_shared_ptrAndroid", + "//xplat/folly/concurrency:priority_unbounded_queue_setAndroid", + "//xplat/folly/concurrency:process_local_unique_idAndroid", + "//xplat/folly/concurrency:unbounded_queueAndroid", + "//xplat/folly/container/detail:bit_iterator_detailAndroid", + "//xplat/folly/container/detail:f14_defaultsAndroid", + "//xplat/folly/container/detail:f14_hash_detailAndroid", + "//xplat/folly/container/detail:f14_intrinsics_availabilityAndroid", + "//xplat/folly/container/detail:f14_maskAndroid", + "//xplat/folly/container/detail:utilAndroid", + "//xplat/folly/container:arrayAndroid", + "//xplat/folly/container:bit_iteratorAndroid", + "//xplat/folly/container:evicting_cache_mapAndroid", + "//xplat/folly/container:f14_hashAndroid", + "//xplat/folly/container:f14_hash_fwdAndroid", + "//xplat/folly/container:heap_vector_typesAndroid", + "//xplat/folly/container:heterogeneous_accessAndroid", + "//xplat/folly/container:heterogeneous_access_fwdAndroid", + "//xplat/folly/container:intrusive_heapAndroid", + "//xplat/folly/container:iteratorAndroid", + "//xplat/folly/container:viewAndroid", + "//xplat/folly/detail:async_traceAndroid", + "//xplat/folly/detail:atomic_hash_utilsAndroid", + "//xplat/folly/detail:file_util_vector_detailAndroid", + "//xplat/folly/detail:futexAndroid", + "//xplat/folly/detail:ip_addressAndroid", + "//xplat/folly/detail:ip_address_sourceAndroid", + "//xplat/folly/detail:iteratorsAndroid", + "//xplat/folly/detail:memory_idlerAndroid", + "//xplat/folly/detail:simd_any_ofAndroid", + "//xplat/folly/detail:simd_char_platformAndroid", + "//xplat/folly/detail:simd_for_eachAndroid", + "//xplat/folly/detail:simple_simd_string_utilsAndroid", + "//xplat/folly/detail:singletonAndroid", + "//xplat/folly/detail:socket_fast_openAndroid", + "//xplat/folly/detail:split_string_simdAndroid", + "//xplat/folly/detail:static_singleton_managerAndroid", + "//xplat/folly/detail:thread_local_detailAndroid", + "//xplat/folly/detail:turn_sequencerAndroid", + "//xplat/folly/detail:unique_instanceAndroid", + "//xplat/folly/detail:unroll_utilsAndroid", + "//xplat/folly/executors/task_queue:blocking_queueAndroid", + "//xplat/folly/executors/task_queue:lifo_sem_mpmc_queueAndroid", + "//xplat/folly/executors/task_queue:priority_lifo_sem_mpmc_queueAndroid", + "//xplat/folly/executors/task_queue:priority_unbounded_blocking_queueAndroid", + "//xplat/folly/executors/task_queue:unbounded_blocking_queueAndroid", + "//xplat/folly/executors/thread_factory:named_thread_factoryAndroid", + "//xplat/folly/executors/thread_factory:thread_factoryAndroid", + "//xplat/folly/executors:cpu_thread_pool_executorAndroid", + "//xplat/folly/executors:drivable_executorAndroid", + "//xplat/folly/executors:executor_with_priorityAndroid", + "//xplat/folly/executors:global_executorAndroid", + "//xplat/folly/executors:global_thread_pool_listAndroid", + "//xplat/folly/executors:inline_executorAndroid", + "//xplat/folly/executors:io_executorAndroid", + "//xplat/folly/executors:io_thread_pool_executorAndroid", + "//xplat/folly/executors:manual_executorAndroid", + "//xplat/folly/executors:queue_observerAndroid", + "//xplat/folly/executors:queued_immediate_executorAndroid", + "//xplat/folly/executors:scheduled_executorAndroid", + "//xplat/folly/executors:sequenced_executorAndroid", + "//xplat/folly/executors:serial_executorAndroid", + "//xplat/folly/executors:serialized_executorAndroid", + "//xplat/folly/executors:thread_pool_executorAndroid", + "//xplat/folly/executors:timed_drivable_executorAndroid", + "//xplat/folly/experimental/coro:traitsAndroid", + "//xplat/folly/fibers:boost_context_compatibilityAndroid", + "//xplat/folly/fibers:coreAndroid", + "//xplat/folly/fibers:guard_page_allocatorAndroid", + "//xplat/folly/fibers:loop_controllerAndroid", + "//xplat/folly/fibers:traitsAndroid", + "//xplat/folly/io/async/ssl:tls_definitionsAndroid", + "//xplat/folly/io/async:async_baseAndroid", + "//xplat/folly/io/async:async_base_fwdAndroid", + "//xplat/folly/io/async:async_signal_handlerAndroid", + "//xplat/folly/io/async:async_socket_baseAndroid", + "//xplat/folly/io/async:async_socket_exceptionAndroid", + "//xplat/folly/io/async:async_udp_server_socketAndroid", + "//xplat/folly/io/async:async_udp_socketAndroid", + "//xplat/folly/io/async:delayed_destructionAndroid", + "//xplat/folly/io/async:destructor_checkAndroid", + "//xplat/folly/io/async:event_base_managerAndroid", + "//xplat/folly/io/async:event_utilAndroid", + "//xplat/folly/io/async:request_contextAndroid", + "//xplat/folly/lang:accessAndroid", + "//xplat/folly/lang:alignedAndroid", + "//xplat/folly/lang:externAndroid", + "//xplat/folly/lang:orderingAndroid", + "//xplat/folly/lang:prettyAndroid", + "//xplat/folly/lang:rvalue_reference_wrapperAndroid", + "//xplat/folly/memory:arenaAndroid", + "//xplat/folly/memory:mallctl_helperAndroid", + "//xplat/folly/memory:memory_resourceAndroid", + "//xplat/folly/memory:reentrant_allocatorAndroid", + "//xplat/folly/memory:sanitize_addressAndroid", + "//xplat/folly/memory:sanitize_leakAndroid", + "//xplat/folly/net/detail:socket_file_descriptor_mapAndroid", + "//xplat/folly/net:net_opsAndroid", + "//xplat/folly/net:net_ops_dispatcherAndroid", + "//xplat/folly/net:network_socketAndroid", + "//xplat/folly/tracing:async_stackAndroid", + "//xplat/folly/tracing:scoped_trace_sectionAndroid", + "//xplat/folly/tracing:static_tracepointAndroid", + "//xplat/folly:atomic_hash_arrayAndroid", + "//xplat/folly:atomic_hash_mapAndroid", + "//xplat/folly:atomic_linked_listAndroid", + "//xplat/folly:cancellation_tokenAndroid", + "//xplat/folly:chronoAndroid", + "//xplat/folly:concurrent_lazyAndroid", + "//xplat/folly:convAndroid", + "//xplat/folly:default_keep_alive_executorAndroid", + "//xplat/folly:demangleAndroid", + "//xplat/folly:dynamicAndroid", + "//xplat/folly:exceptionAndroid", + "//xplat/folly:exception_stringAndroid", + "//xplat/folly:exception_wrapperAndroid", + "//xplat/folly:executorAndroid", + "//xplat/folly:expectedAndroid", + "//xplat/folly:experimental_event_countAndroid", + "//xplat/folly:experimental_execution_observerAndroid", + "//xplat/folly:experimental_jemalloc_huge_page_allocatorAndroid", + "//xplat/folly:experimental_read_mostly_shared_ptrAndroid", + "//xplat/folly:experimental_single_writer_fixed_hash_mapAndroid", + "//xplat/folly:experimental_tl_ref_countAndroid", + "//xplat/folly:extended_lightAndroid", + "//xplat/folly:f14_hashAndroid", + "//xplat/folly:fbstringAndroid", + "//xplat/folly:fbvectorAndroid", + "//xplat/folly:fileAndroid", + "//xplat/folly:file_utilAndroid", + "//xplat/folly:folly_demangle_macos_disable_ibertyAndroid", + "//xplat/folly:folly_demangle_macos_disable_iberty_configAndroid", + "//xplat/folly:folly_demangle_macos_use_iberty_constraintAndroid", + "//xplat/folly:formatAndroid", + "//xplat/folly:format_traitsAndroid", + "//xplat/folly:functional_traitsAndroid", + "//xplat/folly:futuresAndroid", + "//xplat/folly:futures_barrierAndroid", + "//xplat/folly:futures_coreAndroid", + "//xplat/folly:futures_detail_coreAndroid", + "//xplat/folly:futures_detail_typesAndroid", + "//xplat/folly:futures_future_splitterAndroid", + "//xplat/folly:futures_portabilityAndroid", + "//xplat/folly:futures_shared_promiseAndroid", + "//xplat/folly:glogAndroid", + "//xplat/folly:indestructibleAndroid", + "//xplat/folly:indexed_mem_poolAndroid", + "//xplat/folly:intrusive_listAndroid", + "//xplat/folly:io_iobufAndroid", + "//xplat/folly:io_socket_option_mapAndroid", + "//xplat/folly:jsonAndroid", + "//xplat/folly:json_pointerAndroid", + "//xplat/folly:logging_initAndroid", + "//xplat/folly:logging_init_weakAndroid", + "//xplat/folly:logging_log_handlerAndroid", + "//xplat/folly:logging_log_levelAndroid", + "//xplat/folly:logging_log_nameAndroid", + "//xplat/folly:logging_loggingAndroid", + "//xplat/folly:logging_rate_limiterAndroid", + "//xplat/folly:map_utilAndroid", + "//xplat/folly:micro_lockAndroid", + "//xplat/folly:mollyAndroid", + "//xplat/folly:mpmc_queueAndroid", + "//xplat/folly:network_addressAndroid", + "//xplat/folly:overloadAndroid", + "//xplat/folly:portability_asmAndroid", + "//xplat/folly:portability_atomicAndroid", + "//xplat/folly:portability_direntAndroid", + "//xplat/folly:portability_eventAndroid", + "//xplat/folly:portability_extendedAndroid", + "//xplat/folly:portability_fcntlAndroid", + "//xplat/folly:portability_fmt_compileAndroid", + "//xplat/folly:portability_gflagsAndroid", + "//xplat/folly:portability_headersAndroid", + "//xplat/folly:portability_memoryAndroid", + "//xplat/folly:portability_pthreadAndroid", + "//xplat/folly:portability_schedAndroid", + "//xplat/folly:portability_socketsAndroid", + "//xplat/folly:portability_stdlibAndroid", + "//xplat/folly:portability_stringAndroid", + "//xplat/folly:portability_sys_fileAndroid", + "//xplat/folly:portability_sys_membarrierAndroid", + "//xplat/folly:portability_sys_mmanAndroid", + "//xplat/folly:portability_sys_resourceAndroid", + "//xplat/folly:portability_sys_statAndroid", + "//xplat/folly:portability_sys_syscallAndroid", + "//xplat/folly:portability_sys_timeAndroid", + "//xplat/folly:portability_sys_uioAndroid", + "//xplat/folly:portability_syslogAndroid", + "//xplat/folly:portability_timeAndroid", + "//xplat/folly:portability_unistdAndroid", + "//xplat/folly:randomAndroid", + "//xplat/folly:safe_assertAndroid", + "//xplat/folly:shared_mutexAndroid", + "//xplat/folly:singletonAndroid", + "//xplat/folly:singleton_thread_localAndroid", + "//xplat/folly:small_vectorAndroid", + "//xplat/folly:sorted_vector_typesAndroid", + "//xplat/folly:spin_lockAndroid", + "//xplat/folly:stop_watchAndroid", + "//xplat/folly:stringAndroid", + "//xplat/folly:synchronization_asymmetric_thread_fenceAndroid", + "//xplat/folly:synchronization_atomic_notificationAndroid", + "//xplat/folly:synchronization_atomic_refAndroid", + "//xplat/folly:synchronization_atomic_structAndroid", + "//xplat/folly:synchronization_atomic_utilAndroid", + "//xplat/folly:synchronization_batonAndroid", + "//xplat/folly:synchronization_call_onceAndroid", + "//xplat/folly:synchronization_delayed_initAndroid", + "//xplat/folly:synchronization_detail_atomic_utilsAndroid", + "//xplat/folly:synchronization_detail_hazptr_utilsAndroid", + "//xplat/folly:synchronization_detail_inline_function_refAndroid", + "//xplat/folly:synchronization_detail_sleeperAndroid", + "//xplat/folly:synchronization_detail_spinAndroid", + "//xplat/folly:synchronization_distributed_mutexAndroid", + "//xplat/folly:synchronization_hazptrAndroid", + "//xplat/folly:synchronization_lifo_semAndroid", + "//xplat/folly:synchronization_lockAndroid", + "//xplat/folly:synchronization_micro_spin_lockAndroid", + "//xplat/folly:synchronization_parking_lotAndroid", + "//xplat/folly:synchronization_pico_spin_lockAndroid", + "//xplat/folly:synchronization_relaxed_atomicAndroid", + "//xplat/folly:synchronization_sanitize_threadAndroid", + "//xplat/folly:synchronization_saturating_semaphoreAndroid", + "//xplat/folly:synchronization_small_locksAndroid", + "//xplat/folly:synchronization_throttled_lifo_semAndroid", + "//xplat/folly:synchronization_wait_optionsAndroid", + "//xplat/folly:synchronizedAndroid", + "//xplat/folly:system_at_forkAndroid", + "//xplat/folly:system_hardware_concurrencyAndroid", + "//xplat/folly:system_pidAndroid", + "//xplat/folly:system_thread_idAndroid", + "//xplat/folly:system_thread_nameAndroid", + "//xplat/folly:thread_cached_intAndroid", + "//xplat/folly:thread_localAndroid", + "//xplat/folly:tryAndroid", + "//xplat/folly:turnsequencerAndroid", + "//xplat/folly:unicodeAndroid", + "//xplat/folly:uriAndroid", + "//xplat/folly:varintAndroid", +] + +# Entry Points: +# //xplat/folly:extended +FOLLY_EXTENDED_NATIVE_LIBRARY_MERGE_MAP = [ + "//xplat/folly/io/async/observer:async_socket_observer_containerAndroid", + "//xplat/folly/io/async/observer:async_socket_observer_interfaceAndroid", + "//xplat/folly/io/async/ssl:basic_transport_certificateAndroid", + "//xplat/folly/io/async/ssl:openssl_transport_certificateAndroid", + "//xplat/folly/io/async/ssl:openssl_utilsAndroid", + "//xplat/folly/io/async/ssl:ssl_errorsAndroid", + "//xplat/folly/io/async:async_pipeAndroid", + "//xplat/folly/io/async:async_socketAndroid", + "//xplat/folly/io/async:async_socket_transportAndroid", + "//xplat/folly/io/async:async_ssl_socketAndroid", + "//xplat/folly/io/async:async_transportAndroid", + "//xplat/folly/io/async:async_transport_certificateAndroid", + "//xplat/folly/io/async:certificate_identity_verifierAndroid", + "//xplat/folly/io/async:decorated_async_transport_wrapperAndroid", + "//xplat/folly/io/async:scoped_event_base_threadAndroid", + "//xplat/folly/io/async:ssl_contextAndroid", + "//xplat/folly/io/async:ssl_optionsAndroid", + "//xplat/folly/io/async:write_flagsAndroid", + "//xplat/folly/net:tcpinfoAndroid", + "//xplat/folly/net:tcpinfo_dispatcherAndroid", + "//xplat/folly/ssl/detail:openssl_sessionAndroid", + "//xplat/folly/ssl:openssl_cert_utilsAndroid", + "//xplat/folly/ssl:openssl_hashAndroid", + "//xplat/folly/ssl:openssl_ptr_typesAndroid", + "//xplat/folly/ssl:openssl_ticket_handlerAndroid", + "//xplat/folly/ssl:password_collectorAndroid", + "//xplat/folly/ssl:ssl_sessionAndroid", + "//xplat/folly/ssl:ssl_session_managerAndroid", + "//xplat/folly:constructor_callback_listAndroid", + "//xplat/folly:extendedAndroid", + "//xplat/folly:io_shutdown_socket_setAndroid", + "//xplat/folly:observer_containerAndroid", + "//xplat/folly:portability_opensslAndroid", +] diff --git a/folly/ssl/BUCK b/folly/ssl/BUCK new file mode 100644 index 00000000000..8fc4e4b7911 --- /dev/null +++ b/folly/ssl/BUCK @@ -0,0 +1,106 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "openssl_ptr_types", + headers = ["OpenSSLPtrTypes.h"], + exported_deps = [ + "//folly:memory", + "//folly/portability:openssl", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "openssl_hash", + srcs = ["OpenSSLHash.cpp"], + headers = ["OpenSSLHash.h"], + deps = [ + "//folly:format", + ], + exported_deps = [ + ":openssl_ptr_types", + "//folly:exception", + "//folly:range", + "//folly/io:iobuf", + "//folly/portability:openssl", + ], +) + +cpp_library( + name = "openssl_cert_utils", + srcs = ["OpenSSLCertUtils.cpp"], + headers = ["OpenSSLCertUtils.h"], + deps = [ + "//folly:file_util", + "//folly:scope_guard", + "//folly:string", + ], + exported_deps = [ + ":openssl_ptr_types", + "//folly:optional", + "//folly/io:iobuf", + "//folly/portability:openssl", + ], +) + +cpp_library( + name = "openssl_version_finder", + headers = ["OpenSSLVersionFinder.h"], + exported_deps = [ + "//folly/portability:openssl", + ], +) + +cpp_library( + name = "openssl_ticket_handler", + headers = ["OpenSSLTicketHandler.h"], + exported_deps = [ + "//folly/portability:openssl", + ], +) + +cpp_library( + name = "ssl_session", + headers = ["SSLSession.h"], + exported_deps = [ + ], +) + +cpp_library( + name = "ssl_session_manager", + srcs = ["SSLSessionManager.cpp"], + headers = ["SSLSessionManager.h"], + deps = [ + "//folly:overload", + "//folly/ssl/detail:openssl_session", + ], + exported_deps = [ + ":openssl_ptr_types", + ":ssl_session", + "//folly/portability:openssl", + ], +) + +cpp_library( + name = "password_collector", + srcs = ["PasswordCollector.cpp"], + headers = ["PasswordCollector.h"], +) + +cpp_library( + name = "openssl_key_utils", + srcs = ["OpenSSLKeyUtils.cpp"], + headers = ["OpenSSLKeyUtils.h"], + deps = [ + ":password_collector", + "//folly/portability:openssl", + ], + exported_deps = [ + ":openssl_ptr_types", + "//folly:range", + ], +) diff --git a/folly/ssl/detail/BUCK b/folly/ssl/detail/BUCK new file mode 100644 index 00000000000..258f3a4fac4 --- /dev/null +++ b/folly/ssl/detail/BUCK @@ -0,0 +1,16 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "openssl_session", + srcs = ["OpenSSLSession.cpp"], + headers = ["OpenSSLSession.h"], + exported_deps = [ + "//folly:shared_mutex", + "//folly:synchronized", + "//folly/portability:openssl", + "//folly/ssl:openssl_ptr_types", + "//folly/ssl:ssl_session", + ], +) diff --git a/folly/ssl/test/BUCK b/folly/ssl/test/BUCK new file mode 100644 index 00000000000..dbf6b331fba --- /dev/null +++ b/folly/ssl/test/BUCK @@ -0,0 +1,63 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") +load("//folly/io/async/test/certs:defs.bzl", "alias_pem") + +oncall("fbcode_entropy_wardens_folly") + +alias_pem(pems = [ + "tests-cert.pem", + "ca-cert.pem", +]) + +cpp_unittest( + name = "openssl_hash_test", + srcs = ["OpenSSLHashTest.cpp"], + deps = [ + "//folly/io:iobuf", + "//folly/portability:gtest", + "//folly/ssl:openssl_hash", + ], +) + +cpp_unittest( + name = "openssl_cert_utils_test", + srcs = ["OpenSSLCertUtilsTest.cpp"], + resources = [ + ":ca-cert.pem", + ":tests-cert.pem", + ], + supports_static_listing = False, + deps = [ + "//folly:format", + "//folly:range", + "//folly:string", + "//folly/container:enumerate", + "//folly/experimental:test_util", + "//folly/portability:gtest", + "//folly/portability:openssl", + "//folly/portability:time", + "//folly/ssl:openssl_cert_utils", + "//folly/ssl:openssl_ptr_types", + ], +) + +cpp_unittest( + name = "ssl_session_manager_test", + srcs = ["SSLSessionManagerTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/portability:openssl", + "//folly/ssl:openssl_ptr_types", + "//folly/ssl:ssl_session_manager", + "//folly/ssl/detail:openssl_session", + ], +) + +cpp_unittest( + name = "openssl_key_utils_test", + srcs = ["OpenSSLKeyUtilsTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/ssl:openssl_key_utils", + "//folly/ssl:password_collector", + ], +) diff --git a/folly/stats/BUCK b/folly/stats/BUCK new file mode 100644 index 00000000000..d365c78c5bb --- /dev/null +++ b/folly/stats/BUCK @@ -0,0 +1,142 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "bucketed_time_series", + headers = [ + "BucketedTimeSeries.h", + "BucketedTimeSeries-inl.h", + ], + exported_deps = [ + "//folly:likely", + "//folly/stats/detail:bucket", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "histogram", + headers = [ + "Histogram.h", + "Histogram-inl.h", + ], + exported_deps = [ + "//folly:c_portability", + "//folly:conv", + "//folly:traits", + "//folly/lang:exception", + "//folly/stats/detail:bucket", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "streaming_stats", + headers = [ + "StreamingStats.h", + ], + exported_deps = [ + "//folly/lang:exception", + ], +) + +cpp_library( + name = "multi_level_time_series", + headers = [ + "MultiLevelTimeSeries.h", + "MultiLevelTimeSeries-inl.h", + ], + exported_deps = [ + ":bucketed_time_series", + "//folly:constexpr_math", + "//folly:string", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "quantile_estimator", + srcs = [ + "QuantileEstimator.cpp", + ], + headers = [ + "QuantileEstimator.h", + "QuantileEstimator-inl.h", + ], + exported_deps = [ + ":tdigest", + "//folly/stats/detail:buffered_stat", + ], +) + +cpp_library( + name = "quantile_histogram", + headers = [ + "QuantileHistogram.h", + "QuantileHistogram-inl.h", + ], + exported_deps = [ + ":digest_builder", + "//folly:conv", + "//folly:glog", + "//folly:likely", + "//folly:range", + "//folly:shared_mutex", + "//folly/lang:align", + ], +) + +cpp_library( + name = "tdigest", + srcs = [ + "TDigest.cpp", + ], + headers = [ + "TDigest.h", + ], + deps = [ + "//folly/stats/detail:double_radix_sort", + ], + exported_deps = [ + "//folly:range", + "//folly:utility", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "digest_builder", + srcs = [], + headers = [ + "DigestBuilder.h", + "DigestBuilder-inl.h", + ], + exported_deps = [ + "//folly:memory", + "//folly:spin_lock", + "//folly/concurrency:cache_locality", + "//folly/lang:bits", + "//folly/synchronization:lock", + ], +) + +cpp_library( + name = "timeseries_histogram", + headers = [ + "TimeseriesHistogram.h", + "TimeseriesHistogram-inl.h", + ], + exported_deps = [ + ":histogram", + ":multi_level_time_series", + ], +) diff --git a/folly/stats/detail/BUCK b/folly/stats/detail/BUCK new file mode 100644 index 00000000000..324bc67c46b --- /dev/null +++ b/folly/stats/detail/BUCK @@ -0,0 +1,48 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "bucket", + headers = ["Bucket.h"], + exported_deps = [ + "//folly:constexpr_math", + ], +) + +cpp_library( + name = "buffered_stat", + srcs = [], + headers = [ + "BufferedStat.h", + "BufferedStat-inl.h", + ], + exported_deps = [ + ":sliding_window", + "//folly:shared_mutex", + "//folly/stats:digest_builder", + ], +) + +cpp_library( + name = "sliding_window", + srcs = [ + ], + headers = [ + "SlidingWindow.h", + "SlidingWindow-inl.h", + ], + exported_deps = [ + "//folly:function", + ], +) + +cpp_library( + name = "double_radix_sort", + srcs = [ + "DoubleRadixSort.cpp", + ], + headers = [ + "DoubleRadixSort.h", + ], +) diff --git a/folly/stats/detail/test/BUCK b/folly/stats/detail/test/BUCK new file mode 100644 index 00000000000..c8d68738edb --- /dev/null +++ b/folly/stats/detail/test/BUCK @@ -0,0 +1,14 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "double_radix_sort_test", + srcs = ["DoubleRadixSortTest.cpp"], + headers = [], + deps = [ + "//folly:random", + "//folly/portability:gtest", + "//folly/stats/detail:double_radix_sort", + ], +) diff --git a/folly/stats/test/BUCK b/folly/stats/test/BUCK new file mode 100644 index 00000000000..1c25ebd0103 --- /dev/null +++ b/folly/stats/test/BUCK @@ -0,0 +1,207 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "buffered_stat_test", + srcs = ["BufferedStatTest.cpp"], + headers = [], + deps = [ + "//folly:range", + "//folly/portability:gtest", + "//folly/stats/detail:buffered_stat", + ], +) + +cpp_benchmark( + name = "digest_builder_benchmark", + srcs = ["DigestBuilderBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly:range", + "//folly/lang:keep", + "//folly/portability:gflags", + "//folly/stats:digest_builder", + ], + external_deps = [ + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "digest_builder_test", + srcs = ["DigestBuilderTest.cpp"], + headers = [], + deps = [ + "//folly:range", + "//folly/portability:gtest", + "//folly/stats:digest_builder", + ], +) + +cpp_benchmark( + name = "histogram_benchmark", + srcs = ["HistogramBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly/container:foreach", + "//folly/portability:gflags", + "//folly/stats:histogram", + ], +) + +cpp_unittest( + name = "histogram_test", + srcs = ["HistogramTest.cpp"], + headers = [], + deps = [ + "//folly/portability:gtest", + "//folly/stats:histogram", + ], +) + +cpp_unittest( + name = "streaming_stats_test", + srcs = ["StreamingStatsTest.cpp"], + headers = [], + deps = [ + "//folly/portability:gtest", + "//folly/stats:streaming_stats", + ], +) + +cpp_benchmark( + name = "bucketed_time_series_benchmark", + srcs = ["BucketedTimeSeriesBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly/stats:bucketed_time_series", + ], + external_deps = [ + "glog", + ], +) + +cpp_benchmark( + name = "quantile_estimator_benchmark", + srcs = ["QuantileEstimatorBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly/portability:gflags", + "//folly/stats:quantile_estimator", + ], +) + +cpp_unittest( + name = "quantile_estimator_test", + srcs = ["QuantileEstimatorTest.cpp"], + headers = [], + deps = [ + "//folly/portability:gtest", + "//folly/stats:quantile_estimator", + ], +) + +cpp_benchmark( + name = "quantile_histogram_benchmark", + srcs = ["QuantileHistogramBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly/portability:gflags", + "//folly/stats:quantile_histogram", + ], +) + +cpp_unittest( + name = "quantile_histogram_test", + srcs = ["QuantileHistogramTest.cpp"], + headers = [], + deps = [ + "//folly:range", + "//folly/portability:gtest", + "//folly/stats:quantile_histogram", + ], +) + +cpp_unittest( + name = "sliding_window_test", + srcs = ["SlidingWindowTest.cpp"], + headers = [], + deps = [ + "//folly/portability:gtest", + "//folly/stats/detail:sliding_window", + ], +) + +cpp_benchmark( + name = "tdigest_benchmark", + srcs = ["TDigestBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly/portability:gflags", + "//folly/stats:digest_builder", + "//folly/stats:tdigest", + ], +) + +cpp_unittest( + name = "tdigest_test", + srcs = ["TDigestTest.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "//folly/portability:gtest", + "//folly/stats:tdigest", + ], +) + +cpp_unittest( + name = "time_series_test", + srcs = ["TimeSeriesTest.cpp"], + headers = [], + deps = [ + "//folly/container:foreach", + "//folly/portability:gtest", + "//folly/stats:bucketed_time_series", + "//folly/stats:multi_level_time_series", + "//folly/stats/detail:bucket", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "timeseries_histogram_test", + srcs = ["TimeseriesHistogramTest.cpp"], + headers = [], + deps = [ + "//folly/portability:gtest", + "//folly/stats:timeseries_histogram", + ], +) diff --git a/folly/support/test/BUCK b/folly/support/test/BUCK new file mode 100644 index 00000000000..8d387237b7a --- /dev/null +++ b/folly/support/test/BUCK @@ -0,0 +1,38 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("//gdb/scripts/tests/common:gdb_unittest.bzl", "gdb_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "gdb_util", + headers = ["GdbUtil.h"], + exported_deps = [ + "//folly:c_portability", + ], +) + +cpp_binary( + name = "main", + srcs = ["main.cpp"], + modules = False, + deps = [ + "//folly:network_address", + "//folly:range", + "//folly:small_vector", + "//folly/container:f14_hash", + "//folly/json:dynamic", + "//folly/support/test:gdb_util", + ], +) + +# Test all of the printers in the folly gdb extension +gdb_unittest( + name = "test", + binary = "main", + script = "runtest.gdb", + skip_modes = [ + "dev", + "opt*", + ], +) diff --git a/folly/synchronization/BUCK b/folly/synchronization/BUCK new file mode 100644 index 00000000000..f926a692875 --- /dev/null +++ b/folly/synchronization/BUCK @@ -0,0 +1,387 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "asymmetric_thread_fence", + srcs = ["AsymmetricThreadFence.cpp"], + headers = ["AsymmetricThreadFence.h"], + deps = [ + ":relaxed_atomic", + "//folly:exception", + "//folly:indestructible", + "//folly/portability:sys_membarrier", + "//folly/portability:sys_mman", + ], + exported_deps = [ + "//folly/portability:asm", + ], +) + +cpp_library( + name = "atomic_ref", + headers = ["AtomicRef.h"], + exported_deps = [ + "//folly:traits", + "//folly/lang:safe_assert", + ], +) + +cpp_library( + name = "atomic_util", + headers = [ + "AtomicUtil.h", + "AtomicUtil-inl.h", + ], + exported_deps = [ + "//folly:constexpr_math", + "//folly:likely", + "//folly:portability", + "//folly:traits", + ], +) + +cpp_library( + name = "atomic_notification", + srcs = [ + "AtomicNotification.cpp", + ], + headers = [ + "AtomicNotification.h", + "AtomicNotification-inl.h", + ], + exported_deps = [ + ":parking_lot", + "//folly:portability", + "//folly/detail:futex", + ], +) + +cpp_library( + name = "atomic_struct", + headers = ["AtomicStruct.h"], + exported_deps = [ + "//folly:constexpr_math", + "//folly:traits", + "//folly/synchronization/detail:atomic_utils", + ], +) + +cpp_library( + name = "baton", + headers = ["Baton.h"], + exported_deps = [ + ":atomic_util", + ":wait_options", + "//folly:likely", + "//folly/detail:async_trace", + "//folly/detail:futex", + "//folly/detail:memory_idler", + "//folly/portability:asm", + "//folly/synchronization/detail:spin", + ], +) + +cpp_library( + name = "call_once", + headers = ["CallOnce.h"], + exported_deps = [ + "//folly:likely", + "//folly:micro_lock", + "//folly:portability", + "//folly:shared_mutex", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "distributed_mutex", + srcs = [ + "DistributedMutex.cpp", + ], + headers = [ + "DistributedMutex.h", + "DistributedMutex-inl.h", + ], + exported_deps = [ + ":atomic_notification", + ":atomic_util", + ":lock", + "//folly:constexpr_math", + "//folly:likely", + "//folly:optional", + "//folly:portability", + "//folly:scope_guard", + "//folly:utility", + "//folly/chrono:hardware", + "//folly/detail:futex", + "//folly/functional:invoke", + "//folly/lang:align", + "//folly/lang:bits", + "//folly/lang:exception", + "//folly/portability:asm", + "//folly/synchronization/detail:inline_function_ref", + "//folly/synchronization/detail:sleeper", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "hazptr", + srcs = [ + "Hazptr.cpp", + "HazptrDomain.cpp", + ], + headers = [ + "Hazptr.h", + "Hazptr-fwd.h", + "HazptrDomain.h", + "HazptrHolder.h", + "HazptrObj.h", + "HazptrObjLinked.h", + "HazptrRec.h", + "HazptrThrLocal.h", + ], + deps = [ + "//folly/executors:queued_immediate_executor", + "//folly/portability:gflags", + ], + exported_deps = [ + ":asymmetric_thread_fence", + "//folly:c_portability", + "//folly:executor", + "//folly:memory", + "//folly:portability", + "//folly:singleton_thread_local", + "//folly:traits", + "//folly/concurrency:cache_locality", + "//folly/container:f14_hash", + "//folly/synchronization/detail:hazptr_utils", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "hazptr_thread_pool_executor", + srcs = ["HazptrThreadPoolExecutor.cpp"], + headers = [ + "HazptrThreadPoolExecutor.h", + ], + deps = [ + "//folly:singleton", + "//folly/executors:cpu_thread_pool_executor", + ], + exported_deps = [ + ":hazptr", + ], +) + +cpp_library( + name = "latch", + headers = ["Latch.h"], + exported_deps = [ + ":saturating_semaphore", + "//folly:c_portability", + "//folly:likely", + "//folly/lang:exception", + ], +) + +cpp_library( + name = "lifo_sem", + headers = ["LifoSem.h"], + exported_deps = [ + ":atomic_struct", + ":saturating_semaphore", + "//folly:c_portability", + "//folly:indexed_mem_pool", + "//folly:likely", + "//folly:portability", + "//folly:traits", + "//folly/detail:static_singleton_manager", + "//folly/lang:aligned", + "//folly/lang:safe_assert", + ], +) + +cpp_library( + name = "lock", + headers = ["Lock.h"], + exported_deps = [ + "//folly:portability", + "//folly:traits", + "//folly/functional:invoke", + "//folly/lang:exception", + "//folly/lang:hint", + ], +) + +cpp_library( + name = "micro_spin_lock", + headers = ["MicroSpinLock.h"], + exported_deps = [ + ":sanitize_thread", + "//folly:portability", + "//folly/lang:align", + "//folly/synchronization/detail:sleeper", + ], +) + +cpp_library( + name = "native_semaphore", + headers = ["NativeSemaphore.h"], + exported_deps = [ + "//folly:utility", + "//folly/lang:exception", + "//folly/portability:windows", + ], +) + +cpp_library( + name = "pico_spin_lock", + headers = ["PicoSpinLock.h"], + exported_deps = [ + ":atomic_ref", + ":atomic_util", + ":sanitize_thread", + "//folly:portability", + "//folly/lang:safe_assert", + "//folly/synchronization/detail:sleeper", + ], +) + +cpp_library( + name = "parking_lot", + srcs = [ + "ParkingLot.cpp", + ], + headers = ["ParkingLot.h"], + exported_deps = [ + "//folly:hash", + "//folly:indestructible", + "//folly:portability", + "//folly:unit", + "//folly/lang:safe_assert", + ], +) + +cpp_library( + name = "rcu", + srcs = [ + "Rcu.cpp", + ], + headers = [ + "Rcu.h", + ], + deps = [ + "//folly/detail:static_singleton_manager", + ], + exported_deps = [ + "//folly:function", + "//folly:indestructible", + "//folly:optional", + "//folly/detail:turn_sequencer", + "//folly/executors:queued_immediate_executor", + "//folly/synchronization/detail:rcu-detail", + ], +) + +cpp_library( + name = "rw_spin_lock", + headers = ["RWSpinLock.h"], + exported_deps = [ + ":lock", + "//folly:likely", + "//folly:portability", + "//folly/portability:asm", + ], +) + +cpp_library( + name = "relaxed_atomic", + headers = ["RelaxedAtomic.h"], +) + +cpp_library( + name = "sanitize_thread", + srcs = [ + "SanitizeThread.cpp", + ], + headers = ["SanitizeThread.h"], + deps = [ + "//folly/lang:extern", + ], + exported_deps = [ + "//folly:portability", + ], +) + +cpp_library( + name = "saturating_semaphore", + headers = ["SaturatingSemaphore.h"], + exported_deps = [ + ":atomic_util", + ":wait_options", + "//folly:likely", + "//folly/detail:futex", + "//folly/detail:memory_idler", + "//folly/portability:asm", + "//folly/synchronization/detail:spin", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "small_locks", + headers = ["SmallLocks.h"], + exported_deps = [ + ":micro_spin_lock", + ":pico_spin_lock", + "//folly:micro_lock", + "//folly:portability", + ], +) + +cpp_library( + name = "wait_options", + srcs = ["WaitOptions.cpp"], + headers = ["WaitOptions.h"], + deps = [ + "//folly:portability", + ], + exported_deps = [ + "//folly:c_portability", + ], +) + +cpp_library( + name = "delayed_init", + headers = ["DelayedInit.h"], + exported_deps = [ + ":call_once", + "//folly/lang:safe_assert", + ], +) + +cpp_library( + name = "throttled_lifo_sem", + headers = [ + "ThrottledLifoSem.h", + ], + exported_deps = [ + ":distributed_mutex", + ":saturating_semaphore", + ":wait_options", + "//folly:glog", + "//folly:intrusive_list", + "//folly:optional", + "//folly/lang:align", + "//folly/synchronization/detail:spin", + ], +) diff --git a/folly/synchronization/detail/BUCK b/folly/synchronization/detail/BUCK new file mode 100644 index 00000000000..a0e173f4815 --- /dev/null +++ b/folly/synchronization/detail/BUCK @@ -0,0 +1,104 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "atomic_utils", + headers = ["AtomicUtils.h"], + exported_deps = [ + "//folly/lang:assume", + ], +) + +cpp_library( + name = "hazptr_utils", + headers = [ + "HazptrUtils.h", + ], + exported_deps = [ + ":sleeper", + "//folly:portability", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "rcu-detail", + headers = [ + "ThreadCachedLists.h", + "ThreadCachedReaders.h", + "ThreadCachedTag.h", + ], + exported_deps = [ + "//folly:function", + "//folly:synchronized", + "//folly:thread_local", + "//folly/synchronization:asymmetric_thread_fence", + "//folly/synchronization:relaxed_atomic", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "sleeper", + srcs = ["Sleeper.cpp"], + headers = ["Sleeper.h"], + deps = [ + "//folly:portability", + ], + exported_deps = [ + "//folly/portability:asm", + ], +) + +cpp_library( + name = "spin", + headers = ["Spin.h"], + exported_deps = [ + "//folly/portability:asm", + "//folly/synchronization:wait_options", + ], +) + +cpp_library( + name = "inline_function_ref", + headers = [ + "InlineFunctionRef.h", + ], + exported_deps = [ + "//folly:function", + "//folly:traits", + "//folly:utility", + "//folly/functional:invoke", + ], +) + +cpp_library( + name = "hardware", + srcs = [ + # Use source-specific flags so that these flags aren't applied to this + # rules headers when they're compiled as a module, as they don't contain + # any code that requires RTM and they'd conflict when imported by + # dependents that don't also set it. + ( + "Hardware.cpp", + ["-mrtm"], + ), + ], + headers = ["Hardware.h"], + deps = [ + "//folly:cpp_attributes", + "//folly/lang:assume", + "//folly/lang:exception", + ], + exported_deps = [ + "//folly:portability", + ], + external_deps = [ + ("boost", None, "boost_preprocessor"), + ], +) diff --git a/folly/synchronization/detail/test/BUCK b/folly/synchronization/detail/test/BUCK new file mode 100644 index 00000000000..1ed1255cf86 --- /dev/null +++ b/folly/synchronization/detail/test/BUCK @@ -0,0 +1,28 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "inline_function_ref_test", + srcs = [ + "InlineFunctionRefTest.cpp", + ], + deps = [ + "//folly/portability:gtest", + "//folly/synchronization/detail:inline_function_ref", + ], +) + +cpp_unittest( + name = "hardware_test", + srcs = [ + "HardwareTest.cpp", + ], + deps = [ + "//folly/portability:gtest", + "//folly/synchronization/detail:hardware", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/synchronization/example/BUCK b/folly/synchronization/example/BUCK new file mode 100644 index 00000000000..dbb07e67ccd --- /dev/null +++ b/folly/synchronization/example/BUCK @@ -0,0 +1,27 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "hazptr_lock_free_lifo", + headers = ["HazptrLockFreeLIFO.h"], + exported_deps = [ + "//folly/synchronization:hazptr", + ], +) + +cpp_library( + name = "hazptr_swmr_set", + headers = ["HazptrSWMRSet.h"], + exported_deps = [ + "//folly/synchronization:hazptr", + ], +) + +cpp_library( + name = "hazptr_wide_cas", + headers = ["HazptrWideCAS.h"], + exported_deps = [ + "//folly/synchronization:hazptr", + ], +) diff --git a/folly/synchronization/test/BUCK b/folly/synchronization/test/BUCK new file mode 100644 index 00000000000..c26032258c4 --- /dev/null +++ b/folly/synchronization/test/BUCK @@ -0,0 +1,434 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "atomic_notification_test", + srcs = [ + "AtomicNotificationTest.cpp", + ], + deps = [ + "//folly:optional", + "//folly/portability:gtest", + "//folly/synchronization:atomic_notification", + ], +) + +cpp_unittest( + name = "atomic_ref_test", + srcs = ["AtomicRefTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/synchronization:atomic_ref", + ], +) + +cpp_unittest( + name = "atomic_struct_test", + srcs = ["AtomicStructTest.cpp"], + headers = [], + deps = [ + "//folly/portability:gtest", + "//folly/synchronization:atomic_struct", + ], +) + +cpp_benchmark( + name = "atomic_util_bench", + srcs = ["AtomicUtilBench.cpp"], + deps = [ + "//folly:benchmark", + "//folly:constexpr_math", + "//folly/init:init", + "//folly/lang:aligned", + "//folly/lang:assume", + "//folly/lang:keep", + "//folly/synchronization:atomic_util", + ], +) + +cpp_unittest( + name = "atomic_util_test", + srcs = ["AtomicUtilTest.cpp"], + supports_static_listing = False, + deps = [ + "//folly:benchmark", + "//folly:portability", + "//folly:utility", + "//folly/functional:invoke", + "//folly/portability:gtest", + "//folly/synchronization:atomic_ref", + "//folly/synchronization:atomic_util", + ], +) + +cpp_library( + name = "barrier", + headers = ["Barrier.h"], +) + +cpp_unittest( + name = "barrier_test", + srcs = ["BarrierTest.cpp"], + deps = [ + ":barrier", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "baton_benchmark", + srcs = ["BatonBenchmark.cpp"], + deps = [ + ":baton_test_helpers", + "//folly:benchmark", + "//folly/synchronization:baton", + "//folly/synchronization:native_semaphore", + "//folly/test:deterministic_schedule", + ], +) + +cpp_unittest( + name = "baton_test", + srcs = ["BatonTest.cpp"], + deps = [ + ":baton_test_helpers", + "//folly/portability:gtest", + "//folly/synchronization:baton", + "//folly/test:deterministic_schedule", + ], +) + +cpp_library( + name = "baton_test_helpers", + headers = ["BatonTestHelpers.h"], + exported_deps = [ + "//folly/portability:gtest", + "//folly/synchronization:baton", + "//folly/test:deterministic_schedule", + ], +) + +cpp_binary( + name = "call_once_benchmark", + srcs = ["CallOnceBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/synchronization:call_once", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "call_once_test", + srcs = ["CallOnceTest.cpp"], + headers = [], + deps = [ + "//folly:traits", + "//folly/portability:gtest", + "//folly/synchronization:call_once", + ], +) + +cpp_unittest( + name = "delayed_init_test", + srcs = ["DelayedInitTest.cpp"], + headers = [], + deps = [ + "fbsource//third-party/fmt:fmt", + ":barrier", + "//folly/portability:gtest", + "//folly/synchronization:delayed_init", + ], +) + +cpp_unittest( + name = "distributed_mutex_test", + srcs = [ + "DistributedMutexTest.cpp", + ], + deps = [ + "//folly:map_util", + "//folly:synchronized", + "//folly/container:array", + "//folly/container:foreach", + "//folly/lang:customization_point", + "//folly/lang:keep", + "//folly/portability:gtest", + "//folly/synchronization:baton", + "//folly/synchronization:distributed_mutex", + "//folly/test:deterministic_schedule", + "//folly/test:test_utils", + ], +) + +cpp_unittest( + name = "hazptr_test", + srcs = ["HazptrTest.cpp"], + deps = [ + ":barrier", + "//folly:singleton", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/synchronization:hazptr", + "//folly/synchronization:hazptr_thread_pool_executor", + "//folly/synchronization/example:hazptr_lock_free_lifo", + "//folly/synchronization/example:hazptr_swmr_set", + "//folly/synchronization/example:hazptr_wide_cas", + "//folly/test:deterministic_schedule", + ], +) + +cpp_unittest( + name = "latch_test", + srcs = ["LatchTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/synchronization:latch", + ], +) + +cpp_unittest( + name = "lifo_sem_test", + srcs = ["LifoSemTests.cpp"], + headers = [], + allocator = "jemalloc_debug", + deps = [ + "//folly:random", + "//folly/portability:asm", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/synchronization:lifo_sem", + "//folly/synchronization:native_semaphore", + "//folly/test:deterministic_schedule", + ], +) + +cpp_benchmark( + name = "lifo_sem_bench", + srcs = ["LifoSemBench.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/portability:asm", + "//folly/synchronization:lifo_sem", + "//folly/synchronization:native_semaphore", + ], +) + +cpp_unittest( + name = "lock_test", + srcs = ["LockTest.cpp"], + supports_static_listing = False, + deps = [ + "//folly/portability:gtest", + "//folly/synchronization:lock", + ], +) + +cpp_unittest( + name = "native_semaphore_test", + srcs = ["NativeSemaphoreTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/synchronization:native_semaphore", + ], +) + +cpp_binary( + name = "parking_lot_benchmark", + srcs = ["ParkingLotBenchmark.cpp"], + deps = [ + ":barrier", + "//folly:benchmark", + "//folly/detail:futex", + "//folly/synchronization:baton", + "//folly/synchronization:parking_lot", + ], +) + +cpp_unittest( + name = "parking_lot_test", + srcs = ["ParkingLotTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/synchronization:baton", + "//folly/synchronization:parking_lot", + ], +) + +cpp_binary( + name = "rcu_bench", + srcs = ["RcuBench.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/synchronization:rcu", + ], +) + +cpp_unittest( + name = "rcu_test", + srcs = ["RcuTest.cpp"], + deps = [ + "//folly:benchmark", + "//folly:random", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/synchronization:rcu", + "//folly/synchronization:relaxed_atomic", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "relaxed_atomic_test", + srcs = ["RelaxedAtomicTest.cpp"], + headers = [], + deps = [ + "//folly/portability:gtest", + "//folly/synchronization:atomic_util", + "//folly/synchronization:relaxed_atomic", + ], +) + +cpp_unittest( + name = "rw_spin_lock_test", + srcs = ["RWSpinLockTest.cpp"], + headers = [], + deps = [ + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/portability:unistd", + "//folly/synchronization:rw_spin_lock", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "saturating_semaphore_test", + srcs = ["SaturatingSemaphoreTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/synchronization:saturating_semaphore", + "//folly/test:deterministic_schedule", + ], +) + +cpp_library( + name = "semaphore", + headers = ["Semaphore.h"], + exported_deps = [ + "//folly:optional", + "//folly:scope_guard", + "//folly/lang:exception", + ], + exported_external_deps = [ + "boost", + ], +) + +cpp_unittest( + name = "semaphore_test", + srcs = ["SemaphoreTest.cpp"], + deps = [ + ":barrier", + ":semaphore", + "//folly:traits", + "//folly/portability:gtest", + "//folly/portability:sys_mman", + "//folly/synchronization:latch", + ], + external_deps = [ + "glog", + ], +) + +cpp_benchmark( + name = "small_locks_benchmark", + srcs = ["SmallLocksBenchmark.cpp"], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:benchmark", + "//folly:shared_mutex", + "//folly/experimental/flat_combining:flat_combining", + "//folly/lang:aligned", + "//folly/synchronization:distributed_mutex", + "//folly/synchronization:small_locks", + ], +) + +cpp_unittest( + name = "small_locks_test", + srcs = ["SmallLocksTest.cpp"], + headers = [], + deps = [ + "//folly:random", + "//folly/portability:asm", + "//folly/portability:gflags", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/portability:pthread", + "//folly/portability:unistd", + "//folly/synchronization:small_locks", + "//folly/test:test_utils", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "thread_cached_epoch_bench_util", + headers = ["ThreadCachedEpochBench.h"], + exported_deps = [ + "//folly:benchmark", + "//folly/synchronization/detail:rcu-detail", + ], +) + +cpp_binary( + name = "thread_cached_readers_bench", + srcs = ["ThreadCachedReadersBench.cpp"], + headers = [], + deps = [ + ":thread_cached_epoch_bench_util", + "//folly:benchmark", + "//folly/synchronization/detail:rcu-detail", + ], +) + +cpp_unittest( + name = "thread_cached_readers_test", + srcs = ["ThreadCachedReadersTest.cpp"], + headers = [], + deps = [ + "//folly:thread_local", + "//folly/portability:gtest", + "//folly/synchronization/detail:rcu-detail", + ], +) + +cpp_unittest( + name = "throttled_lifo_sem_test", + srcs = [ + "ThrottledLifoSemTest.cpp", + ], + deps = [ + "//folly:benchmark", + "//folly:random", + "//folly/portability:gtest", + "//folly/synchronization:saturating_semaphore", + "//folly/synchronization:throttled_lifo_sem", + ], +) diff --git a/folly/system/BUCK b/folly/system/BUCK new file mode 100644 index 00000000000..08ca1bec7f6 --- /dev/null +++ b/folly/system/BUCK @@ -0,0 +1,117 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "at_fork", + srcs = ["AtFork.cpp"], + headers = ["AtFork.h"], + deps = [ + "//folly:scope_guard", + "//folly/lang:exception", + "//folly/portability:pthread", + "//folly/synchronization:sanitize_thread", + ], + exported_deps = [ + "//folly:function", + "//folly/portability:sys_types", + ], +) + +cpp_library( + name = "pid", + srcs = ["Pid.cpp"], + headers = ["Pid.h"], + deps = [ + ":at_fork", + "//folly/portability:unistd", + ], + exported_deps = [ + "//folly/portability:sys_types", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "hardware_concurrency", + srcs = ["HardwareConcurrency.cpp"], + headers = [ + "HardwareConcurrency.h", + ], + deps = [ + "//folly/portability:sched", + ], +) + +cpp_library( + name = "memory_mapping", + srcs = ["MemoryMapping.cpp"], + headers = ["MemoryMapping.h"], + os_deps = [ + ( + "linux", + ["//folly/experimental/io:huge_pages"], + ), + ], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:portability", + "//folly/portability:gflags", + "//folly/portability:sys_mman", + "//folly/portability:sys_syscall", + ], + exported_deps = [ + "//folly:file", + "//folly:range", + "//folly/portability:unistd", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "shell", + srcs = ["Shell.cpp"], + headers = ["Shell.h"], + exported_deps = [ + "//folly:conv", + "//folly:format", + "//folly:range", + ], +) + +cpp_library( + name = "thread_id", + srcs = ["ThreadId.cpp"], + headers = ["ThreadId.h"], + deps = [ + ":at_fork", + "//folly:likely", + "//folly/portability:pthread", + "//folly/portability:sys_syscall", + "//folly/portability:unistd", + "//folly/portability:windows", + "//folly/synchronization:relaxed_atomic", + ], +) + +cpp_library( + name = "thread_name", + srcs = ["ThreadName.cpp"], + headers = ["ThreadName.h"], + deps = [ + "//folly:portability", + "//folly:scope_guard", + "//folly:traits", + "//folly/portability:windows", + ], + exported_deps = [ + "//folly:optional", + "//folly:range", + "//folly/portability:config", + "//folly/portability:pthread", + ], +) diff --git a/folly/system/test/BUCK b/folly/system/test/BUCK new file mode 100644 index 00000000000..ce4c72dd34b --- /dev/null +++ b/folly/system/test/BUCK @@ -0,0 +1,81 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "at_fork_test", + srcs = ["AtForkTest.cpp"], + deps = [ + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/system:at_fork", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "pid_test", + srcs = ["PidTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/system:pid", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "memory_mapping_test", + srcs = ["MemoryMappingTest.cpp"], + headers = [], + deps = [ + "//folly:file_util", + "//folly:random", + "//folly/portability:gtest", + "//folly/portability:sys_mman", + "//folly/system:memory_mapping", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "shell_test", + srcs = ["ShellTest.cpp"], + headers = [], + deps = [ + "//folly/portability:gtest", + "//folly/system:shell", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "thread_id_test", + srcs = ["ThreadIdTest.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/portability:gtest", + "//folly/portability:unistd", + "//folly/system:thread_id", + ], +) + +cpp_unittest( + name = "thread_name_test", + srcs = ["ThreadNameTest.cpp"], + headers = [], + deps = [ + "//folly:scope_guard", + "//folly/portability:gtest", + "//folly/synchronization:baton", + "//folly/system:thread_name", + ], +) diff --git a/folly/test/BUCK b/folly/test/BUCK new file mode 100644 index 00000000000..b9f5a20c2f3 --- /dev/null +++ b/folly/test/BUCK @@ -0,0 +1,2030 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "ahm_int_stress_test", + srcs = ["AHMIntStressTest.cpp"], + headers = [], + deps = [ + "//folly:atomic_hash_map", + "//folly:memory", + "//folly:scope_guard", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "unicode_test", + srcs = ["UnicodeTest.cpp"], + headers = [], + deps = [ + "//folly:range", + "//folly:unicode", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "arena_smart_ptr_test", + srcs = ["ArenaSmartPtrTest.cpp"], + headers = [], + deps = [ + "//folly:memory", + "//folly/memory:arena", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "ascii_case_insensitive_benchmark", + srcs = ["AsciiCaseInsensitiveBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly:range", + ], +) + +cpp_unittest( + name = "ascii_case_insensitive_test", + srcs = ["AsciiCaseInsensitiveTest.cpp"], + headers = [], + deps = [ + "//folly:range", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "base64_test", + srcs = ["base64_test.cpp"], + headers = [], + deps = [ + "//folly:base64", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "concurrent_bit_set_test", + srcs = ["ConcurrentBitSetTest.cpp"], + headers = [], + deps = [ + "//folly:concurrent_bit_set", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "buffered_atomic_test", + srcs = ["BufferedAtomicTest.cpp"], + headers = [], + deps = [ + ":deterministic_schedule", + "//folly:singleton_thread_local", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "atomic_hash_array_test", + srcs = ["AtomicHashArrayTest.cpp"], + headers = [], + deps = [ + "//folly:atomic_hash_array", + "//folly:conv", + "//folly:memory", + "//folly/hash:hash", + "//folly/portability:gtest", + "//folly/portability:string", + "//folly/portability:sys_mman", + ], +) + +cpp_unittest( + name = "atomic_hash_map_test", + srcs = ["AtomicHashMapTest.cpp"], + headers = [], + deps = [ + "//folly:atomic_hash_map", + "//folly:benchmark", + "//folly:conv", + "//folly/portability:atomic", + "//folly/portability:gtest", + "//folly/portability:sys_time", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "atomic_linked_list_test", + srcs = ["AtomicLinkedListTest.cpp"], + headers = [], + deps = [ + "//folly:atomic_linked_list", + "//folly:utility", + "//folly/portability:gtest", + "//folly/synchronization/test:barrier", + ], +) + +cpp_unittest( + name = "atomic_unordered_map_test", + srcs = ["AtomicUnorderedMapTest.cpp"], + headers = [], + deps = [ + ":deterministic_schedule", + "//folly:atomic_unordered_map", + "//folly:benchmark", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "benchmark_test", + srcs = ["BenchmarkTest.cpp"], + deps = [ + "//folly:benchmark", + "//folly/detail:perf_scoped", + "//folly/portability:gflags", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "benchmark_integration_test", + srcs = ["BenchmarkIntegrationTest.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly:string", + "//folly/container:foreach", + ], +) + +cpp_unittest( + name = "cancellation_token_test", + srcs = ["CancellationTokenTest.cpp"], + headers = [], + deps = [ + "//folly:cancellation_token", + "//folly:optional", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_benchmark( + name = "chrono_bench", + srcs = ["ChronoBench.cpp"], + deps = [ + "//folly:benchmark", + "//folly:chrono", + "//folly/chrono:hardware", + "//folly/hash:hash", + "//folly/init:init", + ], +) + +cpp_unittest( + name = "chrono_test", + srcs = ["ChronoTest.cpp"], + deps = [ + "//folly:chrono", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "clock_gettime_wrappers_test", + srcs = ["ClockGettimeWrappersTest.cpp"], + headers = [], + deps = [ + ":test_utils", + "//folly:clock_gettime_wrappers", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "concurrent_lazy_test", + srcs = ["ConcurrentLazyTest.cpp"], + deps = [ + "//folly:concurrent_lazy", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "concurrent_skip_list_benchmark", + srcs = ["ConcurrentSkipListBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly:concurrent_skip_list", + "//folly/hash:hash", + "//folly/portability:gflags", + "//folly/synchronization:rw_spin_lock", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "concurrent_skip_list_test", + srcs = ["ConcurrentSkipListTest.cpp"], + headers = [], + deps = [ + "//folly:concurrent_skip_list", + "//folly:memory", + "//folly:string", + "//folly/container:foreach", + "//folly/memory:arena", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "constexpr_math_test", + srcs = ["ConstexprMathTest.cpp"], + headers = [], + deps = [ + "//folly:constexpr_math", + "//folly/lang:bits", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "constructor_callback_list_test", + srcs = ["ConstructorCallbackListTest.cpp"], + headers = [], + compiler_flags = [ + # many deps use this, so make sure the unittests pass + "-Werror", + "-Wglobal-constructor", + ], + deps = [ + "//folly:constructor_callback_list", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "constexpr_math_benchmark", + srcs = ["ConstexprMathBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:constexpr_math", + ], + external_deps = [ + "glog", + ], +) + +cpp_binary( + name = "conv_benchmark", + srcs = ["ConvBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:conv", + "//folly:cpp_attributes", + "//folly/container:foreach", + "//folly/lang:to_ascii", + ], + external_deps = [ + ("boost", None, "boost_lexical_cast"), + ], +) + +cpp_unittest( + name = "conv_test", + srcs = ["ConvTest.cpp"], + headers = [], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:conv", + "//folly:random", + "//folly/container:foreach", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "cpu_id_test", + srcs = ["CpuIdTest.cpp"], + headers = [], + deps = [ + "//folly:cpu_id", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "demangle_test", + srcs = ["DemangleTest.cpp"], + headers = [], + deps = [ + "//folly:demangle", + "//folly/lang:pretty", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "detail_typelist_test", + srcs = ["TypeListTest.cpp"], + deps = [ + "//folly/detail:typelist", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "deterministic_schedule", + srcs = [ + "BufferedAtomic.cpp", + "DeterministicSchedule.cpp", + ], + headers = [ + "BufferedAtomic.h", + "DeterministicSchedule.h", + ], + deps = [ + "//folly:random", + "//folly:singleton_thread_local", + ], + exported_deps = [ + "//folly:scope_guard", + "//folly/concurrency:cache_locality", + "//folly/detail:futex", + "//folly/lang:customization_point", + "//folly/synchronization:atomic_notification", + "//folly/synchronization/detail:atomic_utils", + "//folly/synchronization/test:semaphore", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "deterministic_schedule_test", + srcs = ["DeterministicScheduleTest.cpp"], + headers = [], + deps = [ + ":deterministic_schedule", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/synchronization:atomic_util", + ], +) + +cpp_unittest( + name = "discriminated_ptr_test", + srcs = ["DiscriminatedPtrTest.cpp"], + headers = [], + deps = [ + "//folly:discriminated_ptr", + "//folly/portability:gtest", + ], +) + +# This test depends only on :dynamic. Tests which require other +# dependencies should be added to dynamic_other_test. + +cpp_unittest( + name = "endian_test", + srcs = ["EndianTest.cpp"], + headers = [], + deps = [ + "//folly/lang:bits", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "exception_string_test", + srcs = ["ExceptionStringTest.cpp"], + headers = [], + deps = [ + "//folly:exception_string", + "//folly:portability", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "exception_test", + srcs = ["ExceptionTest.cpp"], + headers = [], + deps = [ + "//folly:exception", + "//folly/experimental:test_util", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "exception_wrapper_benchmark", + srcs = ["ExceptionWrapperBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly:exception_wrapper", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "exception_wrapper_test", + srcs = ["ExceptionWrapperTest.cpp"], + headers = [], + compiler_specific_flags = { + "gcc": [ + "-Wno-shadow-compatible-local", + ], + }, + deps = [ + "//folly:conv", + "//folly:exception_wrapper", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "executor_test", + srcs = ["ExecutorTest.cpp"], + headers = [], + deps = [ + "//folly:executor", + "//folly/lang:keep", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "expected_coroutines_bench", + srcs = ["ExpectedCoroutinesBench.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:exception_wrapper", + "//folly:expected", + "//folly/init:init", + "//folly/lang:keep", + ], +) + +cpp_unittest( + name = "expected_coroutines_test", + srcs = ["ExpectedCoroutinesTest.cpp"], + headers = [], + deps = [ + "//folly:expected", + "//folly:portability", + "//folly:scope_guard", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "expected_test", + srcs = ["ExpectedTest.cpp"], + headers = [], + deps = [ + "//folly:expected", + "//folly:portability", + "//folly/lang:keep", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_benchmark( + name = "fbstring_benchmark", + srcs = ["FBStringBenchmark.cpp"], + headers = ["FBStringTestBenchmarks.cpp.h"], + allocator = "jemalloc", + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly:fbstring", + "//folly:random", + "//folly/container:foreach", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "fbstring_test", + srcs = ["FBStringTest.cpp"], + headers = [], + allocator = "jemalloc", + deps = [ + ":test_utils", + "//folly:conv", + "//folly:fbstring", + "//folly:portability", + "//folly:random", + "//folly:utility", + "//folly/container:foreach", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ("boost", None, "boost_algorithm"), + ], +) + +cpp_library( + name = "fbvector_test_util", + srcs = [ + "FBVectorTestUtil.cpp", + ], + exported_deps = [ + "//folly:fbstring", + "//folly:random", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "fbvector_benchmark", + srcs = ["FBVectorBenchmark.cpp"], + headers = ["FBVectorBenchmarks.cpp.h"], + args = [ + "--json", + ], + deps = [ + ":fbvector_test_util", + "//folly:benchmark", + "//folly:fbvector", + "//folly:small_vector", + "//folly:traits", + "//folly/container:foreach", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "fbvector_test", + srcs = ["FBVectorTest.cpp"], + headers = [ + "FBVectorTests.cpp.h", + ], + deps = [ + ":fbvector_test_util", + "//folly:fbstring", + "//folly:fbvector", + "//folly:random", + "//folly:traits", + "//folly/container:foreach", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "file_test", + srcs = ["FileTest.cpp"], + headers = [], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:file", + "//folly:string", + "//folly/portability:fcntl", + "//folly/portability:filesystem", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "file_lock_test", + srcs = ["FileLockTest.cpp"], + headers = [], + env = { + "FOLLY_FILE_LOCK_TEST_HELPER": "$(exe_target :file_test_lock_helper)", + }, + deps = [ + "//folly:file", + "//folly:string", + "//folly:subprocess", + "//folly/experimental:test_util", + "//folly/experimental/io:fs_util", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + ("boost", None, "boost_thread"), + "glog", + ], +) + +cpp_binary( + name = "file_test_lock_helper", + srcs = ["FileTestLockHelper.cpp"], + headers = [], + deps = [ + "//folly:file", + "//folly/portability:gflags", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "file_util_test", + srcs = ["FileUtilTest.cpp"], + headers = [], + extract_helper_lib = False, + deps = [ + "//folly:exception", + "//folly:file", + "//folly:file_util", + "//folly:range", + "//folly:string", + "//folly/detail:file_util_detail", + "//folly/detail:file_util_vector_detail", + "//folly/experimental:test_util", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ("glibc", None, "dl"), + ], +) + +cpp_benchmark( + name = "fingerprint_benchmark", + srcs = ["FingerprintBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:fingerprint", + "//folly:format", + "//folly/detail:slow_fingerprint", + ], +) + +cpp_unittest( + name = "fingerprint_test", + srcs = ["FingerprintTest.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:fingerprint", + "//folly/detail:slow_fingerprint", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "fixed_string_test", + srcs = ["FixedStringTest.cpp"], + headers = [], + deps = [ + "//folly:fixed_string", + "//folly:range", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "format_benchmark", + srcs = ["FormatBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + compiler_specific_flags = { + "clang": [ + "-ftemplate-depth=512", + ], + }, + deps = [ + "//folly:benchmark", + "//folly:fbvector", + "//folly:format", + "//folly:utility", + "//folly/init:init", + "//folly/json:dynamic", + ], + external_deps = [ + "glog", + ], +) + +# This test depends only on :format. Tests for user-defined formatters +# should be added to format_other_test. +cpp_unittest( + name = "format_test", + srcs = ["FormatTest.cpp"], + headers = [], + deps = [ + "//folly:format", + "//folly:utility", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "format_other_test", + srcs = ["FormatOtherTest.cpp"], + headers = [], + deps = [ + "//folly:fbvector", + "//folly:file_util", + "//folly:format", + "//folly:portability", + "//folly:small_vector", + "//folly/json:dynamic", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "function_ref_test", + srcs = ["FunctionRefTest.cpp"], + headers = [], + deps = [ + "//folly:function", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "function_ref_benchmark", + srcs = ["FunctionRefBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:function", + "//folly:random", + "//folly/synchronization/detail:inline_function_ref", + ], +) + +cpp_unittest( + name = "function_test", + srcs = ["FunctionTest.cpp"], + headers = [], + deps = [ + "//folly:function", + "//folly:memory", + "//folly/lang:keep", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "futex_test", + srcs = ["FutexTest.cpp"], + headers = [], + deps = [ + ":deterministic_schedule", + "//folly:chrono", + "//folly/detail:futex", + "//folly/portability:gtest", + "//folly/portability:time", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "group_varint_test", + srcs = ["GroupVarintTest.cpp"], + headers = [], + deps = [ + "//folly:group_varint", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "group_varint_test_ssse3", + srcs = ["GroupVarintTest.cpp"], + headers = [], + compiler_flags = ["-mssse3"], + deps = [ + "//folly:group_varint", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "indestructible_test", + srcs = ["IndestructibleTest.cpp"], + deps = [ + "//folly:indestructible", + "//folly:memory", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "indexed_mem_pool_test", + srcs = ["IndexedMemPoolTest.cpp"], + headers = [], + deps = [ + ":deterministic_schedule", + "//folly:indexed_mem_pool", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/portability:unistd", + ], +) + +cpp_benchmark( + name = "ip_address_benchmark", + srcs = ["IPAddressBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:benchmark", + "//folly:conv", + "//folly:network_address", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "ip_address_test", + srcs = ["IPAddressTest.cpp"], + supports_static_listing = False, + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:network_address", + "//folly:string", + "//folly/container:bit_iterator", + "//folly/detail:ip_address_source", + "//folly/lang:bits", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "iterators_test", + srcs = ["IteratorsTest.cpp"], + deps = [ + "//folly/container:array", + "//folly/detail:iterators", + "//folly/portability:gtest", + ], +) + +# This test depends only on :json. Tests which require other +# dependencies should be added to json_other_test. + +cpp_unittest( + name = "lazy_test", + srcs = ["LazyTest.cpp"], + headers = [], + deps = [ + "//folly:lazy", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "glog_benchmark", + srcs = ["GLogBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:glog", + ], +) + +cpp_unittest( + name = "glog_test", + srcs = ["GLogTest.cpp"], + headers = [], + deps = [ + "//folly:glog", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "mac_address_test", + srcs = ["MacAddressTest.cpp"], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:network_address", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "map_util_test", + srcs = ["MapUtilTest.cpp"], + headers = [], + deps = [ + "//folly:map_util", + "//folly:sorted_vector_types", + "//folly:traits", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "math_benchmark", + srcs = ["MathBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:math", + ], +) + +cpp_unittest( + name = "math_test", + srcs = ["MathTest.cpp"], + headers = [], + deps = [ + "//folly:math", + "//folly:portability", + "//folly/functional:invoke", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +# Test MaybeManagedPtr with default settings and on c++17 and c++20. +# We test c++17 and c++20 explicitly since c++20 can synthesize `operator!=` whereas c++17 cannot. +cpp_unittest( + name = "maybe_managed_ptr_test", + srcs = ["MaybeManagedPtrTest.cpp"], + headers = [], + deps = [ + "//folly:maybe_managed_ptr", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "maybe_managed_ptr_test_c++17", + srcs = ["MaybeManagedPtrTest.cpp"], + headers = [], + compiler_flags = [ + "-std=c++17", + ], + deps = [ + "//folly:maybe_managed_ptr", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "maybe_managed_ptr_test_c++20", + srcs = ["MaybeManagedPtrTest.cpp"], + headers = [], + deps = [ + "//folly:maybe_managed_ptr", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "memset_test", + srcs = [ + "MemsetTest.cpp", + ], + deps = [ + "//folly:memset", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "memset_benchmark", + srcs = ["MemsetBenchmark.cpp"], + headers = [], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:benchmark", + "//folly:memset", + "//folly:preprocessor", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "memcpy_test", + srcs = ["MemcpyTest.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "//folly:memcpy", + "//folly:portability", + "//folly/portability:gtest", + ], +) + +cpp_binary( + name = "memcpy_benchmark", + srcs = ["MemcpyBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:memcpy", + "//folly/portability:unistd", + ], +) + +cpp_unittest( + name = "memcpy_use_test", + srcs = ["MemcpyUseTest.cpp"], + deps = [ + "//folly:memcpy-use", # @manual + "//folly/lang:keep", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "memory_test", + srcs = ["MemoryTest.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "//folly:constexpr_math", + "//folly:memory", + "//folly:string", + "//folly/lang:keep", + "//folly/memory:arena", + "//folly/portability:asm", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_binary( + name = "memory_idler_benchmark", + srcs = ["MemoryIdlerBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly/detail:memory_idler", + ], +) + +cpp_unittest( + name = "memory_idler_test", + srcs = ["MemoryIdlerTest.cpp"], + headers = [], + deps = [ + "//folly/detail:memory_idler", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/synchronization:baton", + ], +) + +cpp_unittest( + name = "move_wrapper_test", + srcs = ["MoveWrapperTest.cpp"], + headers = [], + deps = [ + "//folly:move_wrapper", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "mpmc_pipeline_test", + srcs = ["MPMCPipelineTest.cpp"], + headers = [], + deps = [ + "//folly:conv", + "//folly:mpmc_pipeline", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "mpmc_queue_test", + srcs = ["MPMCQueueTest.cpp"], + headers = [], + deps = [ + ":deterministic_schedule", + "//folly:format", + "//folly:memory", + "//folly:mpmc_queue", + "//folly:stop_watch", + "//folly/portability:gtest", + "//folly/portability:sys_resource", + "//folly/portability:sys_time", + "//folly/portability:unistd", + ], + external_deps = [ + "boost", + ("boost", None, "boost_thread"), + ], +) + +cpp_library( + name = "observer_container_test_util", + headers = ["ObserverContainerTestUtil.h"], + exported_deps = [ + "//folly:function", + "//folly:optional", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "observer_container_test", + srcs = ["ObserverContainerTest.cpp"], + headers = [], + deps = [ + ":observer_container_test_util", + "//folly:observer_container", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "optional_test", + srcs = ["OptionalTest.cpp"], + headers = [], + deps = [ + "//folly:cpp_attributes", + "//folly:optional", + "//folly:portability", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "optional_coroutines_test", + srcs = ["OptionalCoroutinesTest.cpp"], + headers = [], + compiler_specific_flags = { + "clang": [ + "-O1", # BUGBUG https://bugs.llvm.org/show_bug.cgi?id=34289 + ], + }, + deps = [ + "//folly:optional", + "//folly:portability", + "//folly:scope_guard", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "replaceable_test", + srcs = ["ReplaceableTest.cpp"], + headers = [], + deps = [ + "//folly:replaceable", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "overload_test", + srcs = ["OverloadTest.cpp"], + headers = [], + deps = [ + "//folly:discriminated_ptr", + "//folly:overload", + "//folly/portability:gtest", + ], + external_deps = [ + ("boost", None, "boost_variant"), + ], +) + +cpp_unittest( + name = "packed_sync_ptr_test", + srcs = ["PackedSyncPtrTest.cpp"], + headers = [], + deps = [ + "//folly:packed_sync_ptr", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "padded_test", + srcs = ["PaddedTest.cpp"], + headers = [], + deps = [ + "//folly:padded", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "poly_test", + srcs = ["PolyTest.cpp"], + deps = [ + "//folly:conv", + "//folly:cpp_attributes", + "//folly:poly", + "//folly/poly:basic_interfaces", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "portability_test", + srcs = ["PortabilityTest.cpp"], + headers = [], + deps = [ + "//folly:portability", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "producer_consumer_queue_benchmark", + srcs = ["ProducerConsumerQueueBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly:producer_consumer_queue", + "//folly/portability:gflags", + "//folly/portability:pthread", + "//folly/stats:histogram", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "producer_consumer_queue_test", + srcs = ["ProducerConsumerQueueTest.cpp"], + headers = [], + deps = [ + "//folly:producer_consumer_queue", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_binary( + name = "random_benchmark", + srcs = ["RandomBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:random", + "//folly/container:foreach", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "random_test", + srcs = ["RandomTest.cpp"], + headers = [], + deps = [ + "//folly:random", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_benchmark( + name = "range_find_benchmark", + srcs = ["RangeFindBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:range", + "//folly/container:foreach", + ], +) + +cpp_unittest( + name = "range_test", + srcs = ["RangeTest.cpp"], + headers = [], + compiler_specific_flags = { + "gcc": [ + "-Wno-shadow-compatible-local", + ], + }, + deps = [ + "fbsource//third-party/range-v3:range-v3", + "//folly:cpp_attributes", + "//folly:memory", + "//folly:range", + "//folly/portability:gmock", + "//folly/portability:gtest", + "//folly/portability:sys_mman", + ], + external_deps = [ + ("boost", None, "boost_algorithm"), + ("boost", None, "boost_range"), + ], +) + +cpp_unittest( + name = "scope_guard_test", + srcs = ["ScopeGuardTest.cpp"], + headers = [], + deps = [ + "//folly:scope_guard", + "//folly/lang:keep", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "shared_mutex_test", + srcs = ["SharedMutexTest.cpp"], + headers = [], + compiler_specific_flags = { + "gcc": [ + "-Wno-shadow-compatible-local", + ], + }, + deps = [ + ":deterministic_schedule", + ":test_utils", + "//folly:benchmark", + "//folly:mpmc_queue", + "//folly:shared_mutex", + "//folly/fibers:core", + "//folly/fibers:timed_mutex", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/synchronization:rw_spin_lock", + ], + external_deps = [ + ("boost", None, "boost_thread"), + ], +) + +cpp_benchmark( + name = "singleton_benchmark", + srcs = ["SingletonBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly:memory", + "//folly:singleton", + "//folly:singleton_thread_local", + "//folly/portability:gflags", + ], +) + +cpp_unittest( + name = "singleton_test", + srcs = ["SingletonTest.cpp"], + headers = [], + deps = [ + ":singleton_test_structs", + ":test_utils", + "//folly:singleton", + "//folly/experimental/io:fs_util", + "//folly/io/async:async_base", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ("boost", None, "boost_thread"), + ], +) + +cpp_unittest( + name = "singleton_test_global", + srcs = ["SingletonTestGlobal.cpp"], + headers = [], + deps = [ + ":singleton_test_structs", + "//folly:benchmark", + "//folly:singleton", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "singleton_test_structs", + srcs = ["SingletonTestStructs.cpp"], + headers = ["SingletonTestStructs.h"], + exported_deps = [ + "//folly/portability:gtest", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_binary( + name = "singleton_thread_local_overload.so", + srcs = ["SingletonThreadLocalTestOverload.cpp"], + dlopen_enabled = True, + deps = [ + "//folly:singleton_thread_local", + ], +) + +cpp_unittest( + name = "singleton_thread_local_test", + srcs = ["SingletonThreadLocalTest.cpp"], + headers = [], + resources = [ + ":singleton_thread_local_overload.so", + ], + deps = [ + ":singleton_thread_local_overload.so", # @manual + "//folly:singleton_thread_local", + "//folly:string", + "//folly:synchronized", + "//folly/experimental:test_util", + "//folly/experimental/io:fs_util", + "//folly/lang:keep", + "//folly/portability:gtest", + ], + external_deps = [ + ("boost", None, "boost_thread"), + ("glibc", None, "dl"), + ], +) + +cpp_unittest( + name = "small_vector_test", + srcs = ["small_vector_test.cpp"], + headers = [], + supports_static_listing = False, + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:conv", + "//folly:small_vector", + "//folly:sorted_vector_types", + "//folly:traits", + "//folly/container:iterator", + "//folly/portability:gtest", + ], + external_deps = [ + ("boost", None, "boost_algorithm"), + ], +) + +cpp_unittest( + name = "socket_address_test", + srcs = ["SocketAddressTest.cpp"], + deps = [ + ":socket_address_test_helper", + "//folly:network_address", + "//folly:string", + "//folly/container:array", + "//folly/experimental:test_util", + "//folly/portability:gtest", + "//folly/portability:sockets", + ], +) + +cpp_library( + name = "socket_address_test_helper", + srcs = ["SocketAddressTestHelper.cpp"], + headers = ["SocketAddressTestHelper.h"], + deps = [ + "//folly/portability:sockets", + ], +) + +cpp_unittest( + name = "sorted_vector_types_test", + srcs = ["sorted_vector_test.cpp"], + headers = [], + deps = [ + "//folly:optional", + "//folly:range", + "//folly:small_vector", + "//folly:sorted_vector_types", + "//folly:utility", + "//folly/memory:malloc", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "spin_lock_test", + srcs = ["SpinLockTest.cpp"], + headers = [], + deps = [ + "//folly:random", + "//folly:spin_lock", + "//folly:utility", + "//folly/portability:asm", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "string_benchmark", + srcs = ["StringBenchmark.cpp"], + headers = [], + args = [ + "--json", + ], + deps = [ + "fbsource//third-party/fmt:fmt", + "//folly:benchmark", + "//folly:format", + "//folly:random", + "//folly:string", + ], + external_deps = [("boost", None, "boost_algorithm")], +) + +cpp_unittest( + name = "string_test", + srcs = ["StringTest.cpp"], + headers = [], + deps = [ + ":test_utils", + "//folly:fbvector", + "//folly:string", + "//folly/container:array", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ("boost", None, "boost_regex"), + ], +) + +cpp_benchmark( + name = "subprocess_bench", + srcs = ["SubprocessBench.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:file", + "//folly:subprocess", + ], +) + +cpp_unittest( + name = "subprocess_test", + srcs = ["SubprocessTest.cpp"], + headers = [], + resources = [ + ":subprocess_test_parent_death_helper", + ], + deps = [ + ":subprocess_test_parent_death_helper", # @manual + "//folly:exception", + "//folly:file_util", + "//folly:format", + "//folly:string", + "//folly:subprocess", + "//folly/experimental:test_util", + "//folly/experimental/io:fs_util", + "//folly/gen:base", + "//folly/gen:file", + "//folly/gen:string", + "//folly/portability:gtest", + "//folly/portability:unistd", + ], + external_deps = [ + "glog", + ("boost", None, "boost_container"), + ], +) + +cpp_binary( + name = "subprocess_test_parent_death_helper", + srcs = ["SubprocessTestParentDeathHelper.cpp"], + headers = [], + deps = [ + "//folly:conv", + "//folly:subprocess", + "//folly/portability:gflags", + "//folly/portability:unistd", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "synchronized_test", + srcs = ["SynchronizedTest.cpp"], + headers = [], + deps = [ + ":synchronized_test_lib", + "//folly:function", + "//folly:portability", + "//folly:scope_guard", + "//folly:shared_mutex", + "//folly:spin_lock", + "//folly:synchronized", + "//folly/portability:gtest", + "//folly/synchronization:distributed_mutex", + "//folly/synchronization:rw_spin_lock", + ], +) + +cpp_benchmark( + name = "synchronized_benchmark", + srcs = ["SynchronizedBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:synchronized", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "synchronized_ptr_test", + srcs = ["SynchronizedPtrTest.cpp"], + headers = [], + deps = [ + "//folly:optional", + "//folly:replaceable", + "//folly:synchronized_ptr", + "//folly/portability:gtest", + "//folly/synchronization:rw_spin_lock", + ], +) + +cpp_library( + name = "synchronized_test_lib", + headers = [ + "SynchronizedTestLib.h", + "SynchronizedTestLib-inl.h", + ], + exported_deps = [ + "//folly:random", + "//folly:synchronized", + "//folly/container:foreach", + "//folly/portability:gtest", + ], + exported_external_deps = [ + "glog", + ], +) + +cpp_library( + name = "test_utils", + headers = ["TestUtils.h"], + exported_deps = [ + "//folly:conv", + "//folly:exception_string", + "//folly:fbstring", + "//folly:fixed_string", + "//folly:range", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "thread_cached_int_test", + srcs = ["ThreadCachedIntTest.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:thread_cached_int", + "//folly/container:foreach", + "//folly/hash:hash", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/system:thread_id", + ], + external_deps = [ + "glog", + ], +) + +cpp_binary( + name = "thread_local_benchmark", + srcs = ["ThreadLocalBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:thread_local", + "//folly/experimental/io:fs_util", + "//folly/portability:gflags", + ], + external_deps = [ + "glog", + ("boost", None, "boost_thread"), + ], +) + +cpp_binary( + name = "thread_local_access_benchmark", + srcs = ["ThreadLocalAccessBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:thread_local", + ], +) + +cpp_binary( + name = "thread_local_destroy_benchmark", + srcs = ["ThreadLocalDestroyBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:thread_local", + ], +) + +cpp_binary( + name = "thread_local_test_lib.so", + srcs = ["ThreadLocalTestLib.cpp"], + headers = [], + dlopen_enabled = True, + deps = [ + "//folly:thread_local", + ], +) + +cpp_unittest( + name = "thread_local_test", + srcs = ["ThreadLocalTest.cpp"], + headers = [], + resources = [ + ":thread_local_test_lib.so", + ], + deps = [ + "//folly:memory", + "//folly:thread_local", + "//folly/experimental:test_util", + "//folly/experimental/io:fs_util", + "//folly/lang:keep", + "//folly/portability:gtest", + "//folly/portability:unistd", + "//folly/synchronization:baton", + "//folly/system:thread_id", + ], + external_deps = [ + "glog", + ("boost", None, "boost_thread"), + ("glibc", None, "dl"), + ], +) + +cpp_unittest( + name = "timeout_queue_test", + srcs = ["TimeoutQueueTest.cpp"], + headers = [], + deps = [ + "//folly:timeout_queue", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "token_bucket_test", + srcs = ["TokenBucketTest.cpp"], + headers = ["TokenBucketTest.h"], + supports_static_listing = False, + deps = [ + "//folly:string", + "//folly:token_bucket", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "traits_test", + srcs = ["TraitsTest.cpp"], + headers = [], + default_strip_mode = "full", + deps = [ + "//folly:cpp_attributes", + "//folly:scope_guard", + "//folly:traits", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "try_test", + srcs = ["TryTest.cpp"], + headers = [], + deps = [ + "//folly:memory", + "//folly:traits", + "//folly:try", + "//folly/lang:exception", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "unit_test", + srcs = ["UnitTest.cpp"], + headers = [], + deps = [ + "//folly:unit", + "//folly/portability:gtest", + ], +) + +cpp_benchmark( + name = "uri_benchmark", + srcs = ["UriBenchmark.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:uri", + "//folly/init:init", + ], +) + +cpp_unittest( + name = "uri_test", + srcs = ["UriTest.cpp"], + headers = [], + deps = [ + "//folly:uri", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ("boost", None, "boost_algorithm"), + ], +) + +cpp_unittest( + name = "utf8_string_test", + srcs = ["UTF8StringTest.cpp"], + headers = [], + deps = [ + ":test_utils", + "//folly:range", + "//folly:utf8_string", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "utility_test", + srcs = ["UtilityTest.cpp"], + deps = [ + "//folly:utility", + "//folly/lang:keep", + "//folly/portability:gtest", + ], +) + +cpp_unittest( + name = "varint_test", + srcs = ["VarintTest.cpp"], + headers = [], + deps = [ + "//folly:benchmark", + "//folly:random", + "//folly:varint", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) + +cpp_library( + name = "json_mock_util", + headers = [ + "JsonMockUtil.h", + ], + exported_deps = [ + "//folly/json:json_mock_util", + ], +) + +cpp_library( + name = "json_test_util", + headers = [ + "JsonTestUtil.h", + ], + exported_deps = [ + "//folly/json:json_test_util", + ], +) + +cpp_unittest( + name = "test_utils_test", + srcs = ["TestUtilsTest.cpp"], + headers = [], + deps = [ + ":test_utils", + "//folly/portability:gmock", + "//folly/portability:gtest", + ], +) + +cpp_library( + name = "comparison_operator_test_util", + headers = ["ComparisonOperatorTestUtil.h"], + exported_deps = [ + "//folly/portability:gtest", + ], +) diff --git a/folly/test/common/BUCK b/folly/test/common/BUCK new file mode 100644 index 00000000000..7c6fd9e481f --- /dev/null +++ b/folly/test/common/BUCK @@ -0,0 +1,17 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") + +oncall("fbcode_entropy_wardens_folly") + +cpp_binary( + name = "test_main", + srcs = ["TestMain.cpp"], + deps = [ + "//folly:portability", + "//folly/init:init", + "//folly/portability:gflags", + "//folly/portability:gtest", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/test/facebook/BUCK b/folly/test/facebook/BUCK new file mode 100644 index 00000000000..34adf8bbba3 --- /dev/null +++ b/folly/test/facebook/BUCK @@ -0,0 +1,16 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") + +oncall("fbcode_entropy_wardens_folly") + +cpp_binary( + name = "jsonfuzztest.so", + srcs = ["JsonFuzzTest.cpp"], + headers = [], + dlopen_enabled = True, + deps = [ + "//common/testing/fuzztest:fuzz_main", # @manual + "//common/testing/fuzztest:headers", + "//folly/json:dynamic", + "//folly/portability:gtest", + ], +) diff --git a/folly/test/function_benchmark/BUCK b/folly/test/function_benchmark/BUCK new file mode 100644 index 00000000000..5a450793fa7 --- /dev/null +++ b/folly/test/function_benchmark/BUCK @@ -0,0 +1,29 @@ +load("@fbcode_macros//build_defs:cpp_benchmark.bzl", "cpp_benchmark") + +oncall("fbcode_entropy_wardens_folly") + +cpp_benchmark( + name = "function_benchmark", + srcs = [ + "benchmark_impl.cpp", + "main.cpp", + "test_functions.cpp", + ], + headers = [ + "benchmark_impl.h", + "test_functions.h", + ], + args = [ + "--json", + ], + deps = [ + "//folly:benchmark", + "//folly:function", + "//folly:scope_guard", + "//folly/lang:exception", + "//folly/portability:gflags", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/test/stl_tests/BUCK b/folly/test/stl_tests/BUCK new file mode 100644 index 00000000000..4fdff2ee146 --- /dev/null +++ b/folly/test/stl_tests/BUCK @@ -0,0 +1,23 @@ +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "stl_vector_test", + srcs = ["StlVectorTest.cpp"], + deps = [ + "//folly:conv", + "//folly:fbvector", + "//folly:portability", + "//folly:scope_guard", + "//folly/chrono:hardware", + "//folly/lang:pretty", + "//folly/portability:gflags", + "//folly/portability:gtest", + "//folly/test:test_utils", + ], + external_deps = [ + "boost", + ("boost", None, "boost_preprocessor"), + ], +) diff --git a/folly/tool/BUCK b/folly/tool/BUCK new file mode 100644 index 00000000000..5ba3eb93a2e --- /dev/null +++ b/folly/tool/BUCK @@ -0,0 +1,14 @@ +load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") + +oncall("fbcode_entropy_wardens_folly") + +cpp_binary( + name = "benchmark_compare", + srcs = ["BenchmarkCompare.cpp"], + deps = [ + "//folly:benchmark", + "//folly:file_util", + "//folly/init:init", + "//folly/json:dynamic", + ], +) diff --git a/folly/tracing/BUCK b/folly/tracing/BUCK new file mode 100644 index 00000000000..b6660e4a05b --- /dev/null +++ b/folly/tracing/BUCK @@ -0,0 +1,46 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") + +oncall("fbcode_entropy_wardens_folly") + +cpp_library( + name = "static_tracepoint", + headers = [ + "StaticTracepoint.h", + "StaticTracepoint-ELFx86.h", + ], + exported_deps = [ + "//folly/portability:config", + ], +) + +cpp_library( + name = "scoped_trace_section", + headers = [ + "ScopedTraceSection.h", + ], +) + +cpp_library( + name = "async_stack", + srcs = [ + "AsyncStack.cpp", + ], + headers = [ + "AsyncStack.h", + "AsyncStack-inl.h", + ], + deps = [ + "//folly:likely", + "//folly/lang:hint", + "//folly/portability:pthread", + ], + exported_deps = [ + "//folly:c_portability", + "//folly:cpp_attributes", + "//folly:portability", + "//folly/experimental/coro:coroutine", + ], + external_deps = [ + "glog", + ], +) diff --git a/folly/tracing/test/BUCK b/folly/tracing/test/BUCK new file mode 100644 index 00000000000..c9e512d1f93 --- /dev/null +++ b/folly/tracing/test/BUCK @@ -0,0 +1,48 @@ +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest") + +oncall("fbcode_entropy_wardens_folly") + +cpp_unittest( + name = "async_stack_test", + srcs = ["AsyncStackTest.cpp"], + deps = [ + "//folly/portability:gtest", + "//folly/tracing:async_stack", + ], + external_deps = [ + "glog", + ], +) + +cpp_unittest( + name = "static_tracepoint_test", + srcs = ["StaticTracepointTest.cpp"], + deps = [ + ":static_tracepoint_test_module", + "//folly:conv", + "//folly:format", + "//folly:random", + "//folly:string", + "//folly:subprocess", + "//folly/experimental/symbolizer/detail:debug", + "//folly/lang:bits", + "//folly/portability:filesystem", + "//folly/portability:gtest", + "//folly/portability:unistd", + "//folly/tracing:static_tracepoint", + ], +) + +cpp_library( + name = "static_tracepoint_test_module", + srcs = [ + "StaticTracepointTestModule.cpp", + ], + headers = [ + "StaticTracepointTestModule.h", + ], + deps = [ + "//folly/tracing:static_tracepoint", + ], +) diff --git a/shim/.buckconfig b/shim/.buckconfig new file mode 100644 index 00000000000..e69de29bb2d diff --git a/shim/.gitignore b/shim/.gitignore new file mode 100644 index 00000000000..a1412f7fa8e --- /dev/null +++ b/shim/.gitignore @@ -0,0 +1,5 @@ +# We currently expect end users to run reindeer vendor themselves +# so mark these things as to ignore +/third-party/rust/.cargo/ +/third-party/rust/BUCK +/third-party/rust/vendor/ diff --git a/shim/BUCK b/shim/BUCK new file mode 100644 index 00000000000..9e740dde55d --- /dev/null +++ b/shim/BUCK @@ -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() diff --git a/shim/README.md b/shim/README.md new file mode 100644 index 00000000000..7a83226e02a --- /dev/null +++ b/shim/README.md @@ -0,0 +1,4 @@ +# Open Source Shim + +These files are a shim that allow us to build Buck2 with Buck2 outside Meta in +the open source world. diff --git a/shim/buck2/buck_rust_binary.bzl b/shim/buck2/buck_rust_binary.bzl new file mode 100644 index 00000000000..aad0fdab72b --- /dev/null +++ b/shim/buck2/buck_rust_binary.bzl @@ -0,0 +1,13 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +load( + "//:shims.bzl", + _rust_binary = "rust_binary", +) + +buck_rust_binary = _rust_binary diff --git a/shim/buck2/proto_defs.bzl b/shim/buck2/proto_defs.bzl new file mode 100644 index 00000000000..5cafa19acc3 --- /dev/null +++ b/shim/buck2/proto_defs.bzl @@ -0,0 +1,13 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +load( + "//:shims.bzl", + _rust_protobuf_library = "rust_protobuf_library", +) + +rust_protobuf_library = _rust_protobuf_library diff --git a/shim/build_defs/cpp_library.bzl b/shim/build_defs/cpp_library.bzl new file mode 100644 index 00000000000..1e2d7877d3a --- /dev/null +++ b/shim/build_defs/cpp_library.bzl @@ -0,0 +1,10 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +load("//:shims.bzl", _cpp_library = "cpp_library") + +cpp_library = _cpp_library diff --git a/shim/build_defs/custom_unittest.bzl b/shim/build_defs/custom_unittest.bzl new file mode 100644 index 00000000000..f5aa4cf8f06 --- /dev/null +++ b/shim/build_defs/custom_unittest.bzl @@ -0,0 +1,9 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +def custom_unittest(**_): + pass diff --git a/shim/build_defs/export_files.bzl b/shim/build_defs/export_files.bzl new file mode 100644 index 00000000000..b34d9a4b6a6 --- /dev/null +++ b/shim/build_defs/export_files.bzl @@ -0,0 +1,10 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +def export_file(visibility = ["PUBLIC"], **kwargs): + # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode" + native.export_file(visibility = visibility, **kwargs) diff --git a/shim/build_defs/lib/python_common.bzl b/shim/build_defs/lib/python_common.bzl new file mode 100644 index 00000000000..44dc7574685 --- /dev/null +++ b/shim/build_defs/lib/python_common.bzl @@ -0,0 +1,14 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +def get_ldflags(*args): + _unused = args # @unused + return [] + +def get_strip_mode(*args): + _unused = args # @unused + return "" diff --git a/shim/build_defs/native_rules.bzl b/shim/build_defs/native_rules.bzl new file mode 100644 index 00000000000..fb9bddda7e9 --- /dev/null +++ b/shim/build_defs/native_rules.bzl @@ -0,0 +1,22 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +def buck_genrule(visibility = ["PUBLIC"], **kwargs): + # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode" + native.genrule(visibility = visibility, **kwargs) + +def buck_command_alias(**_): + pass + +def buck_filegroup(visibility = ["PUBLIC"], **kwargs): + # @lint-ignore BUCKLINT: avoid "native is forbidden in fbcode" + native.filegroup(visibility = visibility, **kwargs) + +def alias(actual, visibility = ["PUBLIC"], **kwargs): + if actual.startswith("//buck2/"): + actual = "root//" + actual.removeprefix("//buck2/") + native.alias(actual = actual, visibility = visibility, **kwargs) diff --git a/shim/build_defs/ocaml_binary.bzl b/shim/build_defs/ocaml_binary.bzl new file mode 100644 index 00000000000..d5fd250f07a --- /dev/null +++ b/shim/build_defs/ocaml_binary.bzl @@ -0,0 +1,10 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +load("//:shims.bzl", _ocaml_binary = "ocaml_binary") + +ocaml_binary = _ocaml_binary diff --git a/shim/build_defs/platform_utils.bzl b/shim/build_defs/platform_utils.bzl new file mode 100644 index 00000000000..2ea71572f96 --- /dev/null +++ b/shim/build_defs/platform_utils.bzl @@ -0,0 +1,11 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +def _get_cxx_platform_for_base_path(_base_path): + return struct(target_platform = None) + +platform_utils = struct(get_cxx_platform_for_base_path = _get_cxx_platform_for_base_path) diff --git a/shim/build_defs/python_binary.bzl b/shim/build_defs/python_binary.bzl new file mode 100644 index 00000000000..5805fc30bd2 --- /dev/null +++ b/shim/build_defs/python_binary.bzl @@ -0,0 +1,12 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +def python_binary(srcs = [], **kwargs): + _unused = srcs # @unused + + # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." + native.python_binary(**kwargs) diff --git a/shim/build_defs/rust_binary.bzl b/shim/build_defs/rust_binary.bzl new file mode 100644 index 00000000000..188df9aa23f --- /dev/null +++ b/shim/build_defs/rust_binary.bzl @@ -0,0 +1,10 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +load("//:shims.bzl", _rust_binary = "rust_binary") + +rust_binary = _rust_binary diff --git a/shim/build_defs/rust_library.bzl b/shim/build_defs/rust_library.bzl new file mode 100644 index 00000000000..da9da2f0cd0 --- /dev/null +++ b/shim/build_defs/rust_library.bzl @@ -0,0 +1,10 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +load("//:shims.bzl", _rust_library = "rust_library") + +rust_library = _rust_library diff --git a/shim/build_defs/rust_unittest.bzl b/shim/build_defs/rust_unittest.bzl new file mode 100644 index 00000000000..17f03052fd1 --- /dev/null +++ b/shim/build_defs/rust_unittest.bzl @@ -0,0 +1,10 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +load("//:shims.bzl", _rust_unittest = "rust_unittest") + +rust_unittest = _rust_unittest diff --git a/shim/common/ocaml/interop/defs.bzl b/shim/common/ocaml/interop/defs.bzl new file mode 100644 index 00000000000..b8e7f978fe2 --- /dev/null +++ b/shim/common/ocaml/interop/defs.bzl @@ -0,0 +1,3 @@ +load("@root//defs.bzl", _RUST_FLAGS_2018 = "RUST_FLAGS_2018") + +RUST_FLAGS_2018 = _RUST_FLAGS_2018 diff --git a/shim/grpc_fb/codegen/buck_macros.bzl b/shim/grpc_fb/codegen/buck_macros.bzl new file mode 100644 index 00000000000..ed51cb69355 --- /dev/null +++ b/shim/grpc_fb/codegen/buck_macros.bzl @@ -0,0 +1,10 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +def grpc_library(**kwargs): + _unused = kwargs # @unused + pass diff --git a/shim/shims.bzl b/shim/shims.bzl new file mode 100644 index 00000000000..4bc98f9fef9 --- /dev/null +++ b/shim/shims.bzl @@ -0,0 +1,250 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +# @lint-ignore-every FBCODEBZLADDLOADS + +prelude = native + +_SELECT_TYPE = type(select({"DEFAULT": []})) + +def is_select(thing): + return type(thing) == _SELECT_TYPE + +def cpp_library( + deps = [], + external_deps = [], + undefined_symbols = None, + visibility = ["PUBLIC"], + **kwargs): + _unused = undefined_symbols # @unused + + prelude.cxx_library( + deps = _maybe_select_map(deps + external_deps_to_targets(external_deps), _fix_deps), + visibility = visibility, + preferred_linkage = "static", + **kwargs + ) + +def rust_library( + rustc_flags = [], + deps = [], + named_deps = None, + os_deps = None, + test_deps = None, + test_env = None, + test_os_deps = None, + autocargo = None, + unittests = None, + mapped_srcs = {}, + visibility = ["PUBLIC"], + **kwargs): + _unused = (test_deps, test_env, test_os_deps, named_deps, autocargo, unittests, visibility) # @unused + deps = _maybe_select_map(deps, _fix_deps) + mapped_srcs = _maybe_select_map(mapped_srcs, _fix_mapped_srcs) + if os_deps: + deps += _select_os_deps(_fix_dict_deps(os_deps)) + + # Reset visibility because internal and external paths are different. + visibility = ["PUBLIC"] + + prelude.rust_library( + rustc_flags = rustc_flags + [_CFG_BUCK_BUILD], + deps = deps, + visibility = visibility, + mapped_srcs = mapped_srcs, + **kwargs + ) + +def rust_binary( + rustc_flags = [], + deps = [], + autocargo = None, + unittests = None, + allocator = None, + default_strip_mode = None, + visibility = ["PUBLIC"], + **kwargs): + _unused = (unittests, allocator, default_strip_mode, autocargo) # @unused + deps = _maybe_select_map(deps, _fix_deps) + + # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." + prelude.rust_binary( + rustc_flags = rustc_flags + [_CFG_BUCK_BUILD], + deps = deps, + visibility = visibility, + **kwargs + ) + +def rust_unittest( + rustc_flags = [], + deps = [], + visibility = ["PUBLIC"], + **kwargs): + deps = _maybe_select_map(deps, _fix_deps) + + prelude.rust_test( + rustc_flags = rustc_flags + [_CFG_BUCK_BUILD], + deps = deps, + visibility = visibility, + **kwargs + ) + +def rust_protobuf_library( + name, + srcs, + build_script, + protos, + build_env = None, + deps = [], + test_deps = None, + doctests = True): + if build_env: + build_env = { + k: _fix_dep_in_string(v) + for k, v in build_env.items() + } + + build_name = name + "-build" + proto_name = name + "-proto" + + rust_binary( + name = build_name, + srcs = [build_script], + crate_root = build_script, + deps = [ + "fbsource//third-party/rust:tonic-build", + "//buck2/app/buck2_protoc_dev:buck2_protoc_dev", + ], + ) + + build_env = build_env or {} + build_env.update( + { + "PROTOC": "$(exe buck//third-party/proto:protoc)", + "PROTOC_INCLUDE": "$(location buck//third-party/proto:google_protobuf)", + }, + ) + + prelude.genrule( + name = proto_name, + srcs = protos + [ + "buck//third-party/proto:google_protobuf", + ], + out = ".", + cmd = "$(exe :" + build_name + ")", + env = build_env, + ) + + rust_library( + name = name, + srcs = srcs, + doctests = doctests, + env = { + # This is where prost looks for generated .rs files + "OUT_DIR": "$(location :{})".format(proto_name), + }, + test_deps = test_deps, + deps = [ + "fbsource//third-party/rust:prost", + "fbsource//third-party/rust:prost-types", + ] + (deps or []), + ) + + # For python tests only + for proto in protos: + prelude.export_file( + name = proto, + visibility = ["PUBLIC"], + ) + +def ocaml_binary( + deps = [], + visibility = ["PUBLIC"], + **kwargs): + deps = _maybe_select_map(deps, _fix_deps) + + prelude.ocaml_binary( + deps = deps, + visibility = visibility, + **kwargs + ) + +_CFG_BUCK_BUILD = "--cfg=buck_build" + +def _maybe_select_map(v, mapper): + if is_select(v): + return select_map(v, mapper) + return mapper(v) + +def _select_os_deps(xss: list[( + str, + list[str], +)]) -> Select: + d = { + "prelude//os:" + os: xs + for os, xs in xss + } + d["DEFAULT"] = [] + return select(d) + +def _fix_dict_deps(xss: list[( + str, + list[str], +)]) -> list[( + str, + list[str], +)]: + return [ + (k, _fix_deps(xs)) + for k, xs in xss + ] + +def _fix_mapped_srcs(xs: dict[str, str]): + # For reasons, this is source -> file path, which is the opposite of what + # it should be. + return {_fix_dep(k): v for (k, v) in xs.items()} + +def _fix_deps(xs: list[str]) -> list[str]: + return filter(None, map(_fix_dep, xs)) + +def _fix_dep(x: str) -> [ + None, + str, +]: + if x == "//common/rust/shed/fbinit:fbinit": + return "fbsource//third-party/rust:fbinit" + elif x == "//common/rust/shed/sorted_vector_map:sorted_vector_map": + return "fbsource//third-party/rust:sorted_vector_map" + elif x == "//watchman/rust/watchman_client:watchman_client": + return "fbsource//third-party/rust:watchman_client" + elif x.startswith("fbsource//third-party/rust:") or x.startswith(":"): + return x + elif x.startswith("//buck2/facebook/"): + return None + elif x.startswith("//buck2/"): + return "root//" + x.removeprefix("//buck2/") + elif x.startswith("fbcode//common/ocaml/interop/"): + return "root//" + x.removeprefix("fbcode//common/ocaml/interop/") + elif x.startswith("fbcode//third-party-buck/platform010/build/supercaml"): + return "shim//third-party/ocaml" + x.removeprefix("fbcode//third-party-buck/platform010/build/supercaml") + else: + fail("Dependency is unaccounted for `{}`.\n".format(x) + + "Did you forget 'oss-disable'?") + +def _fix_dep_in_string(x: str) -> str: + """Replace internal labels in string values such as env-vars.""" + return (x + .replace("//buck2/", "root//")) + +# Do a nasty conversion of e.g. ("supercaml", None, "ocaml-dev") to +# 'fbcode//third-party-buck/platform010/build/supercaml:ocaml-dev' +# (which will then get mapped to `shim//third-party/ocaml:ocaml-dev`). +def external_dep_to_target(t): + return "fbcode//third-party-buck/platform010/build/{}:{}".format(t[0], t[2]) + +def external_deps_to_targets(ts): + return [external_dep_to_target(t) for t in ts] diff --git a/shim/target_determinator/macros/ci.bzl b/shim/target_determinator/macros/ci.bzl new file mode 100644 index 00000000000..abbd47d8835 --- /dev/null +++ b/shim/target_determinator/macros/ci.bzl @@ -0,0 +1,26 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +def _lbl(*_args): + return "" + +def _package( + _values, + # starlark-lint-disable unused-argument + overwrite = False): # @unused + pass + +ci = struct( + package = _package, + linux = _lbl, + mac = _lbl, + windows = _lbl, + skip_test = _lbl, + aarch64 = _lbl, + mode = _lbl, + opt = _lbl, +) diff --git a/shim/third-party/macros/rust_third_party.bzl b/shim/third-party/macros/rust_third_party.bzl new file mode 100644 index 00000000000..f6a0bd3d227 --- /dev/null +++ b/shim/third-party/macros/rust_third_party.bzl @@ -0,0 +1,11 @@ +# @nolint + +def third_party_rust_prebuilt_cxx_library(name, **kwargs): + # FIXME: This should probably be a fixup.toml, but it currently can't be expressed. + # The windows-sys crate does -lwindows to find windows. We pass libwindows.a on the command line, + # which resolves the symbols, but the linker still needs to "find" windows, so we also put its + # directory on the link options. + if name.endswith("libwindows.a"): + kwargs["exported_linker_flags"] = ["-Lshim/third-party/rust/" + kwargs["static_lib"].rpartition("/")[0]] + + native.prebuilt_cxx_library(name = name, **kwargs) diff --git a/shim/third-party/ocaml/BUCK b/shim/third-party/ocaml/BUCK new file mode 100644 index 00000000000..2343d7b5ee9 --- /dev/null +++ b/shim/third-party/ocaml/BUCK @@ -0,0 +1,7 @@ +# @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." +prebuilt_cxx_library( + name = "ocaml-dev", + header_dirs = ["opam/lib/ocaml"], + header_only = True, + visibility = ["PUBLIC"], +) diff --git a/shim/third-party/proto/BUCK b/shim/third-party/proto/BUCK new file mode 100644 index 00000000000..d8381b74dc0 --- /dev/null +++ b/shim/third-party/proto/BUCK @@ -0,0 +1,21 @@ +# @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." +load(":defs.bzl", "protoc_distribution") + +protoc_distribution( + name = "distribution", + version = "21.4", +) + +# @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." +alias( + name = "protoc", + actual = ":distribution[protoc]", + visibility = ["PUBLIC"], +) + +# @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." +alias( + name = "google_protobuf", + actual = ":distribution[google_protobuf]", + visibility = ["PUBLIC"], +) diff --git a/shim/third-party/proto/defs.bzl b/shim/third-party/proto/defs.bzl new file mode 100644 index 00000000000..18938c5a7fd --- /dev/null +++ b/shim/third-party/proto/defs.bzl @@ -0,0 +1,105 @@ +load("@prelude//http_archive/exec_deps.bzl", "HttpArchiveExecDeps") +load(":releases.bzl", "releases") + +ProtocReleaseInfo = provider(fields = [ + "version", + "url", + "sha256", +]) + +def _get_protoc_release( + version: str, + platform: str) -> ProtocReleaseInfo: + if not version in releases: + fail("Unknown protoc release version '{}'. Available versions: {}".format( + version, + ", ".join(releases.keys()), + )) + protoc_version = releases[version] + artifact = "protoc-{}-{}.zip".format(version, platform) + if not artifact in protoc_version: + fail("Unsupported platform '{}'. Available artifacts: {}".format( + platform, + ", ".join(protoc_version.keys()), + )) + protoc_artifact = protoc_version[artifact] + return ProtocReleaseInfo( + version = version, + url = protoc_artifact["url"], + sha256 = protoc_artifact["sha256"], + ) + +def _turn_http_archive_into_protoc_distribution( + providers: ProviderCollection, + protoc_filename: str) -> list[Provider]: + downloads = providers[DefaultInfo].sub_targets + include = downloads["include"][DefaultInfo] + protoc = downloads[protoc_filename][DefaultInfo] + + return [DefaultInfo( + sub_targets = { + "google_protobuf": [include], + "protoc": [ + protoc, + RunInfo(args = protoc.default_outputs[0]), + ], + }, + )] + +def _download_protoc_distribution_impl(ctx: AnalysisContext) -> Promise: + protoc_filename = "bin/protoc" + ctx.attrs.exe_extension + + # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." + return ctx.actions.anon_target(native.http_archive, { + "exec_deps": ctx.attrs._http_archive_exec_deps, + "sha256": ctx.attrs.sha256, + "sub_targets": [ + protoc_filename, + "include", + ], + "urls": [ctx.attrs.url], + }).promise.map(lambda providers: _turn_http_archive_into_protoc_distribution( + providers = providers, + protoc_filename = protoc_filename, + )) + +download_protoc_distribution = rule( + impl = _download_protoc_distribution_impl, + attrs = { + "exe_extension": attrs.string(), + "sha256": attrs.string(), + "url": attrs.string(), + "_http_archive_exec_deps": attrs.default_only(attrs.exec_dep(providers = [HttpArchiveExecDeps], default = "prelude//http_archive/tools:exec_deps")), + }, +) + +def _host_platform(): + os = host_info().os + arch = host_info().arch + if os.is_linux and arch.is_x86_64: + return "linux-x86_64" + elif os.is_linux and arch.is_aarch64: + return "linux-aarch_64" + elif os.is_macos and arch.is_x86_64: + return "osx-x86_64" + elif os.is_macos and arch.is_aarch64: + return "osx-aarch_64" + elif os.is_windows and arch.is_x86_64: + return "win64" + else: + fail("Unknown platform: os={}, arch={}".format(os, arch)) + +def protoc_distribution( + name: str, + version: str, + platform: [None, str] = None): + if platform == None: + platform = _host_platform() + exe_extension = ".exe" if platform.startswith("win") else "" + release = _get_protoc_release(version, platform) + download_protoc_distribution( + name = name, + url = release.url, + sha256 = release.sha256, + exe_extension = exe_extension, + ) diff --git a/shim/third-party/proto/releases.bzl b/shim/third-party/proto/releases.bzl new file mode 100644 index 00000000000..153ca496e4c --- /dev/null +++ b/shim/third-party/proto/releases.bzl @@ -0,0 +1,46 @@ +# @generated +# Update with ./update.py > releases.bzl +releases = { + "21.4": { + "protoc-21.4-win32.zip": { + "url": "https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-win32.zip", + "sha256": "09760ff98f76ac30c8bca7433715c47161fe305bf41573a7cd00b0afcc518617" + }, + "protoc-21.4-osx-x86_64.zip": { + "url": "https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-osx-x86_64.zip", + "sha256": "27ac01aee3e8b95ebec017b7b3aee55d4eb095cbd2a5148d2a20350af006072e" + }, + "protoc-21.4-osx-universal_binary.zip": { + "url": "https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-osx-universal_binary.zip", + "sha256": "0cf1a340d1fa1366cdf22043e3f92e5374096647037020b405acea706438c603" + }, + "protoc-21.4-osx-aarch_64.zip": { + "url": "https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-osx-aarch_64.zip", + "sha256": "6a677c88a5e5b032aaff96767461788a316408d4ed0afef3f1455390a689ec18" + }, + "protoc-21.4-linux-x86_64.zip": { + "url": "https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-x86_64.zip", + "sha256": "d51e8f030162f08823a4738ab0ac00bee537e30b583a562e6962dbb040d86736" + }, + "protoc-21.4-linux-x86_32.zip": { + "url": "https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-x86_32.zip", + "sha256": "2101e3a4dd490625c15d31274a599e3bfb1f8c9fdd381ca9501da17bb6f7a3d2" + }, + "protoc-21.4-linux-s390_64.zip": { + "url": "https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-s390_64.zip", + "sha256": "e0b69b4242bf409c825d787669a4683d63320d6e52280750df971a3376e0af56" + }, + "protoc-21.4-linux-ppcle_64.zip": { + "url": "https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-ppcle_64.zip", + "sha256": "58c1be8ca89b8b2712f95a9dd9aeb174f8f479be9f55e71f6ffe0b0e83ef8be9" + }, + "protoc-21.4-linux-aarch_64.zip": { + "url": "https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-aarch_64.zip", + "sha256": "5a377b505cf8c3ed29ad0b6e3827c5eb27273c00147fcfd833b9686192143e8d" + }, + "protoc-21.4-win64.zip": { + "url": "https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-win64.zip", + "sha256": "090af381392abaf5fd8ae3070d8fc2a4ba2d0a9f8e52915d69b439c33be72da5" + } + } +} diff --git a/shim/third-party/proto/update.py b/shim/third-party/proto/update.py new file mode 100755 index 00000000000..cfee489f671 --- /dev/null +++ b/shim/third-party/proto/update.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python3 +"""Query recent Github release artifacts for protobuf. + +Use this script to update the releases.bzl file that contains metadata about +protoc releases. + +This script is not executed during the regular Buck2 build. +""" + +import aiohttp +import asyncio +from contextlib import asynccontextmanager +from copy import deepcopy +from gql import gql, Client +from gql.transport.aiohttp import AIOHTTPTransport +import hashlib +import json +import os + +GITHUB_GRAPHQL_URI = "https://api.github.com/graphql" +GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN") +GITHUB_QUERY = """\ +query { + repository(owner: "protocolbuffers", name: "protobuf") { + releases(last: 1) { + nodes { + tagName + releaseAssets(first: 100) { + nodes { + name + downloadUrl + } + } + } + } + } +} +""" + +async def query_releases(): + async with aiohttp.ClientSession(raise_for_status=True) as session: + assert GITHUB_TOKEN is not None, "Provide a Github API token in $GITHUB_TOKEN" + headers = {'Authorization': f'bearer {GITHUB_TOKEN}'} + body = {"query": GITHUB_QUERY} + async with session.post(GITHUB_GRAPHQL_URI, headers=headers, json=body) as resp: + response = await resp.json() + return response["data"] + + +def format_releases(releases): + return { + release["tagName"].strip("v"): { + asset["name"]: { + "url": asset["downloadUrl"], + } + for asset in release["releaseAssets"]["nodes"] + if asset["name"].startswith("protoc-") + } + for release in releases["repository"]["releases"]["nodes"] + } + + +async def fetch_sha256(session, url): + async with session.get(url) as resp: + hasher = hashlib.sha256() + async for chunk, _ in resp.content.iter_chunks(): + hasher.update(chunk) + return hasher.hexdigest() + + +async def hash_releases(releases): + async def hash_asset(session, version, name, url): + sha256 = await fetch_sha256(session, url) + return (version, name, sha256) + + tasks = [] + async with aiohttp.ClientSession() as session: + for version, assets in releases.items(): + for name, asset in assets.items(): + tasks.append(hash_asset(session, version, name, asset["url"])) + + result = deepcopy(releases) + hashes = await asyncio.gather(*tasks) + for version, name, sha256 in hashes: + result[version][name]["sha256"] = sha256 + + return result + + +async def main(): + releases = await query_releases() + formatted = format_releases(releases) + with_sha256 = await hash_releases(formatted) + print("# @" + "generated") + print("# Update with ./update.py > releases.bzl") + print("releases = ", json.dumps(with_sha256, indent=4)) + + +asyncio.run(main()) diff --git a/shim/third-party/rust/.gitignore b/shim/third-party/rust/.gitignore new file mode 100644 index 00000000000..c18f3dc437a --- /dev/null +++ b/shim/third-party/rust/.gitignore @@ -0,0 +1,31 @@ +# Ignore Cargo-related stuff +.cargo/registry +.cargo/git +/registry +/git +.package-cache + +# Various cruft in vendored packages +vendor/*/target +vendor/*/Cargo.lock +vendor/**/.buckconfig +vendor/**/BUCK +vendor/**/OWNERS +vendor/**/*~ +vendor/**/*.bzl +vendor/*/.github/** +vendor/*/.appveyor.yml +vendor/*/.travis.yml +/target/** + +# Bad Windows names - oh for case-insensitive regex matching! +vendor/**/[Aa][Uu][Xx] +vendor/**/[Aa][Uu][Xx].* +vendor/**/[Cc][Oo][Mm][1-9] +vendor/**/[Cc][Oo][Mm][1-9].* +vendor/**/[Cc][Oo][Nn] +vendor/**/[Cc][Oo][Nn].* +vendor/**/[Ll][Pp][Tt][1-9] +vendor/**/[Ll][Pp][Tt][1-9].* +vendor/**/[Nn][Uu][Ll] +vendor/**/[Nn][Uu][Ll].* diff --git a/shim/third-party/rust/Cargo.toml b/shim/third-party/rust/Cargo.toml new file mode 100644 index 00000000000..95749d12cbf --- /dev/null +++ b/shim/third-party/rust/Cargo.toml @@ -0,0 +1,225 @@ +# Definitions of third-party libraries used for buck2 build of buck2. +# This file is **not** used by cargo build of buck2. +# See the /docs/bootstrapping.md for more details. + +[workspace] + +[package] +# Pseudo-package whose dependencies are imported and buckified +name = "rust-third-party" +version = "0.0.0" +publish = false +edition = "2021" + +# Dummy target to keep Cargo happy +[[bin]] +name = "top" +path = "top/main.rs" + +# List of packages to be imported, with version constraints, features +# and all options Cargo supports. +[dependencies] + +gazebo = {version = "0.8.1", features = ["str_pattern_extensions"]} +fbinit = "0.1" +sorted_vector_map = "0.1" +watchman_client = "0.8.0" + +annotate-snippets = { version = "0.9.0", features = ["color"] } +anyhow = "1.0.65" +anymap = "0.12.1" +arc-swap = "1.6.0" +argfile = "0.1.0" +assert_matches = "1.5" +async-compression = { version = "0.4.1", features = ["tokio", "gzip", "zstd"] } +async-condvar-fair = { version = "0.2.2", features = ["parking_lot_0_11", "tokio"] } +async-recursion = "1.0" +async-scoped = { version = "0.8", features = ["use-tokio"] } +async-trait = "0.1.24" +atomic = "0.5.1" +backtrace = "0.3.51" +base64 = "0.13.0" +bincode = "1.3.3" +bitflags = "2.4" +blake3 = { version = "1.3.1", features = [ "default", "digest", "rayon", "std", "traits-preview" ] } +bstr = { version = "1.4.0", features = ["serde", "std", "unicode"] } +bumpalo = { version = "3.14.0", features = ["allocator_api", "collections"] } +byteorder = "1.4.3" +bytes = "1.0" +bytesize = "1.1.0" +chrono = "0.4.28" +clap = { package = "clap", version = "4.5.4", features = ["derive", "env", "string"] } +clap-3 = { package = "clap", version = "3.2.24", features = ["derive", "env", "regex", "unicode", "wrap_help"] } +common-path = "1.0.0" +compact_str = "0.6.1" +constant_time_eq = "0.2.4" +convert_case = "0.4.0" +criterion = { version = "0.3.1", features = [] } +crossbeam = "0.8" +crossbeam-channel = "0.5" +crossbeam-epoch = "0.9.7" +crossterm = "0.27" +csv = "1.1" +ctor = "0.1.16" +dashmap = "5.5.3" +debugserver-types = "0.5.0" +derivative = "2.2" +derive_more = "0.99.3" +digest = "0.10" +dirs = "3.0.1" +dunce = "1.0.2" +either = "1.8" +enum-iterator = "1.4.1" +enum-map = "0.6.3" +env_logger = "0.9.0" +equivalent = "1.0.0" +erased-serde = "0.3.20" +faccess = "0.2.3" +fancy-regex = "0.10.0" +flate2 = "1.0.22" +fnv = "1.0.7" +fs4 = { version = "0.6", features = ["sync"] } +futures = { version = "0.3.28", features = ["async-await", "compat"] } +futures-intrusive = "0.4" +fxhash = "0.2.1" +glob = "0.3.0" +globset = "0.4.10" +hashbrown = { version = "0.14.3", features = ["raw"] } +hex = "0.4.3" +higher-order-closure = "0.0.5" +hostname = "0.3.1" +http = "0.2" +httparse = "1.7.1" +httptest = "0.15" +humantime = "2.0.1" +hyper = { version = "0.14.26", features = ["client", "http1", "http2"] } +hyper-proxy = { git = "https://github.com/get9/hyper-proxy", rev = "205e9fee42d469444d654d9fa207897f4a77d5b6", features = ["rustls"], default_features = false } # branch = tokio-rustls-0.23 Many PRs to bump versions (#28, #30, #31) are several years old, possibly abandoned crate. This fork contains changes from #28 + changes to upgrade rustls to 0.21. +hyper-rustls = { version = "0.24.0", features = ["http2"] } +hyper-timeout = "0.4" +hyper-unix-connector = "0.2" +indent_write = "2.2.0" +indenter = "0.3.3" +indexmap = { version = "2.1.0", features = ["arbitrary", "rayon", "serde"] } +indoc = "1.0.3" +inferno = { version = "0.11.11", default-features = false } +internment = { version = "0.7", features = ["arc"] } +inventory = "0.3.8" +ipnetwork = "0.20.0" +is_proc_translated = "0.1.1" +itertools = "0.10.3" +jemallocator = { version = "0.5.0", features = ["profiling"] } +lalrpop = { version = "0.19.7", artifact = "bin", features = ["pico-args"] } +lalrpop-util = "0.19.7" +libc = "0.2.132" +linked-hash-map = { version = "0.5", features = ["serde_impl"] } +linkme = { version = "0.3.17", features = ["used_linker"] } +log = "0.4" +logos = "0.12" +lsp-server = "0.7.2" +lsp-types = "0.94.1" +maplit = "1.0.2" +mappable-rc = { version = "0.1.1", features = ["std"] } +md-5 = "0.10" +memchr = "2.4.1" +memmap2 = "0.5.0" +memoffset = "0.6.4" +multimap = "0.8.2" +nix = "0.22" +nom = "7.1.3" +notify = "=5.0.0-pre.16" +num-bigint = "0.4.3" +num-traits = "0.2" +num_cpus = "1.11" +num_enum = "0.5" +object = "0.29.0" +once_cell = "1.8" +os_str_bytes = { version = "6.6.0", features = ["conversions"] } +parking_lot = { version = "0.11.2", features = ["send_guard"] } +paste = "1.0" +pathdiff = "0.2" +perf-event = "0.4" +perf-event-open-sys = "4.0" +pin-project = "0.4.29" +plist = "0.5" +pretty_assertions = "1.2.1" +proc-macro2 = { version = "1.0.70", features = ["span-locations"] } +prost = "0.11.9" +prost-build = "0.11.9" +prost-derive = "0.11.9" +prost-types = "0.11.9" +protoc-bin-vendored = "3.0.0" +psutil = "3.2" +quote = "1.0.3" +rand = { version = "0.8.4", features = ["small_rng"] } +rand_chacha = "0.3" +rand_distr = "0.4" +ref-cast = "1.0.0" +regex = "1.5.4" +relative-path = { version = "1.7.0", features = ["serde"] } +ring = "=0.17.5" # Upgrading this is possible, but a pain, so we don't want to pick up every new minor version +rusqlite = { version = "0.29.0", features = ["bundled"] } +rustc-hash = "1.1.0" +rustls = "0.21.0" +rustls-native-certs = { package = "rustls-native-certs", version = "0.6.2" } +rustls-pemfile = { package = "rustls-pemfile", version = "1.0.0" } +rustyline = "11.0" +scopeguard = "1.0.0" +sequence_trie = "0.3.6" +serde = { version = "1.0.173", features = ["derive", "rc"] } +serde_json = "1.0.48" +sha1 = "0.10" +sha2 = "0.10" +shlex = "1.3" +similar = { version = "2.2.0", features = ["inline"] } +siphasher = "0.3.3" +slab = "0.4.7" +slog = "2.7.0" +smallvec = { version = "1.10", features = ["const_generics", "const_new", "serde", "specialization", "union", "write"] } +static_assertions = "1.1.0" +strsim = "0.10.0" +structopt = "0.3.23" +syn = { version = "2", features = ["extra-traits", "full", "visit"] } +syn1 = { package = "syn", version = "1.0.109", features = ["extra-traits", "fold", "full", "visit", "visit-mut"] } +synstructure = "0.12" +sync_wrapper = "0.1.0" +sys-info = "0.9.1" +sysinfo = "0.26.8" +take_mut = "0.2.2" +tar = "0.4.38" +tempfile = "3.1.0" +termimad = "0.20.1" +termios = "0.3" +termwiz = "0.18" +test-case = "3.1.0" +textwrap = { version = "0.11", features = ["term_size"] } +thiserror = "1.0.36" +threadpool = "1.8.1" +tokio = { version = "1.25.0", features = ["full", "test-util", "tracing"] } +tokio-rustls = { package = "tokio-rustls", version = "0.24.0", features = ["dangerous_configuration"] } +tokio-stream = { version = "0.1.14", features = ["fs", "io-util", "net", "sync", "time", "signal"] } +tokio-util = { version = "0.6", features = ["full"] } +toml = "0.5" +tonic = { version = "0.9.2", features = ["tls", "tls-webpki-roots"] } +tonic-build = { version = "0.9.2", features = ["prost", "cleanup-markdown"] } +tower = "0.4" +tower-layer = "0.3.1" +tower-service = "0.3.2" +tracing = "0.1.22" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } +triomphe = "0.1.11" +trybuild = "1.0.56" +twox-hash = "1.6.1" +unicode-segmentation = "1.7" +uuid = { version = "1.2", features = ["v4"] } +walkdir = "2.3.2" +which = "4.3.0" +windows_x86_64_msvc = "=0.48.0" # our fixup only works if we are on precisely 0.48.0 +winapi = { version = "0.3", features = ["everything"] } +xattr = "0.2.2" +zip = "0.5" +zstd = "0.13.0" + +[patch.crates-io] +# For https://github.com/jimblandy/perf-event/pull/29 +perf-event = { git = "https://github.com/krallin/perf-event.git", rev = "86224a9bc025d5d19f719542f27c8c629a08b167", version = "0.4" } +perf-event-open-sys = { git = "https://github.com/krallin/perf-event.git", rev = "86224a9bc025d5d19f719542f27c8c629a08b167", version = "4.0" } diff --git a/shim/third-party/rust/defs.bzl b/shim/third-party/rust/defs.bzl new file mode 100644 index 00000000000..6d295fdd565 --- /dev/null +++ b/shim/third-party/rust/defs.bzl @@ -0,0 +1,7 @@ +def rust_library_from_crates(name): + # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." + native.export_file(name = name, src = "BUCK", visibility = ["PUBLIC"]) + +def rust_binary_from_crates(name): + # @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed." + native.genrule(name = name, cmd = "exit 1", executable = True, out = "out", visibility = ["PUBLIC"]) diff --git a/shim/third-party/rust/fixups/ahash/fixups.toml b/shim/third-party/rust/fixups/ahash/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/ahash/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/anyhow/fixups.toml b/shim/third-party/rust/fixups/anyhow/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/anyhow/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/async-trait/fixups.toml b/shim/third-party/rust/fixups/async-trait/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/async-trait/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/atomic/fixups.toml b/shim/third-party/rust/fixups/atomic/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/atomic/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/axum-core/fixups.toml b/shim/third-party/rust/fixups/axum-core/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/axum-core/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/axum/fixups.toml b/shim/third-party/rust/fixups/axum/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/axum/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/backtrace/fixups.toml b/shim/third-party/rust/fixups/backtrace/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/backtrace/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/blake3/fixups.toml b/shim/third-party/rust/fixups/blake3/fixups.toml new file mode 100644 index 00000000000..389fd57acfc --- /dev/null +++ b/shim/third-party/rust/fixups/blake3/fixups.toml @@ -0,0 +1,81 @@ +buildscript = [] + +## The various X86 platform fixups + +[platform_fixup.'cfg(target_arch = "x86_64")'] +cfgs = ["blake3_sse2_ffi", "blake3_sse41_ffi", "blake3_avx2_ffi", "blake3_avx512_ffi"] +buildscript = [] + +# , any(target_env = "fbcode", target_env = "gnu") +[[platform_fixup.'cfg(all(target_arch = "x86_64", any(target_os = "linux", target_os = "macos")))'.buildscript]] +[platform_fixup.'cfg(all(target_arch = "x86_64", any(target_os = "linux", target_os = "macos")))'.buildscript.cxx_library] +name = "simd_x86_unix" +srcs = [ + "c/blake3.c", + "c/blake3_dispatch.c", + "c/blake3_portable.c", + "c/blake3_sse2_x86-64_unix.S", + "c/blake3_sse41_x86-64_unix.S", + "c/blake3_avx2_x86-64_unix.S", + "c/blake3_avx512_x86-64_unix.S" +] +# Older versions of Clang require these flags, even for assembly. See +# https://github.com/BLAKE3-team/BLAKE3/issues/79. +compiler_flags = ["-mavx512f", "-mavx512vl"] +headers = ["c/*.h"] +compatible_with = [ + "prelude//os/constraints:linux", + "prelude//os/constraints:macos", +] + +[[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "gnu"))'.buildscript]] +[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "gnu"))'.buildscript.cxx_library] +name = "simd_x86_windows_gnu" +srcs = [ + "c/blake3.c", + "c/blake3_dispatch.c", + "c/blake3_portable.c", + "c/blake3_sse2_x86-64_windows_gnu.S", + "c/blake3_sse41_x86-64_windows_gnu.S", + "c/blake3_avx2_x86-64_windows_gnu.S", + "c/blake3_avx512_x86-64_windows_gnu.S" +] +# Older versions of Clang require these flags, even for assembly. See +# https://github.com/BLAKE3-team/BLAKE3/issues/79. +compiler_flags = ["-mavx512f", "-mavx512vl"] +headers = ["c/*.h"] +compatible_with = ["prelude//os/constraints:windows"] + +[[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "msvc"))'.buildscript]] +[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "msvc"))'.buildscript.cxx_library] +name = "simd_x86_windows_msvc" +srcs = [ + "c/blake3.c", + "c/blake3_dispatch.c", + "c/blake3_portable.c", + "c/blake3_sse2_x86-64_windows_msvc.asm", + "c/blake3_sse41_x86-64_windows_msvc.asm", + "c/blake3_avx2_x86-64_windows_msvc.asm", + "c/blake3_avx512_x86-64_windows_msvc.asm" +] +headers = ["c/*.h"] +compatible_with = ["prelude//os/constraints:windows"] + +## ARM and AArch64 fixups + +[platform_fixup.'cfg(any(target_arch = "aarch64", target_arch = "arm"))'] +cfgs = ["blake3_neon"] +buildscript = [] + +[[platform_fixup.'cfg(target_arch = "aarch64")'.buildscript]] +[platform_fixup.'cfg(target_arch = "aarch64")'.buildscript.cxx_library] +name = "simd_neon-aarch64" +srcs = ["c/blake3_neon.c"] +headers = ["c/*.h"] + +[[platform_fixup.'cfg(target_arch = "arm")'.buildscript]] +[platform_fixup.'cfg(target_arch = "arm")'.buildscript.cxx_library] +name = "simd_neon-armv7" +srcs = ["c/blake3_neon.c"] +compiler_flags = ["-mfpu=neon-vfpv4", "-mfloat-abi=hard"] +headers = ["c/*.h"] diff --git a/shim/third-party/rust/fixups/bumpalo/fixups.toml b/shim/third-party/rust/fixups/bumpalo/fixups.toml new file mode 100644 index 00000000000..edd9a2079bd --- /dev/null +++ b/shim/third-party/rust/fixups/bumpalo/fixups.toml @@ -0,0 +1 @@ +extra_srcs = ["README.md"] diff --git a/shim/third-party/rust/fixups/bzip2-sys/fixups.toml b/shim/third-party/rust/fixups/bzip2-sys/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/bzip2-sys/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/clap/fixups.toml b/shim/third-party/rust/fixups/clap/fixups.toml new file mode 100644 index 00000000000..ee94fdc2f29 --- /dev/null +++ b/shim/third-party/rust/fixups/clap/fixups.toml @@ -0,0 +1 @@ +omit_features = ["deprecated"] diff --git a/shim/third-party/rust/fixups/clap_builder/fixups.toml b/shim/third-party/rust/fixups/clap_builder/fixups.toml new file mode 100644 index 00000000000..edd9a2079bd --- /dev/null +++ b/shim/third-party/rust/fixups/clap_builder/fixups.toml @@ -0,0 +1 @@ +extra_srcs = ["README.md"] diff --git a/shim/third-party/rust/fixups/clap_derive/fixups.toml b/shim/third-party/rust/fixups/clap_derive/fixups.toml new file mode 100644 index 00000000000..ee94fdc2f29 --- /dev/null +++ b/shim/third-party/rust/fixups/clap_derive/fixups.toml @@ -0,0 +1 @@ +omit_features = ["deprecated"] diff --git a/shim/third-party/rust/fixups/core-foundation-sys/fixups.toml b/shim/third-party/rust/fixups/core-foundation-sys/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/core-foundation-sys/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/crc32fast/fixups.toml b/shim/third-party/rust/fixups/crc32fast/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/crc32fast/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/criterion/fixups.toml b/shim/third-party/rust/fixups/criterion/fixups.toml new file mode 100644 index 00000000000..41439d3356a --- /dev/null +++ b/shim/third-party/rust/fixups/criterion/fixups.toml @@ -0,0 +1 @@ +cargo_env = true diff --git a/shim/third-party/rust/fixups/crossbeam-epoch/fixups.toml b/shim/third-party/rust/fixups/crossbeam-epoch/fixups.toml new file mode 100644 index 00000000000..3510928422a --- /dev/null +++ b/shim/third-party/rust/fixups/crossbeam-epoch/fixups.toml @@ -0,0 +1,2 @@ +buildscript = [] +cargo_env = true diff --git a/shim/third-party/rust/fixups/crossbeam-queue/fixups.toml b/shim/third-party/rust/fixups/crossbeam-queue/fixups.toml new file mode 100644 index 00000000000..3510928422a --- /dev/null +++ b/shim/third-party/rust/fixups/crossbeam-queue/fixups.toml @@ -0,0 +1,2 @@ +buildscript = [] +cargo_env = true diff --git a/shim/third-party/rust/fixups/crossbeam-utils/fixups.toml b/shim/third-party/rust/fixups/crossbeam-utils/fixups.toml new file mode 100644 index 00000000000..3510928422a --- /dev/null +++ b/shim/third-party/rust/fixups/crossbeam-utils/fixups.toml @@ -0,0 +1,2 @@ +buildscript = [] +cargo_env = true diff --git a/shim/third-party/rust/fixups/crunchy/fixups.toml b/shim/third-party/rust/fixups/crunchy/fixups.toml new file mode 100644 index 00000000000..ac9ebfb4af7 --- /dev/null +++ b/shim/third-party/rust/fixups/crunchy/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.gen_srcs] diff --git a/shim/third-party/rust/fixups/darwin-libproc-sys/fixups.toml b/shim/third-party/rust/fixups/darwin-libproc-sys/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/darwin-libproc-sys/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/debugserver-types/fixups.toml b/shim/third-party/rust/fixups/debugserver-types/fixups.toml new file mode 100644 index 00000000000..50645274fe7 --- /dev/null +++ b/shim/third-party/rust/fixups/debugserver-types/fixups.toml @@ -0,0 +1,2 @@ +extra_srcs = ["src/schema.json"] +cargo_env = true diff --git a/shim/third-party/rust/fixups/erased-serde/fixups.toml b/shim/third-party/rust/fixups/erased-serde/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/erased-serde/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/fs-err/fixups.toml b/shim/third-party/rust/fixups/fs-err/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/fs-err/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/fs4/fixups.toml b/shim/third-party/rust/fixups/fs4/fixups.toml new file mode 100644 index 00000000000..af7edb27e3b --- /dev/null +++ b/shim/third-party/rust/fixups/fs4/fixups.toml @@ -0,0 +1 @@ +extra_srcs = ["src/**/*.rs"] diff --git a/shim/third-party/rust/fixups/futures-channel/fixups.toml b/shim/third-party/rust/fixups/futures-channel/fixups.toml new file mode 100644 index 00000000000..3510928422a --- /dev/null +++ b/shim/third-party/rust/fixups/futures-channel/fixups.toml @@ -0,0 +1,2 @@ +buildscript = [] +cargo_env = true diff --git a/shim/third-party/rust/fixups/futures-core/fixups.toml b/shim/third-party/rust/fixups/futures-core/fixups.toml new file mode 100644 index 00000000000..3510928422a --- /dev/null +++ b/shim/third-party/rust/fixups/futures-core/fixups.toml @@ -0,0 +1,2 @@ +buildscript = [] +cargo_env = true diff --git a/shim/third-party/rust/fixups/futures-task/fixups.toml b/shim/third-party/rust/fixups/futures-task/fixups.toml new file mode 100644 index 00000000000..3510928422a --- /dev/null +++ b/shim/third-party/rust/fixups/futures-task/fixups.toml @@ -0,0 +1,2 @@ +buildscript = [] +cargo_env = true diff --git a/shim/third-party/rust/fixups/futures-util/fixups.toml b/shim/third-party/rust/fixups/futures-util/fixups.toml new file mode 100644 index 00000000000..3510928422a --- /dev/null +++ b/shim/third-party/rust/fixups/futures-util/fixups.toml @@ -0,0 +1,2 @@ +buildscript = [] +cargo_env = true diff --git a/shim/third-party/rust/fixups/generic-array/fixups.toml b/shim/third-party/rust/fixups/generic-array/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/generic-array/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/getrandom/fixups.toml b/shim/third-party/rust/fixups/getrandom/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/getrandom/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/httparse/fixups.toml b/shim/third-party/rust/fixups/httparse/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/httparse/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/hyper/fixups.toml b/shim/third-party/rust/fixups/hyper/fixups.toml new file mode 100644 index 00000000000..9118e9de767 --- /dev/null +++ b/shim/third-party/rust/fixups/hyper/fixups.toml @@ -0,0 +1,5 @@ +# reindeer cannot see through `cfg_proto!` macros and the like +extra_srcs = ["src/**/*.rs"] + +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/indexmap/fixups.toml b/shim/third-party/rust/fixups/indexmap/fixups.toml new file mode 100644 index 00000000000..4aa45eda12c --- /dev/null +++ b/shim/third-party/rust/fixups/indexmap/fixups.toml @@ -0,0 +1,2 @@ +buildscript = [] +cfgs = ["has_std"] diff --git a/shim/third-party/rust/fixups/io-lifetimes/fixups.toml b/shim/third-party/rust/fixups/io-lifetimes/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/io-lifetimes/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/jemalloc-sys/fixups.toml b/shim/third-party/rust/fixups/jemalloc-sys/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/jemalloc-sys/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/lalrpop/fixups.toml b/shim/third-party/rust/fixups/lalrpop/fixups.toml new file mode 100644 index 00000000000..41439d3356a --- /dev/null +++ b/shim/third-party/rust/fixups/lalrpop/fixups.toml @@ -0,0 +1 @@ +cargo_env = true diff --git a/shim/third-party/rust/fixups/lexical-core/fixups.toml b/shim/third-party/rust/fixups/lexical-core/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/lexical-core/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/libc/fixups.toml b/shim/third-party/rust/fixups/libc/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/libc/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/libm/fixups.toml b/shim/third-party/rust/fixups/libm/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/libm/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/libsqlite3-sys/fixups.toml b/shim/third-party/rust/fixups/libsqlite3-sys/fixups.toml new file mode 100644 index 00000000000..b82bb848a22 --- /dev/null +++ b/shim/third-party/rust/fixups/libsqlite3-sys/fixups.toml @@ -0,0 +1,19 @@ +# libsqlite3-sys uses a bindgen binding to libsqlite. +# We can't easily import bindgen because of its libclang dependency, +# so in the meantime we need to use pre-generated bindgen files. + +extra_mapped_srcs = {"sqlite3/bindgen_bundled_version.rs" = "src/bindgen.rs"} + +[env] +OUT_DIR = "." + +[[buildscript]] +[buildscript.cxx_library] +name = "sqlite3" +srcs = ["sqlite3/sqlite3.c"] +headers = ["sqlite3/*.h"] +preprocessor_flags = [ + "-DSQLITE_ENABLE_COLUMN_METADATA", + "-DSQLITE_ENABLE_FTS3", + "-DSQLITE_ENABLE_RTREE", +] diff --git a/shim/third-party/rust/fixups/lock_api/fixups.toml b/shim/third-party/rust/fixups/lock_api/fixups.toml new file mode 100644 index 00000000000..6c1a3d45a5a --- /dev/null +++ b/shim/third-party/rust/fixups/lock_api/fixups.toml @@ -0,0 +1,3 @@ +# the build script for lock_api is a version check for rust 1.61. +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/log/fixups.toml b/shim/third-party/rust/fixups/log/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/log/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/memchr/fixups.toml b/shim/third-party/rust/fixups/memchr/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/memchr/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/memoffset/fixups.toml b/shim/third-party/rust/fixups/memoffset/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/memoffset/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/mio/fixups.toml b/shim/third-party/rust/fixups/mio/fixups.toml new file mode 100644 index 00000000000..af7edb27e3b --- /dev/null +++ b/shim/third-party/rust/fixups/mio/fixups.toml @@ -0,0 +1 @@ +extra_srcs = ["src/**/*.rs"] diff --git a/shim/third-party/rust/fixups/native-tls/fixups.toml b/shim/third-party/rust/fixups/native-tls/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/native-tls/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/nix/fixups.toml b/shim/third-party/rust/fixups/nix/fixups.toml new file mode 100644 index 00000000000..1849ea069d2 --- /dev/null +++ b/shim/third-party/rust/fixups/nix/fixups.toml @@ -0,0 +1,2 @@ +buildscript = [] +extra_srcs = ["src/**/*.rs"] diff --git a/shim/third-party/rust/fixups/nom/fixups.toml b/shim/third-party/rust/fixups/nom/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/nom/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/ntapi/fixups.toml b/shim/third-party/rust/fixups/ntapi/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/ntapi/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/num-bigint/fixups.toml b/shim/third-party/rust/fixups/num-bigint/fixups.toml new file mode 100644 index 00000000000..df0b424f497 --- /dev/null +++ b/shim/third-party/rust/fixups/num-bigint/fixups.toml @@ -0,0 +1,5 @@ +[[buildscript]] +[buildscript.rustc_flags] + +[[buildscript]] +[buildscript.gen_srcs] diff --git a/shim/third-party/rust/fixups/num-integer/fixups.toml b/shim/third-party/rust/fixups/num-integer/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/num-integer/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/num-traits/fixups.toml b/shim/third-party/rust/fixups/num-traits/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/num-traits/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/parking_lot/fixups.toml b/shim/third-party/rust/fixups/parking_lot/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/parking_lot/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/parking_lot_core/fixups.toml b/shim/third-party/rust/fixups/parking_lot_core/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/parking_lot_core/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/paste/fixups.toml b/shim/third-party/rust/fixups/paste/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/paste/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/pest/fixups.toml b/shim/third-party/rust/fixups/pest/fixups.toml new file mode 100644 index 00000000000..af7edb27e3b --- /dev/null +++ b/shim/third-party/rust/fixups/pest/fixups.toml @@ -0,0 +1 @@ +extra_srcs = ["src/**/*.rs"] diff --git a/shim/third-party/rust/fixups/pin-project-internal/fixups.toml b/shim/third-party/rust/fixups/pin-project-internal/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/pin-project-internal/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/platforms/fixups.toml b/shim/third-party/rust/fixups/platforms/fixups.toml new file mode 100644 index 00000000000..e086791cd2f --- /dev/null +++ b/shim/third-party/rust/fixups/platforms/fixups.toml @@ -0,0 +1,26 @@ +# Buildscript sets TARGET in environment +buildscript = [] + +[platform_fixup.'cfg(all(target_os = "linux", target_arch = "aarch64"))'] +env = { TARGET = "aarch64-unknown-linux-gnu" } +buildscript = [] + +[platform_fixup.'cfg(all(target_os = "linux", target_arch = "x86_64"))'] +env = { TARGET = "x86_64-unknown-linux-gnu" } +buildscript = [] + +[platform_fixup.'cfg(all(target_os = "macos", target_arch = "aarch64"))'] +env = { TARGET = "aarch64-apple-darwin" } +buildscript = [] + +[platform_fixup.'cfg(all(target_os = "macos", target_arch = "x86_64"))'] +env = { TARGET = "x86_64-apple-darwin" } +buildscript = [] + +[platform_fixup.'cfg(all(target_os = "windows", target_env = "gnu"))'] +env = { TARGET = "x86_64-pc-windows-gnu" } +buildscript = [] + +[platform_fixup.'cfg(all(target_os = "windows", target_env = "msvc"))'] +env = { TARGET = "x86_64-pc-windows-msvc" } +buildscript = [] diff --git a/shim/third-party/rust/fixups/prettyplease/fixups.toml b/shim/third-party/rust/fixups/prettyplease/fixups.toml new file mode 100644 index 00000000000..3510928422a --- /dev/null +++ b/shim/third-party/rust/fixups/prettyplease/fixups.toml @@ -0,0 +1,2 @@ +buildscript = [] +cargo_env = true diff --git a/shim/third-party/rust/fixups/proc-macro-error-attr/fixups.toml b/shim/third-party/rust/fixups/proc-macro-error-attr/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/proc-macro-error-attr/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/proc-macro-error/fixups.toml b/shim/third-party/rust/fixups/proc-macro-error/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/proc-macro-error/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/proc-macro-hack/fixups.toml b/shim/third-party/rust/fixups/proc-macro-hack/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/proc-macro-hack/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/proc-macro2/fixups.toml b/shim/third-party/rust/fixups/proc-macro2/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/proc-macro2/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/prost-build/fixups.toml b/shim/third-party/rust/fixups/prost-build/fixups.toml new file mode 100644 index 00000000000..5865e690484 --- /dev/null +++ b/shim/third-party/rust/fixups/prost-build/fixups.toml @@ -0,0 +1,7 @@ +buildscript = [] + +# These are here because the crate uses the env! macro +# We override them at runtime. +[env] +PROTOC = "" +PROTOC_INCLUDE = "" diff --git a/shim/third-party/rust/fixups/pulldown-cmark/fixups.toml b/shim/third-party/rust/fixups/pulldown-cmark/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/pulldown-cmark/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/quote/fixups.toml b/shim/third-party/rust/fixups/quote/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/quote/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/radium/fixups.toml b/shim/third-party/rust/fixups/radium/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/radium/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/rayon-core/fixups.toml b/shim/third-party/rust/fixups/rayon-core/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/rayon-core/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/ref-cast/fixups.toml b/shim/third-party/rust/fixups/ref-cast/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/ref-cast/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/reqwest/fixups.toml b/shim/third-party/rust/fixups/reqwest/fixups.toml new file mode 100644 index 00000000000..af7edb27e3b --- /dev/null +++ b/shim/third-party/rust/fixups/reqwest/fixups.toml @@ -0,0 +1 @@ +extra_srcs = ["src/**/*.rs"] diff --git a/shim/third-party/rust/fixups/ring/fixups.toml b/shim/third-party/rust/fixups/ring/fixups.toml new file mode 100644 index 00000000000..d2c83589cf4 --- /dev/null +++ b/shim/third-party/rust/fixups/ring/fixups.toml @@ -0,0 +1,162 @@ +# Copied from fbsource fixup. + +buildscript = [] + +# Generate a C/C++ build rule for all the C code + +[[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "linux"))'.buildscript]] +[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "linux"))'.buildscript.cxx_library] +name = "ring-c-asm-elf-x86_84" +srcs = [ "crypto/**/*.c", "pregenerated/*x86_64*-elf.S" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +# Exclude C AES because we've got the x86_64 one +exclude = [ "crypto/fipsmodule/aes/aes.c" ] +include_paths = ["include"] +compiler_flags = ["-Wno-error"] + +# redundant `any` is needed to differentiate key for config specific to v0.17.5 version +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "linux")))'] +version = "=0.17.5" +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "linux")))'.env] +RING_CORE_PREFIX = "ring_core_0_17_5_" +[[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "linux")))'.buildscript]] +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "linux")))'.buildscript.cxx_library] +name = "ring-c-asm-elf-x86_84" +srcs = [ "crypto/**/*.c", "pregenerated/*x86_64*-elf.S", "third_party/fiat/asm/fiat_curve25519_adx_mul.S", "third_party/fiat/asm/fiat_curve25519_adx_square.S" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +# Exclude C AES because we've got the x86_64 one +exclude = [ "crypto/fipsmodule/aes/aes.c" ] +include_paths = ["include"] +compiler_flags = ["-Wno-error"] +fixup_include_paths = ["include"] + +[[platform_fixup.'cfg(all(target_arch = "aarch64", target_os = "linux"))'.buildscript]] +[platform_fixup.'cfg(all(target_arch = "aarch64", target_os = "linux"))'.buildscript.cxx_library] +name = "ring-c-asm-elf-aarch64" +srcs = [ "crypto/**/*.c", "pregenerated/*armv8*-linux64.S", "pregenerated/*armx*-linux64.S" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +exclude = [ "crypto/cpu-intel.c" ] +include_paths = ["include"] +compiler_flags = ["-Wno-error"] + +[platform_fixup.'cfg(any(all(target_arch = "aarch64", target_os = "linux")))'] +version = "=0.17.5" +[platform_fixup.'cfg(any(all(target_arch = "aarch64", target_os = "linux")))'.env] +RING_CORE_PREFIX = "ring_core_0_17_5_" +[[platform_fixup.'cfg(any(all(target_arch = "aarch64", target_os = "linux")))'.buildscript]] +[platform_fixup.'cfg(any(all(target_arch = "aarch64", target_os = "linux")))'.buildscript.cxx_library] +name = "ring-c-asm-elf-aarch64" +srcs = [ "crypto/**/*.c", "pregenerated/*armv8*-linux64.S", "pregenerated/*armx*-linux64.S" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +exclude = [ "crypto/cpu-intel.c" ] +include_paths = ["include"] +compiler_flags = ["-Wno-error"] +fixup_include_paths = ["include"] + +[[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "macos"))'.buildscript]] +[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "macos"))'.buildscript.cxx_library] +name = "ring-c-asm-macos-x86_64" +srcs = [ "crypto/**/*.c", "pregenerated/*x86_64*-macosx.S" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +# Exclude C AES because we've got the x86_64 one +exclude = [ "crypto/fipsmodule/aes/aes.c" ] +include_paths = ["include"] +compiler_flags = ["-Wno-error"] + +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "macos")))'] +version = "=0.17.5" +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "macos")))'.env] +RING_CORE_PREFIX = "ring_core_0_17_5_" +[[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "macos")))'.buildscript]] +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "macos")))'.buildscript.cxx_library] +name = "ring-c-asm-macos-x86_64" +srcs = [ "crypto/**/*.c", "pregenerated/*x86_64*-macosx.S", "third_party/fiat/asm/fiat_curve25519_adx_mul.S", "third_party/fiat/asm/fiat_curve25519_adx_square.S" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +# Exclude C AES because we've got the x86_64 one +exclude = [ "crypto/fipsmodule/aes/aes.c" ] +include_paths = ["include"] +compiler_flags = ["-Wno-error"] +fixup_include_paths = ["include"] + +[[platform_fixup.'cfg(all(target_arch = "aarch64", target_os = "macos"))'.buildscript]] +[platform_fixup.'cfg(all(target_arch = "aarch64", target_os = "macos"))'.buildscript.cxx_library] +name = "ring-c-asm-macos-arm64" +srcs = [ "crypto/**/*.c", "pregenerated/*armv8*-ios64.S", "pregenerated/*armx*-ios64.S" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +exclude = [ "crypto/cpu-intel.c" ] +include_paths = ["include"] +compiler_flags = ["-Wno-error"] + +[platform_fixup.'cfg(any(all(target_arch = "aarch64", target_os = "macos")))'] +version = "=0.17.5" +[platform_fixup.'cfg(any(all(target_arch = "aarch64", target_os = "macos")))'.env] +RING_CORE_PREFIX = "ring_core_0_17_5_" +[[platform_fixup.'cfg(any(all(target_arch = "aarch64", target_os = "macos")))'.buildscript]] +[platform_fixup.'cfg(any(all(target_arch = "aarch64", target_os = "macos")))'.buildscript.cxx_library] +name = "ring-c-asm-macos-arm64" +srcs = [ "crypto/**/*.c", "pregenerated/*armv8*-ios64.S", "pregenerated/*armx*-ios64.S" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +exclude = [ "crypto/cpu-intel.c" ] +include_paths = ["include"] +compiler_flags = ["-Wno-error"] +fixup_include_paths = ["include"] + +[[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "gnu"))'.buildscript]] +[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "gnu"))'.buildscript.cxx_library] +name = "ring-c-win-x86_84" +srcs = [ "crypto/**/*.c" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +# Exclude C AES because we've got the x86_64 one +exclude = [ "crypto/fipsmodule/aes/aes.c" ] +include_paths = ["include"] +compiler_flags = ["-Wno-error"] + +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "windows", target_env = "gnu")))'] +version = "=0.17.5" +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "windows", target_env = "gnu")))'.env] +RING_CORE_PREFIX = "ring_core_0_17_5_" +[[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "windows", target_env = "gnu")))'.buildscript]] +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "windows", target_env = "gnu")))'.buildscript.cxx_library] +name = "ring-c-win-x86_84" +srcs = [ "crypto/**/*.c" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +# Exclude C AES because we've got the x86_64 one +exclude = [ "crypto/fipsmodule/aes/aes.c" ] +include_paths = ["include"] +compiler_flags = ["-Wno-error"] +fixup_include_paths = ["include"] + +[[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "msvc"))'.buildscript]] +[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "msvc"))'.buildscript.cxx_library] +name = "ring-c-win-msvc-x86_84" +srcs = [ "crypto/**/*.c" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +# Exclude C AES because we've got the x86_64 one +exclude = [ "crypto/fipsmodule/aes/aes.c" ] +include_paths = ["include"] + +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "windows", target_env = "msvc")))'] +version = "=0.17.5" +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "windows", target_env = "msvc")))'.env] +RING_CORE_PREFIX = "ring_core_0_17_5_" +[[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "windows", target_env = "msvc")))'.buildscript]] +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "windows", target_env = "msvc")))'.buildscript.cxx_library] +name = "ring-c-win-msvc-x86_84" +srcs = [ "crypto/**/*.c" ] +headers = [ "include/**/*.h", "crypto/**/*.h", "third_party/**/*.h", "crypto/**/*.inl" ] +# Exclude C AES because we've got the x86_64 one +exclude = [ "crypto/fipsmodule/aes/aes.c" ] +include_paths = ["include"] +fixup_include_paths = ["include"] + +[[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows"))'.buildscript]] +[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows"))'.buildscript.prebuilt_cxx_library] +name = "ring-asm-windows-x86_84" +static_libs = [ "pregenerated/*x86_64*-nasm.obj" ] + +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "windows")))'] +version = "=0.17.5" +[[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "windows")))'.buildscript]] +[platform_fixup.'cfg(any(all(target_arch = "x86_64", target_os = "windows")))'.buildscript.prebuilt_cxx_library] +name = "ring-asm-windows-x86_84" +static_libs = [ "pregenerated/*x86_64*-nasm.o" ] diff --git a/shim/third-party/rust/fixups/ring/include/ring_core_generated/prefix_symbols.h b/shim/third-party/rust/fixups/ring/include/ring_core_generated/prefix_symbols.h new file mode 100644 index 00000000000..9ee40055efd --- /dev/null +++ b/shim/third-party/rust/fixups/ring/include/ring_core_generated/prefix_symbols.h @@ -0,0 +1,119 @@ + +#ifndef ring_core_generated_PREFIX_SYMBOLS_H +#define ring_core_generated_PREFIX_SYMBOLS_H + +#define ecp_nistz256_point_double p256_point_double +#define ecp_nistz256_point_add p256_point_add +#define ecp_nistz256_point_add_affine p256_point_add_affine +#define ecp_nistz256_ord_mul_mont p256_scalar_mul_mont +#define ecp_nistz256_ord_sqr_mont p256_scalar_sqr_rep_mont +#define ecp_nistz256_mul_mont p256_mul_mont +#define ecp_nistz256_sqr_mont p256_sqr_mont +#define CRYPTO_memcmp ring_core_0_17_5_CRYPTO_memcmp +#define CRYPTO_poly1305_finish ring_core_0_17_5_CRYPTO_poly1305_finish +#define CRYPTO_poly1305_finish_neon ring_core_0_17_5_CRYPTO_poly1305_finish_neon +#define CRYPTO_poly1305_init ring_core_0_17_5_CRYPTO_poly1305_init +#define CRYPTO_poly1305_init_neon ring_core_0_17_5_CRYPTO_poly1305_init_neon +#define CRYPTO_poly1305_update ring_core_0_17_5_CRYPTO_poly1305_update +#define CRYPTO_poly1305_update_neon ring_core_0_17_5_CRYPTO_poly1305_update_neon +#define ChaCha20_ctr32 ring_core_0_17_5_ChaCha20_ctr32 +#define LIMBS_add_mod ring_core_0_17_5_LIMBS_add_mod +#define LIMBS_are_even ring_core_0_17_5_LIMBS_are_even +#define LIMBS_are_zero ring_core_0_17_5_LIMBS_are_zero +#define LIMBS_equal ring_core_0_17_5_LIMBS_equal +#define LIMBS_equal_limb ring_core_0_17_5_LIMBS_equal_limb +#define LIMBS_less_than ring_core_0_17_5_LIMBS_less_than +#define LIMBS_less_than_limb ring_core_0_17_5_LIMBS_less_than_limb +#define LIMBS_reduce_once ring_core_0_17_5_LIMBS_reduce_once +#define LIMBS_select_512_32 ring_core_0_17_5_LIMBS_select_512_32 +#define LIMBS_shl_mod ring_core_0_17_5_LIMBS_shl_mod +#define LIMBS_sub_mod ring_core_0_17_5_LIMBS_sub_mod +#define LIMBS_window5_split_window ring_core_0_17_5_LIMBS_window5_split_window +#define LIMBS_window5_unsplit_window ring_core_0_17_5_LIMBS_window5_unsplit_window +#define LIMB_shr ring_core_0_17_5_LIMB_shr +#define OPENSSL_armcap_P ring_core_0_17_5_OPENSSL_armcap_P +#define OPENSSL_cpuid_setup ring_core_0_17_5_OPENSSL_cpuid_setup +#define OPENSSL_ia32cap_P ring_core_0_17_5_OPENSSL_ia32cap_P +#define aes_hw_ctr32_encrypt_blocks ring_core_0_17_5_aes_hw_ctr32_encrypt_blocks +#define aes_hw_encrypt ring_core_0_17_5_aes_hw_encrypt +#define aes_hw_set_encrypt_key ring_core_0_17_5_aes_hw_set_encrypt_key +#define aes_nohw_ctr32_encrypt_blocks ring_core_0_17_5_aes_nohw_ctr32_encrypt_blocks +#define aes_nohw_encrypt ring_core_0_17_5_aes_nohw_encrypt +#define aes_nohw_set_encrypt_key ring_core_0_17_5_aes_nohw_set_encrypt_key +#define aesni_gcm_decrypt ring_core_0_17_5_aesni_gcm_decrypt +#define aesni_gcm_encrypt ring_core_0_17_5_aesni_gcm_encrypt +#define bn_from_montgomery_in_place ring_core_0_17_5_bn_from_montgomery_in_place +#define bn_gather5 ring_core_0_17_5_bn_gather5 +#define bn_mul_mont ring_core_0_17_5_bn_mul_mont +#define bn_mul_mont_gather5 ring_core_0_17_5_bn_mul_mont_gather5 +#define bn_neg_inv_mod_r_u64 ring_core_0_17_5_bn_neg_inv_mod_r_u64 +#define bn_power5 ring_core_0_17_5_bn_power5 +#define bn_scatter5 ring_core_0_17_5_bn_scatter5 +#define bn_sqr8x_internal ring_core_0_17_5_bn_sqr8x_internal +#define bn_sqrx8x_internal ring_core_0_17_5_bn_sqrx8x_internal +#define bsaes_ctr32_encrypt_blocks ring_core_0_17_5_bsaes_ctr32_encrypt_blocks +#define bssl_constant_time_test_conditional_memcpy ring_core_0_17_5_bssl_constant_time_test_conditional_memcpy +#define bssl_constant_time_test_conditional_memxor ring_core_0_17_5_bssl_constant_time_test_conditional_memxor +#define bssl_constant_time_test_main ring_core_0_17_5_bssl_constant_time_test_main +#define chacha20_poly1305_open ring_core_0_17_5_chacha20_poly1305_open +#define chacha20_poly1305_seal ring_core_0_17_5_chacha20_poly1305_seal +#define fiat_curve25519_adx_mul ring_core_0_17_5_fiat_curve25519_adx_mul +#define fiat_curve25519_adx_square ring_core_0_17_5_fiat_curve25519_adx_square +#define gcm_ghash_avx ring_core_0_17_5_gcm_ghash_avx +#define gcm_ghash_clmul ring_core_0_17_5_gcm_ghash_clmul +#define gcm_ghash_neon ring_core_0_17_5_gcm_ghash_neon +#define gcm_gmult_clmul ring_core_0_17_5_gcm_gmult_clmul +#define gcm_gmult_neon ring_core_0_17_5_gcm_gmult_neon +#define gcm_init_avx ring_core_0_17_5_gcm_init_avx +#define gcm_init_clmul ring_core_0_17_5_gcm_init_clmul +#define gcm_init_neon ring_core_0_17_5_gcm_init_neon +#define k25519Precomp ring_core_0_17_5_k25519Precomp +#define limbs_mul_add_limb ring_core_0_17_5_limbs_mul_add_limb +#define little_endian_bytes_from_scalar ring_core_0_17_5_little_endian_bytes_from_scalar +#define ecp_nistz256_neg ring_core_0_17_5_ecp_nistz256_neg +#define ecp_nistz256_select_w5 ring_core_0_17_5_ecp_nistz256_select_w5 +#define ecp_nistz256_select_w7 ring_core_0_17_5_ecp_nistz256_select_w7 +#define p256_mul_mont ring_core_0_17_5_p256_mul_mont +#define p256_point_add ring_core_0_17_5_p256_point_add +#define p256_point_add_affine ring_core_0_17_5_p256_point_add_affine +#define p256_point_double ring_core_0_17_5_p256_point_double +#define p256_point_mul ring_core_0_17_5_p256_point_mul +#define p256_point_mul_base ring_core_0_17_5_p256_point_mul_base +#define p256_point_mul_base_vartime ring_core_0_17_5_p256_point_mul_base_vartime +#define p256_scalar_mul_mont ring_core_0_17_5_p256_scalar_mul_mont +#define p256_scalar_sqr_rep_mont ring_core_0_17_5_p256_scalar_sqr_rep_mont +#define p256_sqr_mont ring_core_0_17_5_p256_sqr_mont +#define p384_elem_div_by_2 ring_core_0_17_5_p384_elem_div_by_2 +#define p384_elem_mul_mont ring_core_0_17_5_p384_elem_mul_mont +#define p384_elem_neg ring_core_0_17_5_p384_elem_neg +#define p384_elem_sub ring_core_0_17_5_p384_elem_sub +#define p384_point_add ring_core_0_17_5_p384_point_add +#define p384_point_double ring_core_0_17_5_p384_point_double +#define p384_point_mul ring_core_0_17_5_p384_point_mul +#define p384_scalar_mul_mont ring_core_0_17_5_p384_scalar_mul_mont +#define openssl_poly1305_neon2_addmulmod ring_core_0_17_5_openssl_poly1305_neon2_addmulmod +#define openssl_poly1305_neon2_blocks ring_core_0_17_5_openssl_poly1305_neon2_blocks +#define sha256_block_data_order ring_core_0_17_5_sha256_block_data_order +#define sha512_block_data_order ring_core_0_17_5_sha512_block_data_order +#define vpaes_ctr32_encrypt_blocks ring_core_0_17_5_vpaes_ctr32_encrypt_blocks +#define vpaes_encrypt ring_core_0_17_5_vpaes_encrypt +#define vpaes_encrypt_key_to_bsaes ring_core_0_17_5_vpaes_encrypt_key_to_bsaes +#define vpaes_set_encrypt_key ring_core_0_17_5_vpaes_set_encrypt_key +#define x25519_NEON ring_core_0_17_5_x25519_NEON +#define x25519_fe_invert ring_core_0_17_5_x25519_fe_invert +#define x25519_fe_isnegative ring_core_0_17_5_x25519_fe_isnegative +#define x25519_fe_mul_ttt ring_core_0_17_5_x25519_fe_mul_ttt +#define x25519_fe_neg ring_core_0_17_5_x25519_fe_neg +#define x25519_fe_tobytes ring_core_0_17_5_x25519_fe_tobytes +#define x25519_ge_double_scalarmult_vartime ring_core_0_17_5_x25519_ge_double_scalarmult_vartime +#define x25519_ge_frombytes_vartime ring_core_0_17_5_x25519_ge_frombytes_vartime +#define x25519_ge_scalarmult_base ring_core_0_17_5_x25519_ge_scalarmult_base +#define x25519_ge_scalarmult_base_adx ring_core_0_17_5_x25519_ge_scalarmult_base_adx +#define x25519_public_from_private_generic_masked ring_core_0_17_5_x25519_public_from_private_generic_masked +#define x25519_sc_mask ring_core_0_17_5_x25519_sc_mask +#define x25519_sc_muladd ring_core_0_17_5_x25519_sc_muladd +#define x25519_sc_reduce ring_core_0_17_5_x25519_sc_reduce +#define x25519_scalar_mult_adx ring_core_0_17_5_x25519_scalar_mult_adx +#define x25519_scalar_mult_generic_masked ring_core_0_17_5_x25519_scalar_mult_generic_masked + +#endif diff --git a/shim/third-party/rust/fixups/ring/include/ring_core_generated/prefix_symbols_asm.h b/shim/third-party/rust/fixups/ring/include/ring_core_generated/prefix_symbols_asm.h new file mode 100644 index 00000000000..84e48709150 --- /dev/null +++ b/shim/third-party/rust/fixups/ring/include/ring_core_generated/prefix_symbols_asm.h @@ -0,0 +1,236 @@ + +#ifndef ring_core_generated_PREFIX_SYMBOLS_ASM_H +#define ring_core_generated_PREFIX_SYMBOLS_ASM_H + +#if defined(__APPLE__) +#define _ecp_nistz256_point_double _p256_point_double +#define _ecp_nistz256_point_add _p256_point_add +#define _ecp_nistz256_point_add_affine _p256_point_add_affine +#define _ecp_nistz256_ord_mul_mont _p256_scalar_mul_mont +#define _ecp_nistz256_ord_sqr_mont _p256_scalar_sqr_rep_mont +#define _ecp_nistz256_mul_mont _p256_mul_mont +#define _ecp_nistz256_sqr_mont _p256_sqr_mont +#define _CRYPTO_memcmp _ring_core_0_17_5_CRYPTO_memcmp +#define _CRYPTO_poly1305_finish _ring_core_0_17_5_CRYPTO_poly1305_finish +#define _CRYPTO_poly1305_finish_neon _ring_core_0_17_5_CRYPTO_poly1305_finish_neon +#define _CRYPTO_poly1305_init _ring_core_0_17_5_CRYPTO_poly1305_init +#define _CRYPTO_poly1305_init_neon _ring_core_0_17_5_CRYPTO_poly1305_init_neon +#define _CRYPTO_poly1305_update _ring_core_0_17_5_CRYPTO_poly1305_update +#define _CRYPTO_poly1305_update_neon _ring_core_0_17_5_CRYPTO_poly1305_update_neon +#define _ChaCha20_ctr32 _ring_core_0_17_5_ChaCha20_ctr32 +#define _LIMBS_add_mod _ring_core_0_17_5_LIMBS_add_mod +#define _LIMBS_are_even _ring_core_0_17_5_LIMBS_are_even +#define _LIMBS_are_zero _ring_core_0_17_5_LIMBS_are_zero +#define _LIMBS_equal _ring_core_0_17_5_LIMBS_equal +#define _LIMBS_equal_limb _ring_core_0_17_5_LIMBS_equal_limb +#define _LIMBS_less_than _ring_core_0_17_5_LIMBS_less_than +#define _LIMBS_less_than_limb _ring_core_0_17_5_LIMBS_less_than_limb +#define _LIMBS_reduce_once _ring_core_0_17_5_LIMBS_reduce_once +#define _LIMBS_select_512_32 _ring_core_0_17_5_LIMBS_select_512_32 +#define _LIMBS_shl_mod _ring_core_0_17_5_LIMBS_shl_mod +#define _LIMBS_sub_mod _ring_core_0_17_5_LIMBS_sub_mod +#define _LIMBS_window5_split_window _ring_core_0_17_5_LIMBS_window5_split_window +#define _LIMBS_window5_unsplit_window _ring_core_0_17_5_LIMBS_window5_unsplit_window +#define _LIMB_shr _ring_core_0_17_5_LIMB_shr +#define _OPENSSL_armcap_P _ring_core_0_17_5_OPENSSL_armcap_P +#define _OPENSSL_cpuid_setup _ring_core_0_17_5_OPENSSL_cpuid_setup +#define _OPENSSL_ia32cap_P _ring_core_0_17_5_OPENSSL_ia32cap_P +#define _aes_hw_ctr32_encrypt_blocks _ring_core_0_17_5_aes_hw_ctr32_encrypt_blocks +#define _aes_hw_encrypt _ring_core_0_17_5_aes_hw_encrypt +#define _aes_hw_set_encrypt_key _ring_core_0_17_5_aes_hw_set_encrypt_key +#define _aes_nohw_ctr32_encrypt_blocks _ring_core_0_17_5_aes_nohw_ctr32_encrypt_blocks +#define _aes_nohw_encrypt _ring_core_0_17_5_aes_nohw_encrypt +#define _aes_nohw_set_encrypt_key _ring_core_0_17_5_aes_nohw_set_encrypt_key +#define _aesni_gcm_decrypt _ring_core_0_17_5_aesni_gcm_decrypt +#define _aesni_gcm_encrypt _ring_core_0_17_5_aesni_gcm_encrypt +#define _bn_from_montgomery_in_place _ring_core_0_17_5_bn_from_montgomery_in_place +#define _bn_gather5 _ring_core_0_17_5_bn_gather5 +#define _bn_mul_mont _ring_core_0_17_5_bn_mul_mont +#define _bn_mul_mont_gather5 _ring_core_0_17_5_bn_mul_mont_gather5 +#define _bn_neg_inv_mod_r_u64 _ring_core_0_17_5_bn_neg_inv_mod_r_u64 +#define _bn_power5 _ring_core_0_17_5_bn_power5 +#define _bn_scatter5 _ring_core_0_17_5_bn_scatter5 +#define _bn_sqr8x_internal _ring_core_0_17_5_bn_sqr8x_internal +#define _bn_sqrx8x_internal _ring_core_0_17_5_bn_sqrx8x_internal +#define _bsaes_ctr32_encrypt_blocks _ring_core_0_17_5_bsaes_ctr32_encrypt_blocks +#define _bssl_constant_time_test_conditional_memcpy _ring_core_0_17_5_bssl_constant_time_test_conditional_memcpy +#define _bssl_constant_time_test_conditional_memxor _ring_core_0_17_5_bssl_constant_time_test_conditional_memxor +#define _bssl_constant_time_test_main _ring_core_0_17_5_bssl_constant_time_test_main +#define _chacha20_poly1305_open _ring_core_0_17_5_chacha20_poly1305_open +#define _chacha20_poly1305_seal _ring_core_0_17_5_chacha20_poly1305_seal +#define _fiat_curve25519_adx_mul _ring_core_0_17_5_fiat_curve25519_adx_mul +#define _fiat_curve25519_adx_square _ring_core_0_17_5_fiat_curve25519_adx_square +#define _gcm_ghash_avx _ring_core_0_17_5_gcm_ghash_avx +#define _gcm_ghash_clmul _ring_core_0_17_5_gcm_ghash_clmul +#define _gcm_ghash_neon _ring_core_0_17_5_gcm_ghash_neon +#define _gcm_gmult_clmul _ring_core_0_17_5_gcm_gmult_clmul +#define _gcm_gmult_neon _ring_core_0_17_5_gcm_gmult_neon +#define _gcm_init_avx _ring_core_0_17_5_gcm_init_avx +#define _gcm_init_clmul _ring_core_0_17_5_gcm_init_clmul +#define _gcm_init_neon _ring_core_0_17_5_gcm_init_neon +#define _k25519Precomp _ring_core_0_17_5_k25519Precomp +#define _limbs_mul_add_limb _ring_core_0_17_5_limbs_mul_add_limb +#define _little_endian_bytes_from_scalar _ring_core_0_17_5_little_endian_bytes_from_scalar +#define _ecp_nistz256_neg _ring_core_0_17_5_ecp_nistz256_neg +#define _ecp_nistz256_select_w5 _ring_core_0_17_5_ecp_nistz256_select_w5 +#define _ecp_nistz256_select_w7 _ring_core_0_17_5_ecp_nistz256_select_w7 +#define _p256_mul_mont _ring_core_0_17_5_p256_mul_mont +#define _p256_point_add _ring_core_0_17_5_p256_point_add +#define _p256_point_add_affine _ring_core_0_17_5_p256_point_add_affine +#define _p256_point_double _ring_core_0_17_5_p256_point_double +#define _p256_point_mul _ring_core_0_17_5_p256_point_mul +#define _p256_point_mul_base _ring_core_0_17_5_p256_point_mul_base +#define _p256_point_mul_base_vartime _ring_core_0_17_5_p256_point_mul_base_vartime +#define _p256_scalar_mul_mont _ring_core_0_17_5_p256_scalar_mul_mont +#define _p256_scalar_sqr_rep_mont _ring_core_0_17_5_p256_scalar_sqr_rep_mont +#define _p256_sqr_mont _ring_core_0_17_5_p256_sqr_mont +#define _p384_elem_div_by_2 _ring_core_0_17_5_p384_elem_div_by_2 +#define _p384_elem_mul_mont _ring_core_0_17_5_p384_elem_mul_mont +#define _p384_elem_neg _ring_core_0_17_5_p384_elem_neg +#define _p384_elem_sub _ring_core_0_17_5_p384_elem_sub +#define _p384_point_add _ring_core_0_17_5_p384_point_add +#define _p384_point_double _ring_core_0_17_5_p384_point_double +#define _p384_point_mul _ring_core_0_17_5_p384_point_mul +#define _p384_scalar_mul_mont _ring_core_0_17_5_p384_scalar_mul_mont +#define _openssl_poly1305_neon2_addmulmod _ring_core_0_17_5_openssl_poly1305_neon2_addmulmod +#define _openssl_poly1305_neon2_blocks _ring_core_0_17_5_openssl_poly1305_neon2_blocks +#define _sha256_block_data_order _ring_core_0_17_5_sha256_block_data_order +#define _sha512_block_data_order _ring_core_0_17_5_sha512_block_data_order +#define _vpaes_ctr32_encrypt_blocks _ring_core_0_17_5_vpaes_ctr32_encrypt_blocks +#define _vpaes_encrypt _ring_core_0_17_5_vpaes_encrypt +#define _vpaes_encrypt_key_to_bsaes _ring_core_0_17_5_vpaes_encrypt_key_to_bsaes +#define _vpaes_set_encrypt_key _ring_core_0_17_5_vpaes_set_encrypt_key +#define _x25519_NEON _ring_core_0_17_5_x25519_NEON +#define _x25519_fe_invert _ring_core_0_17_5_x25519_fe_invert +#define _x25519_fe_isnegative _ring_core_0_17_5_x25519_fe_isnegative +#define _x25519_fe_mul_ttt _ring_core_0_17_5_x25519_fe_mul_ttt +#define _x25519_fe_neg _ring_core_0_17_5_x25519_fe_neg +#define _x25519_fe_tobytes _ring_core_0_17_5_x25519_fe_tobytes +#define _x25519_ge_double_scalarmult_vartime _ring_core_0_17_5_x25519_ge_double_scalarmult_vartime +#define _x25519_ge_frombytes_vartime _ring_core_0_17_5_x25519_ge_frombytes_vartime +#define _x25519_ge_scalarmult_base _ring_core_0_17_5_x25519_ge_scalarmult_base +#define _x25519_ge_scalarmult_base_adx _ring_core_0_17_5_x25519_ge_scalarmult_base_adx +#define _x25519_public_from_private_generic_masked _ring_core_0_17_5_x25519_public_from_private_generic_masked +#define _x25519_sc_mask _ring_core_0_17_5_x25519_sc_mask +#define _x25519_sc_muladd _ring_core_0_17_5_x25519_sc_muladd +#define _x25519_sc_reduce _ring_core_0_17_5_x25519_sc_reduce +#define _x25519_scalar_mult_adx _ring_core_0_17_5_x25519_scalar_mult_adx +#define _x25519_scalar_mult_generic_masked _ring_core_0_17_5_x25519_scalar_mult_generic_masked + +#else +#define ecp_nistz256_point_double p256_point_double +#define ecp_nistz256_point_add p256_point_add +#define ecp_nistz256_point_add_affine p256_point_add_affine +#define ecp_nistz256_ord_mul_mont p256_scalar_mul_mont +#define ecp_nistz256_ord_sqr_mont p256_scalar_sqr_rep_mont +#define ecp_nistz256_mul_mont p256_mul_mont +#define ecp_nistz256_sqr_mont p256_sqr_mont +#define CRYPTO_memcmp ring_core_0_17_5_CRYPTO_memcmp +#define CRYPTO_poly1305_finish ring_core_0_17_5_CRYPTO_poly1305_finish +#define CRYPTO_poly1305_finish_neon ring_core_0_17_5_CRYPTO_poly1305_finish_neon +#define CRYPTO_poly1305_init ring_core_0_17_5_CRYPTO_poly1305_init +#define CRYPTO_poly1305_init_neon ring_core_0_17_5_CRYPTO_poly1305_init_neon +#define CRYPTO_poly1305_update ring_core_0_17_5_CRYPTO_poly1305_update +#define CRYPTO_poly1305_update_neon ring_core_0_17_5_CRYPTO_poly1305_update_neon +#define ChaCha20_ctr32 ring_core_0_17_5_ChaCha20_ctr32 +#define LIMBS_add_mod ring_core_0_17_5_LIMBS_add_mod +#define LIMBS_are_even ring_core_0_17_5_LIMBS_are_even +#define LIMBS_are_zero ring_core_0_17_5_LIMBS_are_zero +#define LIMBS_equal ring_core_0_17_5_LIMBS_equal +#define LIMBS_equal_limb ring_core_0_17_5_LIMBS_equal_limb +#define LIMBS_less_than ring_core_0_17_5_LIMBS_less_than +#define LIMBS_less_than_limb ring_core_0_17_5_LIMBS_less_than_limb +#define LIMBS_reduce_once ring_core_0_17_5_LIMBS_reduce_once +#define LIMBS_select_512_32 ring_core_0_17_5_LIMBS_select_512_32 +#define LIMBS_shl_mod ring_core_0_17_5_LIMBS_shl_mod +#define LIMBS_sub_mod ring_core_0_17_5_LIMBS_sub_mod +#define LIMBS_window5_split_window ring_core_0_17_5_LIMBS_window5_split_window +#define LIMBS_window5_unsplit_window ring_core_0_17_5_LIMBS_window5_unsplit_window +#define LIMB_shr ring_core_0_17_5_LIMB_shr +#define OPENSSL_armcap_P ring_core_0_17_5_OPENSSL_armcap_P +#define OPENSSL_cpuid_setup ring_core_0_17_5_OPENSSL_cpuid_setup +#define OPENSSL_ia32cap_P ring_core_0_17_5_OPENSSL_ia32cap_P +#define aes_hw_ctr32_encrypt_blocks ring_core_0_17_5_aes_hw_ctr32_encrypt_blocks +#define aes_hw_encrypt ring_core_0_17_5_aes_hw_encrypt +#define aes_hw_set_encrypt_key ring_core_0_17_5_aes_hw_set_encrypt_key +#define aes_nohw_ctr32_encrypt_blocks ring_core_0_17_5_aes_nohw_ctr32_encrypt_blocks +#define aes_nohw_encrypt ring_core_0_17_5_aes_nohw_encrypt +#define aes_nohw_set_encrypt_key ring_core_0_17_5_aes_nohw_set_encrypt_key +#define aesni_gcm_decrypt ring_core_0_17_5_aesni_gcm_decrypt +#define aesni_gcm_encrypt ring_core_0_17_5_aesni_gcm_encrypt +#define bn_from_montgomery_in_place ring_core_0_17_5_bn_from_montgomery_in_place +#define bn_gather5 ring_core_0_17_5_bn_gather5 +#define bn_mul_mont ring_core_0_17_5_bn_mul_mont +#define bn_mul_mont_gather5 ring_core_0_17_5_bn_mul_mont_gather5 +#define bn_neg_inv_mod_r_u64 ring_core_0_17_5_bn_neg_inv_mod_r_u64 +#define bn_power5 ring_core_0_17_5_bn_power5 +#define bn_scatter5 ring_core_0_17_5_bn_scatter5 +#define bn_sqr8x_internal ring_core_0_17_5_bn_sqr8x_internal +#define bn_sqrx8x_internal ring_core_0_17_5_bn_sqrx8x_internal +#define bsaes_ctr32_encrypt_blocks ring_core_0_17_5_bsaes_ctr32_encrypt_blocks +#define bssl_constant_time_test_conditional_memcpy ring_core_0_17_5_bssl_constant_time_test_conditional_memcpy +#define bssl_constant_time_test_conditional_memxor ring_core_0_17_5_bssl_constant_time_test_conditional_memxor +#define bssl_constant_time_test_main ring_core_0_17_5_bssl_constant_time_test_main +#define chacha20_poly1305_open ring_core_0_17_5_chacha20_poly1305_open +#define chacha20_poly1305_seal ring_core_0_17_5_chacha20_poly1305_seal +#define fiat_curve25519_adx_mul ring_core_0_17_5_fiat_curve25519_adx_mul +#define fiat_curve25519_adx_square ring_core_0_17_5_fiat_curve25519_adx_square +#define gcm_ghash_avx ring_core_0_17_5_gcm_ghash_avx +#define gcm_ghash_clmul ring_core_0_17_5_gcm_ghash_clmul +#define gcm_ghash_neon ring_core_0_17_5_gcm_ghash_neon +#define gcm_gmult_clmul ring_core_0_17_5_gcm_gmult_clmul +#define gcm_gmult_neon ring_core_0_17_5_gcm_gmult_neon +#define gcm_init_avx ring_core_0_17_5_gcm_init_avx +#define gcm_init_clmul ring_core_0_17_5_gcm_init_clmul +#define gcm_init_neon ring_core_0_17_5_gcm_init_neon +#define k25519Precomp ring_core_0_17_5_k25519Precomp +#define limbs_mul_add_limb ring_core_0_17_5_limbs_mul_add_limb +#define little_endian_bytes_from_scalar ring_core_0_17_5_little_endian_bytes_from_scalar +#define ecp_nistz256_neg ring_core_0_17_5_ecp_nistz256_neg +#define ecp_nistz256_select_w5 ring_core_0_17_5_ecp_nistz256_select_w5 +#define ecp_nistz256_select_w7 ring_core_0_17_5_ecp_nistz256_select_w7 +#define p256_mul_mont ring_core_0_17_5_p256_mul_mont +#define p256_point_add ring_core_0_17_5_p256_point_add +#define p256_point_add_affine ring_core_0_17_5_p256_point_add_affine +#define p256_point_double ring_core_0_17_5_p256_point_double +#define p256_point_mul ring_core_0_17_5_p256_point_mul +#define p256_point_mul_base ring_core_0_17_5_p256_point_mul_base +#define p256_point_mul_base_vartime ring_core_0_17_5_p256_point_mul_base_vartime +#define p256_scalar_mul_mont ring_core_0_17_5_p256_scalar_mul_mont +#define p256_scalar_sqr_rep_mont ring_core_0_17_5_p256_scalar_sqr_rep_mont +#define p256_sqr_mont ring_core_0_17_5_p256_sqr_mont +#define p384_elem_div_by_2 ring_core_0_17_5_p384_elem_div_by_2 +#define p384_elem_mul_mont ring_core_0_17_5_p384_elem_mul_mont +#define p384_elem_neg ring_core_0_17_5_p384_elem_neg +#define p384_elem_sub ring_core_0_17_5_p384_elem_sub +#define p384_point_add ring_core_0_17_5_p384_point_add +#define p384_point_double ring_core_0_17_5_p384_point_double +#define p384_point_mul ring_core_0_17_5_p384_point_mul +#define p384_scalar_mul_mont ring_core_0_17_5_p384_scalar_mul_mont +#define openssl_poly1305_neon2_addmulmod ring_core_0_17_5_openssl_poly1305_neon2_addmulmod +#define openssl_poly1305_neon2_blocks ring_core_0_17_5_openssl_poly1305_neon2_blocks +#define sha256_block_data_order ring_core_0_17_5_sha256_block_data_order +#define sha512_block_data_order ring_core_0_17_5_sha512_block_data_order +#define vpaes_ctr32_encrypt_blocks ring_core_0_17_5_vpaes_ctr32_encrypt_blocks +#define vpaes_encrypt ring_core_0_17_5_vpaes_encrypt +#define vpaes_encrypt_key_to_bsaes ring_core_0_17_5_vpaes_encrypt_key_to_bsaes +#define vpaes_set_encrypt_key ring_core_0_17_5_vpaes_set_encrypt_key +#define x25519_NEON ring_core_0_17_5_x25519_NEON +#define x25519_fe_invert ring_core_0_17_5_x25519_fe_invert +#define x25519_fe_isnegative ring_core_0_17_5_x25519_fe_isnegative +#define x25519_fe_mul_ttt ring_core_0_17_5_x25519_fe_mul_ttt +#define x25519_fe_neg ring_core_0_17_5_x25519_fe_neg +#define x25519_fe_tobytes ring_core_0_17_5_x25519_fe_tobytes +#define x25519_ge_double_scalarmult_vartime ring_core_0_17_5_x25519_ge_double_scalarmult_vartime +#define x25519_ge_frombytes_vartime ring_core_0_17_5_x25519_ge_frombytes_vartime +#define x25519_ge_scalarmult_base ring_core_0_17_5_x25519_ge_scalarmult_base +#define x25519_ge_scalarmult_base_adx ring_core_0_17_5_x25519_ge_scalarmult_base_adx +#define x25519_public_from_private_generic_masked ring_core_0_17_5_x25519_public_from_private_generic_masked +#define x25519_sc_mask ring_core_0_17_5_x25519_sc_mask +#define x25519_sc_muladd ring_core_0_17_5_x25519_sc_muladd +#define x25519_sc_reduce ring_core_0_17_5_x25519_sc_reduce +#define x25519_scalar_mult_adx ring_core_0_17_5_x25519_scalar_mult_adx +#define x25519_scalar_mult_generic_masked ring_core_0_17_5_x25519_scalar_mult_generic_masked + +#endif +#endif diff --git a/shim/third-party/rust/fixups/ring/include/ring_core_generated/prefix_symbols_nasm.inc b/shim/third-party/rust/fixups/ring/include/ring_core_generated/prefix_symbols_nasm.inc new file mode 100644 index 00000000000..50e986a6a6a --- /dev/null +++ b/shim/third-party/rust/fixups/ring/include/ring_core_generated/prefix_symbols_nasm.inc @@ -0,0 +1,236 @@ + +%ifndef ring_core_generated_PREFIX_SYMBOLS_NASM_INC +%define ring_core_generated_PREFIX_SYMBOLS_NASM_INC + +%ifidn __OUTPUT_FORMAT__,win32 +%define _ecp_nistz256_point_double _p256_point_double +%define _ecp_nistz256_point_add _p256_point_add +%define _ecp_nistz256_point_add_affine _p256_point_add_affine +%define _ecp_nistz256_ord_mul_mont _p256_scalar_mul_mont +%define _ecp_nistz256_ord_sqr_mont _p256_scalar_sqr_rep_mont +%define _ecp_nistz256_mul_mont _p256_mul_mont +%define _ecp_nistz256_sqr_mont _p256_sqr_mont +%define _CRYPTO_memcmp _ring_core_0_17_5_CRYPTO_memcmp +%define _CRYPTO_poly1305_finish _ring_core_0_17_5_CRYPTO_poly1305_finish +%define _CRYPTO_poly1305_finish_neon _ring_core_0_17_5_CRYPTO_poly1305_finish_neon +%define _CRYPTO_poly1305_init _ring_core_0_17_5_CRYPTO_poly1305_init +%define _CRYPTO_poly1305_init_neon _ring_core_0_17_5_CRYPTO_poly1305_init_neon +%define _CRYPTO_poly1305_update _ring_core_0_17_5_CRYPTO_poly1305_update +%define _CRYPTO_poly1305_update_neon _ring_core_0_17_5_CRYPTO_poly1305_update_neon +%define _ChaCha20_ctr32 _ring_core_0_17_5_ChaCha20_ctr32 +%define _LIMBS_add_mod _ring_core_0_17_5_LIMBS_add_mod +%define _LIMBS_are_even _ring_core_0_17_5_LIMBS_are_even +%define _LIMBS_are_zero _ring_core_0_17_5_LIMBS_are_zero +%define _LIMBS_equal _ring_core_0_17_5_LIMBS_equal +%define _LIMBS_equal_limb _ring_core_0_17_5_LIMBS_equal_limb +%define _LIMBS_less_than _ring_core_0_17_5_LIMBS_less_than +%define _LIMBS_less_than_limb _ring_core_0_17_5_LIMBS_less_than_limb +%define _LIMBS_reduce_once _ring_core_0_17_5_LIMBS_reduce_once +%define _LIMBS_select_512_32 _ring_core_0_17_5_LIMBS_select_512_32 +%define _LIMBS_shl_mod _ring_core_0_17_5_LIMBS_shl_mod +%define _LIMBS_sub_mod _ring_core_0_17_5_LIMBS_sub_mod +%define _LIMBS_window5_split_window _ring_core_0_17_5_LIMBS_window5_split_window +%define _LIMBS_window5_unsplit_window _ring_core_0_17_5_LIMBS_window5_unsplit_window +%define _LIMB_shr _ring_core_0_17_5_LIMB_shr +%define _OPENSSL_armcap_P _ring_core_0_17_5_OPENSSL_armcap_P +%define _OPENSSL_cpuid_setup _ring_core_0_17_5_OPENSSL_cpuid_setup +%define _OPENSSL_ia32cap_P _ring_core_0_17_5_OPENSSL_ia32cap_P +%define _aes_hw_ctr32_encrypt_blocks _ring_core_0_17_5_aes_hw_ctr32_encrypt_blocks +%define _aes_hw_encrypt _ring_core_0_17_5_aes_hw_encrypt +%define _aes_hw_set_encrypt_key _ring_core_0_17_5_aes_hw_set_encrypt_key +%define _aes_nohw_ctr32_encrypt_blocks _ring_core_0_17_5_aes_nohw_ctr32_encrypt_blocks +%define _aes_nohw_encrypt _ring_core_0_17_5_aes_nohw_encrypt +%define _aes_nohw_set_encrypt_key _ring_core_0_17_5_aes_nohw_set_encrypt_key +%define _aesni_gcm_decrypt _ring_core_0_17_5_aesni_gcm_decrypt +%define _aesni_gcm_encrypt _ring_core_0_17_5_aesni_gcm_encrypt +%define _bn_from_montgomery_in_place _ring_core_0_17_5_bn_from_montgomery_in_place +%define _bn_gather5 _ring_core_0_17_5_bn_gather5 +%define _bn_mul_mont _ring_core_0_17_5_bn_mul_mont +%define _bn_mul_mont_gather5 _ring_core_0_17_5_bn_mul_mont_gather5 +%define _bn_neg_inv_mod_r_u64 _ring_core_0_17_5_bn_neg_inv_mod_r_u64 +%define _bn_power5 _ring_core_0_17_5_bn_power5 +%define _bn_scatter5 _ring_core_0_17_5_bn_scatter5 +%define _bn_sqr8x_internal _ring_core_0_17_5_bn_sqr8x_internal +%define _bn_sqrx8x_internal _ring_core_0_17_5_bn_sqrx8x_internal +%define _bsaes_ctr32_encrypt_blocks _ring_core_0_17_5_bsaes_ctr32_encrypt_blocks +%define _bssl_constant_time_test_conditional_memcpy _ring_core_0_17_5_bssl_constant_time_test_conditional_memcpy +%define _bssl_constant_time_test_conditional_memxor _ring_core_0_17_5_bssl_constant_time_test_conditional_memxor +%define _bssl_constant_time_test_main _ring_core_0_17_5_bssl_constant_time_test_main +%define _chacha20_poly1305_open _ring_core_0_17_5_chacha20_poly1305_open +%define _chacha20_poly1305_seal _ring_core_0_17_5_chacha20_poly1305_seal +%define _fiat_curve25519_adx_mul _ring_core_0_17_5_fiat_curve25519_adx_mul +%define _fiat_curve25519_adx_square _ring_core_0_17_5_fiat_curve25519_adx_square +%define _gcm_ghash_avx _ring_core_0_17_5_gcm_ghash_avx +%define _gcm_ghash_clmul _ring_core_0_17_5_gcm_ghash_clmul +%define _gcm_ghash_neon _ring_core_0_17_5_gcm_ghash_neon +%define _gcm_gmult_clmul _ring_core_0_17_5_gcm_gmult_clmul +%define _gcm_gmult_neon _ring_core_0_17_5_gcm_gmult_neon +%define _gcm_init_avx _ring_core_0_17_5_gcm_init_avx +%define _gcm_init_clmul _ring_core_0_17_5_gcm_init_clmul +%define _gcm_init_neon _ring_core_0_17_5_gcm_init_neon +%define _k25519Precomp _ring_core_0_17_5_k25519Precomp +%define _limbs_mul_add_limb _ring_core_0_17_5_limbs_mul_add_limb +%define _little_endian_bytes_from_scalar _ring_core_0_17_5_little_endian_bytes_from_scalar +%define _ecp_nistz256_neg _ring_core_0_17_5_ecp_nistz256_neg +%define _ecp_nistz256_select_w5 _ring_core_0_17_5_ecp_nistz256_select_w5 +%define _ecp_nistz256_select_w7 _ring_core_0_17_5_ecp_nistz256_select_w7 +%define _p256_mul_mont _ring_core_0_17_5_p256_mul_mont +%define _p256_point_add _ring_core_0_17_5_p256_point_add +%define _p256_point_add_affine _ring_core_0_17_5_p256_point_add_affine +%define _p256_point_double _ring_core_0_17_5_p256_point_double +%define _p256_point_mul _ring_core_0_17_5_p256_point_mul +%define _p256_point_mul_base _ring_core_0_17_5_p256_point_mul_base +%define _p256_point_mul_base_vartime _ring_core_0_17_5_p256_point_mul_base_vartime +%define _p256_scalar_mul_mont _ring_core_0_17_5_p256_scalar_mul_mont +%define _p256_scalar_sqr_rep_mont _ring_core_0_17_5_p256_scalar_sqr_rep_mont +%define _p256_sqr_mont _ring_core_0_17_5_p256_sqr_mont +%define _p384_elem_div_by_2 _ring_core_0_17_5_p384_elem_div_by_2 +%define _p384_elem_mul_mont _ring_core_0_17_5_p384_elem_mul_mont +%define _p384_elem_neg _ring_core_0_17_5_p384_elem_neg +%define _p384_elem_sub _ring_core_0_17_5_p384_elem_sub +%define _p384_point_add _ring_core_0_17_5_p384_point_add +%define _p384_point_double _ring_core_0_17_5_p384_point_double +%define _p384_point_mul _ring_core_0_17_5_p384_point_mul +%define _p384_scalar_mul_mont _ring_core_0_17_5_p384_scalar_mul_mont +%define _openssl_poly1305_neon2_addmulmod _ring_core_0_17_5_openssl_poly1305_neon2_addmulmod +%define _openssl_poly1305_neon2_blocks _ring_core_0_17_5_openssl_poly1305_neon2_blocks +%define _sha256_block_data_order _ring_core_0_17_5_sha256_block_data_order +%define _sha512_block_data_order _ring_core_0_17_5_sha512_block_data_order +%define _vpaes_ctr32_encrypt_blocks _ring_core_0_17_5_vpaes_ctr32_encrypt_blocks +%define _vpaes_encrypt _ring_core_0_17_5_vpaes_encrypt +%define _vpaes_encrypt_key_to_bsaes _ring_core_0_17_5_vpaes_encrypt_key_to_bsaes +%define _vpaes_set_encrypt_key _ring_core_0_17_5_vpaes_set_encrypt_key +%define _x25519_NEON _ring_core_0_17_5_x25519_NEON +%define _x25519_fe_invert _ring_core_0_17_5_x25519_fe_invert +%define _x25519_fe_isnegative _ring_core_0_17_5_x25519_fe_isnegative +%define _x25519_fe_mul_ttt _ring_core_0_17_5_x25519_fe_mul_ttt +%define _x25519_fe_neg _ring_core_0_17_5_x25519_fe_neg +%define _x25519_fe_tobytes _ring_core_0_17_5_x25519_fe_tobytes +%define _x25519_ge_double_scalarmult_vartime _ring_core_0_17_5_x25519_ge_double_scalarmult_vartime +%define _x25519_ge_frombytes_vartime _ring_core_0_17_5_x25519_ge_frombytes_vartime +%define _x25519_ge_scalarmult_base _ring_core_0_17_5_x25519_ge_scalarmult_base +%define _x25519_ge_scalarmult_base_adx _ring_core_0_17_5_x25519_ge_scalarmult_base_adx +%define _x25519_public_from_private_generic_masked _ring_core_0_17_5_x25519_public_from_private_generic_masked +%define _x25519_sc_mask _ring_core_0_17_5_x25519_sc_mask +%define _x25519_sc_muladd _ring_core_0_17_5_x25519_sc_muladd +%define _x25519_sc_reduce _ring_core_0_17_5_x25519_sc_reduce +%define _x25519_scalar_mult_adx _ring_core_0_17_5_x25519_scalar_mult_adx +%define _x25519_scalar_mult_generic_masked _ring_core_0_17_5_x25519_scalar_mult_generic_masked + +%else +%define ecp_nistz256_point_double p256_point_double +%define ecp_nistz256_point_add p256_point_add +%define ecp_nistz256_point_add_affine p256_point_add_affine +%define ecp_nistz256_ord_mul_mont p256_scalar_mul_mont +%define ecp_nistz256_ord_sqr_mont p256_scalar_sqr_rep_mont +%define ecp_nistz256_mul_mont p256_mul_mont +%define ecp_nistz256_sqr_mont p256_sqr_mont +%define CRYPTO_memcmp ring_core_0_17_5_CRYPTO_memcmp +%define CRYPTO_poly1305_finish ring_core_0_17_5_CRYPTO_poly1305_finish +%define CRYPTO_poly1305_finish_neon ring_core_0_17_5_CRYPTO_poly1305_finish_neon +%define CRYPTO_poly1305_init ring_core_0_17_5_CRYPTO_poly1305_init +%define CRYPTO_poly1305_init_neon ring_core_0_17_5_CRYPTO_poly1305_init_neon +%define CRYPTO_poly1305_update ring_core_0_17_5_CRYPTO_poly1305_update +%define CRYPTO_poly1305_update_neon ring_core_0_17_5_CRYPTO_poly1305_update_neon +%define ChaCha20_ctr32 ring_core_0_17_5_ChaCha20_ctr32 +%define LIMBS_add_mod ring_core_0_17_5_LIMBS_add_mod +%define LIMBS_are_even ring_core_0_17_5_LIMBS_are_even +%define LIMBS_are_zero ring_core_0_17_5_LIMBS_are_zero +%define LIMBS_equal ring_core_0_17_5_LIMBS_equal +%define LIMBS_equal_limb ring_core_0_17_5_LIMBS_equal_limb +%define LIMBS_less_than ring_core_0_17_5_LIMBS_less_than +%define LIMBS_less_than_limb ring_core_0_17_5_LIMBS_less_than_limb +%define LIMBS_reduce_once ring_core_0_17_5_LIMBS_reduce_once +%define LIMBS_select_512_32 ring_core_0_17_5_LIMBS_select_512_32 +%define LIMBS_shl_mod ring_core_0_17_5_LIMBS_shl_mod +%define LIMBS_sub_mod ring_core_0_17_5_LIMBS_sub_mod +%define LIMBS_window5_split_window ring_core_0_17_5_LIMBS_window5_split_window +%define LIMBS_window5_unsplit_window ring_core_0_17_5_LIMBS_window5_unsplit_window +%define LIMB_shr ring_core_0_17_5_LIMB_shr +%define OPENSSL_armcap_P ring_core_0_17_5_OPENSSL_armcap_P +%define OPENSSL_cpuid_setup ring_core_0_17_5_OPENSSL_cpuid_setup +%define OPENSSL_ia32cap_P ring_core_0_17_5_OPENSSL_ia32cap_P +%define aes_hw_ctr32_encrypt_blocks ring_core_0_17_5_aes_hw_ctr32_encrypt_blocks +%define aes_hw_encrypt ring_core_0_17_5_aes_hw_encrypt +%define aes_hw_set_encrypt_key ring_core_0_17_5_aes_hw_set_encrypt_key +%define aes_nohw_ctr32_encrypt_blocks ring_core_0_17_5_aes_nohw_ctr32_encrypt_blocks +%define aes_nohw_encrypt ring_core_0_17_5_aes_nohw_encrypt +%define aes_nohw_set_encrypt_key ring_core_0_17_5_aes_nohw_set_encrypt_key +%define aesni_gcm_decrypt ring_core_0_17_5_aesni_gcm_decrypt +%define aesni_gcm_encrypt ring_core_0_17_5_aesni_gcm_encrypt +%define bn_from_montgomery_in_place ring_core_0_17_5_bn_from_montgomery_in_place +%define bn_gather5 ring_core_0_17_5_bn_gather5 +%define bn_mul_mont ring_core_0_17_5_bn_mul_mont +%define bn_mul_mont_gather5 ring_core_0_17_5_bn_mul_mont_gather5 +%define bn_neg_inv_mod_r_u64 ring_core_0_17_5_bn_neg_inv_mod_r_u64 +%define bn_power5 ring_core_0_17_5_bn_power5 +%define bn_scatter5 ring_core_0_17_5_bn_scatter5 +%define bn_sqr8x_internal ring_core_0_17_5_bn_sqr8x_internal +%define bn_sqrx8x_internal ring_core_0_17_5_bn_sqrx8x_internal +%define bsaes_ctr32_encrypt_blocks ring_core_0_17_5_bsaes_ctr32_encrypt_blocks +%define bssl_constant_time_test_conditional_memcpy ring_core_0_17_5_bssl_constant_time_test_conditional_memcpy +%define bssl_constant_time_test_conditional_memxor ring_core_0_17_5_bssl_constant_time_test_conditional_memxor +%define bssl_constant_time_test_main ring_core_0_17_5_bssl_constant_time_test_main +%define chacha20_poly1305_open ring_core_0_17_5_chacha20_poly1305_open +%define chacha20_poly1305_seal ring_core_0_17_5_chacha20_poly1305_seal +%define fiat_curve25519_adx_mul ring_core_0_17_5_fiat_curve25519_adx_mul +%define fiat_curve25519_adx_square ring_core_0_17_5_fiat_curve25519_adx_square +%define gcm_ghash_avx ring_core_0_17_5_gcm_ghash_avx +%define gcm_ghash_clmul ring_core_0_17_5_gcm_ghash_clmul +%define gcm_ghash_neon ring_core_0_17_5_gcm_ghash_neon +%define gcm_gmult_clmul ring_core_0_17_5_gcm_gmult_clmul +%define gcm_gmult_neon ring_core_0_17_5_gcm_gmult_neon +%define gcm_init_avx ring_core_0_17_5_gcm_init_avx +%define gcm_init_clmul ring_core_0_17_5_gcm_init_clmul +%define gcm_init_neon ring_core_0_17_5_gcm_init_neon +%define k25519Precomp ring_core_0_17_5_k25519Precomp +%define limbs_mul_add_limb ring_core_0_17_5_limbs_mul_add_limb +%define little_endian_bytes_from_scalar ring_core_0_17_5_little_endian_bytes_from_scalar +%define ecp_nistz256_neg ring_core_0_17_5_ecp_nistz256_neg +%define ecp_nistz256_select_w5 ring_core_0_17_5_ecp_nistz256_select_w5 +%define ecp_nistz256_select_w7 ring_core_0_17_5_ecp_nistz256_select_w7 +%define p256_mul_mont ring_core_0_17_5_p256_mul_mont +%define p256_point_add ring_core_0_17_5_p256_point_add +%define p256_point_add_affine ring_core_0_17_5_p256_point_add_affine +%define p256_point_double ring_core_0_17_5_p256_point_double +%define p256_point_mul ring_core_0_17_5_p256_point_mul +%define p256_point_mul_base ring_core_0_17_5_p256_point_mul_base +%define p256_point_mul_base_vartime ring_core_0_17_5_p256_point_mul_base_vartime +%define p256_scalar_mul_mont ring_core_0_17_5_p256_scalar_mul_mont +%define p256_scalar_sqr_rep_mont ring_core_0_17_5_p256_scalar_sqr_rep_mont +%define p256_sqr_mont ring_core_0_17_5_p256_sqr_mont +%define p384_elem_div_by_2 ring_core_0_17_5_p384_elem_div_by_2 +%define p384_elem_mul_mont ring_core_0_17_5_p384_elem_mul_mont +%define p384_elem_neg ring_core_0_17_5_p384_elem_neg +%define p384_elem_sub ring_core_0_17_5_p384_elem_sub +%define p384_point_add ring_core_0_17_5_p384_point_add +%define p384_point_double ring_core_0_17_5_p384_point_double +%define p384_point_mul ring_core_0_17_5_p384_point_mul +%define p384_scalar_mul_mont ring_core_0_17_5_p384_scalar_mul_mont +%define openssl_poly1305_neon2_addmulmod ring_core_0_17_5_openssl_poly1305_neon2_addmulmod +%define openssl_poly1305_neon2_blocks ring_core_0_17_5_openssl_poly1305_neon2_blocks +%define sha256_block_data_order ring_core_0_17_5_sha256_block_data_order +%define sha512_block_data_order ring_core_0_17_5_sha512_block_data_order +%define vpaes_ctr32_encrypt_blocks ring_core_0_17_5_vpaes_ctr32_encrypt_blocks +%define vpaes_encrypt ring_core_0_17_5_vpaes_encrypt +%define vpaes_encrypt_key_to_bsaes ring_core_0_17_5_vpaes_encrypt_key_to_bsaes +%define vpaes_set_encrypt_key ring_core_0_17_5_vpaes_set_encrypt_key +%define x25519_NEON ring_core_0_17_5_x25519_NEON +%define x25519_fe_invert ring_core_0_17_5_x25519_fe_invert +%define x25519_fe_isnegative ring_core_0_17_5_x25519_fe_isnegative +%define x25519_fe_mul_ttt ring_core_0_17_5_x25519_fe_mul_ttt +%define x25519_fe_neg ring_core_0_17_5_x25519_fe_neg +%define x25519_fe_tobytes ring_core_0_17_5_x25519_fe_tobytes +%define x25519_ge_double_scalarmult_vartime ring_core_0_17_5_x25519_ge_double_scalarmult_vartime +%define x25519_ge_frombytes_vartime ring_core_0_17_5_x25519_ge_frombytes_vartime +%define x25519_ge_scalarmult_base ring_core_0_17_5_x25519_ge_scalarmult_base +%define x25519_ge_scalarmult_base_adx ring_core_0_17_5_x25519_ge_scalarmult_base_adx +%define x25519_public_from_private_generic_masked ring_core_0_17_5_x25519_public_from_private_generic_masked +%define x25519_sc_mask ring_core_0_17_5_x25519_sc_mask +%define x25519_sc_muladd ring_core_0_17_5_x25519_sc_muladd +%define x25519_sc_reduce ring_core_0_17_5_x25519_sc_reduce +%define x25519_scalar_mult_adx ring_core_0_17_5_x25519_scalar_mult_adx +%define x25519_scalar_mult_generic_masked ring_core_0_17_5_x25519_scalar_mult_generic_masked + +%endif +%endif diff --git a/shim/third-party/rust/fixups/rustix/fixups.toml b/shim/third-party/rust/fixups/rustix/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/rustix/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/rustls/fixups.toml b/shim/third-party/rust/fixups/rustls/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/rustls/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/rustversion/fixups.toml b/shim/third-party/rust/fixups/rustversion/fixups.toml new file mode 100644 index 00000000000..ac9ebfb4af7 --- /dev/null +++ b/shim/third-party/rust/fixups/rustversion/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.gen_srcs] diff --git a/shim/third-party/rust/fixups/serde/fixups.toml b/shim/third-party/rust/fixups/serde/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/serde/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/serde_derive/fixups.toml b/shim/third-party/rust/fixups/serde_derive/fixups.toml new file mode 100644 index 00000000000..7de4ebb3e19 --- /dev/null +++ b/shim/third-party/rust/fixups/serde_derive/fixups.toml @@ -0,0 +1,3 @@ +# To set `CARGO_MANIFEST_DIR` +cargo_env = true +buildscript = [] diff --git a/shim/third-party/rust/fixups/serde_json/fixups.toml b/shim/third-party/rust/fixups/serde_json/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/serde_json/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/signal-hook/fixups.toml b/shim/third-party/rust/fixups/signal-hook/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/signal-hook/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/slab/fixups.toml b/shim/third-party/rust/fixups/slab/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/slab/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/slog/fixups.toml b/shim/third-party/rust/fixups/slog/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/slog/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/syn/fixups.toml b/shim/third-party/rust/fixups/syn/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/syn/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/sys-info/fixups.toml b/shim/third-party/rust/fixups/sys-info/fixups.toml new file mode 100644 index 00000000000..5d124b3ad7a --- /dev/null +++ b/shim/third-party/rust/fixups/sys-info/fixups.toml @@ -0,0 +1,19 @@ +buildscript = [] + +[[platform_fixup.'cfg(target_os = "linux")'.buildscript]] +[platform_fixup.'cfg(target_os = "linux")'.buildscript.cxx_library] +name = "linux" +srcs = ["c/linux.c"] +headers = ["c/*.h"] + +[[platform_fixup.'cfg(target_os = "macos")'.buildscript]] +[platform_fixup.'cfg(target_os = "macos")'.buildscript.cxx_library] +name = "macos" +srcs = ["c/darwin.c"] +headers = ["c/*.h"] + +[[platform_fixup.'cfg(target_os = "windows")'.buildscript]] +[platform_fixup.'cfg(target_os = "windows")'.buildscript.cxx_library] +name = "windows" +srcs = ["c/windows.c"] +headers = ["c/*.h"] diff --git a/shim/third-party/rust/fixups/sysinfo/fixups.toml b/shim/third-party/rust/fixups/sysinfo/fixups.toml new file mode 100644 index 00000000000..8518b189700 --- /dev/null +++ b/shim/third-party/rust/fixups/sysinfo/fixups.toml @@ -0,0 +1,11 @@ +extra_srcs = ["README.md", "md_doc/**/*.md"] +buildscript = [] + +[platform_fixup.'cfg(target_os = "macos")'] +buildscript = [] +rustc_flags = [ + "-lframework=IOKit", + "-lframework=Foundation", + "-lframework=CoreFoundation", + "-lframework=DiskArbitration", +] diff --git a/shim/third-party/rust/fixups/tempfile/fixups.toml b/shim/third-party/rust/fixups/tempfile/fixups.toml new file mode 100644 index 00000000000..5e026f75e0d --- /dev/null +++ b/shim/third-party/rust/fixups/tempfile/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/terminfo/fixups.toml b/shim/third-party/rust/fixups/terminfo/fixups.toml new file mode 100644 index 00000000000..ac9ebfb4af7 --- /dev/null +++ b/shim/third-party/rust/fixups/terminfo/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.gen_srcs] diff --git a/shim/third-party/rust/fixups/termwiz/fixups.toml b/shim/third-party/rust/fixups/termwiz/fixups.toml new file mode 100644 index 00000000000..fdba1eb21b8 --- /dev/null +++ b/shim/third-party/rust/fixups/termwiz/fixups.toml @@ -0,0 +1,2 @@ +cargo_env = true +extra_srcs = ["src/**/*.pest"] diff --git a/shim/third-party/rust/fixups/test-case/fixups.toml b/shim/third-party/rust/fixups/test-case/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/test-case/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/thiserror/fixups.toml b/shim/third-party/rust/fixups/thiserror/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/thiserror/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/tiny-keccak/fixups.toml b/shim/third-party/rust/fixups/tiny-keccak/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/tiny-keccak/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/tokio-stream/fixups.toml b/shim/third-party/rust/fixups/tokio-stream/fixups.toml new file mode 100644 index 00000000000..a1f4f0e7091 --- /dev/null +++ b/shim/third-party/rust/fixups/tokio-stream/fixups.toml @@ -0,0 +1,2 @@ +# reindeer cannot see through `cfg_sync!` macros and the like +extra_srcs = ["src/**/*.rs"] diff --git a/shim/third-party/rust/fixups/tokio-util/fixups.toml b/shim/third-party/rust/fixups/tokio-util/fixups.toml new file mode 100644 index 00000000000..af7edb27e3b --- /dev/null +++ b/shim/third-party/rust/fixups/tokio-util/fixups.toml @@ -0,0 +1 @@ +extra_srcs = ["src/**/*.rs"] diff --git a/shim/third-party/rust/fixups/tokio/fixups.toml b/shim/third-party/rust/fixups/tokio/fixups.toml new file mode 100644 index 00000000000..d69dcefddb3 --- /dev/null +++ b/shim/third-party/rust/fixups/tokio/fixups.toml @@ -0,0 +1,8 @@ +cfgs = ["tokio_unstable", "tokio_track_caller"] + +extra_srcs = ["src/**/*.rs"] + +buildscript = [] +features = ["tokio_track_caller"] + +extra_deps = [ ":tracing" ] diff --git a/shim/third-party/rust/fixups/tonic/fixups.toml b/shim/third-party/rust/fixups/tonic/fixups.toml new file mode 100644 index 00000000000..41439d3356a --- /dev/null +++ b/shim/third-party/rust/fixups/tonic/fixups.toml @@ -0,0 +1 @@ +cargo_env = true diff --git a/shim/third-party/rust/fixups/tracing-subscriber/fixups.toml b/shim/third-party/rust/fixups/tracing-subscriber/fixups.toml new file mode 100644 index 00000000000..28683dbe3cb --- /dev/null +++ b/shim/third-party/rust/fixups/tracing-subscriber/fixups.toml @@ -0,0 +1,2 @@ +# Reindeer can't find the dependencies due to being confused by the feature! macro. +extra_srcs = ["src/**/*.rs"] diff --git a/shim/third-party/rust/fixups/trybuild/fixups.toml b/shim/third-party/rust/fixups/trybuild/fixups.toml new file mode 100644 index 00000000000..ac9ebfb4af7 --- /dev/null +++ b/shim/third-party/rust/fixups/trybuild/fixups.toml @@ -0,0 +1,2 @@ +[[buildscript]] +[buildscript.gen_srcs] diff --git a/shim/third-party/rust/fixups/typenum/fixups.toml b/shim/third-party/rust/fixups/typenum/fixups.toml new file mode 100644 index 00000000000..7ab02e4fd17 --- /dev/null +++ b/shim/third-party/rust/fixups/typenum/fixups.toml @@ -0,0 +1,4 @@ +features = ["force_unix_path_separator"] + +[[buildscript]] +[buildscript.gen_srcs] diff --git a/shim/third-party/rust/fixups/unicase/fixups.toml b/shim/third-party/rust/fixups/unicase/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/unicase/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/winapi-x86_64-pc-windows-gnu/fixups.toml b/shim/third-party/rust/fixups/winapi-x86_64-pc-windows-gnu/fixups.toml new file mode 100644 index 00000000000..07c79834d92 --- /dev/null +++ b/shim/third-party/rust/fixups/winapi-x86_64-pc-windows-gnu/fixups.toml @@ -0,0 +1,9 @@ +buildscript = [] + +[[platform_fixup.'cfg(target_os = "windows")'.buildscript]] +[platform_fixup.'cfg(target_os = "windows")'.buildscript.prebuilt_cxx_library] +name = "extra_libraries" +# The static_libs this crate provides overlaps quite heavily with those in a default +# MinGW install, and there are also many that are DirectX specific. +# We list only those we actually need, since the others are more likely to cause problems. +static_libs = ["lib/libwinapi_ole32.a", "lib/libwinapi_shell32.a"] diff --git a/shim/third-party/rust/fixups/winapi/fixups.toml b/shim/third-party/rust/fixups/winapi/fixups.toml new file mode 100644 index 00000000000..ec4f86e500d --- /dev/null +++ b/shim/third-party/rust/fixups/winapi/fixups.toml @@ -0,0 +1,4 @@ +buildscript = [] + +[[platform_fixup.'cfg(target_os = "windows")'.buildscript]] +[platform_fixup.'cfg(target_os = "windows")'.buildscript.rustc_flags] diff --git a/shim/third-party/rust/fixups/windows-targets/fixups.toml b/shim/third-party/rust/fixups/windows-targets/fixups.toml new file mode 100644 index 00000000000..b3555c7795e --- /dev/null +++ b/shim/third-party/rust/fixups/windows-targets/fixups.toml @@ -0,0 +1,3 @@ +[platform_fixup.'cfg(any(target_os = "windows", target_os = "linux"))'] +version = ">=0.48.0" +cfgs = ["windows_raw_dylib"] diff --git a/shim/third-party/rust/fixups/windows_aarch64_gnullvm/fixups.toml b/shim/third-party/rust/fixups/windows_aarch64_gnullvm/fixups.toml new file mode 100644 index 00000000000..f40e9f9cbe6 --- /dev/null +++ b/shim/third-party/rust/fixups/windows_aarch64_gnullvm/fixups.toml @@ -0,0 +1,8 @@ +buildscript = [] + +[platform_fixup.'cfg(all(target_os = "linux", target_arch = "aarch64"))'] +version = "=0.48.0" +[[platform_fixup.'cfg(all(target_os = "linux", target_arch = "aarch64"))'.buildscript]] +[platform_fixup.'cfg(all(target_os = "linux", target_arch = "aarch64"))'.buildscript.prebuilt_cxx_library] +name = "libwindows" +static_libs = ["lib/libwindows.0.48.0.a"] diff --git a/shim/third-party/rust/fixups/windows_x86_64_gnu/fixups.toml b/shim/third-party/rust/fixups/windows_x86_64_gnu/fixups.toml new file mode 100644 index 00000000000..b25e7f05fa5 --- /dev/null +++ b/shim/third-party/rust/fixups/windows_x86_64_gnu/fixups.toml @@ -0,0 +1,8 @@ +buildscript = [] + +[platform_fixup.'cfg(all(target_os = "windows", target_env = "gnu"))'] +version = "=0.48.0" +[[platform_fixup.'cfg(all(target_os = "windows", target_env = "gnu"))'.buildscript]] +[platform_fixup.'cfg(all(target_os = "windows", target_env = "gnu"))'.buildscript.prebuilt_cxx_library] +name = "libwindows" +static_libs = ["lib/libwindows.0.48.0.a"] diff --git a/shim/third-party/rust/fixups/windows_x86_64_gnullvm/fixups.toml b/shim/third-party/rust/fixups/windows_x86_64_gnullvm/fixups.toml new file mode 100644 index 00000000000..a5579b6930e --- /dev/null +++ b/shim/third-party/rust/fixups/windows_x86_64_gnullvm/fixups.toml @@ -0,0 +1,8 @@ +buildscript = [] + +[platform_fixup.'cfg(all(target_os = "linux", target_arch = "x86_64"))'] +version = "=0.48.0" +[[platform_fixup.'cfg(all(target_os = "linux", target_arch = "x86_64"))'.buildscript]] +[platform_fixup.'cfg(all(target_os = "linux", target_arch = "x86_64"))'.buildscript.prebuilt_cxx_library] +name = "libwindows" +static_libs = ["lib/libwindows.0.48.0.a"] diff --git a/shim/third-party/rust/fixups/windows_x86_64_msvc/fixups.toml b/shim/third-party/rust/fixups/windows_x86_64_msvc/fixups.toml new file mode 100644 index 00000000000..8e8dea35165 --- /dev/null +++ b/shim/third-party/rust/fixups/windows_x86_64_msvc/fixups.toml @@ -0,0 +1,8 @@ +buildscript = [] + +[platform_fixup.'cfg(all(target_os = "windows", target_env = "msvc"))'] +version = "=0.48.0" +[[platform_fixup.'cfg(all(target_os = "windows", target_env = "msvc"))'.buildscript]] +[platform_fixup.'cfg(all(target_os = "windows", target_env = "msvc"))'.buildscript.prebuilt_cxx_library] +name = "windows" +static_libs = ["lib/windows.0.48.0.lib"] diff --git a/shim/third-party/rust/fixups/winreg/fixups.toml b/shim/third-party/rust/fixups/winreg/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/winreg/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/zerocopy/fixups.toml b/shim/third-party/rust/fixups/zerocopy/fixups.toml new file mode 100644 index 00000000000..41439d3356a --- /dev/null +++ b/shim/third-party/rust/fixups/zerocopy/fixups.toml @@ -0,0 +1 @@ +cargo_env = true diff --git a/shim/third-party/rust/fixups/zstd-safe/fixups.toml b/shim/third-party/rust/fixups/zstd-safe/fixups.toml new file mode 100644 index 00000000000..db40d72cb2e --- /dev/null +++ b/shim/third-party/rust/fixups/zstd-safe/fixups.toml @@ -0,0 +1 @@ +buildscript = [] diff --git a/shim/third-party/rust/fixups/zstd-sys/fixups.toml b/shim/third-party/rust/fixups/zstd-sys/fixups.toml new file mode 100644 index 00000000000..164b6a7237b --- /dev/null +++ b/shim/third-party/rust/fixups/zstd-sys/fixups.toml @@ -0,0 +1,114 @@ +buildscript = [] + +[[platform_fixup.'cfg(not(all(target_os = "windows", target_env = "msvc")))'.buildscript]] +[platform_fixup.'cfg(not(all(target_os = "windows", target_env = "msvc")))'.buildscript.cxx_library] +name = "zstd" +srcs = [ + "zstd/lib/common/debug.c", + "zstd/lib/common/entropy_common.c", + "zstd/lib/common/error_private.c", + "zstd/lib/common/fse_decompress.c", + "zstd/lib/common/pool.c", + "zstd/lib/common/threading.c", + #"zstd/lib/common/xxhash.c", + "zstd/lib/common/zstd_common.c", + "zstd/lib/compress/**/*.c", + "zstd/lib/decompress/**/*.c", + "zstd/lib/decompress/huf_decompress_amd64.S", + "zstd/lib/dictBuilder/**/*.c", + "zstd/lib/legacy/**/*.c", +] +headers = [ + "zdict.h", + "zstd.h", + "zstd/lib/common/bitstream.h", + "zstd/lib/common/compiler.h", + "zstd/lib/common/cpu.h", + "zstd/lib/common/debug.h", + "zstd/lib/common/error_private.h", + "zstd/lib/common/fse.h", + "zstd/lib/common/huf.h", + "zstd/lib/common/mem.h", + "zstd/lib/common/pool.h", + "zstd/lib/common/portability_macros.h", + "zstd/lib/common/threading.h", + #"zstd/lib/common/xxhash.h", + "zstd/lib/common/zstd_deps.h", + "zstd/lib/common/zstd_internal.h", + "zstd/lib/common/zstd_trace.h", + "zstd/lib/compress/**/*.h", + "zstd/lib/decompress/**/*.h", + "zstd/lib/deprecated/zbuff.h", + "zstd/lib/dictBuilder/cover.h", + "zstd/lib/dictBuilder/divsufsort.h", + "zstd/lib/legacy/**/*.h", + "zstd/lib/zdict.h", + "zstd/lib/zstd_errors.h", + "zstd/lib/zstd.h", +] +compiler_flags = [ + "-O3", + "-DZSTD_LIB_DEPRECATED=0", + "-fvisibility=hidden", + "-DXXH_PRIVATE_API=", + "-DZSTDLIB_VISIBILITY=", + "-DZDICTLIB_VISIBILITY=", + "-DZSTDERRORLIB_VISIBILITY=", + "-DZSTD_LEGACY_SUPPORT=1" +] + +[[platform_fixup.'cfg(all(target_os = "windows", target_env = "msvc"))'.buildscript]] +[platform_fixup.'cfg(all(target_os = "windows", target_env = "msvc"))'.buildscript.cxx_library] +name = "zstd-msvc" +srcs = [ + "zstd/lib/common/debug.c", + "zstd/lib/common/entropy_common.c", + "zstd/lib/common/error_private.c", + "zstd/lib/common/fse_decompress.c", + "zstd/lib/common/pool.c", + "zstd/lib/common/threading.c", + #"zstd/lib/common/xxhash.c", + "zstd/lib/common/zstd_common.c", + "zstd/lib/compress/**/*.c", + "zstd/lib/decompress/**/*.c", + #"zstd/lib/decompress/huf_decompress_amd64.S", + "zstd/lib/dictBuilder/**/*.c", + "zstd/lib/legacy/**/*.c", +] +headers = [ + "zdict.h", + "zstd.h", + "zstd/lib/common/bitstream.h", + "zstd/lib/common/compiler.h", + "zstd/lib/common/cpu.h", + "zstd/lib/common/debug.h", + "zstd/lib/common/error_private.h", + "zstd/lib/common/fse.h", + "zstd/lib/common/huf.h", + "zstd/lib/common/mem.h", + "zstd/lib/common/pool.h", + "zstd/lib/common/portability_macros.h", + "zstd/lib/common/threading.h", + #"zstd/lib/common/xxhash.h", + "zstd/lib/common/zstd_deps.h", + "zstd/lib/common/zstd_internal.h", + "zstd/lib/common/zstd_trace.h", + "zstd/lib/compress/**/*.h", + "zstd/lib/decompress/**/*.h", + "zstd/lib/deprecated/zbuff.h", + "zstd/lib/dictBuilder/cover.h", + "zstd/lib/dictBuilder/divsufsort.h", + "zstd/lib/legacy/**/*.h", + "zstd/lib/zdict.h", + "zstd/lib/zstd_errors.h", + "zstd/lib/zstd.h", +] +compiler_flags = [ + "/O2", + "-DZSTD_LIB_DEPRECATED=0", + "-DXXH_PRIVATE_API=", + "-DZSTDLIB_VISIBILITY=", + "-DZDICTLIB_VISIBILITY=", + "-DZSTDERRORLIB_VISIBILITY=", + "-DZSTD_LEGACY_SUPPORT=1" +] diff --git a/shim/third-party/rust/reindeer.toml b/shim/third-party/rust/reindeer.toml new file mode 100644 index 00000000000..4aa852e04e1 --- /dev/null +++ b/shim/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/shim/third-party/rust/top/main.rs b/shim/third-party/rust/top/main.rs new file mode 100644 index 00000000000..7dde67dd19b --- /dev/null +++ b/shim/third-party/rust/top/main.rs @@ -0,0 +1,8 @@ +// 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. + +#![allow(unused_crate_dependencies)] + +fn main() {} diff --git a/shim/tools/build_defs/audit_dependencies_test.bzl b/shim/tools/build_defs/audit_dependencies_test.bzl new file mode 100644 index 00000000000..a3174389f55 --- /dev/null +++ b/shim/tools/build_defs/audit_dependencies_test.bzl @@ -0,0 +1,10 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +# Noop in OSS +def audit_dependencies_test(**_kwargs): + pass diff --git a/shim/tools/build_defs/buck2/is_buck2.bzl b/shim/tools/build_defs/buck2/is_buck2.bzl new file mode 100644 index 00000000000..45140ef215f --- /dev/null +++ b/shim/tools/build_defs/buck2/is_buck2.bzl @@ -0,0 +1,9 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +def is_buck2(): + return True diff --git a/shim/tools/build_defs/default_platform_defs.bzl b/shim/tools/build_defs/default_platform_defs.bzl new file mode 100644 index 00000000000..753ec6a3dcf --- /dev/null +++ b/shim/tools/build_defs/default_platform_defs.bzl @@ -0,0 +1 @@ +DEVSERVER_PLATFORM_REGEX = "UNUSED" diff --git a/shim/tools/build_defs/glob_defs.bzl b/shim/tools/build_defs/glob_defs.bzl new file mode 100644 index 00000000000..c119afa5564 --- /dev/null +++ b/shim/tools/build_defs/glob_defs.bzl @@ -0,0 +1,8 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +glob = native.glob diff --git a/shim/xplat/executorch/kernels/optimized/lib_defs.bzl b/shim/xplat/executorch/kernels/optimized/lib_defs.bzl new file mode 100644 index 00000000000..39c94f70fd4 --- /dev/null +++ b/shim/xplat/executorch/kernels/optimized/lib_defs.bzl @@ -0,0 +1,142 @@ +load("@fbsource//tools/build_defs:default_platform_defs.bzl", "DEVSERVER_PLATFORM_REGEX") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + +# Because vec exists as a collection of header files, compile and preprocessor +# flags applied to the vec target do not have any effect, since no compilation +# actually occurs for the target. +# +# Targets using the vec library must therefore call the get_vec_*_flags +# functions in order to declare the required compiler flags needed in order to +# access CPU vector intrinsics. + +def get_vec_android_preprocessor_flags(): + preprocessor_flags = [ + ( + "^android-arm64.*$", + [ + "-DET_BUILD_ARM_VEC256_WITH_SLEEF", + ], + ), + ] + return preprocessor_flags + +def get_vec_cxx_preprocessor_flags(): + preprocessor_flags = [ + ( + DEVSERVER_PLATFORM_REGEX, + [ + "-DCPU_CAPABILITY_AVX2", + ], + ), + ] + return preprocessor_flags + +def get_vec_fbcode_preprocessor_flags(): + preprocessor_flags = [ + "-DCPU_CAPABILITY_AVX2", + ] + return preprocessor_flags + +# Currently, having a dependency on fbsource//third-party/sleef:sleef may cause +# duplicate symbol errors when linking fbcode targets in opt mode that also +# depend on ATen. This is because ATen accesses sleef via the third-party folder +# in caffe2 (caffe2/third-party//sleef:sleef). +# TODO(ssjia): Enable -DCPU_CAPABILITY_AVX2 in fbcode, which requires sleef. +def define_libs(): + runtime.cxx_library( + name = "libvec", + srcs = [], + exported_headers = native.glob([ + "vec/**/*.h", + ]), + header_namespace = "executorch/kernels/optimized", + visibility = [ + "//executorch/...", + "@EXECUTORCH_CLIENTS", + ], + cxx_platform_deps = select({ + "DEFAULT": [ + ( + DEVSERVER_PLATFORM_REGEX, + [ + "fbsource//third-party/sleef:sleef", + ], + ), + ], + "ovr_config//cpu:arm64": [ + ( + DEVSERVER_PLATFORM_REGEX, + [ + "fbsource//third-party/sleef:sleef_arm", + ], + ), + ], + }), + fbandroid_platform_deps = [ + ( + "^android-arm64.*$", + [ + "fbsource//third-party/sleef:sleef_arm", + ], + ), + ], + ) + + runtime.cxx_library( + name = "libutils", + srcs = [], + exported_headers = native.glob([ + "utils/**/*.h", + ]), + header_namespace = "executorch/kernels/optimized", + visibility = [ + "//executorch/...", + "@EXECUTORCH_CLIENTS", + ], + exported_deps = [ + # Needed to access the __ET_INLINE macro + "//executorch/runtime/platform:compiler", + ], + ) + + runtime.cxx_library( + name = "libblas", + srcs = native.glob([ + "blas/**/*.cpp", + ]), + exported_headers = native.glob([ + "blas/**/*.h", + ]), + header_namespace = "executorch/kernels/optimized", + visibility = [ + "//executorch/...", + "@EXECUTORCH_CLIENTS", + ], + fbandroid_platform_preprocessor_flags = [ + ( + "^android-arm64.*$", + [ + "-DET_BUILD_WITH_BLAS", + ], + ), + ], + fbandroid_platform_deps = [ + ( + "^android-arm64.*$", + [ + "fbsource//third-party/openblas:openblas", + ], + ), + ], + fbobjc_exported_preprocessor_flags = [ + "-DET_BUILD_WITH_BLAS", + "-DET_BUILD_FOR_APPLE", + ], + fbobjc_frameworks = [ + "Accelerate", + ], + exported_deps = [ + "//executorch/kernels/optimized:libutils", + "//executorch/runtime/core/exec_aten:lib", + ], + ) diff --git a/shim/xplat/executorch/kernels/optimized/op_registration_util.bzl b/shim/xplat/executorch/kernels/optimized/op_registration_util.bzl new file mode 100644 index 00000000000..785c40187b8 --- /dev/null +++ b/shim/xplat/executorch/kernels/optimized/op_registration_util.bzl @@ -0,0 +1,131 @@ +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbsource//xplat/executorch/build:selects.bzl", "selects") +load( + "@fbsource//xplat/executorch/kernels/optimized:lib_defs.bzl", + "get_vec_android_preprocessor_flags", +) + +def op_target(name, deps = []): + """Registers an optimized implementation for an operator overload group. + + An operator overload group is a set of operator overloads with a common + operator name. That common operator name should be the base name of this + target. + + E.g., the "add" operator overload group, named "op_add" in this target, + might implement: + - add.Tensor + - add_.Tensor + - add.out + - add.Scalar + + If an op target would like to share a header/sources with a different op + target (e.g., helpers/utilities), it should declare a separate cxx_library + and add it as a dep. + + Args: + name: The name of the operator overload group; e.g., + "op_add". This directory must contain a source file named + ".cpp"; e.g., "op_add.cpp". + deps: Optional extra deps to add to the cxx_library(). Note: + - op targets may not depend on other op targets, to keep the + dependencies manageable. If two op targets would like to share + code, define a separate runtime.cxx_library that they both depend + on. + """ + + # Note that this doesn't actually define the target, but helps register + # it in a table that's used to define the target. + return { + "deps": deps, + "name": name, + } + +def _enforce_deps(deps, name): + """Fails if any of the deps are not allowed. + + Args: + deps: A list of build target strings. + name: The name of the target; e.g., "op_add" + """ + for dep in deps: + if dep.startswith(":op_"): + # op targets may not depend on other op targets, to keep the + # dependencies manageable. If two op targets would like to share + # code, define a separate runtime.cxx_library that they both depend + # on. + fail("op_target {} may not depend on other op_target {}".format( + name, + dep, + )) + +def define_op_library(name, deps): + """Defines a cxx_library target for the named operator overload group. + + Args: + name: The name of the target; e.g., "op_add" + deps: List of deps for the target. + """ + selects.apply(obj = deps, function = native.partial(_enforce_deps, name = name)) + + augmented_deps = deps + [ + "//executorch/kernels/optimized:libvec", + "//executorch/kernels/optimized:libutils", + ] + + runtime.cxx_library( + name = "{}".format(name), + srcs = [ + "{}.cpp".format(name), + ], + visibility = [ + "//executorch/kernels/portable/test/...", + "//executorch/kernels/quantized/test/...", + "//executorch/kernels/optimized/test/...", + "//executorch/kernels/test/...", + "@EXECUTORCH_CLIENTS", + ], + # kernels often have helpers with no prototypes just disabling the warning here as the headers + # are codegend and linked in later + compiler_flags = ["-Wno-missing-prototypes"], + deps = [ + "//executorch/runtime/kernel:kernel_includes", + ] + augmented_deps, + fbandroid_platform_preprocessor_flags = get_vec_android_preprocessor_flags(), + # sleef needs to be added as a direct dependency of the operator target when building for Android, + # or a linker error may occur. Not sure why this happens; it seems that fbandroid_platform_deps of + # dependencies are not transitive + fbandroid_platform_deps = [ + ( + "^android-arm64.*$", + [ + "fbsource//third-party/sleef:sleef_arm", + ], + ), + ], + # link_whole is necessary because the operators register themselves + # via static initializers that run at program startup. + # @lint-ignore BUCKLINT link_whole + link_whole = True, + ) + +def define_op_target(name, deps): + """Possibly defines cxx_library targets for the named operator group. + + Args: + name: The base name of the target; e.g., "op_add" + deps: List of deps for the targets. + """ + + # When building in ATen mode, ATen-compatible (non-custom) operators will + # use the implementations provided by ATen, so we should not build the + # versions defined here. + define_op_library( + name = name, + deps = deps, + ) + +def is_op_disabled(name): + # TODO (gjcomer) Enable ops with sleef dependency in OSS + disabled_ops = ["op_gelu", "op_log_softmax"] + return name in disabled_ops