plugin: Add resource bundles defined in Package.swift to container images #78
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.
Motivation
A target in
Package.swift
can include resources. When the target is built, the resources are copied into a bundle directory and aBundle
class is generated, giving the executable a convenient way to retrieve them at run time.A target with resources should be able to access them when it is packaged in a container image. For example, a web server might bundle resources such as images or fonts.
Fixes #48
Modifications
--resource
parameter tocontainertool
. This specifies a resource bundle directory which is added to the container image using the directory archiving support added to theTar
module in tar: Add support for archiving directories #74. Whencontainertool
is used alone, multiple--resource
flags can be specified and will be added to the image in the order in which they appear on the command line. A target inPackage.swift
can only define one resource bundle, so when used through the plugin only one bundle will be added.--resource
flag tocontainertool
when an executable target has resources.Result
If a target includes resources, the resource bundle will be copied into the container image at a path where the generated
Bundle
class can find it.If a target does not include resources, the container image will only include the executable.
Test Plan