mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[xcodegen] Avoid buildable folders for mixed Swift targets
If a Swift target has sources in its folder that aren't part of the target, we can't form a buildable folder.
This commit is contained in:
@@ -531,11 +531,20 @@ fileprivate final class ProjectGenerator {
|
||||
guard checkNotExcluded(buildRule.parentPath, for: "Swift target") else {
|
||||
return nil
|
||||
}
|
||||
// Create the target. Swift targets can always use buildable folders
|
||||
// since they have a consistent set of arguments.
|
||||
// Swift targets can almost always use buildable folders since they have
|
||||
// a consistent set of arguments, but we need to ensure we don't have any
|
||||
// child source files that aren't part of the target.
|
||||
let canUseBuildableFolder = try {
|
||||
guard let parent = buildRule.parentPath else { return false }
|
||||
let repoSources = Set(buildRule.sources.repoSources)
|
||||
return try getAllRepoSubpaths(of: parent)
|
||||
.allSatisfy { !$0.isSourceLike || repoSources.contains($0) }
|
||||
}()
|
||||
// Create the target.
|
||||
let target = generateBaseTarget(
|
||||
targetInfo.name, at: buildRule.parentPath, canUseBuildableFolder: true,
|
||||
productType: .staticArchive, includeInAllTarget: includeInAllTarget
|
||||
targetInfo.name, at: buildRule.parentPath,
|
||||
canUseBuildableFolder: canUseBuildableFolder, productType: .staticArchive,
|
||||
includeInAllTarget: includeInAllTarget
|
||||
)
|
||||
guard let target else { return nil }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user