Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Sources/ContainerPersistence/ContainerSystemConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ final public class BuildConfig: Codable, Sendable {
public static let defaultRosetta = true
public static let defaultCPUs = 2
public static let defaultMemory = try! MemorySize("2048MB")
public static var defaultImage: String {
public static let defaultImage: String = {
let tag = String(cString: get_container_builder_shim_version())
return "ghcr.io/apple/container-builder-shim/builder:\(tag)"
}
}()

public let rosetta: Bool
public let cpus: Int
Expand Down Expand Up @@ -145,12 +145,12 @@ final public class DNSConfig: Codable, Sendable {
}

final public class VminitConfig: Codable, Sendable {
public static var defaultImage: String {
public static let defaultImage: String = {
let tag = String(cString: get_swift_containerization_version())
return tag == "latest"
? "vminit:latest"
: "ghcr.io/apple/containerization/vminit:\(tag)"
}
}()

public let image: String

Expand Down
8 changes: 3 additions & 5 deletions Sources/ContainerPersistence/MachineConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ public struct MachineConfig: Codable, Sendable {
public static let `default`: MachineConfig = try! .init(
cpus: nil, memory: nil, homeMount: nil, virtualization: nil, kernelPath: nil)

public static var defaultCPUs: Int {
max(ProcessInfo.processInfo.processorCount / 2, 4)
}
public static let defaultCPUs: Int = max(ProcessInfo.processInfo.processorCount / 2, 4)

public static var defaultMemory: MemorySize {
public static let defaultMemory: MemorySize = {
let bytes = max(ProcessInfo.processInfo.physicalMemory / 2, 1024 * 1024 * 1024)
let gb = bytes / (1024 * 1024 * 1024)
return try! MemorySize("\(gb)gb")
}
}()

public static let defaultHomeMount: HomeMountOption = .rw

Expand Down
7 changes: 1 addition & 6 deletions Sources/TerminalProgress/Int+Formatted.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ extension Int {
}

func formattedNumber() -> String {
let formatter = NumberFormatter()
formatter.numberStyle = .decimal
guard let formattedNumber = formatter.string(from: NSNumber(value: self)) else {
return ""
}
return formattedNumber
self.formatted(.number)
}
}