-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Support for embedding resources in an executable #6067
Conversation
Would it be better for performance if it was embedded as a |
b3bae58
to
c3fc702
Compare
I updated the PR, but I think we'd still want to rely on |
Although the bundle form of this code generation does rely on Foundation, I think it makes sense for the byte array form to not do so. That makes it useful on, say, new platforms that doesn't have Foundation yet (or is having Foundation now a requirement for any new platform that claims to support Swift? — I've lost track of how core it is now considered to the Swift standard libraries). |
Sources/Build/BuildDescription/SwiftTargetBuildDescription.swift
Outdated
Show resolved
Hide resolved
c3fc702
to
6422935
Compare
Updated naming to |
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.
cool 👍
looks good. I guess its draft since we need some tests? |
Basic support for a new `.embed` resource rule which will allow embedding the contents of the resource into the executable code by generating a byte array, e.g. ``` struct PackageResources { static let best_txt: [UInt8] = [104,101,108,108,111,32,119,111,114,108,100,10] } ``` Note that the current naïve implementaton will not work well for larger resources as it is pretty memory inefficient.
6422935
to
f231059
Compare
Added a test now, so this is ready for review. Note that the test is part of |
@swift-ci please smoke test |
Seeing another immediate failure for Windows here, cc @shahmishal |
@swift-ci test Windows |
@swift-ci smoke test Windows |
@swift-ci smoke test macOS |
thanks for adding this great feature @neonichu , should we add an entry in the change log / release note? seems important to communicate this one |
Added in #6132 |
Basic support for a new
.embed
resource rule which will allow embedding the contents of the resource into the executable code by generating a byte array, e.g.Note that the current naïve implementaton will not work well for larger resources as it is pretty memory inefficient.