@@ -193,8 +193,6 @@ private func checkCachingBuildJobDependencies(job: Job,
193
193
194
194
195
195
final class CachingBuildTests : XCTestCase {
196
- let dependencyOracle = InterModuleDependencyOracle ( )
197
-
198
196
override func setUpWithError( ) throws {
199
197
try super. setUpWithError ( )
200
198
@@ -368,6 +366,7 @@ final class CachingBuildTests: XCTestCase {
368
366
let privateSwiftInterfacePath : AbsolutePath = path. appending ( component: " testModuleOnlyJob.private.swiftinterface " )
369
367
let modulePath : AbsolutePath = path. appending ( component: " testModuleOnlyJob.swiftmodule " )
370
368
let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
369
+ let dependencyOracle = InterModuleDependencyOracle ( )
371
370
var driver = try Driver ( args: [ " swiftc " ,
372
371
" -module-name " , " ModuleOnly " ,
373
372
" -I " , cHeadersPath. nativePathString ( escaped: true ) ,
@@ -423,6 +422,7 @@ final class CachingBuildTests: XCTestCase {
423
422
let privateSwiftInterfacePath : AbsolutePath = path. appending ( component: " testSeparateModuleJob.private.swiftinterface " )
424
423
let modulePath : AbsolutePath = path. appending ( component: " testSeparateModuleJob.swiftmodule " )
425
424
let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
425
+ let dependencyOracle = InterModuleDependencyOracle ( )
426
426
var driver = try Driver ( args: [ " swiftc " ,
427
427
" -module-name " , " SeparateModuleJob " ,
428
428
" -I " , cHeadersPath. nativePathString ( escaped: true ) ,
@@ -621,6 +621,7 @@ final class CachingBuildTests: XCTestCase {
621
621
try testInputsPath. appending ( component: " ExplicitModuleBuilds " )
622
622
. appending ( component: " Swift " )
623
623
let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
624
+ let dependencyOracle = InterModuleDependencyOracle ( )
624
625
var driver = try Driver ( args: [ " swiftc " ,
625
626
" -I " , cHeadersPath. nativePathString ( escaped: true ) ,
626
627
" -I " , swiftModuleInterfacesPath. nativePathString ( escaped: true ) ,
@@ -672,6 +673,7 @@ final class CachingBuildTests: XCTestCase {
672
673
$0. send ( " import Foo " )
673
674
}
674
675
let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
676
+ let dependencyOracle = InterModuleDependencyOracle ( )
675
677
676
678
var fooBuildDriver = try Driver ( args: [ " swiftc " ,
677
679
" -explicit-module-build " ,
@@ -745,6 +747,7 @@ final class CachingBuildTests: XCTestCase {
745
747
. appending ( component: " Swift " )
746
748
let casPath = path. appending ( component: " cas " )
747
749
let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
750
+ let dependencyOracle = InterModuleDependencyOracle ( )
748
751
var driver = try Driver ( args: [ " swiftc " ,
749
752
" -I " , cHeadersPath. nativePathString ( escaped: true ) ,
750
753
" -I " , swiftModuleInterfacesPath. nativePathString ( escaped: true ) ,
@@ -756,6 +759,8 @@ final class CachingBuildTests: XCTestCase {
756
759
" -disable-clang-target " ,
757
760
main. nativePathString ( escaped: true ) ] + sdkArgumentsForTesting,
758
761
interModuleDependencyOracle: dependencyOracle)
762
+ // Plan a build to initialize the scanner and the CAS underneath.
763
+ _ = try driver. planBuild ( )
759
764
let scanLibPath = try XCTUnwrap ( driver. getSwiftScanLibPath ( ) )
760
765
try dependencyOracle. verifyOrCreateScannerInstance ( swiftScanLibPath: scanLibPath)
761
766
let resolver = try ArgsResolver ( fileSystem: localFileSystem)
@@ -858,6 +863,7 @@ final class CachingBuildTests: XCTestCase {
858
863
859
864
XCTAssertEqual ( scanDiagnostics. count, 1 )
860
865
XCTAssertEqual ( scanDiagnostics [ 0 ] . severity, . error)
866
+
861
867
}
862
868
}
863
869
@@ -882,6 +888,7 @@ final class CachingBuildTests: XCTestCase {
882
888
let mockBlocklistDir = try testInputsPath. appending ( components: " Dummy.xctoolchain " , " usr " , " bin " )
883
889
var env = ProcessEnv . block
884
890
env [ " _SWIFT_DRIVER_MOCK_BLOCK_LIST_DIR " ] = mockBlocklistDir. nativePathString ( escaped: true )
891
+ let dependencyOracle = InterModuleDependencyOracle ( )
885
892
var driver = try Driver ( args: [ " swiftc " ,
886
893
" -I " , cHeadersPath. nativePathString ( escaped: true ) ,
887
894
" -I " , swiftModuleInterfacesPath. nativePathString ( escaped: true ) ,
@@ -962,6 +969,7 @@ final class CachingBuildTests: XCTestCase {
962
969
let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
963
970
let bridgingHeaderpath : AbsolutePath =
964
971
cHeadersPath. appending ( component: " Bridging.h " )
972
+ let dependencyOracle = InterModuleDependencyOracle ( )
965
973
var driver = try Driver ( args: [ " swiftc " ,
966
974
" -I " , cHeadersPath. nativePathString ( escaped: true ) ,
967
975
" -I " , swiftModuleInterfacesPath. nativePathString ( escaped: true ) ,
@@ -1016,6 +1024,7 @@ final class CachingBuildTests: XCTestCase {
1016
1024
let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
1017
1025
let bridgingHeaderpath : AbsolutePath =
1018
1026
cHeadersPath. appending ( component: " Bridging.h " )
1027
+ let dependencyOracle = InterModuleDependencyOracle ( )
1019
1028
var driver = try Driver ( args: [ " swiftc " ,
1020
1029
" -I " , cHeadersPath. nativePathString ( escaped: true ) ,
1021
1030
" -I " , swiftModuleInterfacesPath. nativePathString ( escaped: true ) ,
@@ -1072,8 +1081,7 @@ final class CachingBuildTests: XCTestCase {
1072
1081
" -cache-compile-job " , " -cas-path " , casPath. nativePathString ( escaped: true ) ,
1073
1082
" -import-objc-header " , bridgingHeaderpath. nativePathString ( escaped: true ) ,
1074
1083
" -working-directory " , path. nativePathString ( escaped: true ) ,
1075
- main. nativePathString ( escaped: true ) ] + sdkArgumentsForTesting,
1076
- interModuleDependencyOracle: dependencyOracle)
1084
+ main. nativePathString ( escaped: true ) ] + sdkArgumentsForTesting)
1077
1085
let jobs = try driver. planBuild ( )
1078
1086
jobs. forEach { job in
1079
1087
guard job. kind == . compile else {
@@ -1093,6 +1101,7 @@ final class CachingBuildTests: XCTestCase {
1093
1101
let casPath = path. appending ( component: " cas " )
1094
1102
let driver = try Driver ( args: [ " swiftc " ] )
1095
1103
let scanLibPath = try XCTUnwrap ( driver. getSwiftScanLibPath ( ) )
1104
+ let dependencyOracle = InterModuleDependencyOracle ( )
1096
1105
try dependencyOracle. verifyOrCreateScannerInstance ( swiftScanLibPath: scanLibPath)
1097
1106
let cas = try dependencyOracle. getOrCreateCAS ( pluginPath: nil , onDiskPath: casPath, pluginOptions: [ ] )
1098
1107
guard cas. supportsSizeManagement else {
0 commit comments