mirror of
https://github.com/apple/container.git
synced 2026-09-25 16:40:28 -04:00
add support for local build output (#369)
Fixes https://github.com/apple/container/issues/354
This commit is contained in:
@@ -292,6 +292,17 @@ extension Application {
|
||||
let tarURL = tempURL.appendingPathComponent("out.tar")
|
||||
try FileManager.default.moveItem(at: tarURL, to: dest)
|
||||
finalMessage = "Successfully exported to \(dest.absolutePath())"
|
||||
case "local":
|
||||
guard let dest = exp.destination else {
|
||||
throw ContainerizationError(.invalidArgument, message: "dest is required \(exp.rawValue)")
|
||||
}
|
||||
let localDir = tempURL.appendingPathComponent("local")
|
||||
|
||||
guard FileManager.default.fileExists(atPath: localDir.path) else {
|
||||
throw ContainerizationError(.invalidArgument, message: "expected local output not found")
|
||||
}
|
||||
try FileManager.default.copyItem(at: localDir, to: dest)
|
||||
finalMessage = "Successfully exported to \(dest.absolutePath())"
|
||||
default:
|
||||
throw ContainerizationError(.invalidArgument, message: "invalid exporter \(exp.rawValue)")
|
||||
}
|
||||
|
||||
@@ -175,6 +175,10 @@ public struct Builder: Sendable {
|
||||
if destinationValue == nil {
|
||||
throw Builder.Error.invalidExport(input, "dest field is required")
|
||||
}
|
||||
case "local":
|
||||
if destinationValue == nil {
|
||||
throw Builder.Error.invalidExport(input, "dest field is required")
|
||||
}
|
||||
default:
|
||||
throw Builder.Error.invalidExport(input, "unsupported output type")
|
||||
}
|
||||
@@ -187,7 +191,7 @@ public struct Builder: Sendable {
|
||||
var components = ["type=\(type)"]
|
||||
|
||||
switch type {
|
||||
case "oci", "tar":
|
||||
case "oci", "tar", "local":
|
||||
break // ignore destination
|
||||
default:
|
||||
throw Builder.Error.invalidExport(rawValue, "unsupported output type")
|
||||
|
||||
Reference in New Issue
Block a user