From 465ea0ed66367bb55091ad567028c4e5aa161c8b Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 18 Jun 2019 11:39:36 -0700 Subject: [PATCH] Fix framework imports with Swift modules With bazel 0.27.0 and the flip of `incompatible_objc_framework_cleanup` https://github.com/bazelbuild/bazel/issues/7944 framework imports of Swift frameworks broke because the modules were included and processed as module map files. This change makes them available in the build but without processing them. They are handled automatically by clang / swift since the framework is included using `-F` --- apple/internal/apple_framework_import.bzl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apple/internal/apple_framework_import.bzl b/apple/internal/apple_framework_import.bzl index 11fa7b31c5..a4ebea4a01 100644 --- a/apple/internal/apple_framework_import.bzl +++ b/apple/internal/apple_framework_import.bzl @@ -63,8 +63,13 @@ def _classify_framework_imports(framework_imports): # This matches /Headers/ and /PrivateHeaders/ header_imports.append(file) continue - if "/Modules/" in file_short_path: - module_map_imports.append(file) + if file_short_path.endswith(".swiftmodule") or file_short_path.endswith(".swiftinterface"): + # Add Swift's module files to header_imports so that they are correctly included in the build + # by Bazel but they aren't processed in any way + header_imports.append(file) + continue + if file_short_path.endswith(".swiftdoc"): + # Ignore swiftdoc files, they don't matter in the build, only for IDEs continue bundling_imports.append(file)