@@ -1157,6 +1157,67 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests {
1157
1157
}
1158
1158
}
1159
1159
1160
+ @Test ( . requireSDKs( . macOS) )
1161
+ func swiftModuleCacheFlags( ) async throws {
1162
+ let swiftCompilerPath = try await self . swiftCompilerPath
1163
+ let swiftVersion = try await self . swiftVersion
1164
+ let testProject = TestProject (
1165
+ " aProject " ,
1166
+ groupTree: TestGroup (
1167
+ " SomeFiles " , path: " Sources " ,
1168
+ children: [
1169
+ TestFile ( " Foo.swift " ) ,
1170
+ ] ) ,
1171
+ buildConfigurations: [
1172
+ TestBuildConfiguration (
1173
+ " Debug " ,
1174
+ buildSettings: [
1175
+ " CODE_SIGN_IDENTITY " : " " ,
1176
+ " PRODUCT_NAME " : " $(TARGET_NAME) " ,
1177
+ " GCC_GENERATE_DEBUGGING_SYMBOLS " : " NO " ,
1178
+ " SWIFT_ENABLE_EXPLICIT_MODULES " : " YES " ,
1179
+ " SWIFT_EXPLICIT_MODULES_OUTPUT_PATH " : " /path/to/ExplicitModules " ,
1180
+ ] ) ,
1181
+ ] ,
1182
+ targets: [
1183
+ TestStandardTarget (
1184
+ " CoreFoo " , type: . framework,
1185
+ buildConfigurations: [
1186
+ TestBuildConfiguration ( " Debug " ,
1187
+ buildSettings: [
1188
+ " SDKROOT " : " macosx " ,
1189
+ " SWIFT_VERSION " : swiftVersion,
1190
+ ] ) ,
1191
+ ] ,
1192
+ buildPhases: [
1193
+ TestSourcesBuildPhase ( [
1194
+ " Foo.swift " ,
1195
+ ] ) ,
1196
+ ] )
1197
+ ] )
1198
+ let core = try await getCore ( )
1199
+ let tester = try TaskConstructionTester ( core, testProject)
1200
+
1201
+ let fs = PseudoFS ( )
1202
+
1203
+ try await fs. writeFileContents ( swiftCompilerPath) { $0 <<< " binary " }
1204
+ let arena = ArenaInfo ( derivedDataPath: Path ( " /path/to/DerivedData " ) , buildProductsPath: Path . root, buildIntermediatesPath: Path . root, pchPath: Path . root, indexRegularBuildProductsPath: nil , indexRegularBuildIntermediatesPath: nil , indexPCHPath: Path . root, indexDataStoreFolderPath: nil , indexEnableDataStore: false )
1205
+ await tester. checkBuild ( BuildParameters ( configuration: " Debug " , arena: arena) , runDestination: . macOS, fs: fs) { results in
1206
+ results. checkTarget ( " CoreFoo " ) { target in
1207
+ results. checkTask ( . matchTarget( target) , . matchRuleType( " SwiftDriver Compilation " ) ) { task in
1208
+ task. checkCommandLineContains ( [ " -module-cache-path " , " /path/to/ExplicitModules " ] )
1209
+ if LibSwiftDriver . supportsDriverFlag ( spelled: " -clang-scanner-module-cache-path " ) {
1210
+ task. checkCommandLineContains ( [ " -clang-scanner-module-cache-path " , " /path/to/DerivedData/ModuleCache.noindex " ] )
1211
+ }
1212
+ if LibSwiftDriver . supportsDriverFlag ( spelled: " -sdk-module-cache-path " ) {
1213
+ task. checkCommandLineContains ( [ " -sdk-module-cache-path " , " /path/to/DerivedData/ModuleCache.noindex " ] )
1214
+ }
1215
+ }
1216
+ }
1217
+ results. checkNoDiagnostics ( )
1218
+ }
1219
+ }
1220
+
1160
1221
@Test ( . requireSDKs( . macOS) )
1161
1222
func swiftLTO( ) async throws {
1162
1223
let testProject = try await TestProject (
0 commit comments