Skip to content

Commit 04360fb

Browse files
committed
test helpers: do not use default build system
Many of the executeSwift* command helpers accept a build system provider, which was defaulted to the native build system. Since we are augmenting the tests to also run against the SwiftBuild, setting a default value may lead to an undesirable test behaviour. Update all the executeSwift* commands to no set a default build system provider, and update SwiftBuild tests accordingly.
1 parent 3fbec0b commit 04360fb

File tree

45 files changed

+1402
-528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1402
-528
lines changed

Fixtures/Miscellaneous/Unicode/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let complicatedString = "πשּׁµ𝄞🇺🇳🇮🇱x̱̱̱̱̱̄̄̄̄̄"
1313
// 🇮🇱 U+1F1EE U+1F1F1: Second consecutive regional indicator. (Complicated grapheme breaking.)
1414
// x̱̱̱̱̱̄̄̄̄̄ U+0078 (U+0331 U+0304) × 5: Extremely long combining sequence. (Also reordrant under normalization.)
1515

16-
// The following verifies that sources havent been normalized, which would reduce the tests effectiveness.
16+
// The following verifies that sources haven't been normalized, which would reduce the test's effectiveness.
1717
var verify = "\u{03C0}\u{0FB2C}\u{00B5}\u{1D11E}\u{1F1FA}\u{1F1F3}\u{1F1EE}\u{1F1F1}\u{0078}\u{0331}\u{0304}\u{0331}\u{0304}\u{0331}\u{0304}\u{0331}\u{0304}\u{0331}\u{0304}"
1818
assert(
1919
complicatedString.unicodeScalars.elementsEqual(verify.unicodeScalars),

Sources/Commands/PackageCommands/PluginCommand.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,11 @@ struct PluginCommand: AsyncSwiftCommand {
157157
}
158158
for plugin in allPlugins.sorted(by: { $0.name < $1.name }) {
159159
guard case .command(let intent, _) = plugin.capability else { continue }
160-
var line = "\(intent.invocationVerb) (plugin \(plugin.name)"
160+
var line = "'\(intent.invocationVerb)' (plugin '\(plugin.name)'"
161161
if let package = packageGraph.packages
162162
.first(where: { $0.modules.contains(where: { $0.name == plugin.name }) })
163163
{
164-
line += " in package \(package.manifest.displayName)"
164+
line += " in package '\(package.manifest.displayName)'"
165165
}
166166
line += ")"
167167
print(line)
@@ -186,14 +186,14 @@ struct PluginCommand: AsyncSwiftCommand {
186186
// Load the workspace and resolve the package graph.
187187
let packageGraph = try await swiftCommandState.loadPackageGraph()
188188

189-
swiftCommandState.observabilityScope.emit(info: "Finding plugin for command \(command)")
189+
swiftCommandState.observabilityScope.emit(info: "Finding plugin for command '\(command)'")
190190
let matchingPlugins = PluginCommand.findPlugins(matching: command, in: packageGraph, limitedTo: options.packageIdentity)
191191

192192
// Complain if we didn't find exactly one.
193193
if matchingPlugins.isEmpty {
194-
throw ValidationError("Unknown subcommand or plugin name \(command)")
194+
throw ValidationError("Unknown subcommand or plugin name '\(command)'")
195195
} else if matchingPlugins.count > 1 {
196-
throw ValidationError("\(matchingPlugins.count) plugins found for \(command)")
196+
throw ValidationError("\(matchingPlugins.count) plugins found for '\(command)'")
197197
}
198198

199199
// handle plugin execution arguments that got passed after the plugin name
@@ -242,7 +242,7 @@ struct PluginCommand: AsyncSwiftCommand {
242242
let pluginsDir = try swiftCommandState.getActiveWorkspace().location.pluginWorkingDirectory
243243
.appending(component: plugin.name)
244244

245-
// The `cache` directory is in the plugins directory and is where the plugin script runner caches compiled plugin binaries and any other derived information for this plugin.
245+
// The `cache` directory is in the plugin's directory and is where the plugin script runner caches compiled plugin binaries and any other derived information for this plugin.
246246
let pluginScriptRunner = try swiftCommandState.getPluginScriptRunner(
247247
customPluginsDir: pluginsDir
248248
)
@@ -291,7 +291,7 @@ struct PluginCommand: AsyncSwiftCommand {
291291
"--allow-network-connections \(PluginCommand.PluginOptions.NetworkPermission(scope).remedyDescription)"
292292
}
293293

294-
let problem = "Plugin \(plugin.name) wants permission to \(permissionString)."
294+
let problem = "Plugin '\(plugin.name)' wants permission to \(permissionString)."
295295
let reason = "Stated reason: “\(reasonString)”."
296296
if swiftCommandState.outputStream.isTTY {
297297
// We can ask the user directly, so we do so.

Sources/CoreCommands/Options.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,15 +454,15 @@ public struct BuildOptions: ParsableArguments {
454454
)
455455
}
456456

457-
/// The compilation destinations target triple.
457+
/// The compilation destination's target triple.
458458
@Option(name: .customLong("triple"), transform: Triple.init)
459459
public var customCompileTriple: Triple?
460460

461-
/// Path to the compilation destinations SDK.
461+
/// Path to the compilation destination's SDK.
462462
@Option(name: .customLong("sdk"))
463463
public var customCompileSDK: AbsolutePath?
464464

465-
/// Path to the compilation destinations toolchain.
465+
/// Path to the compilation destination's toolchain.
466466
@Option(name: .customLong("toolchain"))
467467
public var customCompileToolchain: AbsolutePath?
468468

Sources/PackageCollectionsModel/PackageCollectionModel+v1.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ extension PackageCollectionModel.V1.Collection.Package {
186186
/// An array of the package version's products.
187187
public let products: [PackageCollectionModel.V1.Product]
188188

189-
/// An array of the package versions supported platforms specified in `Package.swift`.
189+
/// An array of the package version's supported platforms specified in `Package.swift`.
190190
public let minimumPlatformVersions: [PackageCollectionModel.V1.PlatformVersion]?
191191

192192
/// Creates a `Manifest`
@@ -239,7 +239,7 @@ extension PackageCollectionModel.V1 {
239239
/// The product type.
240240
public let type: ProductType
241241

242-
/// An array of the products targets.
242+
/// An array of the product's targets.
243243
public let targets: [String]
244244

245245
/// Creates a `Product`

Sources/PackageCollectionsSigning/CertificatePolicy.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ enum CertificatePolicyError: Error, Equatable {
123123
/// Default policy for validating certificates used to sign package collections.
124124
///
125125
/// Certificates must satisfy these conditions:
126-
/// - The timestamp at which signing/verification is done must fall within the signing certificates validity period.
127-
/// - The certificates “Extended Key Usage” extension must include “Code Signing”.
126+
/// - The timestamp at which signing/verification is done must fall within the signing certificate's validity period.
127+
/// - The certificate's “Extended Key Usage” extension must include “Code Signing”.
128128
/// - The certificate must use either 256-bit EC (recommended) or 2048-bit RSA key.
129129
/// - The certificate must not be revoked. The certificate authority must support OCSP.
130130
/// - The certificate chain is valid and root certificate must be trusted.

Sources/PackageGraph/ModulesGraph.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ extension PackageGraphError: CustomStringConvertible {
374374
}
375375
return description
376376
}
377-
return "multiple packages (\(packagesDescriptions.joined(separator: ", "))) declare products with a conflicting name: '\(product); product names need to be unique across the package graph"
377+
return "multiple packages (\(packagesDescriptions.joined(separator: ", "))) declare products with a conflicting name: '\(product)'; product names need to be unique across the package graph"
378378
case .multipleModuleAliases(let target, let product, let package, let aliases):
379379
return "multiple aliases: ['\(aliases.joined(separator: "', '"))'] found for target '\(target)' in product '\(product)' from package '\(package)'"
380380
case .unsupportedPluginDependency(let targetName, let dependencyName, let dependencyType, let dependencyPackage):

Sources/PackageGraph/PackageModel+Extensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ extension PackageContainerConstraint {
6464
case .specific:
6565
switch products {
6666
case .everything:
67-
assertionFailure("Attempted to enumerate a root packages product filter; root packages have no filter.")
67+
assertionFailure("Attempted to enumerate a root package's product filter; root packages have no filter.")
6868
return []
6969
case .specific(let set):
7070
if set.isEmpty { // Pointing at the package without a particular product.

Sources/PackageGraph/Resolution/DependencyResolutionNode.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public enum DependencyResolutionNode {
104104
///
105105
/// This is the constraint that requires all products from a package resolve to the same version.
106106
internal func versionLock(version: Version) -> PackageContainerConstraint? {
107-
// Dont create a version lock for anything but a product.
107+
// Don't create a version lock for anything but a product.
108108
guard specificProduct != nil else { return nil }
109109
return PackageContainerConstraint(
110110
package: self.package,
@@ -118,7 +118,7 @@ public enum DependencyResolutionNode {
118118
///
119119
/// This is the constraint that requires all products from a package resolve to the same revision.
120120
internal func revisionLock(revision: String) -> PackageContainerConstraint? {
121-
// Dont create a revision lock for anything but a product.
121+
// Don't create a revision lock for anything but a product.
122122
guard specificProduct != nil else { return nil }
123123
return PackageContainerConstraint(
124124
package: self.package,

Sources/PackageLoading/PackageBuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ extension ModuleError: CustomStringConvertible {
111111
switch self {
112112
case .duplicateModule(let target, let packages):
113113
let packages = packages.map(\.description).sorted().joined(separator: "', '")
114-
return "multiple packages ('\(packages)') declare targets with a conflicting name: '\(target); target names need to be unique across the package graph"
114+
return "multiple packages ('\(packages)') declare targets with a conflicting name: '\(target)'; target names need to be unique across the package graph"
115115
case .moduleNotFound(let target, let type, let shouldSuggestRelaxedSourceDir):
116116
let folderName = (type == .test) ? "Tests" : (type == .plugin) ? "Plugins" : "Sources"
117117
var clauses = ["Source files for target \(target) should be located under '\(folderName)/\(target)'"]

Sources/PackageModel/Manifest/Manifest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ public final class Manifest: Sendable {
519519
registry: &registry.known,
520520
availablePackages: availablePackages
521521
) {
522-
// If it doesnt match a package, it should be a target, not a product.
522+
// If it doesn't match a package, it should be a target, not a product.
523523
if self.targets.contains(where: { $0.name == product }) {
524524
break
525525
} else {

0 commit comments

Comments
 (0)