-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Handle generated resources from plugins #4306
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
Conversation
Biggest question I have: since we don't support generated sources for Clang targets, yet, I am assuming we do the same for resources for now and handle support for Clang targets separately? |
Oh, there's one major limitation right now: because we do not retain information from the manifest about non-existent files during the initial pass of Maybe we should treat any unknown resources as to be processed right now? The main reason we don't include anything but certain known types automatically was that we wanted to prevent people from accidentally shipping files with their products, but since any files here are basically already opt-in through depending on a given plugin, that might not be a concern? |
Because unknown files are vended to the plugin, I did actually extend
To do this completely correctly I think would involve reworking |
Yes, I think that makes sense. It's unfortunate that there's such a split between Clang targets and Swift targets in SwiftPM, causing overlap for the things that aren't difference. But I think it's a good idea to tackle this piecemeal, as you're doing. |
98499b4
to
4650e37
Compare
OK, I think this is basically ready for review now, just need to add some tests. |
@swift-ci please smoke test |
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.
LGTM (modulo the need for tests as you mentioned). Thank you for taking this on!
4650e37
to
3f65655
Compare
I moved the big switch statement into |
3f65655
to
36240e9
Compare
|
Self-hosted is running macOS 11.5.2, so we shouldn't be trying to find the concurrency libs in the OS, I think. Also odd that the smoke test passes just fine. Maybe an issue with the superior toolchain? |
It is using
So maybe we'll just disable the test for < 5.6 |
36240e9
to
0caca44
Compare
@swift-ci please smoke test |
0caca44
to
c0393be
Compare
@swift-ci please smoke test |
Oh I see! Yes, this needs at least 5.6. |
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.
looks good, some style nits
Up until now, we were treating all generated files as Swift source files. With this, we are involving `TargetSourcesBuilder` in the decision of how to treat a certain file, provided the tools version is 5.7 or newer. Remaining limitations: - generated files aren't treated the same way as non-generated ones, e.g. we will treat anything unknown as a resource to be processed and we won't respect declarations from the manifest - files in Clang targets aren't treated at all at the moment rdar://89693335
c0393be
to
dfefce8
Compare
@swift-ci please smoke test |
@swift-ci please smoke test linux |
Due to the fact that swiftlang/swift-package-manager#4306 will only be available starting with Swift 5.7, we can't generate these resources with a SwiftPM plugin. I propose storing the generated code in the repository directly for now. When 5.7 is released, we can switch to a SwiftPM plugin approach. Can be tested end-to-end with swiftwasm/carton#335. Co-authored-by: Yuta Saito <[email protected]>
rdar://89693335