Skip to content
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

Newly created build tool and command plugin templates should have conditional support for XcodeProjectPlugin #6446

Merged
merged 1 commit into from Apr 18, 2023

Conversation

abertelrud
Copy link
Contributor

@abertelrud abertelrud commented Apr 17, 2023

Package plugins can be applied to packages in Xcode without any modification. But Xcode also has an additional XcodeProjectPlugin module that provides extra API for applying plugins to Xcode projects. Since this is a common use case, it makes sense for newly created plugins to have conditional use of that extra API by default. If there is support for applying plugins to the project formats of other IDEs in the future, it would make sense to add those to the templates as well.

This support is currently always added but we could consider having options in the API for whether to add it.

Changes:

  • extended the template-generated source code
  • added to the unit tests

rdar://108166582

@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Member

@neonichu neonichu left a comment

Choose a reason for hiding this comment

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

LGTM.

I think this naturally poses the question why we don't have the simpler func createBuildCommand(for inputPath: Path, in outputDirectoryPath: Path, with generatorToolPath: Path) -> Command? as an API, but that shouldn't prevent us from improving the template.

@apple apple deleted a comment from ShimaaElabid Apr 18, 2023
@abertelrud
Copy link
Contributor Author

I think this naturally poses the question why we don't have the simpler func createBuildCommand(for inputPath: Path, in outputDirectoryPath: Path, with generatorToolPath: Path) -> Command? as an API, but that shouldn't prevent us from improving the template.

Absolutely. There are a lot of refinements that can be made to the API, and it would still be interesting to see if there could be some kind of über-API that would be generic enough to cover most conceivable IDEs. That approach didn't seem possible for the general case given the differences between the data models of Xcode and Swift Package Manager, but for the common case of just wanting to create a command for every file of some type, it seems a shame to have to have the Xcode specialization.

…ional support for XcodeProjectPlugin

Many package plugins are used from Xcode, so it makes sense for newly created ones to have that by default.  If there is support for other IDEs in the future, it would make sense to add that as well.

This support is currently always added but we could consider having options in the API for whether to add it.

rdar://108166582
@abertelrud
Copy link
Contributor Author

Thanks @MaxDesiatov those newlines were a mistake. I'll fix that.

@abertelrud abertelrud force-pushed the eng/plugin-template-xcodeproject branch from bb96497 to e4ef6b3 Compare April 18, 2023 16:56
@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

@abertelrud
Copy link
Contributor Author

@swift-ci please test windows platform

@abertelrud abertelrud merged commit f0eae33 into apple:main Apr 18, 2023
5 checks passed
@abertelrud abertelrud deleted the eng/plugin-template-xcodeproject branch April 18, 2023 18:47
abertelrud added a commit to abertelrud/swift-package-manager that referenced this pull request Apr 18, 2023
This is a supplemental fix for apple#6446 that removes the `async` specifier and corrects the protocol conformance of the Xcode command plug-in.  This change should have been part of that PR.

- remove the `async` specifier since the entry point that XcodeProjectPlugin defines isn't async
- correct the protocol conformance of the Xcode command plug-in
- update the unit tests

rdar://108166582
abertelrud added a commit that referenced this pull request Apr 18, 2023
…ate (#6451)

This is a supplemental fix for #6446 that removes the `async` specifier and corrects the protocol conformance of the Xcode command plug-in.  This change should have been part of that PR.

- remove the `async` specifier since the entry point that XcodeProjectPlugin defines isn't async
- correct the protocol conformance of the Xcode command plug-in
- update the unit tests

rdar://108166582
abertelrud added a commit to abertelrud/swift-package-manager that referenced this pull request Apr 19, 2023
…ional support for XcodeProjectPlugin (apple#6446)

Many package plugins are used from Xcode, so it makes sense for newly created ones to have that by default.  If there is support for other IDEs in the future, it would make sense to add that as well.

This support is currently always added but we could consider having options in the API for whether to add it.

rdar://108166582
(cherry picked from commit f0eae33)
abertelrud added a commit to abertelrud/swift-package-manager that referenced this pull request Apr 19, 2023
…ate (apple#6451)

This is a supplemental fix for apple#6446 that removes the `async` specifier and corrects the protocol conformance of the Xcode command plug-in.  This change should have been part of that PR.

- remove the `async` specifier since the entry point that XcodeProjectPlugin defines isn't async
- correct the protocol conformance of the Xcode command plug-in
- update the unit tests

rdar://108166582
(cherry picked from commit 87ecb5d)
abertelrud added a commit that referenced this pull request Apr 19, 2023
…ve conditional support for XcodeProjectPlugin #6446 (#6456)

* New build tool plugin and command plugin templates should have conditional support for XcodeProjectPlugin (#6446)

Many package plugins are used from Xcode, so it makes sense for newly created ones to have that by default.  If there is support for other IDEs in the future, it would make sense to add that as well.

This support is currently always added but we could consider having options in the API for whether to add it.

rdar://108166582
(cherry picked from commit f0eae33)

* Supplemental fix for XcodeProjectPlugin support in package init template (#6451)

This is a supplemental fix for #6446 that removes the `async` specifier and corrects the protocol conformance of the Xcode command plug-in.  This change should have been part of that PR.

- remove the `async` specifier since the entry point that XcodeProjectPlugin defines isn't async
- correct the protocol conformance of the Xcode command plug-in
- update the unit tests

rdar://108166582
(cherry picked from commit 87ecb5d)
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.

None yet

3 participants