Skip to content

Commit f6292e6

Browse files
ElektrojungeAtWorkaciidgh
authored andcommitted
Update the in-source docs for better readability.
1 parent 74a03c3 commit f6292e6

10 files changed

+460
-352
lines changed

Sources/PackageDescription4/BuildSettings.swift

Lines changed: 75 additions & 76 deletions
Large diffs are not rendered by default.

Sources/PackageDescription4/LanguageStandardSettings.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

11-
/// Support C language standards.
11+
/// The supported C language standard to use for compiling C sources in the package.
1212
public enum CLanguageStandard: String, Encodable {
1313
case c89
1414
case c90
@@ -24,7 +24,7 @@ public enum CLanguageStandard: String, Encodable {
2424
case gnu11
2525
}
2626

27-
/// Supported C++ language standards.
27+
/// The supported C++ language standards to use for compiling C++ sources in the package.
2828
public enum CXXLanguageStandard: String, Encodable {
2929
case cxx98 = "c++98"
3030
case cxx03 = "c++03"
@@ -39,8 +39,7 @@ public enum CXXLanguageStandard: String, Encodable {
3939
}
4040

4141
#if !PACKAGE_DESCRIPTION_4
42-
/// Represents the version of the Swift language that should be used for
43-
/// compiling Swift sources in the package.
42+
/// The version of the Swift language to use for compiling Swift sources in the package.
4443
public enum SwiftVersion {
4544
@available(_PackageDescription, introduced: 4, obsoleted: 5)
4645
case v3
@@ -54,13 +53,14 @@ public enum SwiftVersion {
5453
@available(_PackageDescription, introduced: 5)
5554
case v5
5655

57-
/// User-defined value of Swift version.
56+
/// A user-defined value for the Swift version.
5857
///
59-
/// The value is passed as-is to Swift compiler's `-swift-version` flag.
58+
/// The value is passed as-is to the Swift compiler's `-swift-version` flag.
6059
case version(String)
6160
}
6261

6362
extension SwiftVersion: Encodable {
63+
6464
public func encode(to encoder: Encoder) throws {
6565
let value: String
6666

Sources/PackageDescription4/Package.swift

Lines changed: 116 additions & 65 deletions
Large diffs are not rendered by default.

Sources/PackageDescription4/PackageDependency.swift

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,21 @@
1010

1111
extension Package.Dependency {
1212

13-
/// Add a package dependency that is required from the given minimum version,
13+
/// Create a package dependency that uses the version requirement, starting with the given minimum version,
1414
/// going up to the next major version.
1515
///
16-
/// This is the recommend way to specify a remote package dependency because
17-
/// it allows you to specify the minimum version you require and gives
18-
/// explicit opt-in for new major versions, but otherwise provides maximal
19-
/// flexibility on which version is used. This helps to prevent conflicts in
20-
/// your package dependency graph.
16+
/// This is the recommended way to specify a remote package dependency.
17+
/// It allows you to specify the minimum version you require, allows updates that include bug fixes
18+
/// and backward-compatible feature updates, but requires you to explicitly update to a new major version of the dependency.
19+
/// This approach provides the maximum flexibility on which version to use,
20+
/// while making sure you don't update to a version with breaking changes,
21+
/// and helps to prevent conflicts in your dependency graph.
2122
///
22-
/// For example, specifying
23+
/// The following example allows the Swift package manager to select a version
24+
/// like a `1.2.3`, `1.2.4`, or `1.3.0`, but not `2.0.0`.
2325
///
2426
/// .package(url: "https://example.com/example-package.git", from: "1.2.3"),
2527
///
26-
/// will allow the Swift package manager to select a version like a "1.2.3",
27-
/// "1.2.4" or "1.3.0" but not "2.0.0".
28-
///
2928
/// - Parameters:
3029
/// - url: The valid Git URL of the package.
3130
/// - version: The minimum version requirement.
@@ -50,14 +49,13 @@ extension Package.Dependency {
5049
}
5150

5251
/// Add a package dependency starting with a specific minimum version, up to
53-
/// but not including a specific maximum version.
52+
/// but not including a specified maximum version.
5453
///
55-
/// For example
54+
/// The following example allows the Swift package manager to pick
55+
/// versions `1.2.3`, `1.2.4`, `1.2.5`, but not `1.2.6`.
5656
///
5757
/// .package(url: "https://example.com/example-package.git", "1.2.3"..<"1.2.6"),
5858
///
59-
/// will allow the Swift package manager to pick versions 1.2.3, 1.2.4, 1.2.5, but not 1.2.6.
60-
///
6159
/// - Parameters:
6260
/// - url: The valid Git URL of the package.
6361
/// - range: The custom version range requirement.
@@ -75,12 +73,11 @@ extension Package.Dependency {
7573
/// Add a package dependency starting with a specific minimum version, going
7674
/// up to and including a specific maximum version.
7775
///
78-
/// For example
76+
/// The following example allows the Swift package manager to pick
77+
/// versions 1.2.3, 1.2.4, 1.2.5, as well as 1.2.6.
7978
///
8079
/// .package(url: "https://example.com/example-package.git", "1.2.3"..."1.2.6"),
8180
///
82-
/// will allow the Swift package manager to pick versions 1.2.3, 1.2.4, 1.2.5, as well as 1.2.6.
83-
///
8481
/// - Parameters:
8582
/// - url: The valid Git URL of the package.
8683
/// - range: The closed version range requirement.
@@ -100,10 +97,10 @@ extension Package.Dependency {
10097
#if !PACKAGE_DESCRIPTION_4
10198
/// Add a dependency to a local package on the filesystem.
10299
///
103-
/// The package dependency is used as-is and no source control access is
104-
/// performed. Local package dependencies are especially useful during
105-
/// development of a new package or when working on multiple tightly-coupled
106-
/// packages.
100+
/// The Swift Package Manager uses the package dependency as-is
101+
/// and does not perform any source control access. Local package dependencies
102+
/// are especially useful during development of a new package or when working
103+
/// on multiple tightly coupled packages.
107104
///
108105
/// - Parameter path: The path of the package.
109106
public static func package(

Sources/PackageDescription4/PackageRequirement.swift

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ extension Package.Dependency.Requirement: Encodable {
1212

1313
/// Returns a requirement for the given exact version.
1414
///
15-
/// Specifying exact version requirements are usually not recommended, as
16-
/// they can cause conflicts in your package dependency graph when a package
17-
/// is depended on by multiple other packages.
15+
/// Specifying exact version requirements are not recommended as
16+
/// they can cause conflicts in your dependency graph when multiple other packages depend on a package.
17+
/// As Swift packages follow the semantic versioning convention,
18+
/// think about specifying a version range instead.
1819
///
19-
/// Example:
20+
/// The following example defines a version requirement that requires version 1.2.3 of a package.
2021
///
2122
/// .exact("1.2.3")
2223
///
2324
/// - Parameters:
24-
/// - version: The exact version to be specified.
25+
/// - version: The exact version of the dependency for this requirement.
2526
public static func exact(_ version: Version) -> Package.Dependency.Requirement {
2627
#if PACKAGE_DESCRIPTION_4
2728
return .exactItem(version)
@@ -30,20 +31,19 @@ extension Package.Dependency.Requirement: Encodable {
3031
#endif
3132
}
3233

33-
/// Returns a requirement for a source control revision. This is usually
34-
/// specified with the hash of a commit.
34+
/// Returns a requirement for a source control revision such as the hash of a commit.
3535
///
36-
/// Note that packages which use commit-based dependency requirements
37-
/// cannot be depended-upon by packages which use version-based dependency
36+
/// Note that packages that use commit-based dependency requirements
37+
/// can't be depended upon by packages that use version-based dependency
3838
/// requirements; you should remove commit-based dependency requirements
3939
/// before publishing a version of your package.
4040
///
41-
/// Example:
41+
/// The following example defines a version requirement for a specific commit hash.
4242
///
4343
/// .revision("e74b07278b926c9ec6f9643455ea00d1ce04a021")
4444
///
4545
/// - Parameters:
46-
/// - ref: The Git revision, usually a hash of the commit.
46+
/// - ref: The Git revision, usually a commit hash.
4747
public static func revision(_ ref: String) -> Package.Dependency.Requirement {
4848
#if PACKAGE_DESCRIPTION_4
4949
return .revisionItem(ref)
@@ -54,12 +54,13 @@ extension Package.Dependency.Requirement: Encodable {
5454

5555
/// Returns a requirement for a source control branch.
5656
///
57-
/// Note that packages which use branch-based dependency requirements
58-
/// cannot be depended-upon by packages which use version-based dependency
57+
/// Note that packages that use branch-based dependency requirements
58+
/// can't be depended upon by packages that use version-based dependency
5959
/// requirements; you should remove branch-based dependency requirements
6060
/// before publishing a version of your package.
6161
///
62-
/// Example:
62+
/// The following example defines a version requirement that accepts any
63+
/// change in the develop branch.
6364
///
6465
/// .branch("develop")
6566
///
@@ -74,7 +75,7 @@ extension Package.Dependency.Requirement: Encodable {
7475
}
7576

7677
/// Returns a requirement for a version range, starting at the given minimum
77-
/// version and going up to the next major version.
78+
/// version and going up to the next major version. This is the recommended version requirement.
7879
///
7980
/// - Parameters:
8081
/// - version: The minimum version for the version range.

Sources/PackageDescription4/Product.swift

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

11-
/// Defines a package product.
11+
/// The object that defines a package product.
1212
///
13-
/// A package product defines an externally visible build artifact that is
13+
/// A package product defines an externally visible build artifact that's
1414
/// available to clients of a package. The product is assembled from the build
1515
/// artifacts of one or more of the package's targets.
1616
///
1717
/// A package product can be one of two types:
1818
///
19-
/// 1. Library
19+
/// Library
2020
///
21-
/// A library product is used to vend library targets containing the public
22-
/// APIs that will be available to clients.
21+
/// Use a library product to vend library targets. This makes a target's public APIs
22+
/// available to clients that integrate the Swift package.
2323
///
24-
/// 2. Executable
24+
/// Executable
2525
///
26-
/// An executable product is used to vend an executable target. This should
27-
/// only be used if the executable needs to be made available to clients.
26+
/// Use an executable product to vend an executable target.
27+
/// Use this only if you want to make the executable available to clients.
2828
///
2929
/// The following example shows a package manifest for a library called "Paper"
3030
/// that defines multiple products:
@@ -63,14 +63,14 @@ public class Product: Encodable {
6363
case type = "product_type"
6464
}
6565

66-
/// The name of the product.
66+
/// The name of the package product.
6767
public let name: String
6868

6969
init(name: String) {
7070
self.name = name
7171
}
7272

73-
/// Represents an executable product.
73+
/// The executable product of a Swift package.
7474
public final class Executable: Product {
7575
private enum ExecutableCodingKeys: CodingKey {
7676
case targets
@@ -93,14 +93,14 @@ public class Product: Encodable {
9393
}
9494
}
9595

96-
/// Represents a library product.
96+
/// The library product of a Swift package.
9797
public final class Library: Product {
9898
private enum LibraryCodingKeys: CodingKey {
9999
case type
100100
case targets
101101
}
102102

103-
/// The type of library product.
103+
/// The different types of a library product.
104104
public enum LibraryType: String, Encodable {
105105
case `static`
106106
case `dynamic`
@@ -111,7 +111,8 @@ public class Product: Encodable {
111111

112112
/// The type of the library.
113113
///
114-
/// If the type is unspecified, package manager will automatically choose a type.
114+
/// If the type is unspecified, the Swift Package Manager automatically
115+
/// chooses a type based on the client's preference.
115116
public let type: LibraryType?
116117

117118
init(name: String, type: LibraryType? = nil, targets: [String]) {
@@ -130,12 +131,13 @@ public class Product: Encodable {
130131
}
131132
}
132133

133-
/// Create a library product that can be used by clients that depend on this package.
134+
/// Create a library product to allow clients that declare a dependency on this package
135+
/// to use the package's functionality.
134136
///
135-
/// A library's product can either be statically or dynamically linked. It
136-
/// is recommended to not declare the type of library explicitly to let the
137-
/// Swift Package Manager choose between static or dynamic linking depending
138-
/// on the consumer of the package.
137+
/// A library's product can either be statically or dynamically linked.
138+
/// If possible, don't declare the type of library explicitly to let
139+
/// the Swift Package Manager choose between static or dynamic linking based
140+
/// on the preference of the package's consumer.
139141
///
140142
/// - Parameters:
141143
/// - name: The name of the library product.
@@ -151,11 +153,11 @@ public class Product: Encodable {
151153
return Library(name: name, type: type, targets: targets)
152154
}
153155

154-
/// Create an executable product.
156+
/// Create an executable package product that clients can run.
155157
///
156158
/// - Parameters:
157159
/// - name: The name of the executable product.
158-
/// - targets: The targets that are bundled into an executable product.
160+
/// - targets: The targets to bundle into an executable product.
159161
public static func executable(
160162
name: String,
161163
targets: [String]

0 commit comments

Comments
 (0)