@@ -29,7 +29,7 @@ public struct StaticBuildConfiguration: Codable {
2929 customConditions: Set < String > = [ ] ,
3030 features: Set < String > = [ ] ,
3131 attributes: Set < String > = [ ] ,
32- targetOSNames : Set < String > = [ ] ,
32+ targetOSs : Set < String > = [ ] ,
3333 targetArchitectures: Set < String > = [ ] ,
3434 targetEnvironments: Set < String > = [ ] ,
3535 targetRuntimes: Set < String > = [ ] ,
@@ -44,7 +44,7 @@ public struct StaticBuildConfiguration: Codable {
4444 self . customConditions = customConditions
4545 self . features = features
4646 self . attributes = attributes
47- self . targetOSNames = targetOSNames
47+ self . targetOSs = targetOSs
4848 self . targetArchitectures = targetArchitectures
4949 self . targetEnvironments = targetEnvironments
5050 self . targetRuntimes = targetRuntimes
@@ -53,7 +53,7 @@ public struct StaticBuildConfiguration: Codable {
5353 self . targetPointerBitWidth = targetPointerBitWidth
5454 self . targetAtomicBitWidths = targetAtomicBitWidths
5555 self . endianness = endianness
56- self . languageVersion = languageVersion
56+ self . languageMode = languageVersion
5757 self . compilerVersion = compilerVersion
5858 }
5959
@@ -95,22 +95,76 @@ public struct StaticBuildConfiguration: Codable {
9595 /// ```
9696 public var attributes : Set < String > = [ ]
9797
98- /// The active target OS names, e.g., "Windows", "iOS".
99- public var targetOSNames : Set < String > = [ ]
98+ /// The active target OS, e.g., "Windows", "iOS".
99+ ///
100+ /// The target operating system can be queried with `os(<name>)`, e.g.,
101+ ///
102+ /// ```swift
103+ /// #if os(Linux)
104+ /// // Linux-specific implementation
105+ /// #endif
106+ /// ```
107+ public var targetOSs : Set < String > = [ ]
100108
101109 /// The active target architectures, e.g., "x64_64".
110+ ///
111+ /// The target processor architecture can be queried with `arch(<name>)`, e.g.,
112+ ///
113+ /// ```swift
114+ /// #if arch(x86_64)
115+ /// // 64-bit x86 Intel-specific code
116+ /// #endif
117+ /// ```
102118 public var targetArchitectures : Set < String > = [ ]
103119
104120 /// The active target environments, e.g., "simulator".
121+ ///
122+ /// The target environment can be queried with `targetEnvironment(<name>)`,
123+ /// e.g.,
124+ ///
125+ /// ```swift
126+ /// #if targetEnvironment(simulator)
127+ /// // Simulator-specific code
128+ /// #endif
129+ /// ```
105130 public var targetEnvironments : Set < String > = [ ]
106131
107132 /// The active target runtimes, e.g., _ObjC.
133+ ///
134+ /// The target runtime can only be queried by an experimental syntax
135+ /// `_runtime(<name>)`, e.g.,
136+ ///
137+ /// ```swift
138+ /// #if _runtime(_ObjC)
139+ /// // Code that depends on Swift being built for use with the Objective-C
140+ /// // runtime, e.g., on Apple platforms.
141+ /// #endif
142+ /// ```
108143 public var targetRuntimes : Set < String > = [ ]
109144
110145 /// The active target's pointer authentication schemes, e.g., "arm64e".
146+ ///
147+ /// The target pointer authentication scheme describes how pointers are
148+ /// signed, as a security mitigation. This scheme can only be queried by
149+ /// an experimental syntax `_ptrath(<name>)`, e.g.,
150+ ///
151+ /// ```swift
152+ /// #if _ptrauth(arm64e)
153+ /// // Special logic for arm64e pointer signing
154+ /// #endif
155+ /// ```
111156 public var targetPointerAuthenticationSchemes : Set < String > = [ ]
112157
113158 /// The active target's object file formats, e.g., "COFF"
159+ ///
160+ /// The target object file format can only be queried by an experimental
161+ /// syntax `_objectFileFormat(<name>)`, e.g.,
162+ ///
163+ /// ```swift
164+ /// #if _objectFileFormat(ELF)
165+ /// // Special logic for ELF object file formats
166+ /// #endif
167+ /// ```
114168 public var targetObjectFileFormats : Set < String > = [ ]
115169
116170 /// The bit width of a data pointer for the target architecture.
@@ -151,17 +205,17 @@ public struct StaticBuildConfiguration: Codable {
151205 /// ```
152206 public var endianness : Endianness = . little
153207
154- /// The effective language version , which can be set by the user (e.g., 5.0).
208+ /// The effective language mode , which can be set by the user (e.g., 5.0).
155209 ///
156210 /// The language version can be queried with the `swift` directive that checks
157211 /// how the supported language version compares, as described by
158212 /// [SE-0212](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0212-compiler-version-directive.md). For example:
159213 ///
160214 /// ```swift
161- /// #if swift(>=5.5 )
215+ /// #if swift(>=6.0 )
162216 /// // Hooray, we can use tasks!
163217 /// ```
164- public var languageVersion : VersionTuple
218+ public var languageMode : VersionTuple
165219
166220 /// The version of the compiler (e.g., 5.9).
167221 ///
@@ -264,7 +318,7 @@ extension StaticBuildConfiguration: BuildConfiguration {
264318 /// - Returns: Whether the given operating system name is the target operating
265319 /// system, i.e., the operating system for which code is being generated.
266320 public func isActiveTargetOS( name: String ) -> Bool {
267- targetOSNames . contains ( name)
321+ targetOSs . contains ( name)
268322 }
269323
270324 /// Determine whether the given name is the active target architecture
@@ -363,6 +417,12 @@ extension StaticBuildConfiguration: BuildConfiguration {
363417 public func isActiveTargetObjectFileFormat( name: String ) -> Bool {
364418 targetObjectFileFormats. contains ( name)
365419 }
420+
421+ /// Equivalent to `languageMode`, but required for conformance to the
422+ /// `BuildConfiguration` protocol.
423+ public var languageVersion : VersionTuple {
424+ languageMode
425+ }
366426}
367427
368428extension StaticBuildConfiguration {
@@ -376,11 +436,11 @@ extension StaticBuildConfiguration {
376436extension StaticBuildConfiguration {
377437 /// The Swift version that can be set for the parser.
378438 public var parserSwiftVersion : Parser . SwiftVersion {
379- if languageVersion < VersionTuple ( 5 ) {
439+ if languageMode < VersionTuple ( 5 ) {
380440 return . v4
381- } else if languageVersion < VersionTuple ( 6 ) {
441+ } else if languageMode < VersionTuple ( 6 ) {
382442 return . v5
383- } else if languageVersion < VersionTuple ( 7 ) {
443+ } else if languageMode < VersionTuple ( 7 ) {
384444 return . v6
385445 } else {
386446 return Parser . defaultSwiftVersion
0 commit comments