Skip to content

Commit

Permalink
Support Swift Macro (bazel-ios#805)
Browse files Browse the repository at this point in the history
Add support for `plugins` kwarg
  • Loading branch information
qyang-nj authored Nov 9, 2023
1 parent 414ce26 commit f4d41bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rules/library.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Library rules"""

load("@bazel_skylib//lib:dicts.bzl", "dicts")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//lib:sets.bzl", "sets")
load("@bazel_skylib//lib:selects.bzl", "selects")
Expand Down Expand Up @@ -582,6 +583,7 @@ def apple_library(
defines = kwargs.pop("defines", [])
testonly = kwargs.pop("testonly", False)
features = kwargs.pop("features", [])
plugins = kwargs.pop("plugins", None)

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

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

swift_library(
name = swift_libname,
module_name = module_name,
Expand All @@ -985,7 +990,7 @@ def apple_library(
tags = tags_manual,
defines = defines + swift_defines,
testonly = testonly,
**kwargs
**swift_kwargs
)
lib_names.append(swift_libname)

Expand Down

0 comments on commit f4d41bd

Please sign in to comment.