Skip to content

PackageLoading: convert most of ManifestLoader to async/await #6624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
818ebd1
PackageLoading: make private/internal parts of ManifestLoader async
MaxDesiatov Oct 13, 2023
4818168
Remove unused `ManifestLoader.DelayableAction`
MaxDesiatov Oct 13, 2023
8e4b233
Merge branch 'main' of github.com:apple/swift-package-manager into ma…
MaxDesiatov Nov 28, 2023
c516e85
Update tests for async manifests loader
MaxDesiatov Nov 28, 2023
77ae554
Fix broken test
MaxDesiatov Nov 28, 2023
f37ef3a
Merge branch 'main' of github.com:apple/swift-package-manager into ma…
MaxDesiatov Nov 28, 2023
189d644
Fix bad merge
MaxDesiatov Nov 28, 2023
6bd15d9
Fix test build error
MaxDesiatov Nov 28, 2023
0d1feff
Add `@available` to tests where `Duration` is used
MaxDesiatov Nov 28, 2023
91e9f1b
Merge branch 'main' of github.com:apple/swift-package-manager into ma…
MaxDesiatov Dec 7, 2023
d995225
Address PR feedback
MaxDesiatov Dec 11, 2023
069c208
Merge branch 'main' of github.com:apple/swift-package-manager into ma…
MaxDesiatov Dec 12, 2023
83cf3f1
Formatting fix
MaxDesiatov Dec 14, 2023
8ccad6e
Minor cleanups
MaxDesiatov Dec 14, 2023
3a01c5e
Merge branch 'main' of github.com:apple/swift-package-manager into ma…
MaxDesiatov Jan 12, 2024
5273dee
Merge branch 'main' of github.com:apple/swift-package-manager into ma…
MaxDesiatov Jan 15, 2024
fd6d798
Merge branch 'main' of github.com:apple/swift-package-manager into ma…
MaxDesiatov Feb 21, 2024
d12d1db
Merge branch 'main' of github.com:apple/swift-package-manager into ma…
MaxDesiatov Feb 23, 2024
bf95ea2
Fix build errors in tests after resolving merge conflicts
MaxDesiatov Feb 23, 2024
48f12d9
Merge branch 'main' into maxd/async-manifest-loader
MaxDesiatov Feb 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,011 changes: 483 additions & 528 deletions Sources/PackageLoading/ManifestLoader.swift

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions Sources/SPMTestSupport/MockManifestLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ extension ManifestLoader {
dependencyMapper: DependencyMapper? = .none,
fileSystem: FileSystem,
observabilityScope: ObservabilityScope
) async throws -> Manifest{
) async throws -> Manifest {
let packageIdentity: PackageIdentity
let packageLocation: String
switch packageKind {
Expand Down Expand Up @@ -121,8 +121,7 @@ extension ManifestLoader {
dependencyMapper: dependencyMapper ?? DefaultDependencyMapper(identityResolver: identityResolver),
fileSystem: fileSystem,
observabilityScope: observabilityScope,
delegateQueue: .sharedConcurrent,
callbackQueue: .sharedConcurrent
delegateQueue: .sharedConcurrent
)
}
}
Expand All @@ -136,7 +135,7 @@ extension ManifestLoader {
dependencyMapper: DependencyMapper? = .none,
fileSystem: FileSystem,
observabilityScope: ObservabilityScope
) async throws -> Manifest{
) async throws -> Manifest {
let packageIdentity: PackageIdentity
let packageLocation: String
switch packageKind {
Expand Down
1 change: 0 additions & 1 deletion Sources/SPMTestSupport/XCTAssertHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ package func XCTAsyncUnwrap<T>(
return result
}


package struct CommandExecutionError: Error {
package let result: ProcessResult
package let stdout: String
Expand Down
2 changes: 1 addition & 1 deletion Tests/PackageLoadingTests/PDLoadingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class PackageDescriptionLoadingTests: XCTestCase, ManifestLoaderDelegate {
}
}

@available(macOS 13, iOS 16, tvOS 16, watchOS 9, *)
final class ManifestTestDelegate: ManifestLoaderDelegate {
private let loaded = ThreadSafeArrayStore<AbsolutePath>()
private let parsed = ThreadSafeArrayStore<AbsolutePath>()
Expand Down Expand Up @@ -157,7 +158,6 @@ final class ManifestTestDelegate: ManifestLoaderDelegate {
self.parsed.append(manifestPath)
}


func clear() {
self.loaded.clear()
self.parsed.clear()
Expand Down
9 changes: 3 additions & 6 deletions Tests/PackageLoadingTests/PD_4_2_LoadingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,7 @@ final class PackageDescription4_2LoadingTests: PackageDescriptionLoadingTests {
dependencyMapper: dependencyMapper,
fileSystem: localFileSystem,
observabilityScope: observability.topScope,
delegateQueue: .sharedConcurrent,
callbackQueue: .sharedConcurrent
delegateQueue: .sharedConcurrent
)

XCTAssertNoDiagnostics(observability.diagnostics)
Expand All @@ -661,8 +660,7 @@ final class PackageDescription4_2LoadingTests: PackageDescriptionLoadingTests {
dependencyMapper: dependencyMapper,
fileSystem: localFileSystem,
observabilityScope: observability.topScope,
delegateQueue: .sharedConcurrent,
callbackQueue: .sharedConcurrent
delegateQueue: .sharedConcurrent
)

XCTAssertNoDiagnostics(observability.diagnostics)
Expand Down Expand Up @@ -725,8 +723,7 @@ final class PackageDescription4_2LoadingTests: PackageDescriptionLoadingTests {
dependencyMapper: dependencyMapper,
fileSystem: localFileSystem,
observabilityScope: observability.topScope,
delegateQueue: .sharedConcurrent,
callbackQueue: .sharedConcurrent
delegateQueue: .sharedConcurrent
)

XCTAssertEqual(manifest.displayName, "Trivial-\(random)")
Expand Down
2 changes: 1 addition & 1 deletion Tests/PackageLoadingTests/PD_5_4_LoadingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import PackageModel
import SPMTestSupport
import XCTest

class PackageDescription5_4LoadingTests: PackageDescriptionLoadingTests {
final class PackageDescription5_4LoadingTests: PackageDescriptionLoadingTests {
override var toolsVersion: ToolsVersion {
.v5_4
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/PackageLoadingTests/PD_5_5_LoadingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import PackageModel
import SPMTestSupport
import XCTest

class PackageDescription5_5LoadingTests: PackageDescriptionLoadingTests {
final class PackageDescription5_5LoadingTests: PackageDescriptionLoadingTests {
override var toolsVersion: ToolsVersion {
.v5_5
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/PackageLoadingTests/PD_Next_LoadingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import PackageModel
import SPMTestSupport
import XCTest

class PackageDescriptionNextLoadingTests: PackageDescriptionLoadingTests {
final class PackageDescriptionNextLoadingTests: PackageDescriptionLoadingTests {
override var toolsVersion: ToolsVersion {
.vNext
}
Expand Down
6 changes: 2 additions & 4 deletions Tests/WorkspaceTests/ManifestSourceGenerationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ class ManifestSourceGenerationTests: XCTestCase {
dependencyMapper: dependencyMapper,
fileSystem: fs,
observabilityScope: observability.topScope,
delegateQueue: .sharedConcurrent,
callbackQueue: .sharedConcurrent
delegateQueue: .sharedConcurrent
)

XCTAssertNoDiagnostics(observability.diagnostics)
Expand Down Expand Up @@ -93,8 +92,7 @@ class ManifestSourceGenerationTests: XCTestCase {
dependencyMapper: dependencyMapper,
fileSystem: fs,
observabilityScope: observability.topScope,
delegateQueue: .sharedConcurrent,
callbackQueue: .sharedConcurrent
delegateQueue: .sharedConcurrent
)

XCTAssertNoDiagnostics(observability.diagnostics)
Expand Down