@@ -23,18 +23,22 @@ extension SSGC
23
23
private
24
24
let paths : Paths
25
25
26
+ private
27
+ let recoverFromAppleBugs : Bool
26
28
private
27
29
let pretty : Bool
28
30
29
31
public
30
32
init ( appleSDK: AppleSDK ? ,
31
33
splash: Splash ,
32
34
paths: Paths ,
35
+ recoverFromAppleBugs: Bool ,
33
36
pretty: Bool )
34
37
{
35
38
self . appleSDK = appleSDK
36
39
self . splash = splash
37
40
self . paths = paths
41
+ self . recoverFromAppleBugs = recoverFromAppleBugs
38
42
self . pretty = pretty
39
43
}
40
44
}
@@ -44,6 +48,7 @@ extension SSGC.Toolchain
44
48
public static
45
49
func detect( appleSDK: SSGC . AppleSDK ? = nil ,
46
50
paths: Paths = . init( swiftPM: nil , usr: nil ) ,
51
+ recoverFromAppleBugs: Bool = true ,
47
52
pretty: Bool = false ) throws -> Self
48
53
{
49
54
let ( readable, writable) : ( FileDescriptor , FileDescriptor ) = try FileDescriptor . pipe ( )
@@ -58,6 +63,7 @@ extension SSGC.Toolchain
58
63
return . init( appleSDK: appleSDK,
59
64
splash: try . init( parsing: try readable. read ( buffering: 1024 ) ) ,
60
65
paths: paths,
66
+ recoverFromAppleBugs: recoverFromAppleBugs,
61
67
pretty: pretty)
62
68
}
63
69
}
@@ -303,25 +309,40 @@ extension SSGC.Toolchain
303
309
{
304
310
try extractor ( )
305
311
}
306
- catch SystemProcessError . exit( 139 , _)
307
- {
308
- print ( """
309
- Failed to dump symbols for module ' \( id) ' due to SIGSEGV \
310
- from 'swift symbolgraph-extract'. This is a known bug in the Apple Swift \
311
- compiler; see https://github.com/apple/swift/issues/68767.
312
- """ )
313
- }
314
- catch SystemProcessError . exit( 134 , _)
315
- {
316
- print ( """
317
- Failed to dump symbols for module ' \( id) ' due to SIGABRT \
318
- from 'swift symbolgraph-extract'. This is a known bug in the Apple Swift \
319
- compiler; see https://github.com/swiftlang/swift/issues/75318.
320
- """ )
321
- }
322
312
catch SystemProcessError . exit( let code, let invocation)
323
313
{
324
- throw SSGC . PackageBuildError. swift_symbolgraph_extract ( code, invocation)
314
+ guard self . recoverFromAppleBugs
315
+ else
316
+ {
317
+ throw SSGC . PackageBuildError. swift_symbolgraph_extract ( code, invocation)
318
+ }
319
+
320
+ switch code
321
+ {
322
+ case 139 :
323
+ print ( """
324
+ Failed to dump symbols for module ' \( id) ' due to SIGSEGV \
325
+ from 'swift symbolgraph-extract'. \
326
+ This is a known bug in the Apple Swift compiler; see \
327
+ https://github.com/apple/swift/issues/68767.
328
+ """ )
329
+ case 134 :
330
+ print ( """
331
+ Failed to dump symbols for module ' \( id) ' due to SIGABRT \
332
+ from 'swift symbolgraph-extract'. \
333
+ This is a known bug in the Apple Swift compiler; see \
334
+ https://github.com/swiftlang/swift/issues/75318.
335
+ """ )
336
+
337
+ case let code:
338
+ print ( """
339
+ Failed to dump symbols for module ' \( id) ' due to exit code \( code) \
340
+ from 'swift symbolgraph-extract'. \
341
+ If the output above indicates 'swift symbolgraph-extract' exited \
342
+ gracefully, this is most likely because the module.modulemap file declares \
343
+ a different module name than we detected from the package manifest.
344
+ """ )
345
+ }
325
346
}
326
347
}
327
348
}
0 commit comments