@@ -244,29 +244,29 @@ public struct SwiftSDK: Equatable {
244
244
245
245
/// Initialize paths configuration from values deserialized using v3 schema.
246
246
/// - Parameters:
247
- /// - properties: properties of the destination for the given triple.
248
- /// - destinationDirectory : directory used for converting relative paths in `properties` to absolute paths.
247
+ /// - properties: properties of the Swift SDK for the given triple.
248
+ /// - swiftSDKDirectory : directory used for converting relative paths in `properties` to absolute paths.
249
249
fileprivate init (
250
250
_ properties: SerializedDestinationV3 . TripleProperties ,
251
- destinationDirectory : AbsolutePath ? = nil
251
+ swiftSDKDirectory : AbsolutePath ? = nil
252
252
) throws {
253
- if let destinationDirectory {
253
+ if let swiftSDKDirectory {
254
254
self . init (
255
- sdkRootPath: try AbsolutePath ( validating: properties. sdkRootPath, relativeTo: destinationDirectory ) ,
255
+ sdkRootPath: try AbsolutePath ( validating: properties. sdkRootPath, relativeTo: swiftSDKDirectory ) ,
256
256
swiftResourcesPath: try properties. swiftResourcesPath. map {
257
- try AbsolutePath ( validating: $0, relativeTo: destinationDirectory )
257
+ try AbsolutePath ( validating: $0, relativeTo: swiftSDKDirectory )
258
258
} ,
259
259
swiftStaticResourcesPath: try properties. swiftStaticResourcesPath. map {
260
- try AbsolutePath ( validating: $0, relativeTo: destinationDirectory )
260
+ try AbsolutePath ( validating: $0, relativeTo: swiftSDKDirectory )
261
261
} ,
262
262
includeSearchPaths: try properties. includeSearchPaths? . map {
263
- try AbsolutePath ( validating: $0, relativeTo: destinationDirectory )
263
+ try AbsolutePath ( validating: $0, relativeTo: swiftSDKDirectory )
264
264
} ,
265
265
librarySearchPaths: try properties. librarySearchPaths? . map {
266
- try AbsolutePath ( validating: $0, relativeTo: destinationDirectory )
266
+ try AbsolutePath ( validating: $0, relativeTo: swiftSDKDirectory )
267
267
} ,
268
268
toolsetPaths: try properties. toolsetPaths? . map {
269
- try AbsolutePath ( validating: $0, relativeTo: destinationDirectory )
269
+ try AbsolutePath ( validating: $0, relativeTo: swiftSDKDirectory )
270
270
}
271
271
)
272
272
} else {
@@ -364,10 +364,10 @@ public struct SwiftSDK: Equatable {
364
364
}
365
365
}
366
366
367
- /// Configuration of file system paths used by this destination when building.
367
+ /// Configuration of file system paths used by this Swift SDK when building.
368
368
public var pathsConfiguration : PathsConfiguration
369
369
370
- /// Creates a compilation destination with the specified properties.
370
+ /// Creates a Swift SDK with the specified properties.
371
371
@available ( * , deprecated, message: " use `init(targetTriple:sdkRootDir:toolset:)` instead " )
372
372
public init (
373
373
target: Triple ? = nil ,
@@ -389,7 +389,7 @@ public struct SwiftSDK: Equatable {
389
389
)
390
390
}
391
391
392
- /// Creates a compilation destination with the specified properties.
392
+ /// Creates a Swift SDK with the specified properties.
393
393
@available ( * , deprecated, message: " use `init(hostTriple:targetTriple:toolset:pathsConfiguration:)` instead " )
394
394
public init (
395
395
hostTriple: Triple ? = nil ,
@@ -406,7 +406,7 @@ public struct SwiftSDK: Equatable {
406
406
)
407
407
}
408
408
409
- /// Creates a compilation destination with the specified properties.
409
+ /// Creates a Swift SDK with the specified properties.
410
410
public init (
411
411
hostTriple: Triple ? = nil ,
412
412
targetTriple: Triple ? = nil ,
@@ -433,8 +433,7 @@ public struct SwiftSDK: Equatable {
433
433
return try AbsolutePath ( validating: CommandLine . arguments [ 0 ] , relativeTo: cwd) . parentDirectory
434
434
}
435
435
436
- /// The destination describing the host OS.
437
-
436
+ /// The Swift SDK describing the host platform.
438
437
@available ( * , deprecated, renamed: " hostSwiftSDK " )
439
438
public static func hostDestination(
440
439
_ binDir: AbsolutePath ? = nil ,
@@ -444,7 +443,7 @@ public struct SwiftSDK: Equatable {
444
443
try self . hostSwiftSDK ( binDir, originalWorkingDirectory: originalWorkingDirectory, environment: environment)
445
444
}
446
445
447
- /// The Swift SDK for the host OS .
446
+ /// The Swift SDK for the host platform .
448
447
public static func hostSwiftSDK(
449
448
_ binDir: AbsolutePath ? = nil ,
450
449
originalWorkingDirectory: AbsolutePath ? = nil ,
@@ -544,7 +543,7 @@ public struct SwiftSDK: Equatable {
544
543
/// Cache storage for sdk platform path.
545
544
private static var _sdkPlatformFrameworkPath : ( fwk: AbsolutePath , lib: AbsolutePath ) ? = nil
546
545
547
- /// Returns a default destination of a given target environment
546
+ /// Returns a default Swift SDK for a given target environment
548
547
@available ( * , deprecated, renamed: " defaultSwiftSDK " )
549
548
public static func defaultDestination( for triple: Triple , host: SwiftSDK ) -> SwiftSDK ? {
550
549
if triple. isWASI ( ) {
@@ -575,7 +574,7 @@ public struct SwiftSDK: Equatable {
575
574
return nil
576
575
}
577
576
578
- /// Propagates toolchain and SDK paths known to the destination to `swiftc` CLI options.
577
+ /// Propagates toolchain and SDK paths known to the Swift SDK to `swiftc` CLI options.
579
578
public mutating func applyPathCLIOptions( ) {
580
579
var properties = self . toolset. knownTools [ . swiftCompiler] ?? . init( extraCLIOptions: [ ] )
581
580
properties. extraCLIOptions. append ( contentsOf: self . toolset. rootPaths. flatMap { [ " -tools-directory " , $0. pathString] } )
@@ -588,7 +587,7 @@ public struct SwiftSDK: Equatable {
588
587
}
589
588
590
589
/// Appends a path to the array of toolset root paths.
591
- /// - Parameter toolsetRootPath: new path to add to the destination 's toolset.
590
+ /// - Parameter toolsetRootPath: new path to add to Swift SDK 's toolset.
592
591
public mutating func add( toolsetRootPath: AbsolutePath ) {
593
592
self . toolset. rootPaths. append ( toolsetRootPath)
594
593
}
@@ -627,28 +626,28 @@ extension SwiftSDK {
627
626
) throws -> [ SwiftSDK ] {
628
627
switch semanticVersion. schemaVersion {
629
628
case Version ( 3 , 0 , 0 ) :
630
- let destinations = try decoder. decode ( path: path, fileSystem: fileSystem, as: SerializedDestinationV3 . self)
631
- let destinationDirectory = path. parentDirectory
629
+ let swiftSDKs = try decoder. decode ( path: path, fileSystem: fileSystem, as: SerializedDestinationV3 . self)
630
+ let swiftSDKDirectory = path. parentDirectory
632
631
633
- return try destinations . runTimeTriples. map { triple, properties in
632
+ return try swiftSDKs . runTimeTriples. map { triple, properties in
634
633
let triple = try Triple ( triple)
635
634
636
635
let pathStrings = properties. toolsetPaths ?? [ ]
637
636
let toolset = try pathStrings. reduce ( into: Toolset ( knownTools: [ : ] , rootPaths: [ ] ) ) {
638
637
try $0. merge (
639
638
with: Toolset (
640
- from: . init( validating: $1, relativeTo: destinationDirectory ) ,
639
+ from: . init( validating: $1, relativeTo: swiftSDKDirectory ) ,
641
640
at: fileSystem,
642
641
observabilityScope
643
642
)
644
643
)
645
644
}
646
645
647
646
return try SwiftSDK (
648
- runTimeTriple : triple,
647
+ targetTriple : triple,
649
648
properties: properties,
650
649
toolset: toolset,
651
- destinationDirectory : destinationDirectory
650
+ swiftSDKDirectory : swiftSDKDirectory
652
651
)
653
652
}
654
653
@@ -701,22 +700,22 @@ extension SwiftSDK {
701
700
)
702
701
}
703
702
704
- /// Initialize new Swift SDK from values deserialized using v3 schema.
703
+ /// Initialize new Swift SDK from values deserialized using the v3 schema.
705
704
/// - Parameters:
706
- /// - runTimeTriple : triple of the machine running code built with this destination .
705
+ /// - targetTriple : triple of the machine running code built with this Swift SDK .
707
706
/// - properties: properties of the destination for the given triple.
708
707
/// - toolset: combined toolset used by this destination.
709
- /// - destinationDirectory : directory used for converting relative paths in `properties` to absolute paths.
708
+ /// - swiftSDKDirectory : directory used for converting relative paths in `properties` to absolute paths.
710
709
private init (
711
- runTimeTriple : Triple ,
710
+ targetTriple : Triple ,
712
711
properties: SerializedDestinationV3 . TripleProperties ,
713
712
toolset: Toolset = . init( ) ,
714
- destinationDirectory : AbsolutePath ? = nil
713
+ swiftSDKDirectory : AbsolutePath ? = nil
715
714
) throws {
716
715
self . init (
717
- targetTriple: runTimeTriple ,
716
+ targetTriple: targetTriple ,
718
717
toolset: toolset,
719
- pathsConfiguration: try . init( properties, destinationDirectory : destinationDirectory )
718
+ pathsConfiguration: try . init( properties, swiftSDKDirectory : swiftSDKDirectory )
720
719
)
721
720
}
722
721
@@ -730,50 +729,54 @@ extension SwiftSDK {
730
729
// Check schema version.
731
730
switch version. version {
732
731
case 1 :
733
- let destination = try decoder. decode ( path: path, fileSystem: fileSystem, as: SerializedDestinationV1 . self)
732
+ let serializedMetadata = try decoder. decode (
733
+ path: path,
734
+ fileSystem: fileSystem,
735
+ as: SerializedDestinationV1 . self
736
+ )
734
737
try self . init (
735
- targetTriple: destination . target. map { try Triple ( $0) } ,
738
+ targetTriple: serializedMetadata . target. map { try Triple ( $0) } ,
736
739
toolset: . init(
737
- toolchainBinDir: destination . binDir,
740
+ toolchainBinDir: serializedMetadata . binDir,
738
741
buildFlags: . init(
739
- cCompilerFlags: destination . extraCCFlags,
740
- cxxCompilerFlags: destination . extraCPPFlags,
741
- swiftCompilerFlags: destination . extraSwiftCFlags
742
+ cCompilerFlags: serializedMetadata . extraCCFlags,
743
+ cxxCompilerFlags: serializedMetadata . extraCPPFlags,
744
+ swiftCompilerFlags: serializedMetadata . extraSwiftCFlags
742
745
)
743
746
) ,
744
- pathsConfiguration: . init( sdkRootPath: destination . sdk)
747
+ pathsConfiguration: . init( sdkRootPath: serializedMetadata . sdk)
745
748
)
746
749
case 2 :
747
- let destination = try decoder. decode ( path: path, fileSystem: fileSystem, as: SerializedDestinationV2 . self)
748
- let destinationDirectory = path. parentDirectory
750
+ let serializedMetadata = try decoder. decode ( path: path, fileSystem: fileSystem, as: SerializedDestinationV2 . self)
751
+ let swiftSDKDirectory = path. parentDirectory
749
752
750
753
try self . init (
751
- hostTriple: destination . hostTriples. map ( Triple . init) . first,
752
- targetTriple: destination . targetTriples. map ( Triple . init) . first,
754
+ hostTriple: serializedMetadata . hostTriples. map ( Triple . init) . first,
755
+ targetTriple: serializedMetadata . targetTriples. map ( Triple . init) . first,
753
756
toolset: . init(
754
757
toolchainBinDir: AbsolutePath (
755
- validating: destination . toolchainBinDir,
756
- relativeTo: destinationDirectory
758
+ validating: serializedMetadata . toolchainBinDir,
759
+ relativeTo: swiftSDKDirectory
757
760
) ,
758
761
buildFlags: . init(
759
- cCompilerFlags: destination . extraCCFlags,
760
- cxxCompilerFlags: destination . extraCXXFlags,
761
- swiftCompilerFlags: destination . extraSwiftCFlags,
762
- linkerFlags: destination . extraLinkerFlags
762
+ cCompilerFlags: serializedMetadata . extraCCFlags,
763
+ cxxCompilerFlags: serializedMetadata . extraCXXFlags,
764
+ swiftCompilerFlags: serializedMetadata . extraSwiftCFlags,
765
+ linkerFlags: serializedMetadata . extraLinkerFlags
763
766
)
764
767
) ,
765
768
pathsConfiguration: . init(
766
- sdkRootPath: AbsolutePath ( validating: destination . sdkRootDir, relativeTo: destinationDirectory )
769
+ sdkRootPath: AbsolutePath ( validating: serializedMetadata . sdkRootDir, relativeTo: swiftSDKDirectory )
767
770
)
768
771
)
769
772
default :
770
773
throw SwiftSDKError . invalidSchemaVersion
771
774
}
772
775
}
773
776
774
- /// Encodes a destination into its serialized form, which is a pair of its run time triple and paths configuration.
777
+ /// Encodes a Swift SDK into its serialized form, which is a pair of its run time triple and paths configuration.
775
778
/// Returns a pair that can be used to reconstruct a `SerializedDestinationV3` value for storage. `nil` if
776
- /// required configuration properties aren't available on `self`, which can happen if `Destination ` was decoded
779
+ /// required configuration properties aren't available on `self`, which can happen if `Swift SDK ` was decoded
777
780
/// from different schema versions or constructed manually without providing valid values for such properties.
778
781
var serialized : ( Triple , SerializedDestinationV3 . TripleProperties ) {
779
782
get throws {
0 commit comments