Skip to content

[xcodegen] Enable buildable folders by default #77791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 2, 2024
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
4 changes: 2 additions & 2 deletions utils/swift-xcodegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ PROJECT CONFIGURATION:
edit (e.g sourcekitdAPI-InProc.cpp). (default: --infer-args)
--prefer-folder-refs/--no-prefer-folder-refs
Whether to prefer folder references for groups containing non-source
files (default: --no-prefer-folder-refs)
files (default: --prefer-folder-refs)
--buildable-folders/--no-buildable-folders
Requires Xcode 16: Enables the use of "buildable folders", allowing
folder references to be used for compatible targets. This allows new
Expand All @@ -98,7 +98,7 @@ PROJECT CONFIGURATION:
Only supported for targets that have no per-file build settings. This
unfortunately means some Clang targes such as 'lib/Basic' and 'stdlib'
cannot currently use buildable folders. (default: --no-buildable-folders)
cannot currently use buildable folders. (default: --buildable-folders)
MISC:
--project-root-dir <project-root-dir>
Expand Down
4 changes: 2 additions & 2 deletions utils/swift-xcodegen/Sources/swift-xcodegen/Options.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ struct ProjectOptions: ParsableArguments {
files
"""
)
var preferFolderRefs: Bool = false
var preferFolderRefs: Bool = true

@Flag(
name: .customLong("buildable-folders"), inversion: .prefixedNo,
Expand All @@ -215,7 +215,7 @@ struct ProjectOptions: ParsableArguments {
cannot currently use buildable folders.
"""
)
var useBuildableFolders: Bool = false
var useBuildableFolders: Bool = true

@Option(help: .hidden)
var blueFolders: String = ""
Expand Down
29 changes: 29 additions & 0 deletions utils/swift-xcodegen/Sources/swift-xcodegen/SwiftXcodegen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,34 @@ struct SwiftXcodegen: AsyncParsableCommand, Sendable {
return task
}

func showCaveatsIfNeeded() {
guard log.logLevel <= .note else { return }

var notes: [String] = []
if projectOpts.useBuildableFolders {
notes.append("""
- Buildable folders are enabled by default, which requires Xcode 16. You
can pass '--no-buildable-folders' to disable this. See the '--help'
entry for more info.
""")
}

if !projectOpts.addStdlibSwift {
notes.append("""
- Swift standard library targets are disabled by default since they require
using a development snapshot of Swift with Xcode. You can pass '--stdlib-swift'
to enable. See the '--help' entry for more info.
""")
}
guard !notes.isEmpty else { return }
log.note("Caveats:")
for note in notes {
for line in note.components(separatedBy: .newlines) {
log.note(line)
}
}
}

func generate() async throws {
let buildDirPath = buildDir.absoluteInWorkingDir.resolvingSymlinks
log.info("Generating project for '\(buildDirPath)'...")
Expand Down Expand Up @@ -342,6 +370,7 @@ struct SwiftXcodegen: AsyncParsableCommand, Sendable {
try lldbLLVMWorkspace.write("LLDB+LLVM", into: outputDir)
}
}
showCaveatsIfNeeded()
}

func run() async {
Expand Down