Skip to content

Commit

Permalink
Use the same deps_remappings to convert TARGETS to BUCK
Browse files Browse the repository at this point in the history
Summary:
These are in lock steo now, so we should be good to convert. Let's try with one target first.

Once we have removed the `TARGETS` files, the target structure can no
longer diverge

Reviewed By: bigfootjon

Differential Revision: D66676179

fbshipit-source-id: b6855f97f0bff334d341e10e326ef821f120bd9f
  • Loading branch information
mzlee authored and facebook-github-bot committed Dec 7, 2024
1 parent 18f4254 commit 23f2575
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 214 deletions.
203 changes: 0 additions & 203 deletions quic/api/BUCK

This file was deleted.

56 changes: 45 additions & 11 deletions quic/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = [
Expand Down Expand Up @@ -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 = (),
Expand Down

0 comments on commit 23f2575

Please sign in to comment.