Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Sources/ProjectDrivers/XcodeProjectDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@

try xcodebuild.ensureConfigured()

let project: XcodeProjectlike = if projectPath.extension == "xcworkspace" {
try XcodeWorkspace(
let project: XcodeProjectlike
if projectPath.extension == "xcworkspace" {
project = try XcodeWorkspace(
path: .makeAbsolute(projectPath),
xcodebuild: xcodebuild,
configuration: configuration,
logger: logger,
shell: shell
)
} else {
try XcodeProject(
var loadedProjectPaths: Set<FilePath> = []
project = try XcodeProject(
path: .makeAbsolute(projectPath),
loadedProjectPaths: &loadedProjectPaths,
xcodebuild: xcodebuild,
shell: shell,
logger: logger
Expand Down
10 changes: 5 additions & 5 deletions Sources/XcodeSupport/XcodeProject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public final class XcodeProject: XcodeProjectlike {

convenience init?(
path: FilePath,
loadedProjectPaths: Set<FilePath> = [],
loadedProjectPaths: inout Set<FilePath>,
referencedBy refPath:
FilePath,
shell: Shell,
Expand All @@ -31,7 +31,7 @@ public final class XcodeProject: XcodeProjectlike {
let xcodebuild = Xcodebuild(shell: shell, logger: logger)
try self.init(
path: path,
loadedProjectPaths: loadedProjectPaths,
loadedProjectPaths: &loadedProjectPaths,
xcodebuild: xcodebuild,
shell: shell,
logger: logger
Expand All @@ -40,7 +40,7 @@ public final class XcodeProject: XcodeProjectlike {

public required init(
path: FilePath,
loadedProjectPaths: Set<FilePath> = [],
loadedProjectPaths: inout Set<FilePath>,
xcodebuild: Xcodebuild,
shell: Shell,
logger: Logger
Expand All @@ -59,7 +59,7 @@ public final class XcodeProject: XcodeProjectlike {
}

var subProjects: [XcodeProject] = []
let loadedProjectPaths = loadedProjectPaths.union([path])
loadedProjectPaths.insert(path)

// Don't search for sub projects within CocoaPods.
if !path.components.contains("Pods.xcodeproj") {
Expand All @@ -74,7 +74,7 @@ public final class XcodeProject: XcodeProjectlike {

return try XcodeProject(
path: projectPath,
loadedProjectPaths: loadedProjectPaths,
loadedProjectPaths: &loadedProjectPaths,
referencedBy: path,
shell: shell,
logger: logger
Expand Down
2 changes: 2 additions & 0 deletions Sources/XcodeSupport/XcodeProjectSetupGuide.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ public final class XcodeProjectSetupGuide: SetupGuideHelpers, SetupGuide {
shell: shell
)
} else if let projectPath = identifyProject() {
var loadedProjectPaths: Set<FilePath> = []
project = try XcodeProject(
path: projectPath,
loadedProjectPaths: &loadedProjectPaths,
xcodebuild: xcodebuild,
shell: shell,
logger: logger
Expand Down
5 changes: 4 additions & 1 deletion Sources/XcodeSupport/XcodeWorkspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public final class XcodeWorkspace: XcodeProjectlike {
}

let projectPaths = collectProjectPaths(in: xcworkspace.data.children)
let projects = try projectPaths.compactMapSet { try XcodeProject(path: sourceRoot.pushing($0), referencedBy: self.path, shell: shell, logger: logger) }
var loadedProjectPaths: Set<FilePath> = []
let projects = try projectPaths.compactMapSet {
try XcodeProject(path: sourceRoot.pushing($0), loadedProjectPaths: &loadedProjectPaths, referencedBy: self.path, shell: shell, logger: logger)
}

targets = projects.reduce(into: .init()) { result, project in
result.formUnion(project.targets)
Expand Down
Loading