Skip to content

Commit b55c2fd

Browse files
committed
add Synchronization and Cxx modules to macOS stdlib
1 parent 6791d9d commit b55c2fd

File tree

3 files changed

+63
-18
lines changed

3 files changed

+63
-18
lines changed

Sources/SymbolGraphBuilder/Standard library/SSGC.StandardLibrary.swift

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extension SSGC.StandardLibrary
2525
{
2626
case (.linux, .v(6, 0)): self = .linux_6_0
2727
case (.linux, _): self = .linux_5_10
28+
case (.macOS, .v(6, 0)): self = .macOS_6_0
2829
case (.macOS, _): self = .macOS_5_10
2930
default: fatalError("Unsupported platform: \(platform)")
3031
}
@@ -132,6 +133,54 @@ extension SSGC.StandardLibrary
132133
dependencies: 0),
133134
])
134135
}
136+
}
137+
extension SSGC.StandardLibrary
138+
{
139+
static var macOS_6_0:Self
140+
{
141+
.init(
142+
products: [
143+
.init(name: "__stdlib__", type: .library(.automatic),
144+
dependencies: [],
145+
cultures: [Int].init(0 ... 6)),
146+
.init(name: "__corelibs__", type: .library(.automatic),
147+
dependencies: [],
148+
cultures: [Int].init(0 ... 9)),
149+
],
150+
modules: [
151+
// 0:
152+
.toolchain(module: "Swift"),
153+
// 1:
154+
.toolchain(module: "_Concurrency",
155+
dependencies: 0),
156+
// 2:
157+
.toolchain(module: "Distributed",
158+
dependencies: 0, 1),
159+
160+
// 3:
161+
.toolchain(module: "_StringProcessing",
162+
dependencies: 0),
163+
// 4:
164+
.toolchain(module: "RegexBuilder",
165+
dependencies: 0, 3),
166+
// 5:
167+
.toolchain(module: "Synchronization",
168+
dependencies: 0),
169+
// 6:
170+
.toolchain(module: "Cxx",
171+
dependencies: 0),
172+
173+
// 7:
174+
.toolchain(module: "Dispatch",
175+
dependencies: 0),
176+
// 8:
177+
.toolchain(module: "DispatchIntrospection",
178+
dependencies: 0, 7),
179+
// 9:
180+
.toolchain(module: "Foundation",
181+
dependencies: 0, 7, 8),
182+
])
183+
}
135184

136185
static var linux_6_0:Self
137186
{
@@ -179,7 +228,7 @@ extension SSGC.StandardLibrary
179228
dependencies: 0),
180229
// 10:
181230
.toolchain(module: "DispatchIntrospection",
182-
dependencies: 0),
231+
dependencies: 0, 9),
183232
// 11:
184233
.toolchain(module: "FoundationEssentials",
185234
dependencies: 0, 4, 5, 9),

Sources/SymbolGraphBuilder/Toolchains/SSGC.Toolchain.SymbolDumpOptions.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@ extension SSGC.Toolchain
55
struct SymbolDumpOptions
66
{
77
var minimumACL:Symbol.ACL
8-
var allowedReexportedModules:[Symbol.Module]
98
var emitExtensionBlockSymbols:Bool
109
var includeInterfaceSymbols:Bool
1110
var skipInheritedDocs:Bool
1211

1312
init(minimumACL:Symbol.ACL = .internal,
14-
allowedReexportedModules:[Symbol.Module] = [],
1513
emitExtensionBlockSymbols:Bool = true,
1614
includeInterfaceSymbols:Bool = true,
1715
skipInheritedDocs:Bool = true)
1816
{
1917
self.minimumACL = minimumACL
20-
self.allowedReexportedModules = allowedReexportedModules
2118
self.emitExtensionBlockSymbols = emitExtensionBlockSymbols
2219
self.includeInterfaceSymbols = includeInterfaceSymbols
2320
self.skipInheritedDocs = skipInheritedDocs

Sources/SymbolGraphBuilder/Toolchains/SSGC.Toolchain.swift

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,7 @@ extension SSGC.Toolchain
218218
/// this methods disables extension block symbols by default.
219219
func dump(
220220
standardLibrary:SSGC.StandardLibrary,
221-
options:SymbolDumpOptions = .init(allowedReexportedModules: [
222-
"_Concurrency",
223-
"_StringProcessing",
224-
"FoundationEssentials",
225-
"FoundationInternationalization",
226-
],
227-
emitExtensionBlockSymbols: false),
221+
options:SymbolDumpOptions = .init(emitExtensionBlockSymbols: false),
228222
cache:FilePath.Directory) throws -> FilePath.Directory
229223
{
230224
let cached:FilePath.Directory = cache / "swift@\(self.splash.swift.version)"
@@ -234,9 +228,16 @@ extension SSGC.Toolchain
234228
let temporary:FilePath.Directory = cache / "swift"
235229
try temporary.create(clean: true)
236230

231+
var dumped:[Symbol.Module] = []
232+
237233
for module:SymbolGraph.Module in standardLibrary.modules
238234
{
239-
try self.dump(module: module.id, to: temporary, options: options)
235+
try self.dump(module: module.id,
236+
to: temporary,
237+
options: options,
238+
allowedReexportedModules: dumped)
239+
240+
dumped.append(module.id)
240241
}
241242

242243
try temporary.move(replacing: cached)
@@ -250,7 +251,8 @@ extension SSGC.Toolchain
250251
func dump(module id:Symbol.Module,
251252
to output:FilePath.Directory,
252253
options:SymbolDumpOptions,
253-
include:[FilePath.Directory] = []) throws
254+
include:[FilePath.Directory] = [],
255+
allowedReexportedModules:[Symbol.Module] = []) throws
254256
{
255257
print("Dumping symbols for module '\(id)'")
256258

@@ -278,12 +280,9 @@ extension SSGC.Toolchain
278280
{
279281
arguments.append("-skip-inherited-docs")
280282
}
281-
if self.splash.swift.version >= .v(6, 0, 0),
282-
// Temporary hack until we have the right stdlib definitions for macOS
283-
self.splash.triple.os.starts(with: "linux"),
284-
!options.allowedReexportedModules.isEmpty
283+
if self.splash.swift.version >= .v(6, 0, 0), !allowedReexportedModules.isEmpty
285284
{
286-
let whitelist:String = options.allowedReexportedModules.lazy.map { "\($0)" }.joined(
285+
let whitelist:String = allowedReexportedModules.lazy.map { "\($0)" }.joined(
287286
separator: ",")
288287

289288
arguments.append("""

0 commit comments

Comments
 (0)