Skip to content

Commit

Permalink
Handle selects better [3/7]
Browse files Browse the repository at this point in the history
Summary:
This handles select() better inside _fix_deps(), and unifies the processing of
deps field across the rules in this file.

Reviewed By: stepancheg

Differential Revision: D63295977

fbshipit-source-id: d2971bac91691c9a6c145e0d0855b4d7407043c1
  • Loading branch information
ckwalsh authored and facebook-github-bot committed Sep 25, 2024
1 parent 2ba7c02 commit f02c43c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions shim/shims.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ def cpp_library(
prelude.cxx_library(
name = name,
srcs = srcs,
deps = _maybe_select_map(deps + external_deps_to_targets(external_deps), _fix_deps),
exported_deps = _maybe_select_map(exported_deps + external_deps_to_targets(exported_external_deps), _fix_deps),
deps = _fix_deps(deps + external_deps_to_targets(external_deps)),
exported_deps = _fix_deps(exported_deps + external_deps_to_targets(exported_external_deps)),
visibility = visibility,
preferred_linkage = "static",
exported_headers = headers,
Expand Down Expand Up @@ -209,7 +209,7 @@ def cpp_unittest(
_unused = (supports_static_listing, allocator, owner, tags, emails, extract_helper_lib, compiler_specific_flags, default_strip_mode) # @unused
deps = deps + [CPP_UNITTEST_MAIN_DEP] + CPP_UNITTEST_LIB_DEPS
prelude.cxx_test(
deps = _maybe_select_map(deps + external_deps_to_targets(external_deps), _fix_deps),
deps = _fix_deps(deps + external_deps_to_targets(external_deps)),
visibility = visibility,
resources = _fix_resources(resources),
**kwargs
Expand All @@ -227,7 +227,7 @@ def cpp_binary(
**kwargs):
_unused = (dlopen_enabled, compiler_specific_flags, os_linker_flags, allocator, modules) # @unused
prelude.cxx_binary(
deps = _maybe_select_map(deps + external_deps_to_targets(external_deps), _fix_deps),
deps = _fix_deps(deps + external_deps_to_targets(external_deps)),
visibility = visibility,
**kwargs
)
Expand All @@ -246,7 +246,7 @@ def rust_library(
visibility = ["PUBLIC"],
**kwargs):
_unused = (test_deps, test_env, test_os_deps, named_deps, autocargo, unittests, visibility) # @unused
deps = _maybe_select_map(deps, _fix_deps)
deps = _fix_deps(deps)
mapped_srcs = _maybe_select_map(mapped_srcs, _fix_mapped_srcs)
if os_deps:
deps += _select_os_deps(_fix_dict_deps(os_deps))
Expand All @@ -272,7 +272,7 @@ def rust_binary(
visibility = ["PUBLIC"],
**kwargs):
_unused = (unittests, allocator, default_strip_mode, autocargo) # @unused
deps = _maybe_select_map(deps, _fix_deps)
deps = _fix_deps(deps)

# @lint-ignore BUCKLINT: avoid "Direct usage of native rules is not allowed."
prelude.rust_binary(
Expand All @@ -287,7 +287,7 @@ def rust_unittest(
deps = [],
visibility = ["PUBLIC"],
**kwargs):
deps = _maybe_select_map(deps, _fix_deps)
deps = _fix_deps(deps)

prelude.rust_test(
rustc_flags = rustc_flags + [_CFG_BUCK_BUILD],
Expand Down Expand Up @@ -361,7 +361,7 @@ def ocaml_binary(
deps = [],
visibility = ["PUBLIC"],
**kwargs):
deps = _maybe_select_map(deps, _fix_deps)
deps = _fix_deps(deps)

prelude.ocaml_binary(
deps = deps,
Expand Down Expand Up @@ -397,7 +397,7 @@ def _fix_mapped_srcs(xs: dict[str, str]):

def _fix_deps(xs):
if is_select(xs):
return xs
return select_map(xs, lambda child_targets: _fix_deps(child_targets))
return map(_fix_dep, xs)

def _fix_resources(resources):
Expand Down

0 comments on commit f02c43c

Please sign in to comment.