diff --git a/quic/api/BUCK b/quic/api/BUCK deleted file mode 100644 index ec6343d00..000000000 --- a/quic/api/BUCK +++ /dev/null @@ -1,203 +0,0 @@ -load("@fbcode//quic:defs.bzl", "mvfst_cpp_library") - -oncall("traffic_protocols") - -mvfst_cpp_library( - name = "quic_batch_writer", - srcs = [ - "QuicBatchWriter.cpp", - "QuicBatchWriterFactory.cpp", - "QuicGsoBatchWriters.cpp", - ], - headers = [ - "QuicBatchWriter.h", - "QuicBatchWriterFactory.h", - "QuicGsoBatchWriters.h", - ], - deps = [ - "//quic/common:buf_accessor", - ], - exported_deps = [ - "//folly:network_address", - "//folly:portability", - "//folly/io:iobuf", - "//quic:constants", - "//quic/common/events:eventbase", - "//quic/common/udpsocket:quic_async_udp_socket", - "//quic/state:quic_state_machine", - ], -) - -mvfst_cpp_library( - name = "quic_callbacks", - srcs = [ - ], - headers = [ - "QuicCallbacks.h", - ], - deps = [ - ], - exported_deps = [ - "//quic/codec:types", - ], -) - -mvfst_cpp_library( - name = "transport", - srcs = [ - "QuicTransportBase.cpp", - ], - headers = [ - "QuicSocket.h", - "QuicTransportBase.h", - ], - deps = [ - ":loop_detector_callback", - ":quic_batch_writer", - ":transport_helpers", - "//folly:chrono", - "//folly:scope_guard", - "//quic/common:time_util", - "//quic/congestion_control:pacer", - "//quic/logging:qlogger_constants", - "//quic/loss:loss", - "//quic/state:pacing_functions", - "//quic/state:simple_frame_functions", - "//quic/state:state_functions", - "//quic/state:stream_functions", - ], - exported_deps = [ - ":transport_lite", - "//folly:exception_wrapper", - "//folly:maybe_managed_ptr", - "//folly:portability", - "//folly/io:iobuf", - "//quic:constants", - "//quic:exception", - "//quic/codec:types", - "//quic/common:network_data", - "//quic/common:optional", - "//quic/common:small_collections", - "//quic/common/events:eventbase", - "//quic/common/events:quic_timer", - "//quic/common/udpsocket:quic_async_udp_socket", - "//quic/congestion_control:bandwidth", - "//quic/congestion_control:congestion_controller_factory", - "//quic/congestion_control:copa", - "//quic/congestion_control:cubic", - "//quic/congestion_control:newreno", - "//quic/observer:socket_observer_container", - "//quic/observer:socket_observer_types", - "//quic/state:quic_connection_stats", - "//quic/state:quic_priority_queue", - "//quic/state:quic_state_machine", - "//quic/state:quic_stream_utilities", - "//quic/state:retransmission_policy", - ], -) - -mvfst_cpp_library( - name = "transport_lite", - srcs = [ - "QuicTransportBaseLite.cpp", - ], - headers = [ - "QuicSocketLite.h", - "QuicTransportBaseLite.h", - ], - deps = [ - ":loop_detector_callback", - "//quic/congestion_control:congestion_controller_factory", - "//quic/congestion_control:ecn_l4s_tracker", - "//quic/congestion_control:pacer", - "//quic/flowcontrol:flow_control", - "//quic/loss:loss", - "//quic/state:pacing_functions", - "//quic/state:stream_functions", - "//quic/state/stream:stream", - ], - exported_deps = [ - ":quic_callbacks", - ":transport_helpers", - "//folly:maybe_managed_ptr", - "//folly/io/async:async_transport_certificate", - "//quic:exception", - "//quic/codec:types", - "//quic/common:looper", - "//quic/common/udpsocket:quic_async_udp_socket", - "//quic/handshake:transport_parameters", - "//quic/state:quic_state_machine", - ], -) - -mvfst_cpp_library( - name = "transport_helpers", - srcs = [ - "IoBufQuicBatch.cpp", - "QuicPacketScheduler.cpp", - "QuicTransportFunctions.cpp", - ], - headers = [ - "IoBufQuicBatch.h", - "QuicPacketScheduler.h", - "QuicTransportFunctions.h", - ], - deps = [ - "//folly/tracing:static_tracepoint", - "//quic/common:buf_accessor", - "//quic/common:socket_util", - "//quic/happyeyeballs:happyeyeballs", - "//quic/state:ack_frequency_functions", - "//quic/state:ack_handler", - "//quic/state:simple_frame_functions", - ], - exported_deps = [ - ":quic_batch_writer", - "//folly:expected", - "//folly/lang:assume", - "//quic:constants", - "//quic:exception", - "//quic/client:state_and_handshake", - "//quic/codec:codec", - "//quic/codec:pktbuilder", - "//quic/codec:pktrebuilder", - "//quic/codec:types", - "//quic/common/udpsocket:quic_async_udp_socket", - "//quic/flowcontrol:flow_control", - "//quic/handshake:transport_parameters", - "//quic/state:quic_state_machine", - "//quic/state:state_functions", - "//quic/state:stats_callback", - "//quic/state:stream_functions", - ], - exported_external_deps = [ - "boost", - ], -) - -mvfst_cpp_library( - name = "loop_detector_callback", - headers = ["LoopDetectorCallback.h"], - exported_deps = [ - "//quic:constants", - ], -) - -mvfst_cpp_library( - name = "stream_async_transport", - srcs = [ - "QuicStreamAsyncTransport.cpp", - ], - headers = [ - "QuicStreamAsyncTransport.h", - ], - deps = [ - "//folly/io:iobuf", - "//quic/common/events:folly_eventbase", - ], - exported_deps = [ - ":transport", - "//folly/io/async:async_transport", - "//quic/common/events:eventbase", - ], -) diff --git a/quic/defs.bzl b/quic/defs.bzl index 60608ff00..f6165d9b4 100644 --- a/quic/defs.bzl +++ b/quic/defs.bzl @@ -6,6 +6,7 @@ load("@fbcode_macros//build_defs:autodeps_rule.bzl", "autodeps_rule") load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") load("@fbsource//tools/build_defs:buckconfig.bzl", "read_bool") +load("@fbsource//tools/build_defs:cell_defs.bzl", "get_fbsource_cell") load( "@fbsource//tools/build_defs:default_platform_defs.bzl", "ANDROID", @@ -21,6 +22,7 @@ load("@fbsource//tools/build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_libra 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") load("@fbsource//tools/build_defs:type_defs.bzl", "is_tuple") +load("@fbsource//tools/build_defs/xplat:deps_map_utils.bzl", "deps_map_utils") load("@fbsource//xplat/pfh/Infra_Networking_Core:DEFS.bzl", "Infra_Networking_Core") CXXFLAGS = [ @@ -73,21 +75,53 @@ def _compute_header_namespace(): def use_libev(): return read_bool("mvfst", "use_libev", False) -def mvfst_cpp_library(name, autodeps_skip = False, **kwargs): - preprocessor_flags = kwargs.pop("preprocessor_flags", []) - if use_libev(): - preprocessor_flags += ["-DMVFST_USE_LIBEV"] - - kwargs["preprocessor_flags"] = preprocessor_flags - cpp_library(name = name, autodeps_skip = True, **kwargs) +def mvfst_cpp_library( + name, + autodeps_skip = False, + deps = (), + exported_deps = (), + external_deps = (), + exported_external_deps = (), + **kwargs): + # Convert deps, exported_deps, and external_deps + if get_fbsource_cell() == "fbcode": + preprocessor_flags = kwargs.pop("preprocessor_flags", []) + if use_libev(): + preprocessor_flags += ["-DMVFST_USE_LIBEV"] - if not autodeps_skip: - autodeps_rule( + kwargs["preprocessor_flags"] = preprocessor_flags + cpp_library( name = name, - type = "mvfst_cpp_library", - attrs = kwargs, + autodeps_skip = True, + deps = deps, + exported_deps = exported_deps, + external_deps = external_deps, + exported_external_deps = exported_external_deps, + **kwargs + ) + + if not autodeps_skip: + autodeps_rule( + name = name, + type = "mvfst_cpp_library", + attrs = kwargs, + ) + else: + deps = deps_map_utils.convert_to_fbsource_fp_deps(deps) + deps_map_utils.convert_to_fbsource_tp_deps(external_deps) + exported_deps = deps_map_utils.convert_to_fbsource_fp_deps(exported_deps) + deps_map_utils.convert_to_fbsource_tp_deps(exported_external_deps) + headers = kwargs.pop("headers", []) + private_headers = kwargs.pop("private_headers", []) + mvfst_cxx_library( + name, + deps = deps, + exported_deps = exported_deps, + exported_headers = headers, + headers = private_headers, + visibility = ["PUBLIC"], + **kwargs ) +# TODO: Turn this into an internal implementation detail def mvfst_cxx_library( name, srcs = (),