Skip to content

Commit 813a979

Browse files
authored
containertool: Move ELF architecture translation extension to Extensions (#73)
Motivation ---------- All extensions defined in `containertool` should be in the `Extensions` subdirectory. Modifications ------------- Move `ELF.containerArchitecture` extension to `Extensions`. Result ------ All `containertool` extensions can be found in one place. Test Plan --------- Tests continue to pass.
1 parent ae18b60 commit 813a979

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the SwiftContainerPlugin open source project
4+
//
5+
// Copyright (c) 2024 Apple Inc. and the SwiftContainerPlugin project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of SwiftContainerPlugin project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
extension ELF.ISA {
16+
/// Converts the ELF architecture to the GOARCH string representation understood by the container runtime.
17+
/// Unsupported architectures are mapped to nil.
18+
var containerArchitecture: String? {
19+
switch self {
20+
case .x86_64: "amd64"
21+
case .aarch64: "arm64"
22+
default: nil
23+
}
24+
}
25+
}

Sources/containertool/containertool.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,3 @@ enum AllowHTTP: String, ExpressibleByArgument, CaseIterable { case source, desti
237237
print(destination_image)
238238
}
239239
}
240-
241-
extension ELF.ISA {
242-
var containerArchitecture: String? {
243-
switch self {
244-
case .x86_64: "amd64"
245-
case .aarch64: "arm64"
246-
default: nil
247-
}
248-
}
249-
}

0 commit comments

Comments
 (0)