Skip to content

Commit e2b96c4

Browse files
committed
Merge generated swift headers for xcode 10.2
close #58
1 parent e8997b7 commit e2b96c4

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib/cocoapods-binary/rome/build_framework.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,29 @@ def build_for_iosish_platform(sandbox,
5353
FileUtils.cp_r simulator_swiftmodule_path + "/.", device_swiftmodule_path
5454
end
5555

56+
# combine the generated swift headers
57+
# (In xcode 10.2, the generated swift headers vary for each archs)
58+
# https://github.com/leavez/cocoapods-binary/issues/58
59+
simulator_generated_swift_header_path = simulator_framework_path + "/Headers/#{module_name}-Swift.h"
60+
device_generated_swift_header_path = device_framework_path + "/Headers/#{module_name}-Swift.h"
61+
if File.exist? simulator_generated_swift_header_path
62+
device_header = File.read(device_generated_swift_header_path)
63+
simulator_header = File.read(simulator_generated_swift_header_path)
64+
# https://github.com/Carthage/Carthage/issues/2718#issuecomment-473870461
65+
combined_header_content = %Q{
66+
#if TARGET_OS_SIMULATOR // merged by cocoapods-binary
67+
68+
#{simulator_header}
69+
70+
#else // merged by cocoapods-binary
71+
72+
#{device_header}
73+
74+
#endif // merged by cocoapods-binary
75+
}
76+
File.write(device_generated_swift_header_path, combined_header_content.strip)
77+
end
78+
5679
# handle the dSYM files
5780
device_dsym = "#{device_framework_path}.dSYM"
5881
if File.exist? device_dsym

0 commit comments

Comments
 (0)