tar: Add support for archiving directories#74
Merged
euanh merged 1 commit intoapple:mainfrom Mar 18, 2025
Merged
Conversation
566f881 to
7e7ec1c
Compare
504338d to
504050b
Compare
504050b to
fdfa139
Compare
euanh
added a commit
that referenced
this pull request
Apr 11, 2025
…ages (#78) Motivation ---------- A target in `Package.swift` can include [resources](https://developer.apple.com/documentation/packagedescription/target/resources). When the target is built, the resources are copied into a bundle directory and a [`Bundle`](https://developer.apple.com/documentation/foundation/bundle) 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 ------------- * Add a new `--resource` parameter to `containertool`. This specifies a resource bundle directory which is added to the container image using the directory archiving support added to the `Tar` module in #74. When `containertool` 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 in `Package.swift` can only define one resource bundle, so when used through the plugin only one bundle will be added. * Update the plugin to pass the `--resource` flag to `containertool` 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 --------- * Existing tests continue to pass. * New integration tests verify that all expected resources are present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The tar writer currently provides helper functions which can create tar archives containing single executable files. In order to include resource bundles in container images (#48) the tar writer must be able create archives containing multiple files and directories.
Modifications
Archivetype representing a tar archive allows multiple files to be added before being written out as an array of bytes.Result
The tar writer is able to create archives containing files and directories.
Test Plan
New tests exercise creating archives containing multiple members, including directories.