@@ -1385,6 +1385,63 @@ struct BuildCommandTestCases {
1385
1385
}
1386
1386
}
1387
1387
}
1388
+
1389
+ @Test ( . requireHostOS( . macOS) , arguments: SupportedBuildSystemOnPlatform)
1390
+ func buildingPackageWhichRequiresOlderDeploymentTarget( buildSystem: BuildSystemProvider . Kind ) async throws {
1391
+ // This fixture specifies a deployment target of macOS 12, and uses API obsoleted in macOS 13. The goal
1392
+ // of this test is to ensure that SwiftPM respects the deployment target specified in the package manifest
1393
+ // when passed no triple of an unversioned triple, rather than using the latests deployment target.
1394
+
1395
+ // No triple - build should pass
1396
+ try await fixture ( name: " Miscellaneous/RequiresOlderDeploymentTarget " ) { path in
1397
+ try await executeSwiftBuild (
1398
+ path,
1399
+ buildSystem: buildSystem,
1400
+ throwIfCommandFails: true
1401
+ )
1402
+ }
1403
+
1404
+ let hostArch : String
1405
+ #if arch(arm64)
1406
+ hostArch = " arm64 "
1407
+ #else
1408
+ hostArch = " x86_64 "
1409
+ #endif
1410
+
1411
+ // Unversioned triple - build should pass
1412
+ try await fixture ( name: " Miscellaneous/RequiresOlderDeploymentTarget " ) { path in
1413
+ try await executeSwiftBuild (
1414
+ path,
1415
+ extraArgs: [ " --triple " , " \( hostArch) -apple-macosx " ] ,
1416
+ buildSystem: buildSystem,
1417
+ throwIfCommandFails: true
1418
+ )
1419
+ }
1420
+
1421
+ // Versioned triple with supported deployment target - build should pass
1422
+ try await fixture ( name: " Miscellaneous/RequiresOlderDeploymentTarget " ) { path in
1423
+ try await executeSwiftBuild (
1424
+ path,
1425
+ extraArgs: [ " --triple " , " \( hostArch) -apple-macosx12.0 " ] ,
1426
+ buildSystem: buildSystem,
1427
+ throwIfCommandFails: true
1428
+ )
1429
+ }
1430
+
1431
+ if buildSystem == . swiftbuild {
1432
+ // Versioned triple with unsupported deployment target - build should fail
1433
+ try await fixture ( name: " Miscellaneous/RequiresOlderDeploymentTarget " ) { path in
1434
+ await #expect( throws: Error . self) {
1435
+ try await executeSwiftBuild (
1436
+ path,
1437
+ extraArgs: [ " --triple " , " \( hostArch) -apple-macosx14.0 " ] ,
1438
+ buildSystem: buildSystem,
1439
+ throwIfCommandFails: true
1440
+ )
1441
+ }
1442
+ }
1443
+ }
1444
+ }
1388
1445
}
1389
1446
1390
1447
extension Triple {
0 commit comments