swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.58k stars 10.36k forks source link

[swift-xcodegen] Fails to generate an Xcode project when "build" directory is a symbolic link. #77472

Closed YOCKOW closed 4 hours ago

YOCKOW commented 5 hours ago

Description

You may want to separate "build" directory from the Swift project directory. In such case, you might create a symbolic link. However, 'swift-xcodegen' doesn't seem to assume such a situation.

Reproduction

Given the composition like below:

% pwd
/Volumes/swift-project

% ls -g -o
total 0
lrwxr-xr-x   1     33 12 14  2021 build -> /Users/yockow/swift-project-build
drwxr-xr-x  34   1088  7  9 10:43 cmark
drwxr-xr-x  35   1120 11  7 15:32 llbuild
drwxr-xr-x  45   1440 11  7 12:47 llvm-project
drwxr-xr-x   1     34  7  5 17:12 ninja
drwxr-xr-x  36   1152 11  7 12:31 swift
drwxr-xr-x  23    736 11  7 15:32 swift-argument-parser
drwxr-xr-x   1     46  7  8 16:59 swift-collections
drwxr-xr-x  17    544 11  7 12:53 swift-corelibs-foundation
drwxr-xr-x  27    864  8 30 12:08 swift-corelibs-libdispatch
drwxr-xr-x  18    576  8 30 12:08 swift-corelibs-xctest
drwxr-xr-x   1     41  7  8 17:02 swift-crypto
drwxr-xr-x  17    544 11  7 15:32 swift-driver
drwxr-xr-x  15    480  8 30 12:13 swift-experimental-string-processing
drwxr-xr-x  17    544 11  7 15:15 swift-foundation
drwxr-xr-x  12    384  9 26 16:50 swift-foundation-icu
drwxr-xr-x  34   1088 11  7 15:27 swift-llbuild
drwxr-xr-x  33   1056 11  7 14:49 swift-syntax
drwxr-xr-x   1     41  7 29 12:00 swift-system
drwxr-xr-x  13    416 11  7 15:32 swift-toolchain-sqlite
drwxr-xr-x  16    512 11  7 15:32 swift-tools-support-core
drwxr-xr-x  31    992 11  7 14:50 swiftpm
drwxr-xr-x   1     33  7 12 10:06 yams

Then try to generate an Xcode project:

% ./swift/utils/generate-xcode ./build/Ninja-ReleaseAssert
Building for production...
[1/1] Write swift-version--58304C5D6DBC2206.txt
Build of product 'swift-xcodegen' complete! (0.23s)
info: Generating project for '/Users/yockow/swift-project-build/Ninja-ReleaseAssert'...
error: '/Users/yockow/swift' not found

Expected behavior

'swift-xcodegen' can find the repository.

Environment

Hash of 'swiftlang/swift' repository: 7a43b44a2e2.

swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx15.0

Additional information

No response

YOCKOW commented 4 hours ago

Sorry, but I overlooked --project-root-dir option. Closing this.