@@ -79,6 +79,11 @@ public final class ClangTargetBuildDescription {
79
79
/// The filesystem to operate on.
80
80
private let fileSystem : FileSystem
81
81
82
+ /// Whether or not the target belongs to a mixed language target.
83
+ ///
84
+ /// Mixed language targets consist of an underlying Swift and Clang target.
85
+ let isWithinMixedTarget : Bool
86
+
82
87
/// If this target is a test target.
83
88
public var isTestTarget : Bool {
84
89
target. type == . test
@@ -89,7 +94,8 @@ public final class ClangTargetBuildDescription {
89
94
target: ResolvedTarget ,
90
95
toolsVersion: ToolsVersion ,
91
96
buildParameters: BuildParameters ,
92
- fileSystem: FileSystem
97
+ fileSystem: FileSystem ,
98
+ isWithinMixedTarget: Bool = false
93
99
) throws {
94
100
guard target. underlyingTarget is ClangTarget else {
95
101
throw InternalError ( " underlying target type mismatch \( target) " )
@@ -101,9 +107,12 @@ public final class ClangTargetBuildDescription {
101
107
self . buildParameters = buildParameters
102
108
self . tempsPath = buildParameters. buildPath. appending ( component: target. c99name + " .build " )
103
109
self . derivedSources = Sources ( paths: [ ] , root: tempsPath. appending ( component: " DerivedSources " ) )
110
+ self . isWithinMixedTarget = isWithinMixedTarget
104
111
105
- // Try computing modulemap path for a C library. This also creates the file in the file system, if needed.
106
- if target. type == . library {
112
+ // Try computing the modulemap path, creating a module map in the
113
+ // file system if necessary. If building for a mixed target, the mixed
114
+ // target build description handle the module map.
115
+ if target. type == . library, !isWithinMixedTarget {
107
116
// If there's a custom module map, use it as given.
108
117
if case . custom( let path) = clangTarget. moduleMapType {
109
118
self . moduleMap = path
0 commit comments