Resolves https://github.com/tuist/tuist/issues/YYY
This fixes a regression in the prebuilt SwiftSyntax integration where local macro packages could be forced to import incompatible prebuilt binary modules.
The relevant context is:
Tuist was reading SwiftPM prebuilt metadata from .build/workspace-state.json and applying the resulting module and linker search paths while mapping local external packages. That metadata belongs to the remote package, for example swift-syntax, but when applied to user-owned local macro targets it removed SwiftPM’s normal ability to select a compatible prebuilt or fall back to building SwiftSyntax from source. The result was failures such as importing SwiftCompilerPlugin from an incompatible .swiftmodule under .build/prebuilts.
This PR keeps local external packages on source dependencies when prebuilt metadata is present. Remote packages can still consume SwiftSyntax prebuilts, while local macro packages build their SwiftSyntax dependencies with the user’s active toolchain.
It also adds a regression test covering a local macro target that depends on SwiftSyntax, asserting that Tuist keeps the source dependency and does not inject prebuilt search or linker settings.
How to test locally
git diff --check
env -u TUIST_USE_SWIFTERPM tuist install --replace-scm-with-registry
env -u TUIST_USE_SWIFTERPM tuist generate TuistLoaderTests --no-open
xcodebuild test -workspace Tuist.xcworkspace -scheme TuistUnitTests -only-testing TuistLoaderTests/PackageInfoMapperTests/map_whenLocalMacroTargetDependsOnPrebuiltProduct_keepsSourceDependency CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY=""