Skip to content

Commit 80a9c8b

Browse files
committed
Post rebase fixes
1 parent 7edad7f commit 80a9c8b

File tree

5 files changed

+504
-1961
lines changed

5 files changed

+504
-1961
lines changed

Sources/Build/BuildDescription/ClangTargetBuildDescription.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public final class ClangTargetBuildDescription {
7979
/// The filesystem to operate on.
8080
private let fileSystem: FileSystem
8181

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+
8287
/// If this target is a test target.
8388
public var isTestTarget: Bool {
8489
target.type == .test
@@ -89,7 +94,8 @@ public final class ClangTargetBuildDescription {
8994
target: ResolvedTarget,
9095
toolsVersion: ToolsVersion,
9196
buildParameters: BuildParameters,
92-
fileSystem: FileSystem
97+
fileSystem: FileSystem,
98+
isWithinMixedTarget: Bool = false
9399
) throws {
94100
guard target.underlyingTarget is ClangTarget else {
95101
throw InternalError("underlying target type mismatch \(target)")
@@ -101,9 +107,12 @@ public final class ClangTargetBuildDescription {
101107
self.buildParameters = buildParameters
102108
self.tempsPath = buildParameters.buildPath.appending(component: target.c99name + ".build")
103109
self.derivedSources = Sources(paths: [], root: tempsPath.appending(component: "DerivedSources"))
110+
self.isWithinMixedTarget = isWithinMixedTarget
104111

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 {
107116
// If there's a custom module map, use it as given.
108117
if case .custom(let path) = clangTarget.moduleMapType {
109118
self.moduleMap = path

0 commit comments

Comments
 (0)