Add Support For Copying All Resources Into Final Executable #386
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for copying all resources (from all dependencies) into the final executable when packaging for aws lambda.
Motivation:
Closes #367 (and I believe #385 as well).
When an external dependency has resources in SPM, the packager would not copy them into the final executable. This caused an issue on launch where swift would try to create the resources, but this would fail to package. This fixes this.
Modifications:
Updated the packager to go through the build artifact and copy all
.resources
files into the new zip. This also adds a dependency to theLocalDebugging
package so that I could test with that.I also made some small updates to the packager to get them working locally with the new package directory setup (changing from 2 levels deep of folder nesting to 3).
Result:
I couldn't find any automated tests for the packager (I might have missed them), but to test this locally, I applied the following diff (to make the project build):
and then ran
LAMBDA_USE_LOCAL_DEPS=true swift package archive --disable-sandbox
in theMyLambda
folder. This then created a zip that had both thebootstrap
and theShared_Shared.resources
in it.