Skip to content

Commit 29cfe90

Browse files
committed
[xcodegen] Remove isImportant
This only existed to avoid adding anything under a folder reference. Now that we add those references first, this is no longer needed.
1 parent 5ff60d0 commit 29cfe90

File tree

3 files changed

+12
-26
lines changed

3 files changed

+12
-26
lines changed

utils/swift-xcodegen/Sources/SwiftXcodeGen/Generator/ProjectGenerator.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ fileprivate final class ProjectGenerator {
199199

200200
@discardableResult
201201
private func getOrCreateRepoRef(
202-
_ ref: ProjectSpec.PathReference, allowExcluded: Bool = false
202+
_ ref: ProjectSpec.PathReference
203203
) -> Xcode.FileReference? {
204204
let path = ref.path
205-
guard allowExcluded || checkNotExcluded(path) else { return nil }
205+
guard checkNotExcluded(path) else { return nil }
206206
return getOrCreateProjectRef(ref.withPath(repoRelativePath.appending(path)))
207207
}
208208

@@ -629,8 +629,7 @@ fileprivate final class ProjectGenerator {
629629

630630
// First add file/folder references.
631631
for ref in spec.referencesToAdd {
632-
// Allow important references to bypass exclusion checks.
633-
getOrCreateRepoRef(ref, allowExcluded: ref.isImportant)
632+
getOrCreateRepoRef(ref)
634633
}
635634

636635
// Gather the Swift targets to generate, including any dependencies.

utils/swift-xcodegen/Sources/SwiftXcodeGen/Generator/ProjectSpec.swift

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,11 @@ extension ProjectSpec {
8383
var kind: Kind
8484
var path: RelativePath
8585

86-
/// Whether this reference should bypass exclusion checks.
87-
var isImportant: Bool
88-
89-
static func file(_ path: RelativePath, isImportant: Bool = false) -> Self {
90-
.init(kind: .file, path: path, isImportant: isImportant)
86+
static func file(_ path: RelativePath) -> Self {
87+
.init(kind: .file, path: path)
9188
}
92-
static func folder(_ path: RelativePath, isImportant: Bool = false) -> Self {
93-
.init(kind: .folder, path: path, isImportant: isImportant)
89+
static func folder(_ path: RelativePath) -> Self {
90+
.init(kind: .folder, path: path)
9491
}
9592

9693
func withPath(_ newPath: RelativePath) -> Self {
@@ -145,20 +142,10 @@ extension ProjectSpec {
145142
self.knownUnbuildables.insert(path)
146143
}
147144

148-
public mutating func addReference(
149-
to path: RelativePath, isImportant: Bool = false
150-
) {
145+
public mutating func addReference(to path: RelativePath) {
151146
guard let path = mapPath(path, for: "file") else { return }
152-
if repoRoot.appending(path).isDirectory {
153-
if isImportant {
154-
// Important folder references should block anything being added under
155-
// them.
156-
excludedPaths.append(.init(path: path))
157-
}
158-
referencesToAdd.append(.folder(path, isImportant: isImportant))
159-
} else {
160-
referencesToAdd.append(.file(path, isImportant: isImportant))
161-
}
147+
let isDir = repoRoot.appending(path).isDirectory
148+
referencesToAdd.append(isDir ? .folder(path) : .file(path))
162149
}
163150

164151
public mutating func addHeaders(in path: RelativePath) {

utils/swift-xcodegen/Sources/swift-xcodegen/SwiftXcodegen.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ struct SwiftXcodegen: AsyncParsableCommand, Sendable {
192192
mayHaveUnbuildableFiles: true
193193
)
194194
if self.addTestFolders {
195-
spec.addReference(to: "../clang-tools-extra/test", isImportant: true)
195+
spec.addReference(to: "../clang-tools-extra/test")
196196
} else {
197197
// Avoid adding any headers present in the test folder.
198198
spec.addExcludedPath("../clang-tools-extra/test")
@@ -263,7 +263,7 @@ struct SwiftXcodegen: AsyncParsableCommand, Sendable {
263263
below: "../compiler-rt", addingPrefix: "extra-"
264264
)
265265
if self.addTestFolders {
266-
spec.addReference(to: "../compiler-rt/test", isImportant: true)
266+
spec.addReference(to: "../compiler-rt/test")
267267
} else {
268268
// Avoid adding any headers present in the test folder.
269269
spec.addExcludedPath("../compiler-rt/test")

0 commit comments

Comments
 (0)