Skip to content

Commit

Permalink
Forward package_name to swift_library part of apple_library
Browse files Browse the repository at this point in the history
  • Loading branch information
luispadron committed Mar 26, 2024
1 parent da630a2 commit 0a4f176
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions rules/library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ GLOBAL_INDEX_STORE_PATH = "bazel-out/_global_index_store"

_MANUAL = ["manual"]

_SWIFT_LIBRARY_KWARGS = [
"always_include_developer_search_paths",
"package_name",
"plugins",
]

def _private_headers_impl(ctx):
return [
PrivateHeadersInfo(
Expand Down Expand Up @@ -578,8 +584,13 @@ def apple_library(
defines = kwargs.pop("defines", [])
testonly = kwargs.pop("testonly", False)
features = kwargs.pop("features", [])
plugins = kwargs.pop("plugins", None)
always_include_developer_search_paths = kwargs.pop("always_include_developer_search_paths", None)

# Collect the swift_library related kwargs, these are typically only set when provided to allow
# for wider compatibility with rule_swift versions.
swift_kwargs = dicts.add(
kwargs,
{arg: kwargs.pop(arg) for arg in _SWIFT_LIBRARY_KWARGS if arg in kwargs},
)

for (k, v) in {"momc_copts": momc_copts, "mapc_copts": mapc_copts, "ibtool_copts": ibtool_copts}.items():
if v:
Expand Down Expand Up @@ -958,16 +969,6 @@ def apple_library(
)

if swift_sources:
swift_kwargs = kwargs

# To be backward compatible with rules_apple 2.x
if plugins:
swift_kwargs = dicts.add(swift_kwargs, {"plugins": plugins})

# Allow consumers to opt-in to https://github.com/bazelbuild/rules_swift/pull/1162
if always_include_developer_search_paths:
swift_kwargs = dicts.add(swift_kwargs, {"always_include_developer_search_paths": always_include_developer_search_paths})

swift_library(
name = swift_libname,
module_name = module_name,
Expand Down

0 comments on commit 0a4f176

Please sign in to comment.