@@ -28,28 +28,31 @@ public struct BuildConfiguration: Encodable {
28
28
/// A condition that limits the application of a build setting.
29
29
///
30
30
/// By default, build settings are applicable for all platforms and build
31
- /// configurations. Use the `` when(platforms:configuration:)`` modifier to define a build
32
- /// setting for a specific condition. Invalid usage of `.when` emits an error during
33
- /// manifest parsing. For example, it's invalid to specify a `.when` condition with
34
- /// both parameters as `nil`.
31
+ /// configurations. Use the `. when` modifier to define a build setting for a
32
+ /// specific condition. Invalid usage of `.when` emits an error during manifest
33
+ /// parsing. For example, it's invalid to specify a `.when` condition with both
34
+ /// parameters as `nil`.
35
35
///
36
- /// The following example shows how to use build setting conditions with various APIs:
36
+ /// The following example shows how to use build setting conditions with various
37
+ /// APIs:
37
38
///
38
- /// ...
39
- /// .target(
40
- /// name: "MyTool",
41
- /// dependencies: ["Utility"],
42
- /// cSettings: [
43
- /// .headerSearchPath("path/relative/to/my/target"),
44
- /// .define("DISABLE_SOMETHING", .when(platforms: [.iOS], configuration: .release)),
45
- /// ],
46
- /// swiftSettings: [
47
- /// .define("ENABLE_SOMETHING", .when(configuration: .release)),
48
- /// ],
49
- /// linkerSettings: [
50
- /// .linkedLibrary("openssl", .when(platforms: [.linux])),
51
- /// ]
52
- /// ),
39
+ /// ```swift
40
+ /// ...
41
+ /// .target(
42
+ /// name: "MyTool",
43
+ /// dependencies: ["Utility"],
44
+ /// cSettings: [
45
+ /// .headerSearchPath("path/relative/to/my/target"),
46
+ /// .define("DISABLE_SOMETHING", .when(platforms: [.iOS], configuration: .release)),
47
+ /// ],
48
+ /// swiftSettings: [
49
+ /// .define("ENABLE_SOMETHING", .when(configuration: .release)),
50
+ /// ],
51
+ /// linkerSettings: [
52
+ /// .linkLibrary("openssl", .when(platforms: [.linux])),
53
+ /// ]
54
+ /// ),
55
+ /// ```
53
56
public struct BuildSettingCondition : Encodable {
54
57
55
58
private let platforms : [ Platform ] ?
@@ -125,10 +128,10 @@ public struct CSetting: Encodable {
125
128
///
126
129
/// The path must be a directory inside the package.
127
130
///
128
- /// - Since: First available in PackageDescription 5.0
131
+ /// - Since: First available in PackageDescription 5.0.
129
132
///
130
133
/// - Parameters:
131
- /// - path: The path of the directory that contains the headers. The path is relative to the target's directory.
134
+ /// - path: The path of the directory that contains the headers. The path is relative to the target's directory.
132
135
/// - condition: A condition that restricts the application of the build setting.
133
136
public static func headerSearchPath( _ path: String , _ condition: BuildSettingCondition ? = nil ) -> CSetting {
134
137
return CSetting ( name: " headerSearchPath " , value: [ path] , condition: condition)
@@ -138,12 +141,13 @@ public struct CSetting: Encodable {
138
141
///
139
142
/// If you don't specify a value, the macro's default value is 1.
140
143
///
141
- /// - Since: First available in PackageDescription 5.0
144
+ /// - Since: First available in PackageDescription 5.0.
142
145
///
143
146
/// - Parameters:
144
147
/// - name: The name of the macro.
145
148
/// - value: The value of the macro.
146
- /// - condition: A condition that restricts the application of the build setting.
149
+ /// - condition: A condition that restricts the application of the build
150
+ /// setting.
147
151
public static func define( _ name: String , to value: String ? = nil , _ condition: BuildSettingCondition ? = nil ) -> CSetting {
148
152
var settingValue = name
149
153
if let value = value {
@@ -152,22 +156,23 @@ public struct CSetting: Encodable {
152
156
return CSetting ( name: " define " , value: [ settingValue] , condition: condition)
153
157
}
154
158
155
- /// Sets unsafe flags to pass arbitrary command-line flags to the corresponding build tool.
159
+ /// Sets unsafe flags to pass arbitrary command-line flags to the
160
+ /// corresponding build tool.
156
161
///
157
- /// As the usage of the word "unsafe" implies, the Swift Package Manager
158
- /// can't safely determine if the build flags have any negative
159
- /// side effect on the build since certain flags can change the behavior of
160
- /// how it performs a build.
162
+ /// As the usage of the word “unsafe” implies, Swift Package Manager can't safely determine
163
+ /// if the build flags have any negative side effect on the build since
164
+ /// certain flags can change the behavior of how it performs a build.
161
165
///
162
166
/// As some build flags can be exploited for unsupported or malicious
163
- /// behavior, the use of unsafe flags make the products containing this
167
+ /// behavior, the use of unsafe flags makes the products containing this
164
168
/// target ineligible for use by other packages.
165
169
///
166
- /// - Since: First available in PackageDescription 5.0
170
+ /// - Since: First available in PackageDescription 5.0.
167
171
///
168
172
/// - Parameters:
169
173
/// - flags: The unsafe flags to set.
170
- /// - condition: A condition that restricts the application of the build setting.
174
+ /// - condition: A condition that restricts the application of the build
175
+ /// setting.
171
176
public static func unsafeFlags( _ flags: [ String ] , _ condition: BuildSettingCondition ? = nil ) -> CSetting {
172
177
return CSetting ( name: " unsafeFlags " , value: flags, condition: condition)
173
178
}
@@ -189,10 +194,10 @@ public struct CXXSetting: Encodable {
189
194
///
190
195
/// The path must be a directory inside the package.
191
196
///
192
- /// - Since: First available in PackageDescription 5.0
197
+ /// - Since: First available in PackageDescription 5.0.
193
198
///
194
199
/// - Parameters:
195
- /// - path: The path of the directory that contains the headers. The path is relative to the target's directory.
200
+ /// - path: The path of the directory that contains the headers. The path is
196
201
/// - condition: A condition that restricts the application of the build setting.
197
202
public static func headerSearchPath( _ path: String , _ condition: BuildSettingCondition ? = nil ) -> CXXSetting {
198
203
return CXXSetting ( name: " headerSearchPath " , value: [ path] , condition: condition)
@@ -202,12 +207,13 @@ public struct CXXSetting: Encodable {
202
207
///
203
208
/// If you don't specify a value, the macro's default value is 1.
204
209
///
205
- /// - Since: First available in PackageDescription 5.0
210
+ /// - Since: First available in PackageDescription 5.0.
206
211
///
207
212
/// - Parameters:
208
213
/// - name: The name of the macro.
209
214
/// - value: The value of the macro.
210
- /// - condition: A condition that restricts the application of the build setting.
215
+ /// - condition: A condition that restricts the application of the build
216
+ /// setting.
211
217
public static func define( _ name: String , to value: String ? = nil , _ condition: BuildSettingCondition ? = nil ) -> CXXSetting {
212
218
var settingValue = name
213
219
if let value = value {
@@ -216,21 +222,22 @@ public struct CXXSetting: Encodable {
216
222
return CXXSetting ( name: " define " , value: [ settingValue] , condition: condition)
217
223
}
218
224
219
- /// Sets unsafe flags to pass arbitrary command-line flags to the corresponding build tool.
225
+ /// Sets unsafe flags to pass arbitrary command-line flags to the
226
+ /// corresponding build tool.
220
227
///
221
- /// As the usage of the word "unsafe" implies, the Swift Package Manager
222
- /// can't safely determine if the build flags have any negative
223
- /// side effect on the build since certain flags can change the behavior of
224
- /// how a build is performed.
228
+ /// As the usage of the word “unsafe” implies, Swift Package Manager can't safely determine
229
+ /// if the build flags have any negative side effect on the build since
230
+ /// certain flags can change the behavior of how it performs a build.
225
231
///
226
232
/// As some build flags can be exploited for unsupported or malicious
227
- /// behavior, a product can't be used as a dependency in another package if one of its targets uses unsafe flags .
233
+ /// behavior, you can't use products with unsafe build flags as dependencies in another package .
228
234
///
229
- /// - Since: First available in PackageDescription 5.0
235
+ /// - Since: First available in PackageDescription 5.0.
230
236
///
231
237
/// - Parameters:
232
238
/// - flags: The unsafe flags to set.
233
- /// - condition: A condition that restricts the application of the build setting.
239
+ /// - condition: A condition that restricts the application of the build
240
+ /// setting.
234
241
public static func unsafeFlags( _ flags: [ String ] , _ condition: BuildSettingCondition ? = nil ) -> CXXSetting {
235
242
return CXXSetting ( name: " unsafeFlags " , value: flags, condition: condition)
236
243
}
@@ -246,41 +253,46 @@ public struct SwiftSetting: Encodable {
246
253
247
254
/// Defines a compilation condition.
248
255
///
249
- /// Use compilation conditions to only compile statements if a certain condition is true.
250
- /// For example, the Swift compiler will only compile the
256
+ /// Use compilation conditions to only compile statements if a certain
257
+ /// condition is true. For example, the Swift compiler will only compile the
251
258
/// statements inside the `#if` block when `ENABLE_SOMETHING` is defined:
252
259
///
253
- /// #if ENABLE_SOMETHING
254
- /// ...
255
- /// #endif
260
+ /// ```swift
261
+ /// #if ENABLE_SOMETHING
262
+ /// ...
263
+ /// #endif
264
+ /// ```
256
265
///
257
- /// Unlike macros in C/C++, compilation conditions don't have an
258
- /// associated value.
266
+ /// Unlike macros in C/C++, compilation conditions don't have an associated
267
+ /// value.
259
268
///
260
- /// - Since: First available in PackageDescription 5.0
269
+ /// - Since: First available in PackageDescription 5.0.
261
270
///
262
271
/// - Parameters:
263
272
/// - name: The name of the macro.
264
- /// - condition: A condition that restricts the application of the build setting.
273
+ /// - condition: A condition that restricts the application of the build
274
+ /// setting.
265
275
public static func define( _ name: String , _ condition: BuildSettingCondition ? = nil ) -> SwiftSetting {
266
276
return SwiftSetting ( name: " define " , value: [ name] , condition: condition)
267
277
}
268
278
269
- /// Sets unsafe flags to pass arbitrary command-line flags to the corresponding build tool.
279
+ /// Set unsafe flags to pass arbitrary command-line flags to the
280
+ /// corresponding build tool.
270
281
///
271
- /// As the usage of the word "unsafe" implies, the Swift Package Manager
272
- /// can't safely determine if the build flags have any negative
273
- /// side effect on the build since certain flags can change the behavior of
274
- /// how a build is performed.
282
+ /// As the usage of the word “unsafe” implies, Swift Package Manager can't safely determine
283
+ /// if the build flags have any negative side effect on the build since
284
+ /// certain flags can change the behavior of how it performs a build.
275
285
///
276
286
/// As some build flags can be exploited for unsupported or malicious
277
- /// behavior, a product can't be used as a dependency in another package if one of its targets uses unsafe flags.
287
+ /// behavior, the use of unsafe flags makes the products containing this
288
+ /// target ineligible for use by other packages.
278
289
///
279
- /// - Since: First available in PackageDescription 5.0
290
+ /// - Since: First available in PackageDescription 5.0.
280
291
///
281
292
/// - Parameters:
282
293
/// - flags: The unsafe flags to set.
283
- /// - condition: A condition that restricts the application of the build setting..
294
+ /// - condition: A condition that restricts the application of the build
295
+ /// setting.
284
296
public static func unsafeFlags( _ flags: [ String ] , _ condition: BuildSettingCondition ? = nil ) -> SwiftSetting {
285
297
return SwiftSetting ( name: " unsafeFlags " , value: flags, condition: condition)
286
298
}
@@ -297,48 +309,50 @@ public struct LinkerSetting: Encodable {
297
309
/// Declares linkage to a system library.
298
310
///
299
311
/// This setting is most useful when the library can't be linked
300
- /// automatically, such as C++ based libraries and non-modular
301
- /// libraries.
312
+ /// automatically, such as C++ based libraries and non-modular libraries.
302
313
///
303
- /// - Since: First available in PackageDescription 5.0
314
+ /// - Since: First available in PackageDescription 5.0.
304
315
///
305
316
/// - Parameters:
306
317
/// - library: The library name.
307
- /// - condition: A condition that restricts the application of the build setting.
318
+ /// - condition: A condition that restricts the application of the build
319
+ /// setting.
308
320
public static func linkedLibrary( _ library: String , _ condition: BuildSettingCondition ? = nil ) -> LinkerSetting {
309
321
return LinkerSetting ( name: " linkedLibrary " , value: [ library] , condition: condition)
310
322
}
311
323
312
324
/// Declares linkage to a system framework.
313
325
///
314
326
/// This setting is most useful when the framework can't be linked
315
- /// automatically, such as C++ based frameworks and non-modular
316
- /// frameworks.
327
+ /// automatically, such as C++ based frameworks and non-modular frameworks.
317
328
///
318
- /// - Since: First available in PackageDescription 5.0
329
+ /// - Since: First available in PackageDescription 5.0.
319
330
///
320
331
/// - Parameters:
321
332
/// - framework: The framework name.
322
- /// - condition: A condition that restricts the application of the build setting.
333
+ /// - condition: A condition that restricts the application of the build
334
+ /// setting.
323
335
public static func linkedFramework( _ framework: String , _ condition: BuildSettingCondition ? = nil ) -> LinkerSetting {
324
336
return LinkerSetting ( name: " linkedFramework " , value: [ framework] , condition: condition)
325
337
}
326
-
327
- /// Sets unsafe flags to pass arbitrary command-line flags to the corresponding build tool.
338
+
339
+ /// Sets unsafe flags to pass arbitrary command-line flags to the
340
+ /// corresponding build tool.
328
341
///
329
- /// As the usage of the word "unsafe" implies, the Swift Package Manager
330
- /// can't safely determine if the build flags have any negative
331
- /// side effect on the build since certain flags can change the behavior of
332
- /// how a build is performed.
342
+ /// As the usage of the word “unsafe” implies, Swift Package Manager can't safely determine
343
+ /// if the build flags have any negative side effect on the build since
344
+ /// certain flags can change the behavior of how it performs a build.
333
345
///
334
346
/// As some build flags can be exploited for unsupported or malicious
335
- /// behavior, a product can't be used as a dependency in another package if one of its targets uses unsafe flags.
347
+ /// behavior, the use of unsafe flags makes the products containing this
348
+ /// target ineligible for use by other packages.
336
349
///
337
- /// - Since: First available in PackageDescription 5.0
350
+ /// - Since: First available in PackageDescription 5.0.
338
351
///
339
352
/// - Parameters:
340
353
/// - flags: The unsafe flags to set.
341
- /// - condition: A condition that restricts the application of the build setting.
354
+ /// - condition: A condition that restricts the application of the build
355
+ /// setting.
342
356
public static func unsafeFlags( _ flags: [ String ] , _ condition: BuildSettingCondition ? = nil ) -> LinkerSetting {
343
357
return LinkerSetting ( name: " unsafeFlags " , value: flags, condition: condition)
344
358
}
0 commit comments