Skip to content

Commit

Permalink
Update header_namespace for OSS
Browse files Browse the repository at this point in the history
Summary: fizz might depend on a folly header like `<folly/portability/Sys.h>`, but due to the layout of the repo buck2 actually places this header at `<folly/folly/portability/Sys.h>`

Reviewed By: ajb85

Differential Revision: D58272254

fbshipit-source-id: 3abc6240a83b6dc8036dc88b704c816bc7946e62
  • Loading branch information
namanahuja authored and facebook-github-bot committed Jun 7, 2024
1 parent c631235 commit 591e85c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions shim/shims.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,22 @@ def cpp_library(
private_headers = None,
propagated_pp_flags = (),
**kwargs):
base_path = native.package_name()
oss_depends_on_folly = read_config("oss_depends_on", "folly", False)
header_base_path = base_path
if oss_depends_on_folly and header_base_path.startswith("folly"):
header_base_path = header_base_path.replace("folly/", "", 1)

_unused = (undefined_symbols, arch_preprocessor_flags, modular_headers, arch_compiler_flags, tags, propagated_pp_flags) # @unused
if os_deps:
deps += _select_os_deps(_fix_dict_deps(os_deps))
if headers == None:
headers = []
if tags != None and "oss_dependency" in tags:
oss_depends_on_folly = read_config("oss_depends_on", "folly", False)
if oss_depends_on_folly:
headers = [item.replace("//:", "//folly:") if item == "//:folly-config.h" else item for item in headers]
if is_select(srcs) and auto_headers == AutoHeaders.SOURCES:
# Validate `srcs` and `auto_headers` before the config check
base_path = native.package_name()
fail(
"//{}:{}: `select` srcs cannot support AutoHeaders.SOURCES".format(base_path, name),
)
Expand Down Expand Up @@ -178,6 +182,7 @@ def cpp_library(
headers = private_headers,
exported_linker_flags = linker_flags,
linker_flags = private_linker_flags,
header_namespace = header_base_path,
**kwargs
)

Expand Down

0 comments on commit 591e85c

Please sign in to comment.