@@ -13,11 +13,45 @@ class XcodeToolsTests: XCTestCase {
1313
1414 let projectDirectoryPath = " PROJECT_DIRECTORY_PATH "
1515 let scheme = " SCHEME "
16- let projectType = ProjectType . swiftPackage
16+
17+ try await testArchiving (
18+ projectDirectoryPath: projectDirectoryPath,
19+ scheme: scheme,
20+ projectType: . swiftPackage
21+ )
22+ }
23+
24+ func test_archive_xcodeProject( ) async throws {
25+
26+ let projectDirectoryPath = " PROJECT_DIRECTORY_PATH "
27+ let scheme = " SCHEME "
28+
29+ try await testArchiving (
30+ projectDirectoryPath: projectDirectoryPath,
31+ scheme: scheme,
32+ projectType: . xcodeProject( scheme: scheme)
33+ )
34+ }
35+ }
36+
37+ private extension XcodeToolsTests {
38+
39+ func testArchiving(
40+ projectDirectoryPath: String ,
41+ scheme: String ,
42+ projectType: ProjectType
43+ ) async throws {
1744
1845 let archiveResult = " ARCHIVE_RESULT "
1946 let expectedDerivedDataPath = " \( projectDirectoryPath) /.build "
20- var expectedHandleExecuteCalls = [ " cd \( projectDirectoryPath) ; xcodebuild clean build -scheme \" \( scheme) \" -destination \" generic/platform=iOS \" -derivedDataPath .build -sdk `xcrun --sdk iphonesimulator --show-sdk-path` BUILD_LIBRARY_FOR_DISTRIBUTION=YES -skipPackagePluginValidation " ]
47+ var expectedHandleExecuteCalls : [ String ] = {
48+ switch projectType {
49+ case . swiftPackage:
50+ [ " cd \( projectDirectoryPath) ; xcodebuild clean build -scheme \" \( scheme) \" -destination \" generic/platform=iOS \" -derivedDataPath .build -sdk `xcrun --sdk iphonesimulator --show-sdk-path` BUILD_LIBRARY_FOR_DISTRIBUTION=YES -skipPackagePluginValidation " ]
51+ case . xcodeProject( let scheme) :
52+ [ " cd \( projectDirectoryPath) ; xcodebuild clean build -scheme \" \( scheme) \" -destination \" generic/platform=iOS \" -derivedDataPath .build -sdk `xcrun --sdk iphonesimulator --show-sdk-path` BUILD_LIBRARY_FOR_DISTRIBUTION=YES " ]
53+ }
54+ } ( )
2155 var expectedHandleLogCalls : [ ( message: String , subsystem: String ) ] = [
2256 ( " 📦 Archiving SCHEME from PROJECT_DIRECTORY_PATH " , " XcodeTools " )
2357 ]
0 commit comments