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). |
c3fc702 to
6422935
Compare
|
Updated naming to |
|
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
.embedresource 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.