@@ -1014,82 +1014,6 @@ final class ExplicitModuleBuildTests: XCTestCase {
10141014 }
10151015 }
10161016
1017- func testExplicitModuleBuildEndToEndWithBinaryHeaderDeps( ) throws {
1018- try withTemporaryDirectory { path in
1019- try localFileSystem. changeCurrentWorkingDirectory ( to: path)
1020- let moduleCachePath = path. appending ( component: " ModuleCache " )
1021- try localFileSystem. createDirectory ( moduleCachePath)
1022- let PCHPath = path. appending ( component: " PCH " )
1023- try localFileSystem. createDirectory ( PCHPath)
1024- let FooInstallPath = path. appending ( component: " Foo " )
1025- try localFileSystem. createDirectory ( FooInstallPath)
1026- let foo = path. appending ( component: " foo.swift " )
1027- try localFileSystem. writeFileContents ( foo) {
1028- $0 <<< " extension Profiler { "
1029- $0 <<< " public static let count: Int = 42 "
1030- $0 <<< " } "
1031- }
1032- let fooHeader = path. appending ( component: " foo.h " )
1033- try localFileSystem. writeFileContents ( fooHeader) {
1034- $0 <<< " struct Profiler { void* ptr; }; "
1035- }
1036- let main = path. appending ( component: " main.swift " )
1037- try localFileSystem. writeFileContents ( main) {
1038- $0 <<< " import Foo "
1039- }
1040- let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
1041-
1042- var fooBuildDriver = try Driver ( args: [ " swiftc " ,
1043- " -explicit-module-build " ,
1044- " -module-cache-path " , moduleCachePath. nativePathString ( escaped: true ) ,
1045- " -working-directory " , path. nativePathString ( escaped: true ) ,
1046- foo. nativePathString ( escaped: true ) ,
1047- " -emit-module " , " -wmo " , " -module-name " , " Foo " ,
1048- " -emit-module-path " , FooInstallPath . nativePathString ( escaped: true ) ,
1049- " -import-objc-header " , fooHeader. nativePathString ( escaped: true ) ,
1050- " -pch-output-dir " , PCHPath . nativePathString ( escaped: true ) ,
1051- FooInstallPath . appending ( component: " Foo.swiftmodule " ) . nativePathString ( escaped: true ) ]
1052- + sdkArgumentsForTesting,
1053- env: ProcessEnv . vars)
1054-
1055- // Ensure this tooling supports this functionality
1056- let dependencyOracle = InterModuleDependencyOracle ( )
1057- let scanLibPath = try XCTUnwrap ( fooBuildDriver. toolchain. lookupSwiftScanLib ( ) )
1058- guard try dependencyOracle
1059- . verifyOrCreateScannerInstance ( fileSystem: localFileSystem,
1060- swiftScanLibPath: scanLibPath) else {
1061- XCTFail ( " Dependency scanner library not found " )
1062- return
1063- }
1064- guard try dependencyOracle. supportsBinaryModuleHeaderDependencies ( ) else {
1065- throw XCTSkip ( " libSwiftScan does not support binary module header dependencies. " )
1066- }
1067-
1068- let fooJobs = try fooBuildDriver. planBuild ( )
1069- try fooBuildDriver. run ( jobs: fooJobs)
1070- XCTAssertFalse ( fooBuildDriver. diagnosticEngine. hasErrors)
1071-
1072- var driver = try Driver ( args: [ " swiftc " ,
1073- " -I " , FooInstallPath . nativePathString ( escaped: true ) ,
1074- " -explicit-module-build " , " -emit-module " , " -emit-module-path " ,
1075- path. appending ( component: " testEMBETEWBHD.swiftmodule " ) . nativePathString ( escaped: true ) ,
1076- " -module-cache-path " , moduleCachePath. nativePathString ( escaped: true ) ,
1077- " -working-directory " , path. nativePathString ( escaped: true ) ,
1078- main. nativePathString ( escaped: true ) ] + sdkArgumentsForTesting,
1079- env: ProcessEnv . vars)
1080- let jobs = try driver. planBuild ( )
1081- let compileJob = try XCTUnwrap ( jobs. first ( where: { $0. description == " Compiling main main.swift " } ) )
1082-
1083- // Ensure the header dependency of Foo shows up on client compile commands
1084- XCTAssertTrue ( compileJob. commandLine. contains ( subsequence: [ . flag( " -Xcc " ) ,
1085- . flag( " -include-pch " ) ,
1086- . flag( " -Xcc " ) ,
1087- . path( . absolute( PCHPath . appending ( component: " foo.pch " ) ) ) ] ) )
1088- try driver. run ( jobs: jobs)
1089- XCTAssertFalse ( driver. diagnosticEngine. hasErrors)
1090- }
1091- }
1092-
10931017 func testExplicitModuleBuildEndToEnd( ) throws {
10941018 try withTemporaryDirectory { path in
10951019 try localFileSystem. changeCurrentWorkingDirectory ( to: path)
0 commit comments