Remove unnecessary Defaults dependency from macro target#223
Merged
sindresorhus merged 1 commit intosindresorhus:mainfrom Mar 23, 2026
Merged
Remove unnecessary Defaults dependency from macro target#223sindresorhus merged 1 commit intosindresorhus:mainfrom
sindresorhus merged 1 commit intosindresorhus:mainfrom
Conversation
The `DefaultsMacrosDeclarations` macro target only uses SwiftSyntax modules — it generates source code strings containing Defaults references but never imports or links against the Defaults library itself. Having `Defaults` as a dependency of the `.macro` target causes Mac Catalyst archive builds to fail with "Multiple commands produce" errors. Macro targets are built for the host platform (macOS), and when the app target is Mac Catalyst (also a macOS variant), the Defaults library gets built for both host and target, producing duplicate output files at the same path. Removing this dependency fixes the archive collision while all 289 package tests continue to pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note this fix and PR where supplied by Claude after we were diagnosing a failure to archive an app I'm building. Claude told me the problem was effectively a circular dependency of Defaults -> Defaults Macros -> Defaults which was as per its description below, causing duplicate compilations. This only occurred during archiving and not during normal development.
Summary
The
DefaultsMacrosDeclarationsmacro target declares"Defaults"as a dependency inPackage.swift, but the macro source files only import SwiftSyntax modules — they generate source code strings containing Defaults references but never import or link against the Defaults library itself.This unnecessary dependency causes Mac Catalyst archive builds to fail with "Multiple commands produce" errors for
Defaults.oandDefaults_Defaults.bundle. The root cause:.macrotargets are compiled for the host platform (macOS)Defaultslibrary gets built for both host and targetFix
Remove
"Defaults"from theDefaultsMacrosDeclarationstarget's dependencies. The macro implementation only needs SwiftSyntax.Verification