12
12
import TSCBasic
13
13
import SwiftOptions
14
14
15
+ func isIosMac( _ path: TypedVirtualPath ) -> Bool {
16
+ // Infer macabi interfaces by the file name.
17
+ // FIXME: more robust way to do this.
18
+ return path. file. basenameWithoutExt. contains ( " macabi " )
19
+ }
20
+
15
21
public class PrebuitModuleGenerationDelegate : JobExecutionDelegate {
16
22
var failingModules = Set < String > ( )
23
+ var succeededJobs : [ Job ] = [ ]
17
24
var commandMap : [ Int : String ] = [ : ]
18
25
let diagnosticsEngine : DiagnosticsEngine
19
26
let verbose : Bool
@@ -22,6 +29,13 @@ public class PrebuitModuleGenerationDelegate: JobExecutionDelegate {
22
29
self . verbose = verbose
23
30
}
24
31
32
+ /// Dangling jobs are macabi-only modules. We should run those jobs if foundation
33
+ /// is built successfully for macabi.
34
+ public var shouldRunDanglingJobs : Bool {
35
+ return succeededJobs. contains { job in
36
+ return isIosMac ( job. outputs [ 0 ] ) && job. moduleName == " Foundation "
37
+ }
38
+ }
25
39
func printJobInfo( _ job: Job , _ start: Bool ) {
26
40
guard verbose else {
27
41
return
@@ -54,6 +68,7 @@ public class PrebuitModuleGenerationDelegate: JobExecutionDelegate {
54
68
case . terminated( code: let code) :
55
69
if code == 0 {
56
70
printJobInfo ( job, false )
71
+ succeededJobs. append ( job)
57
72
} else {
58
73
failingModules. insert ( job. moduleName)
59
74
let result : String = try ! result. utf8stderrOutput ( )
@@ -224,11 +239,6 @@ extension Driver {
224
239
_ inputPath: PrebuiltModuleInput , _ outputPath: PrebuiltModuleOutput ,
225
240
_ dependencies: [ TypedVirtualPath ] ) throws -> Job {
226
241
assert ( inputPath. path. file. basenameWithoutExt == outputPath. path. file. basenameWithoutExt)
227
- func isIosMac( _ path: TypedVirtualPath ) -> Bool {
228
- // Infer macabi interfaces by the file name.
229
- // FIXME: more robust way to do this.
230
- return path. file. basenameWithoutExt. contains ( " macabi " )
231
- }
232
242
var commandLine : [ Job . ArgTemplate ] = [ ]
233
243
commandLine. appendFlag ( . compileModuleFromInterface)
234
244
commandLine. appendFlag ( . sdk)
0 commit comments