@@ -7,61 +7,68 @@ extension SSGC
7
7
@_spi ( testable) public
8
8
struct SymbolDumps
9
9
{
10
- let location : FilePath . Directory
11
- let modules : [ Symbol . Module : [ SymbolGraphPart . ID ] ]
10
+ let modules : [ Symbol . Module : SymbolFiles ]
12
11
13
12
private
14
- init ( location : FilePath . Directory , modules: [ Symbol . Module : [ SymbolGraphPart . ID ] ] )
13
+ init ( modules: [ Symbol . Module : SymbolFiles ] )
15
14
{
16
- self . location = location
17
15
self . modules = modules
18
16
}
19
17
}
20
18
}
21
19
extension SSGC . SymbolDumps
22
20
{
23
21
@_spi ( testable) public
24
- static func collect( from location : FilePath . Directory ) throws -> Self
22
+ static func collect( from locations : FilePath . Directory ... ) throws -> Self
25
23
{
26
- let symbols : [ Symbol . Module : [ SymbolGraphPart . ID ] ] = try location. reduce (
24
+ try . collect( from: locations)
25
+ }
26
+
27
+ static func collect( from locations: [ FilePath . Directory ] ) throws -> Self
28
+ {
29
+ let symbols : [ Symbol . Module : SSGC . SymbolFiles ] = try locations. reduce (
27
30
into: [ : ] )
28
31
{
29
- // We don’t want to *parse* the JSON yet to discover the culture,
30
- // because the JSON can be very large, and parsing JSON is very
31
- // expensive (compared to parsing BSON). So we trust that the file
32
- // name is correct and indicates what is contained within the file.
33
- let filename : FilePath . Component = try $1. get ( )
34
- guard
35
- let id: SymbolGraphPart . ID = . init( " \( filename) " )
36
- else
32
+ for filename : Result < FilePath . Component , any Error > in $1
37
33
{
38
- return
39
- }
34
+ // We don’t want to *parse* the JSON yet to discover the culture,
35
+ // because the JSON can be very large, and parsing JSON is very
36
+ // expensive (compared to parsing BSON). So we trust that the file
37
+ // name is correct and indicates what is contained within the file.
38
+ let filename : FilePath . Component = try filename. get ( )
40
39
41
- switch id. namespace
42
- {
43
- case " CDispatch " , // too low-level
44
- " CFURLSessionInterface " , // too low-level
45
- " CFXMLInterface " , // too low-level
46
- " CoreFoundation " , // too low-level
47
- " Glibc " , // linux-gnu specific
48
- " SwiftGlibc " , // linux-gnu specific
49
- " SwiftOnoneSupport " , // contains no symbols
50
- " SwiftOverlayShims " , // too low-level
51
- " SwiftShims " , // contains no symbols
52
- " _Builtin_intrinsics " , // contains only one symbol, free(_:)
53
- " _Builtin_stddef_max_align_t " , // contains only two symbols
54
- " _InternalStaticMirror " , // unbuildable
55
- " _InternalSwiftScan " , // unbuildable
56
- " _SwiftConcurrencyShims " , // contains only two symbols
57
- " std " : // unbuildable
58
- return
40
+ guard
41
+ let id: SymbolGraphPart . ID = . init( " \( filename) " )
42
+ else
43
+ {
44
+ continue
45
+ }
46
+
47
+ switch id. namespace
48
+ {
49
+ case " CDispatch " , // too low-level
50
+ " CFURLSessionInterface " , // too low-level
51
+ " CFXMLInterface " , // too low-level
52
+ " CoreFoundation " , // too low-level
53
+ " Glibc " , // linux-gnu specific
54
+ " SwiftGlibc " , // linux-gnu specific
55
+ " SwiftOnoneSupport " , // contains no symbols
56
+ " SwiftOverlayShims " , // too low-level
57
+ " SwiftShims " , // contains no symbols
58
+ " _Builtin_intrinsics " , // contains only one symbol, free(_:)
59
+ " _Builtin_stddef_max_align_t " , // contains only two symbols
60
+ " _InternalStaticMirror " , // unbuildable
61
+ " _InternalSwiftScan " , // unbuildable
62
+ " _SwiftConcurrencyShims " , // contains only two symbols
63
+ " std " : // unbuildable
64
+ continue
59
65
60
- default :
61
- $0 [ id. culture, default: [ ] ] . append ( id)
66
+ default :
67
+ $0 [ id. culture, default: . init( location: $1) ] . parts. append ( id)
68
+ }
62
69
}
63
70
}
64
71
65
- return . init( location : location , modules: symbols)
72
+ return . init( modules: symbols)
66
73
}
67
74
}
0 commit comments