Skip to content

Commit 11102fb

Browse files
committed
Discovered workaround to previous commit's issue
- See the last two commit messages for more context. - It seems that one can import the generated bridging header and if it is imported, it must be imported before the generated Swift header.
1 parent b1d769d commit 11102fb

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#import <XCTest/XCTest.h>
2+
3+
// IMPORTANT: The generated "bridging" header must be imported before the
4+
// generated interop header.
5+
#import "BasicMixedTarget/BasicMixedTarget.h"
6+
#import "BasicMixedTarget-Swift.h"
7+
8+
@interface ObjcBasicMixedTargetTestsViaGeneratedBridgingHeader : XCTestCase
9+
10+
@end
11+
12+
@implementation ObjcBasicMixedTargetTestsViaGeneratedBridgingHeader
13+
14+
- (void)testPublicSwiftAPI {
15+
// Check that Objective-C compatible Swift API surface is exposed...
16+
Engine *engine = [[Engine alloc] init];
17+
}
18+
19+
- (void)testPublicObjcAPI {
20+
// Check that Objective-C API surface is exposed...
21+
OldCar *oldCar = [[OldCar alloc] init];
22+
Driver *driver = [[Driver alloc] init];
23+
CarPart *carPart = [[CarPart alloc] init];
24+
}
25+
26+
@end

Fixtures/MixedTargets/BasicMixedTargets/Tests/MixedTargetWithCustomModuleMapTests/ObjcMixedTargetWithCustomModuleMapTestsViaGeneratedBridgingHeader.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#import <XCTest/XCTest.h>
22

3+
// IMPORTANT: The generated "bridging" header must be imported before the
4+
// generated interop header.
35
#import "MixedTargetWithCustomModuleMap/MixedTargetWithCustomModuleMap.h"
46
#import "MixedTargetWithCustomModuleMap-Swift.h"
57

Sources/Build/BuildPlan.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,10 +1496,6 @@ public final class MixedTargetBuildDescription {
14961496
interopSupportDirectory = nil
14971497
}
14981498

1499-
// TODO(ncooke3): Is there a way to remove the generated umbrella
1500-
// header when compiling individual clang files? This will reduce the
1501-
// misuse of importing the generated umbrella header.
1502-
15031499
// Clients will later depend on the public header directory, and, if an
15041500
// umbrella header was created, the header's root directory.
15051501
self.publicHeaderPaths = interopSupportDirectory != nil ?

0 commit comments

Comments
 (0)