Skip to content

Commit 1eb64ab

Browse files
authored
Revert "Avoid use of temp_await in PackageRegistryToolTests.swift" (#7169)
Reverts #7015
1 parent b29c93e commit 1eb64ab

File tree

2 files changed

+11
-42
lines changed

2 files changed

+11
-42
lines changed

Sources/Basics/Archiver/Archiver.swift

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ public protocol Archiver {
5656
}
5757

5858
extension Archiver {
59-
/// Asynchronously extracts the contents of an archive to a destination folder.
60-
///
61-
/// - Parameters:
62-
/// - archivePath: The `AbsolutePath` to the archive to extract.
63-
/// - destinationPath: The `AbsolutePath` to the directory to extract to.
6459
public func extract(
6560
from archivePath: AbsolutePath,
6661
to destinationPath: AbsolutePath
@@ -85,31 +80,5 @@ extension Archiver {
8580
try await safe_async {
8681
self.validate(path: path, completion: $0)
8782
}
88-
}
89-
90-
/// Asynchronously compresses the contents of a directory to a destination archive.
91-
///
92-
/// - Parameters:
93-
/// - directory: The `AbsolutePath` to the archive to extract.
94-
/// - destinationPath: The `AbsolutePath` to the directory to extract to.
95-
public func compress(
96-
directory: AbsolutePath,
97-
to destinationPath: AbsolutePath
98-
) async throws {
99-
try await withCheckedThrowingContinuation {
100-
self.compress(directory: directory, to: destinationPath, completion: $0.resume(with:))
101-
}
102-
}
103-
104-
/// Asynchronously validates if a file is an archive.
105-
///
106-
/// - Parameters:
107-
/// - path: The `AbsolutePath` to the archive to validate.
108-
public func validate(
109-
path: AbsolutePath
110-
) async throws -> Bool {
111-
try await withCheckedThrowingContinuation {
112-
self.validate(path: path, completion: $0.resume(with:))
113-
}
11483
}
11584
}

Tests/CommandsTests/PackageRegistryToolTests.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ final class PackageRegistryToolTests: CommandsTestCase {
279279

280280
// TODO: Test example with login and password
281281

282-
func testArchiving() async throws {
282+
func testArchiving() throws {
283283
#if os(Linux)
284284
// needed for archiving
285285
guard SPM_posix_spawn_file_actions_addchdir_np_supported() else {
@@ -293,7 +293,7 @@ final class PackageRegistryToolTests: CommandsTestCase {
293293
let metadataFilename = SwiftPackageRegistryTool.Publish.metadataFilename
294294

295295
// git repo
296-
try await withTemporaryDirectory { temporaryDirectory in
296+
try withTemporaryDirectory { temporaryDirectory in
297297
let packageDirectory = temporaryDirectory.appending("MyPackage")
298298
try localFileSystem.createDirectory(packageDirectory)
299299

@@ -320,12 +320,12 @@ final class PackageRegistryToolTests: CommandsTestCase {
320320
observabilityScope: observability.topScope
321321
)
322322

323-
try await validatePackageArchive(at: archivePath)
323+
try validatePackageArchive(at: archivePath)
324324
XCTAssertTrue(archivePath.isDescendant(of: workingDirectory))
325325
}
326326

327327
// not a git repo
328-
try await withTemporaryDirectory { temporaryDirectory in
328+
try withTemporaryDirectory { temporaryDirectory in
329329
let packageDirectory = temporaryDirectory.appending("MyPackage")
330330
try localFileSystem.createDirectory(packageDirectory)
331331

@@ -350,11 +350,11 @@ final class PackageRegistryToolTests: CommandsTestCase {
350350
observabilityScope: observability.topScope
351351
)
352352

353-
try await validatePackageArchive(at: archivePath)
353+
try validatePackageArchive(at: archivePath)
354354
}
355355

356356
// canonical metadata location
357-
try await withTemporaryDirectory { temporaryDirectory in
357+
try withTemporaryDirectory { temporaryDirectory in
358358
let packageDirectory = temporaryDirectory.appending("MyPackage")
359359
try localFileSystem.createDirectory(packageDirectory)
360360

@@ -385,17 +385,17 @@ final class PackageRegistryToolTests: CommandsTestCase {
385385
observabilityScope: observability.topScope
386386
)
387387

388-
let extractedPath = try await validatePackageArchive(at: archivePath)
388+
let extractedPath = try validatePackageArchive(at: archivePath)
389389
XCTAssertFileExists(extractedPath.appending(component: metadataFilename))
390390
}
391391

392392
@discardableResult
393-
func validatePackageArchive(at archivePath: AbsolutePath) async throws -> AbsolutePath {
393+
func validatePackageArchive(at archivePath: AbsolutePath) throws -> AbsolutePath {
394394
XCTAssertFileExists(archivePath)
395395
let archiver = ZipArchiver(fileSystem: localFileSystem)
396396
let extractPath = archivePath.parentDirectory.appending(component: UUID().uuidString)
397397
try localFileSystem.createDirectory(extractPath)
398-
try await archiver.extract(from: archivePath, to: extractPath)
398+
try temp_await { archiver.extract(from: archivePath, to: extractPath, completion: $0) }
399399
try localFileSystem.stripFirstLevel(of: extractPath)
400400
XCTAssertFileExists(extractPath.appending("Package.swift"))
401401
return extractPath
@@ -550,7 +550,7 @@ final class PackageRegistryToolTests: CommandsTestCase {
550550
let archiver = ZipArchiver(fileSystem: localFileSystem)
551551
let extractPath = archivePath.parentDirectory.appending(component: UUID().uuidString)
552552
try localFileSystem.createDirectory(extractPath)
553-
try await archiver.extract(from: archivePath, to: extractPath)
553+
try temp_await { archiver.extract(from: archivePath, to: extractPath, completion: $0) }
554554
try localFileSystem.stripFirstLevel(of: extractPath)
555555

556556
let manifestInArchive = try localFileSystem.readFileContents(extractPath.appending(manifestFile)).contents
@@ -963,7 +963,7 @@ final class PackageRegistryToolTests: CommandsTestCase {
963963
let archiver = ZipArchiver(fileSystem: localFileSystem)
964964
let extractPath = archivePath.parentDirectory.appending(component: UUID().uuidString)
965965
try localFileSystem.createDirectory(extractPath)
966-
try await archiver.extract(from: archivePath, to: extractPath)
966+
try temp_await { archiver.extract(from: archivePath, to: extractPath, completion: $0) }
967967
try localFileSystem.stripFirstLevel(of: extractPath)
968968

969969
let manifestSignature = try ManifestSignatureParser.parse(

0 commit comments

Comments
 (0)