fix(doctor): detect missing Swift macro plugins on CLT-only hosts (#174)#414
Open
pnascimento9596 wants to merge 1 commit into
Open
Conversation
Scripts/doctor.sh passed on Command Line Tools-only machines while the build could not succeed, because it never exercised macro-plugin expansion. RepoPrompt CE's own source uses @entry (SwiftUIMacros, 10 sites across 5 files) and a pinned dependency uses #Preview (PreviewsMacros); both plugins ship only with full Xcode.app. Add a swiftc -typecheck probe that expands both macros and hard-fails with actionable guidance when the plugins are absent, closing the false positive where doctor.sh reported success on an unbuildable host. Correct the README source-build requirements, which incorrectly listed Command Line Tools as a supported build path. Closes repoprompt#174
884c557 to
df25992
Compare
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.
Summary
Scripts/doctor.sh --quietpasses on Command Line Tools–only macOS hosts, but the build then fails at macro expansion. The check verified tool presence and a SwiftUI symbol typecheck (the Liquid Glass probe) but never exercised macro-plugin availability, so it reported success on a host that cannot build the app.Root cause
RepoPrompt CE requires two Swift macro plugins that ship only with full
Xcode.app, never with Command Line Tools:SwiftUIMacros— CE's own source uses@Entryat 10 sites across 5 files.PreviewsMacros— the pinnedKeyboardShortcuts2.3.0 (045cf174…) uses#PreviewinRecorder.swift.CLT alone is structurally insufficient, and the old
doctor.shcould not tell a contributor that.Fix
Scripts/doctor.sh: adds a macro-plugin probe (mirrors the existing Liquid Glass probe) that typechecks a snippet using both@Entryand#Preview. Because macro expansion runs during type-checking, an absent plugin fails the probe, which then hard-fails with guidance to install Xcode 26. Catches both blockers — and any future macro dependency — in one place.README.md: corrects the source-build requirements, which incorrectly listed Command Line Tools as a supported alternative to Xcode.Validation
doctor.shexits 0 withOK: toolchain provides Swift macro plugins (@Entry, #Preview).DEVELOPER_DIR=/Library/Developer/CommandLineTools): probe fails withexternal macro implementation type 'SwiftUIMacros.EntryMacro' … plugin for module 'SwiftUIMacros' not foundand the equivalent forPreviewsMacros;doctor.sh --quietexits non-zero with the install-Xcode guidance. Notably the Liquid Glass probe still passes under CLT — i.e. the old check would have reported success — confirming this reproduces and closes CLT-only builds fail despite doctor.sh passing — Xcode-only macro plugins #174.bash -n Scripts/doctor.shpasses;python3 Scripts/test_release_tooling.py→ 52 tests, all pass.Scope
PackageDescriptionmismatch) is environment-specific and self-resolves via CLT reinstall; intentionally not probed to avoid false positives.@Entryusage; making CLT builds succeed would mean removing an idiomatic SwiftUI macro codebase-wide and guarding it in CI — a poor trade for a native macOS app. The honest fix is to detect the unsupported host and say so.Known limitation / follow-up
CI does not exercise the CLT-only path (GitHub
macos-26runners ship Xcode), so this probe is validated by contributors, not CI. A job that selects CLT and assertsdoctor.shfails would close that gap but is awkward on hosted runners; proposed as a separate change.