Skip to content

Commit

Permalink
Start converting fizz to use fbcode defs {3/N}
Browse files Browse the repository at this point in the history
Summary:
`TARGETS -> BUCK` for `fizz`.

1. Update boilerplate to not regenerate
2. Add a helper to make this easier since we will need to do this a number of times
3. Switch over and delete `TARGETS` file for `fizz` <-

Reviewed By: ckwalsh

Differential Revision: D67865886

fbshipit-source-id: f8cd66d91d7df85e605174418ed3dcf00071dba1
  • Loading branch information
mzlee authored and facebook-github-bot committed Jan 7, 2025
1 parent 0887cd3 commit 562db13
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 98 deletions.
92 changes: 0 additions & 92 deletions fizz/crypto/BUCK

This file was deleted.

55 changes: 49 additions & 6 deletions fizz/defs.bzl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbsource//tools/build_defs:buckconfig.bzl", "read", "read_bool")
load("@fbsource//tools/build_defs:cell_defs.bzl", "get_fbsource_cell")
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")
Expand All @@ -17,6 +14,13 @@ load(
"MACOSX",
"WINDOWS",
)

# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
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")

# Fizz is a cross platform library used across fbcode, fbobjc, fbandroid, etc.
Expand Down Expand Up @@ -94,6 +98,45 @@ def _compute_header_namespace():
base_path = native.package_name()
return base_path[6:]

def fizz_cpp_library(
name,
headers = [],
private_headers = [],
srcs = [],
deps = None,
exported_deps = None,
external_deps = None,
exported_external_deps = None,
**kwargs):
"""Translate a simpler declartion into the more complete library target"""
if get_fbsource_cell() == "fbcode":
cpp_library(
name = name,
headers = headers,
private_headers = private_headers,
srcs = srcs,
deps = deps,
exported_deps = exported_deps,
external_deps = external_deps,
exported_external_deps = exported_external_deps,
)
else:
converted_deps = deps_map_utils.convert_all_to_fbsource_deps(
deps = deps,
exported_deps = exported_deps,
external_deps = external_deps,
exported_external_deps = exported_external_deps,
)
fizz_cxx_library(
name = name,
exported_headers = headers,
headers = private_headers,
srcs = srcs,
deps = converted_deps.deps,
exported_deps = converted_deps.exported_deps,
**kwargs
)

def fizz_cxx_library(
name,
platforms = None,
Expand All @@ -103,7 +146,7 @@ def fizz_cxx_library(
enable_static_variant = True,
header_namespace = "",
feature = None,
srcs = None,
srcs = [],
**kwargs):
"""Translate a simpler declartion into the more complete library target"""
if apple_sdks == None:
Expand Down

0 comments on commit 562db13

Please sign in to comment.