|
| 1 | +//===----------------------------------------------------------------------===// |
| 2 | +// |
| 3 | +// This source file is part of the Swift open source project |
| 4 | +// |
| 5 | +// Copyright (c) 2025 Apple Inc. and the Swift project authors |
| 6 | +// Licensed under Apache License v2.0 with Runtime Library Exception |
| 7 | +// |
| 8 | +// See http://swift.org/LICENSE.txt for license information |
| 9 | +// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 10 | +// |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | + |
| 13 | +public import SWBUtil |
| 14 | +public import SWBCore |
| 15 | +import SWBMacro |
| 16 | +import Foundation |
| 17 | + |
| 18 | +struct BareMetalPlatformExtension: PlatformInfoExtension { |
| 19 | + func additionalPlatforms(context: any PlatformInfoExtensionAdditionalPlatformsContext) throws -> [(path: Path, data: [String: PropertyListItem])] { |
| 20 | + [ |
| 21 | + (.root, [ |
| 22 | + "Type": .plString("Platform"), |
| 23 | + "Name": .plString("none"), |
| 24 | + "Identifier": .plString("none"), |
| 25 | + "Description": .plString("Bare Metal"), |
| 26 | + "FamilyName": .plString("None"), |
| 27 | + "FamilyIdentifier": .plString("none"), |
| 28 | + "IsDeploymentPlatform": .plString("YES"), |
| 29 | + ]) |
| 30 | + ] |
| 31 | + } |
| 32 | +} |
| 33 | + |
| 34 | +@_spi(Testing) public struct BareMetalSDKRegistryExtension: SDKRegistryExtension { |
| 35 | + public func additionalSDKs(context: any SDKRegistryExtensionAdditionalSDKsContext) async throws -> [(path: Path, platform: Platform?, data: [String: PropertyListItem])] { |
| 36 | + guard let platform = context.platformRegistry.lookup(name: "none") else { |
| 37 | + return [] |
| 38 | + } |
| 39 | + |
| 40 | + let defaultProperties: [String: PropertyListItem] = [ |
| 41 | + "SDK_STAT_CACHE_ENABLE": "NO", |
| 42 | + ] |
| 43 | + |
| 44 | + return [(.root, platform, [ |
| 45 | + "Type": .plString("SDK"), |
| 46 | + "Version": .plString("0.0.0"), |
| 47 | + "CanonicalName": .plString("none"), |
| 48 | + "IsBaseSDK": .plBool(true), |
| 49 | + "DefaultProperties": .plDict([ |
| 50 | + "PLATFORM_NAME": .plString("none"), |
| 51 | + ].merging(defaultProperties, uniquingKeysWith: { _, new in new })), |
| 52 | + "CustomProperties": .plDict([:]), |
| 53 | + "SupportedTargets": .plDict([ |
| 54 | + "none": .plDict([ |
| 55 | + "Archs": .plArray([]), |
| 56 | + "LLVMTargetTripleSys": .plString("none"), |
| 57 | + ]) |
| 58 | + ]), |
| 59 | + ])] |
| 60 | + } |
| 61 | +} |
0 commit comments