Skip to content

Commit

Permalink
bazel: assert if '-Swift.h' files are not exactly 1 (#374)
Browse files Browse the repository at this point in the history
Addressing envoyproxy/envoy-mobile#372 (comment)

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: JP Simard <jp@jpsim.com>
  • Loading branch information
rebello95 authored and jpsim committed Nov 29, 2022
1 parent 90e8cad commit 0518e0c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions mobile/bazel/swift_static_framework.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,17 @@ def _swift_static_framework_impl(ctx):

# We can potentially simplify this if this change lands upstream:
# https://github.com/bazelbuild/rules_swift/issues/291
objc_headers = archive[apple_common.Objc].header.to_list()
objc_header = objc_headers[-1]
if objc_header:
zip_args.append(_zip_header_arg(module_name, objc_header))
objc_headers = [
header
for header in archive[apple_common.Objc].header.to_list()
if header.path.endswith("-Swift.h")
]

if len(objc_headers) == 1:
zip_args.append(_zip_header_arg(module_name, objc_headers[0]))
else:
header_names = [header.basename for header in objc_headers]
fail("Expected exactly 1 '-Swift.h' header, got {}".format(", ".join(header_names)))

swiftdoc = swift_info.direct_swiftdocs[0]
swiftmodule = swift_info.direct_swiftmodules[0]
Expand Down

0 comments on commit 0518e0c

Please sign in to comment.