Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,14 @@ struct SwiftTargets {
// A relative path is for a file in the build directory, it's external.
let abs = buildDir.path.appending(r)
guard abs.exists else { continue }
sources.externalSources.append(abs)
sources.externalSources.append(abs.realPath)

case .absolute(let a):
guard a.exists, let rel = a.removingPrefix(buildDir.repoPath) else {
guard a.exists else { continue }
// Symlinks shouldn't really be a concern here, but we need to realpath
// in order to canonicalize the casing.
let a = a.realPath
guard let rel = a.removingPrefix(buildDir.repoPath) else {
sources.externalSources.append(a)
continue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public extension AbsolutePath {
(try? FileManager.default.destinationOfSymbolicLink(atPath: rawPath)) != nil
}

var resolvingSymlinks: Self {
var realPath: Self {
guard let resolved = realpath(rawPath, nil) else { return self }
defer {
free(resolved)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct SwiftXcodegen: AsyncParsableCommand, Sendable {

// Check to see if we have a separate runnable build dir.
let runnableBuildDirPath =
self.runnableBuildDir?.absoluteInWorkingDir.resolvingSymlinks
self.runnableBuildDir?.absoluteInWorkingDir.realPath
let runnableBuildDir = try runnableBuildDirPath.map {
try NinjaBuildDir(at: $0, projectRootDir: ninja.projectRootDir)
.buildDir(for: .swift)
Expand Down Expand Up @@ -332,7 +332,7 @@ struct SwiftXcodegen: AsyncParsableCommand, Sendable {
}

func generate() async throws {
let buildDirPath = buildDir.absoluteInWorkingDir.resolvingSymlinks
let buildDirPath = buildDir.absoluteInWorkingDir.realPath
log.info("Generating project for '\(buildDirPath)'...")

let projectRootDir = self.projectRootDir?.absoluteInWorkingDir
Expand Down