File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Sources/Build/BuildDescription Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -982,7 +982,15 @@ public final class SwiftModuleBuildDescription {
982
982
if self . isTestTarget {
983
983
// test targets must be built with -enable-testing
984
984
// since its required for test discovery (the non objective-c reflection kind)
985
- return [ " -enable-testing " ]
985
+ var result = [ " -enable-testing " ]
986
+
987
+ // Test targets need to enable cross-import overlays because Swift
988
+ // Testing cannot directly link to most other modules and needs to
989
+ // provide API that works with e.g. Foundation. (Developers can
990
+ // override this flag by passing -disable-cross-import-overlays.)
991
+ result += [ " -Xfrontend " , " -enable-cross-import-overlays " ]
992
+
993
+ return result
986
994
} else if self . buildParameters. enableTestability {
987
995
return [ " -enable-testing " ]
988
996
} else {
Original file line number Diff line number Diff line change @@ -2337,6 +2337,8 @@ final class BuildPlanTests: XCTestCase {
2337
2337
" -enable-batch-mode " ,
2338
2338
" -Onone " ,
2339
2339
" -enable-testing " ,
2340
+ " -Xfrontend " ,
2341
+ " -enable-cross-import-overlays " ,
2340
2342
. equal( self . j) ,
2341
2343
" -DSWIFT_PACKAGE " ,
2342
2344
" -DDEBUG " ,
You can’t perform that action at this time.
0 commit comments