[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.
This commit is contained in:
Hamish Knight
2024-11-09 20:01:37 +00:00
parent 5ff60d014b
commit 29cfe90869
3 changed files with 12 additions and 26 deletions

View File

@@ -199,10 +199,10 @@ fileprivate final class ProjectGenerator {
@discardableResult
private func getOrCreateRepoRef(
_ ref: ProjectSpec.PathReference, allowExcluded: Bool = false
_ ref: ProjectSpec.PathReference
) -> Xcode.FileReference? {
let path = ref.path
guard allowExcluded || checkNotExcluded(path) else { return nil }
guard checkNotExcluded(path) else { return nil }
return getOrCreateProjectRef(ref.withPath(repoRelativePath.appending(path)))
}
@@ -629,8 +629,7 @@ fileprivate final class ProjectGenerator {
// First add file/folder references.
for ref in spec.referencesToAdd {
// Allow important references to bypass exclusion checks.
getOrCreateRepoRef(ref, allowExcluded: ref.isImportant)
getOrCreateRepoRef(ref)
}
// Gather the Swift targets to generate, including any dependencies.

View File

@@ -83,14 +83,11 @@ extension ProjectSpec {
var kind: Kind
var path: RelativePath
/// Whether this reference should bypass exclusion checks.
var isImportant: Bool
static func file(_ path: RelativePath, isImportant: Bool = false) -> Self {
.init(kind: .file, path: path, isImportant: isImportant)
static func file(_ path: RelativePath) -> Self {
.init(kind: .file, path: path)
}
static func folder(_ path: RelativePath, isImportant: Bool = false) -> Self {
.init(kind: .folder, path: path, isImportant: isImportant)
static func folder(_ path: RelativePath) -> Self {
.init(kind: .folder, path: path)
}
func withPath(_ newPath: RelativePath) -> Self {
@@ -145,20 +142,10 @@ extension ProjectSpec {
self.knownUnbuildables.insert(path)
}
public mutating func addReference(
to path: RelativePath, isImportant: Bool = false
) {
public mutating func addReference(to path: RelativePath) {
guard let path = mapPath(path, for: "file") else { return }
if repoRoot.appending(path).isDirectory {
if isImportant {
// Important folder references should block anything being added under
// them.
excludedPaths.append(.init(path: path))
}
referencesToAdd.append(.folder(path, isImportant: isImportant))
} else {
referencesToAdd.append(.file(path, isImportant: isImportant))
}
let isDir = repoRoot.appending(path).isDirectory
referencesToAdd.append(isDir ? .folder(path) : .file(path))
}
public mutating func addHeaders(in path: RelativePath) {