Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't include objc_library generated module maps in packaged frameworks #180

Merged
merged 3 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rules/framework.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ def _apple_framework_packaging_impl(ctx):

# collect modulemaps
for modulemap in dep[apple_common.Objc].direct_module_maps:
if modulemap.owner == dep.label:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to make sure I understand this correctly, for direct module maps of a given obj-c dependency, if the module map is generated by the dep itself, including it will cause redefinition error, so skip them at this point is the way to fix this error

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

# module map is generated by the objc_library, and does not come
# from the attr
continue
modulemap_in = modulemap

binary_out = None
Expand Down
1 change: 1 addition & 0 deletions tests/ios/unit-test/test-imports-app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ios_application(
exclude_directories = 0,
)},
sdk_frameworks = ["UIKit"],
swift_objc_bridging_header = "TestImports-App-Bridging-Header.h",
visibility = ["//visibility:public"],
deps = [
":SomeFramework",
Expand Down
9 changes: 9 additions & 0 deletions tests/ios/unit-test/test-imports-app/Header2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import Foundation;

NS_ASSUME_NONNULL_BEGIN

typedef NS_CLOSED_ENUM(NSInteger, AppErrorCode) {
Unknown = 0
};

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#import "Header2.h"
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
4EA47E87D37B93163DC37DFE /* Header2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Header2.h; sourceTree = "<group>"; };
4ED99215913B1CD2AA84B255 /* empty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = empty.swift; sourceTree = "<group>"; };
632CFB9DFB491CE5041EE814 /* TestStickers.xcstickers */ = {isa = PBXFileReference; lastKnownFileType = folder.stickers; path = TestStickers.xcstickers; sourceTree = "<group>"; };
A1558B75425B9A00EAECC6AA /* TestImports-App-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TestImports-App-Bridging-Header.h"; sourceTree = "<group>"; };
B3D32E19E3BA9A9FCC8FCBCF /* common.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = common.pch; sourceTree = "<group>"; };
B4CD841B3F2A7DEE174D9413 /* Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Header.h; sourceTree = "<group>"; };
B776E1DCA016E54FFA3DD126 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -92,6 +93,7 @@
22A8A4218E2455208F73FDF0 /* Resources */,
2EF81609D3AA2C86BD531FC9 /* test.m */,
0A9CDCA4AFFA244654BAAF8B /* test.swift */,
A1558B75425B9A00EAECC6AA /* TestImports-App-Bridging-Header.h */,
);
path = "test-imports-app";
sourceTree = "<group>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
6B5478D8BA2BE2A548270A80 /* empty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = empty.swift; sourceTree = "<group>"; };
6E1E57A5D2E549D270B1B1A7 /* resource_bundle.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = resource_bundle.plist; sourceTree = "<group>"; };
8BBBE8333A9A3A09CEFFD917 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
9683E3E05D116FBB2D85DC23 /* TestImports-App-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TestImports-App-Bridging-Header.h"; sourceTree = "<group>"; };
9E7E8177A9991D407C446EF6 /* TestImports-Unit-Tests.xctest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = "TestImports-Unit-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
A038F6999FF698D9E7E393F6 /* BUILD.bazel */ = {isa = PBXFileReference; path = BUILD.bazel; sourceTree = "<group>"; };
A5AC323968F3E7DC9BAFEC85 /* empty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = empty.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -137,6 +138,7 @@
DC21B9839449D8D9195E4A22 /* Resources */,
EC2BF9F658BA7B0FF93BA215 /* test.m */,
5EF21FC7C23005F0603AD4F0 /* test.swift */,
9683E3E05D116FBB2D85DC23 /* TestImports-App-Bridging-Header.h */,
);
path = "test-imports-app";
sourceTree = "<group>";
Expand Down