Skip to content

Commit 4352b87

Browse files
authored
[5.9] Cherry-pick documentation updates (#6511)
* [5.9] Documentation update. (#6434) * Updated documentation for BuildSettings. * Updated documentation for PackageDescription. * [5.9] Editorial review changes of PackageDescription documentation. (#6471)
1 parent 340db0b commit 4352b87

15 files changed

+154
-141
lines changed

Sources/PackageDescription/BuildSettings.swift

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
/// The build configuration such as debug or release.
13+
/// The build configuration, such as debug or release.
1414
public struct BuildConfiguration {
15+
/// The configuration of the build. Valid values are `debug` and `release`.
1516
let config: String
1617

1718
private init(_ config: String) {
@@ -54,7 +55,9 @@ public struct BuildConfiguration {
5455
/// ),
5556
/// ```
5657
public struct BuildSettingCondition {
58+
/// The applicable platforms for this build setting condition.
5759
let platforms: [Platform]?
60+
/// The applicable build configuration for this build setting condition.
5861
let config: BuildConfiguration?
5962

6063
private init(platforms: [Platform]?, config: BuildConfiguration?) {
@@ -111,8 +114,9 @@ struct BuildSettingData {
111114
let condition: BuildSettingCondition?
112115
}
113116

114-
/// A C-language build setting.
117+
/// A C language build setting.
115118
public struct CSetting {
119+
/// The abstract build setting data.
116120
let data: BuildSettingData
117121

118122
private init(name: String, value: [String], condition: BuildSettingCondition?) {
@@ -131,7 +135,7 @@ public struct CSetting {
131135
///
132136
/// - Parameters:
133137
/// - path: The path of the directory that contains the headers. The path is relative to the target's directory.
134-
/// - condition: A condition that restricts the application of the build setting.
138+
/// - condition: A condition that restricts the use of the build setting.
135139
@available(_PackageDescription, introduced: 5.0)
136140
public static func headerSearchPath(_ path: String, _ condition: BuildSettingCondition? = nil) -> CSetting {
137141
return CSetting(name: "headerSearchPath", value: [path], condition: condition)
@@ -146,7 +150,7 @@ public struct CSetting {
146150
/// - Parameters:
147151
/// - name: The name of the macro.
148152
/// - value: The value of the macro.
149-
/// - condition: A condition that restricts the application of the build
153+
/// - condition: A condition that restricts the use of the build
150154
/// setting.
151155
@available(_PackageDescription, introduced: 5.0)
152156
public static func define(_ name: String, to value: String? = nil, _ condition: BuildSettingCondition? = nil) -> CSetting {
@@ -182,6 +186,7 @@ public struct CSetting {
182186

183187
/// A CXX-language build setting.
184188
public struct CXXSetting {
189+
/// The data store for the CXX build setting.
185190
let data: BuildSettingData
186191

187192
private init(name: String, value: [String], condition: BuildSettingCondition?) {
@@ -200,6 +205,7 @@ public struct CXXSetting {
200205
///
201206
/// - Parameters:
202207
/// - path: The path of the directory that contains the headers. The path is
208+
/// relative to the target's directory.
203209
/// - condition: A condition that restricts the application of the build setting.
204210
@available(_PackageDescription, introduced: 5.0)
205211
public static func headerSearchPath(_ path: String, _ condition: BuildSettingCondition? = nil) -> CXXSetting {
@@ -250,6 +256,7 @@ public struct CXXSetting {
250256

251257
/// A Swift language build setting.
252258
public struct SwiftSetting {
259+
/// The data store for the Swift build setting.
253260
let data: BuildSettingData
254261

255262
private init(name: String, value: [String], condition: BuildSettingCondition?) {
@@ -306,18 +313,18 @@ public struct SwiftSetting {
306313

307314
/// Enable an upcoming feature with the given name.
308315
///
309-
/// An upcoming feature is one that has been accepted into Swift as of a
310-
/// certain language version, but is not available by default in prior
316+
/// An upcoming feature is one that is available in Swift as of a
317+
/// certain language version, but isn't available by default in prior
311318
/// language modes because it has some impact on source compatibility.
312319
///
313-
/// Multiple upcoming features can be added to a given target, and can
314-
/// be used in a target without affecting its dependencies. An unknown
315-
/// upcoming feature will be ignored by the implementation.
320+
/// You can add and use multiple upcoming features in a given target
321+
/// without affecting its dependencies. Targets will ignore any unknown
322+
/// upcoming features.
316323
///
317324
/// - Since: First available in PackageDescription 5.8.
318325
///
319326
/// - Parameters:
320-
/// - name: The name of the upcoming feature, e.g., ConciseMagicFile.
327+
/// - name: The name of the upcoming feature; for example, `ConciseMagicFile`.
321328
/// - condition: A condition that restricts the application of the build
322329
/// setting.
323330
@available(_PackageDescription, introduced: 5.8)
@@ -331,17 +338,17 @@ public struct SwiftSetting {
331338

332339
/// Enable an experimental feature with the given name.
333340
///
334-
/// An experimental feature is one that is in development, but
335-
/// has not been accepted into Swift as a language feature.
341+
/// An experimental feature is one that's in development, but
342+
/// is not yet available in Swift as a language feature.
336343
///
337-
/// Multiple experimental features can be added to a given target, and can
338-
/// be used in a target without affecting its dependencies. An unknown
339-
/// experimental feature will be ignored by the implementation.
344+
/// You can add and use multiple experimental features in a given target
345+
/// without affecting its dependencies. Targets will ignore any unknown
346+
/// experimental features.
340347
///
341348
/// - Since: First available in PackageDescription 5.8.
342349
///
343350
/// - Parameters:
344-
/// - name: The name of the experimental feature, e.g., VariadicGenerics.
351+
/// - name: The name of the experimental feature; for example, `VariadicGenerics`.
345352
/// - condition: A condition that restricts the application of the build
346353
/// setting.
347354
@available(_PackageDescription, introduced: 5.8)
@@ -360,18 +367,18 @@ public struct SwiftSetting {
360367

361368
/// Enable Swift interoperability with a given language.
362369
///
363-
/// This is useful for enabling Swift/C++ interoperability for a given
370+
/// This is useful for enabling interoperability with Swift and C++ for a given
364371
/// target.
365372
///
366373
/// Enabling C++ interoperability mode might alter the way some existing
367-
/// C/Objective-C APIs are imported.
374+
/// C and Objective-C APIs are imported.
368375
///
369376
/// - Since: First available in PackageDescription 5.9.
370377
///
371378
/// - Parameters:
372-
/// - mode: The language mode, either C or Cxx.
373-
/// - version: If Cxx language mode is used, the version of Swift/C++
374-
/// interoperability, otherwise `nil`.
379+
/// - mode: The language mode, either C or CXX.
380+
/// - version: When using the CXX language mode, pass the version of Swift and C++
381+
/// interoperability; otherwise, `nil`.
375382
/// - condition: A condition that restricts the application of the build
376383
/// setting.
377384
@available(_PackageDescription, introduced: 5.9)
@@ -391,6 +398,7 @@ public struct SwiftSetting {
391398

392399
/// A linker build setting.
393400
public struct LinkerSetting {
401+
/// The data store for the Linker setting.
394402
let data: BuildSettingData
395403

396404
private init(name: String, value: [String], condition: BuildSettingCondition?) {

Sources/PackageDescription/PackageDependency.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ extension Package {
1717
/// A package dependency consists of a Git URL to the source of the package,
1818
/// and a requirement for the version of the package.
1919
///
20-
/// Swift Package Manager performs a process called _dependency resolution_ to figure out
20+
/// Swift Package Manager performs a process called _dependency resolution_ to determine
2121
/// the exact version of the package dependencies that an app or other Swift
2222
/// package can use. The `Package.resolved` file records the results of the
2323
/// dependency resolution and lives in the top-level directory of a Swift
2424
/// package. If you add the Swift package as a package dependency to an app
2525
/// for an Apple platform, you can find the `Package.resolved` file inside
2626
/// your `.xcodeproj` or `.xcworkspace`.
2727
public class Dependency {
28-
/// The kind of dependency.
28+
/// The type of dependency.
2929
@available(_PackageDescription, introduced: 5.6)
3030
public enum Kind {
3131
/// A dependency located at the given path.
@@ -482,11 +482,11 @@ extension Package.Dependency {
482482
/// Adds a package dependency that uses the exact version requirement.
483483
///
484484
/// Specifying exact version requirements are not recommended as
485-
/// they can cause conflicts in your dependency graph when multiple other packages depend on a package.
485+
/// they can cause conflicts in your dependency graph when other packages depend on this package.
486486
/// As Swift packages follow the semantic versioning convention,
487487
/// think about specifying a version range instead.
488488
///
489-
/// The following example instruct the Swift Package Manager to use version `1.2.3`.
489+
/// The following example instructs the Swift Package Manager to use version `1.2.3`.
490490
///
491491
/// ```swift
492492
/// .package(url: "https://example.com/example-package.git", exact: "1.2.3"),
@@ -587,10 +587,10 @@ extension Package.Dependency {
587587
///
588588
/// Specifying exact version requirements are not recommended as
589589
/// they can cause conflicts in your dependency graph when multiple other packages depend on a package.
590-
/// As Swift packages follow the semantic versioning convention,
590+
/// Because Swift packages follow the semantic versioning convention,
591591
/// think about specifying a version range instead.
592592
///
593-
/// The following example instruct the Swift Package Manager to use version `1.2.3`.
593+
/// The following example instructs the Swift Package Manager to use version `1.2.3`.
594594
///
595595
/// ```swift
596596
/// .package(id: "scope.name", exact: "1.2.3"),

Sources/PackageDescription/PackageDescription.docc/Curation/Extensions/Product-Executable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
## Topics
44

5-
### Describing an Executable Product
5+
### Describing an executable product
66

77
- ``targets``

Sources/PackageDescription/PackageDescription.docc/Curation/Platform.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- ``wasi``
1818
- ``windows``
1919

20-
### Type Methods
20+
### Type methods
2121

2222
- ``custom(_:)``
2323

Sources/PackageDescription/PackageDescription.docc/Curation/Plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
## Topics
44

5-
### Describing a Plugin Product
5+
### Describing a plug-in product
66

77
- ``targets``

Sources/PackageDescription/PackageDescription.docc/Curation/PluginPermission.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Topics
44

5-
### Create a Permission
5+
### Create a permission
66

77
- ``allowNetworkConnections(scope:reason:)``
88
- ``writeToPackageDirectory(reason:)``

Sources/PackageDescription/PackageDescription.docc/Curation/Product.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
- ``Product/plugin(name:targets:)``
1818
- ``Plugin``
1919

20-
### Naming the Product
20+
### Naming the product
2121

2222
- ``name``

Sources/PackageDescription/PackageDescription.docc/Curation/SupportedPlatforms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
- <doc:/documentation/PackageDescription/Platform/linux>
5050

51-
### Type Methods
51+
### Type methods
5252

5353
- ``custom(_:versionString:)``
5454

Sources/PackageDescription/PackageDescription.docc/Curation/Target-Dependency.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- ``init(extendedGraphemeClusterLiteral:)``
1919
- ``init(unicodeScalarLiteral:)``
2020

21-
### Identifying Related Types
21+
### Identifying related types
2222

2323
- ``ExtendedGraphemeClusterLiteralType``
2424
- ``StringLiteralType``

Sources/PackageDescription/PackageDescription.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ public final class Package {
315315
/// [RFC5646](https://tools.ietf.org/html/rfc5646).
316316
public struct LanguageTag: Hashable {
317317

318-
/// An IETF language tag.
318+
/// An IETF BCP 47 standard language tag.
319319
let tag: String
320320

321-
/// Creates a language tag from its IETF string representation.
321+
/// Creates a language tag from its [IETF BCP 47](https://datatracker.ietf.org/doc/html/rfc5646) string representation.
322322
///
323323
/// - Parameter tag: The string representation of an IETF language tag.
324324
private init(_ tag: String) {
@@ -377,14 +377,15 @@ public enum SystemPackageProvider {
377377
case brewItem([String])
378378
/// Packages installable by the apt-get package manager.
379379
case aptItem([String])
380-
/// Packages installable by the yum package manager.
380+
/// Packages installable by the Yellowdog Updated, Modified (YUM) package manager.
381381
@available(_PackageDescription, introduced: 5.3)
382382
case yumItem([String])
383+
/// Packages installable by the NuGet package manager.
383384
@available(_PackageDescription, introduced: 999.0)
384385
case nugetItem([String])
385386

386387
/// Creates a system package provider with a list of installable packages
387-
/// for users of the HomeBrew package manager on macOS.
388+
/// for people who use the HomeBrew package manager on macOS.
388389
///
389390
/// - Parameter packages: The list of package names.
390391
///
@@ -416,7 +417,7 @@ public enum SystemPackageProvider {
416417
}
417418

418419
/// Creates a system package provider with a list of installable packages
419-
/// for users of the nuget package manager on Linux or Windows.
420+
/// for users of the NuGet package manager on Linux or Windows.
420421
///
421422
/// - Parameter packages: The list of package names.
422423
///
@@ -451,7 +452,7 @@ private func dumpPackageAtExit(_ package: Package, to handle: Int) {
451452
guard let dumpInfo = dumpInfo else { return }
452453

453454
let hFile: HANDLE = HANDLE(bitPattern: dumpInfo.handle)!
454-
// NOTE: `_open_osfhandle` transfers ownership of the HANDLE to the file
455+
// NOTE: `_open_osfhandle` transfers ownership of the `HANDLE` to the file
455456
// descriptor. DO NOT invoke `CloseHandle` on `hFile`.
456457
let fd: CInt = _open_osfhandle(Int(bitPattern: hFile), _O_APPEND)
457458
// NOTE: `_fdopen` transfers ownership of the file descriptor to the

Sources/PackageDescription/PackageDescriptionSerializationConversion.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//===----------------------------------------------------------------------===//
22
//
3-
// This source file is part of the Swift open source project
3+
// This source file is part of the Swift open source project.
44
//
5-
// Copyright (c) 2023 Apple Inc. and the Swift project authors
6-
// Licensed under Apache License v2.0 with Runtime Library Exception
5+
// Copyright (c) 2023 Apple Inc. and the Swift project authors.
6+
// Licensed under Apache License v2.0 with Runtime Library Exception.
77
//
88
// See http://swift.org/LICENSE.txt for license information
99
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

Sources/PackageDescription/Product.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ public class Product {
105105
}
106106
}
107107

108-
/// The plugin product of a Swift package.
108+
/// The plug-in product of a Swift package.
109109
public final class Plugin: Product {
110-
/// The name of the plugin target to vend as a product.
110+
/// The name of the plug-in target to vend as a product.
111111
public let targets: [String]
112112

113113
init(name: String, targets: [String]) {

Sources/PackageDescription/Resource.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public struct Resource {
3838
/// Defines the explicit type of localization for resources.
3939
public enum Localization: String {
4040

41-
/// A constant that represents default internationalization.
41+
/// A constant that represents default localization.
4242
case `default`
4343

4444
/// A constant that represents base internationalization.
@@ -47,7 +47,7 @@ public struct Resource {
4747

4848
/// The rule for the resource.
4949
let rule: String
50-
50+
5151
/// The path of the resource.
5252
let path: String
5353

@@ -97,6 +97,10 @@ public struct Resource {
9797
}
9898

9999
/// Applies the embed rule to a resource at the given path.
100+
///
101+
/// You can use the embed rule to embed the contents of the resource into the executable code.
102+
/// - Parameter path: The path for a resource.
103+
/// - Returns: A `Resource` instance.
100104
@available(_PackageDescription, introduced: 5.9)
101105
public static func embedInCode(_ path: String) -> Resource {
102106
return Resource(rule: "embedInCode", path: path, localization: nil)

Sources/PackageDescription/SupportedPlatforms.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,11 @@ extension SupportedPlatform {
601601
public static let v22: DriverKitVersion = .init(string: "22.0")
602602
}
603603

604+
/// A supported custom platform version.
604605
public struct CustomPlatformVersion: AppleOSVersion {
606+
/// The name of the custom platform.
605607
static var name: String = "custom platform"
608+
/// The minimum valid major version number.
606609
static var minimumMajorVersion = 0
607610

608611
fileprivate init(uncheckedVersion version: String) {

0 commit comments

Comments
 (0)