Commit 9ee1649
committed
On Darwin, allow XCTest to be missing if we're only building swift-testing tests. (#7426)
This PR removes the constraint on Darwin that XCTest.framework must be
present in order to build tests using swift-testing. On Darwin, XCTest
is included as a framework inside Xcode, but if a developer installs the
Xcode Command Line Tools instead of the full IDE, XCTest is not
included. They then get a diagnostic of the form:
> error: XCTest not available: terminated(1): /usr/bin/xcrun --sdk
macosx --show-sdk-platform-path output:
> xcrun: error: unable to lookup item 'PlatformPath' from command line
tools installation
> xcrun: error: unable to lookup item 'PlatformPath' in SDK
'/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk'
Which is a poor experience if they aren't even using XCTest.
This change, as a (positive) side effect, suppresses the same diagnostic
when running commands that are not usually dependent on the presence of
XCTest such as `swift build`.
Note that swift-corelibs-xctest is not supported on Darwin, so
installing the Xcode Command Line Tools and adding an explicit
dependency on swift-corelibs-xctest will not produce a functional test
target bundle. Supporting swift-corelibs-xctest on Darwin is a potential
future direction.
Automated testing for this change is difficult because it relies on a
build environment that is not supported in CI (namely the presence of
the CL tools but not Xcode nor XCTest.framework.) I have manually tested
the change against swift-testing's own test target.
A separate PR will be necessary in swift-testing to remove some
remaining XCTest dependencies. Those changes are not covered by this PR.
Resolves rdar://125372431.1 parent 174e327 commit 9ee1649
File tree
3 files changed
+76
-21
lines changed- Sources
- Commands
- Utilities
- PackageModel/SwiftSDKs
3 files changed
+76
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
203 | 206 | | |
204 | 207 | | |
205 | 208 | | |
206 | | - | |
207 | | - | |
208 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
209 | 217 | | |
210 | 218 | | |
211 | 219 | | |
| |||
814 | 822 | | |
815 | 823 | | |
816 | 824 | | |
817 | | - | |
| 825 | + | |
818 | 826 | | |
819 | 827 | | |
820 | 828 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
151 | 173 | | |
152 | 174 | | |
153 | 175 | | |
| |||
418 | 440 | | |
419 | 441 | | |
420 | 442 | | |
| 443 | + | |
421 | 444 | | |
422 | 445 | | |
423 | 446 | | |
424 | 447 | | |
425 | 448 | | |
426 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
427 | 474 | | |
428 | 475 | | |
429 | 476 | | |
430 | 477 | | |
431 | 478 | | |
432 | | - | |
| 479 | + | |
433 | 480 | | |
434 | 481 | | |
435 | 482 | | |
| |||
496 | 543 | | |
497 | 544 | | |
498 | 545 | | |
499 | | - | |
| 546 | + | |
500 | 547 | | |
501 | 548 | | |
502 | 549 | | |
| |||
506 | 553 | | |
507 | 554 | | |
508 | 555 | | |
509 | | - | |
| 556 | + | |
510 | 557 | | |
511 | | - | |
512 | | - | |
| 558 | + | |
513 | 559 | | |
514 | 560 | | |
515 | | - | |
| 561 | + | |
516 | 562 | | |
517 | 563 | | |
518 | 564 | | |
| |||
528 | 574 | | |
529 | 575 | | |
530 | 576 | | |
531 | | - | |
| 577 | + | |
532 | 578 | | |
533 | 579 | | |
534 | 580 | | |
| |||
0 commit comments