@@ -395,6 +395,9 @@ public struct Driver {
395
395
396
396
/// Path to the Swift module source information file.
397
397
let moduleSourceInfoPath : VirtualPath . Handle ?
398
+
399
+ /// Path to the emitted API descriptor file.
400
+ let apiDescriptorFilePath : VirtualPath . Handle ?
398
401
}
399
402
400
403
private static func computeModuleOutputPaths(
@@ -424,6 +427,24 @@ public struct Driver {
424
427
moduleName: moduleOutputInfo. name,
425
428
projectDirectory: projectDirectory)
426
429
430
+ // ---------------------
431
+ // API Descriptor Path
432
+ let apiDescriptorFilePath : VirtualPath . Handle ?
433
+ if let apiDescriptorDirectory = apiDescriptorDirectory {
434
+ apiDescriptorFilePath = apiDescriptorDirectory
435
+ . appending ( component: " \( moduleOutputInfo. name) . \( target. moduleTriple. triple) .swift.sdkdb " )
436
+ . intern ( )
437
+ } else {
438
+ apiDescriptorFilePath = try Self . computeSupplementaryOutputPath (
439
+ & parsedOptions, type: . jsonAPIDescriptor, isOutputOptions: [ ] ,
440
+ outputPath: . emitApiDescriptorPath,
441
+ compilerOutputType: compilerOutputType,
442
+ compilerMode: compilerMode,
443
+ emitModuleSeparately: emitModuleSeparately,
444
+ outputFileMap: outputFileMap,
445
+ moduleName: moduleOutputInfo. name)
446
+ }
447
+
427
448
// ---------------------
428
449
// Swift interface paths
429
450
let swiftInterfacePath = try Self . computeSupplementaryOutputPath (
@@ -492,6 +513,7 @@ public struct Driver {
492
513
swiftPrivateInterfacePath: swiftPrivateInterfacePath,
493
514
swiftPackageInterfacePath: swiftPackageInterfacePath,
494
515
moduleSourceInfoPath: moduleSourceInfoPath)
516
+ apiDescriptorFilePath: apiDescriptorFilePath)
495
517
}
496
518
497
519
/// Structure storing paths to supplemental outputs for the target module
@@ -509,8 +531,6 @@ public struct Driver {
509
531
/// Path to the module's digester baseline file.
510
532
let digesterBaselinePath : VirtualPath . Handle ?
511
533
512
- /// Path to the emitted API descriptor file.
513
- let apiDescriptorFilePath : VirtualPath . Handle ?
514
534
515
535
/// The mode the API digester should run in.
516
536
let digesterMode : DigesterMode
@@ -1151,6 +1171,13 @@ public struct Driver {
1151
1171
moduleOutputPath: moduleOutputInfo. output? . outputPath,
1152
1172
fileSystem: self . fileSystem)
1153
1173
1174
+ var apiDescriptorDirectory : VirtualPath ? = nil
1175
+ if let apiDescriptorDirectoryEnvVar = env [ " TAPI_SDKDB_OUTPUT_PATH " ] {
1176
+ apiDescriptorDirectory = try VirtualPath ( path: apiDescriptorDirectoryEnvVar)
1177
+ } else if let ldTraceFileEnvVar = env [ " LD_TRACE_FILE " ] {
1178
+ apiDescriptorDirectory = try VirtualPath ( path: ldTraceFileEnvVar) . parentDirectory. appending ( component: " SDKDB " )
1179
+ }
1180
+
1154
1181
self . moduleOutputPaths = try Self . computeModuleOutputPaths (
1155
1182
& parsedOptions,
1156
1183
moduleName: moduleOutputInfo. name,
@@ -1161,8 +1188,11 @@ public struct Driver {
1161
1188
emitModuleSeparately: emitModuleSeparately,
1162
1189
outputFileMap: self . outputFileMap,
1163
1190
projectDirectory: projectDirectory)
1191
+ apiDescriptorDirectory: apiDescriptorDirectory,
1192
+ target: frontendTargetInfo. target)
1164
1193
1165
1194
if let variantModuleOutputInfo = self . variantModuleOutputInfo {
1195
+ let targetVariant = self . frontendTargetInfo. targetVariant {
1166
1196
self . variantModuleOutputPaths = try Self . computeModuleOutputPaths (
1167
1197
& parsedOptions,
1168
1198
moduleName: variantModuleOutputInfo. name,
@@ -1172,7 +1202,9 @@ public struct Driver {
1172
1202
compilerMode: compilerMode,
1173
1203
emitModuleSeparately: true , // variant module is always independent
1174
1204
outputFileMap: self . outputFileMap,
1175
- projectDirectory: projectDirectory)
1205
+ projectDirectory: projectDirectory,
1206
+ apiDescriptorDirectory: apiDescriptorDirectory,
1207
+ target: targetVariant)
1176
1208
} else {
1177
1209
self . variantModuleOutputPaths = nil
1178
1210
}
@@ -1210,27 +1242,6 @@ public struct Driver {
1210
1242
outputFileMap: self . outputFileMap,
1211
1243
moduleName: moduleOutputInfo. name)
1212
1244
1213
- var apiDescriptorDirectory : VirtualPath ? = nil
1214
- if let apiDescriptorDirectoryEnvVar = env [ " TAPI_SDKDB_OUTPUT_PATH " ] {
1215
- apiDescriptorDirectory = try VirtualPath ( path: apiDescriptorDirectoryEnvVar)
1216
- } else if let ldTraceFileEnvVar = env [ " LD_TRACE_FILE " ] {
1217
- apiDescriptorDirectory = try VirtualPath ( path: ldTraceFileEnvVar) . parentDirectory. appending ( component: " SDKDB " )
1218
- }
1219
- if let apiDescriptorDirectory = apiDescriptorDirectory {
1220
- self . apiDescriptorFilePath = apiDescriptorDirectory
1221
- . appending ( component: " \( moduleOutputInfo. name) . \( frontendTargetInfo. target. moduleTriple. triple) .swift.sdkdb " )
1222
- . intern ( )
1223
- } else {
1224
- self . apiDescriptorFilePath = try Self . computeSupplementaryOutputPath (
1225
- & parsedOptions, type: . jsonAPIDescriptor, isOutputOptions: [ ] ,
1226
- outputPath: . emitApiDescriptorPath,
1227
- compilerOutputType: compilerOutputType,
1228
- compilerMode: compilerMode,
1229
- emitModuleSeparately: emitModuleSeparately,
1230
- outputFileMap: self . outputFileMap,
1231
- moduleName: moduleOutputInfo. name)
1232
- }
1233
-
1234
1245
Self . validateDigesterArgs ( & parsedOptions,
1235
1246
moduleOutputInfo: moduleOutputInfo,
1236
1247
digesterMode: self . digesterMode,
0 commit comments