-
Notifications
You must be signed in to change notification settings - Fork 1.4k
When adding a macro target to a package, create a dependency on swift-syntax #7476
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
When adding a macro target to a package, create a dependency on swift-syntax #7476
Conversation
…-syntax When editing a package manifest to add a new macro target, also create a package dependency on swift-syntax and import CompilerPluginSupport. We need both so that the macro will build.
@swift-ci please test |
} | ||
|
||
/// Package dependency on the swift-syntax package. | ||
static var swiftSyntax: PackageDependency { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to get the UserToolchain
where you need this? Ideally this would use the installedSwiftPMConfiguration
property there, InstalledSwiftPMConfiguration.default.swiftSyntaxVersionForMacroTemplate
should disappear. The URL could also be added to that JSON file as well (Utilities/config.json
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can grab it from the command state and thread it through. I've done so in c66eb4f, thanks for the pointer!
…ation This allows us to pick up the appropriate swift-syntax version from the host toolchain, rather than using the hard-coded one.
23ba109
to
c66eb4f
Compare
@swift-ci please test |
@swift-ci please test Windows |
…-syntax (swiftlang#7476) (cherry picked from commit d30647a)
#7494) * **Explanation**: Implement package manifest editing commands (`swift package add-dependency`, `swift package add-target`, `swift package add-product`) described in [SE-0301](https://github.com/apple/swift-evolution/blob/main/proposals/0301-package-editing-commands.md), using swift-syntax under the hood to perform the edits. * **Original PR**: #7467, #7476, #7477 * **Risk**: Very low. All new code for new commands. * **Reviewed by**: @ahoppen , @bnbarham , @owenv , @MaxDesiatov * **Testing**: New tests. --------- Co-authored-by: Rintaro Ishizaki <[email protected]> Co-authored-by: Saleem Abdulrasool <[email protected]>
When editing a package manifest to add a new macro target, also create a package dependency on swift-syntax and import CompilerPluginSupport. We need both so that the macro will build.