Skip to content

Add EmitFrontendCommandLines user default - #1345

Open
benlangmuir wants to merge 1 commit into
swiftlang:mainfrom
benlangmuir:blangmuir/emit-frontend-command-lines
Open

Add EmitFrontendCommandLines user default#1345
benlangmuir wants to merge 1 commit into
swiftlang:mainfrom
benlangmuir:blangmuir/emit-frontend-command-lines

Conversation

@benlangmuir

Copy link
Copy Markdown
Contributor

Introduce a new user default that sets EMIT_FRONTEND_COMMAND_LINES persistently and works better with swift package builds outside Xcode. This is a lighter-weight alternative to EnableDebugActivityLogs for users who only want frontend command lines logged.

Why not just use EnableDebugActivityLogs? It's too verbose for my use case where I want to leave this enabled permanently. Debug logs are ~4x larger in storage size than simply emitting frontend lines, and more importantly they are ~15x more lines, which I find makes them very challenging to read as a human (the discrepancy between 4x and 15x is because many of the extra lines have few characters on them while the frontend commands themselves are very long lines). That was measured building swift-build itself, but it matches my general impression from other projects.

@benlangmuir

Copy link
Copy Markdown
Contributor Author

@swift-ci test

Comment thread Sources/SWBCore/Settings/Settings.swift Outdated
pushTable(.exported) { $0.push(BuiltinMacros.COMPILATION_CACHE_CAS_PATH, BuiltinMacros.namespace.parseString("$(\(compileCacheDirMacro))/CompilationCache.noindex")) }
}

if UserDefaults.emitFrontendCommandLines {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to avoid reading UserDefaults from static globals like this for new settings. Take a look at UserPreferences instead

@benlangmuir benlangmuir Apr 25, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do setUserPreferences or SetSessionUserPreferencesRequest have API stability or other compatibility requirements? I see we already have one deprecated setUserPreferences that lets you skip one value, which is what made me wonder about this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IPC requests like SetSessionUserPreferencesRequest or public APIs in the SwiftBuild module should try to maintain temporary compatibility on the decode side for approximately one release cycle. Other than that, no.

Introduce a new user default that sets EMIT_FRONTEND_COMMAND_LINES persistently
and works better with swift package builds outside Xcode. This is a
lighter-weight alternative to EnableDebugActivityLogs for users who only want
frontend command lines logged.

Why not just use EnableDebugActivityLogs? It's too verbose for my use case
where I want to leave this enabled permanently. Debug logs are ~4x larger in
storage size than simply emitting frontend lines, and more importantly they are
~15x more lines, which I find makes them very challenging to read as a human
(the discrepancy between 4x and 15x is because many of the extra lines have few
characters on them while the frontend commands themselves are very long lines).
That was measured building swift-build itself, but it matches my general
impression from other projects.
@benlangmuir
benlangmuir force-pushed the blangmuir/emit-frontend-command-lines branch from 890cc60 to f5d267c Compare April 28, 2026 22:30
@benlangmuir

Copy link
Copy Markdown
Contributor Author

@swift-ci test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants