Skip to content

Commit 4077320

Browse files
authored
Merge pull request #347 from tayloraswift/swift-6-stdlib
2 parents 4f7ac8b + e98566c commit 4077320

File tree

58 files changed

+889
-210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+889
-210
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,12 @@ jobs:
3939
--package-name swift-unidoc
4040
4141
macos:
42-
runs-on: macos-14
42+
runs-on: macos-15
4343
name: macOS
4444
env:
4545
UNIDOC_ENABLE_INDEXSTORE: "0"
4646

4747
steps:
48-
- name: Install Swift 6.0
49-
uses: tayloraswift/swift-install-action@master
50-
with:
51-
swift-prefix: "swift-6.0-release/xcode/swift-6.0-RELEASE"
52-
swift-id: "swift-6.0-RELEASE"
53-
5448
- name: Install Unidoc
5549
uses: tayloraswift/swift-unidoc-action@master
5650

.github/workflows/package.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,9 @@ on:
99

1010
jobs:
1111
macos:
12-
runs-on: macos-14
12+
runs-on: macos-15
1313
name: macOS
1414
steps:
15-
- name: Install Swift 6.0
16-
uses: tayloraswift/swift-install-action@master
17-
with:
18-
swift-prefix: "swift-6.0-release/xcode/swift-6.0-RELEASE"
19-
swift-id: "swift-6.0-RELEASE"
20-
2115
- name: Checkout repository
2216
uses: actions/checkout@v3
2317

.github/workflows/test.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,12 @@ jobs:
3737
/bin/bash .github/pipeline
3838
3939
macos:
40-
runs-on: macos-14
40+
runs-on: macos-15
4141
name: macOS
4242
env:
4343
UNIDOC_ENABLE_INDEXSTORE: "1"
4444

4545
steps:
46-
- name: Install Swift 6.0
47-
uses: tayloraswift/swift-install-action@master
48-
with:
49-
swift-prefix: "swift-6.0-release/xcode/swift-6.0-RELEASE"
50-
swift-id: "swift-6.0-RELEASE"
51-
5246
- name: Checkout repository
5347
uses: actions/checkout@v3
5448

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.testing
66
.unidoc
77
.vscode
8+
.DS_Store
89

910
unidoc/
1011
swiftpm/

Sources/Availability/Domains/Availability.PlatformDomain.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ extension Availability
55
@frozen public
66
enum PlatformDomain:String, CaseIterable, Equatable, Hashable, Sendable
77
{
8+
case bridgeOS
89
case iOS
910
case macOS
1011
case macCatalyst
@@ -37,6 +38,7 @@ extension Availability.PlatformDomain:CustomStringConvertible
3738
{
3839
switch self
3940
{
41+
case .bridgeOS: "bridgeOS"
4042
case .iOS: "iOS"
4143
case .macOS: "macOS"
4244
case .macCatalyst: "Mac Catalyst"

Sources/SourceDiagnostics/Emission/DiagnosticLevel.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ enum DiagnosticLevel:Equatable, Hashable, Comparable
44
case note
55
case warning
66
case error
7+
case fatal
78
}
89
extension DiagnosticLevel:CustomStringConvertible
910
{
@@ -15,6 +16,7 @@ extension DiagnosticLevel:CustomStringConvertible
1516
case .note: "note"
1617
case .warning: "warning"
1718
case .error: "error"
19+
case .fatal: "fatal"
1820
}
1921
}
2022
}
@@ -27,6 +29,7 @@ extension DiagnosticLevel
2729
case .note: .rgb(150, 150, 150)
2830
case .warning: .magenta
2931
case .error: .red
32+
case .fatal: .red
3033
}
3134
}
3235
}

Sources/SymbolGraphBuilder/Builds/SSGC.PackageBuild.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,7 @@ extension SSGC.PackageBuild
326326
throw SSGC.PackageBuildError.swift_build(code, invocation)
327327
}
328328

329-
let platform:SymbolGraphMetadata.Platform = try toolchain.platform()
330-
var packages:SSGC.PackageGraph = .init(platform: platform)
329+
var packages:SSGC.PackageGraph = .init(platform: try toolchain.platform())
331330

332331
for pin:SPM.DependencyPin in pins
333332
{
@@ -341,13 +340,17 @@ extension SSGC.PackageBuild
341340
packages.attach(manifest, as: pin.identity)
342341
}
343342

343+
let standardLibrary:SSGC.StandardLibrary = .init(platform: packages.platform,
344+
version: toolchain.splash.swift.version.minor)
345+
344346
let modules:SSGC.ModuleGraph = try packages.join(dependencies: pins,
347+
standardLibrary: standardLibrary,
345348
with: &manifest,
346349
as: self.id.package)
347350

348351
// Dump the standard library’s symbols, unless they’re already cached.
349352
let artifactsCached:FilePath.Directory = try toolchain.dump(
350-
standardLibrary: .init(platform: platform),
353+
standardLibrary: standardLibrary,
351354
cache: cache)
352355
for (module, include):(Symbol.Module, [FilePath.Directory]) in try self.modulesToDump(
353356
among: modules)

Sources/SymbolGraphBuilder/SSGC.Logger.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ extension SSGC.Logger:DiagnosticLogger
5050
}
5151

5252
case .ignoreErrors:
53-
break
53+
if messages.status >= .fatal
54+
{
55+
self.failed = true
56+
}
5457

5558
case .demoteErrors:
5659
messages.demoteErrors(to: .warning)

Sources/SymbolGraphBuilder/SSGC.PackageGraph.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ extension SSGC.PackageGraph
110110

111111
consuming
112112
func join(dependencies pins:[SPM.DependencyPin],
113+
standardLibrary:SSGC.StandardLibrary,
113114
with sinkManifest:inout SPM.Manifest,
114115
as id:Symbol.Package) throws -> SSGC.ModuleGraph
115116
{
@@ -144,8 +145,6 @@ extension SSGC.PackageGraph
144145
print("\(i + 1). \(package)")
145146
}
146147

147-
let standardLibrary:SSGC.StandardLibrary = .init(platform: self.platform)
148-
149148
return try .init(
150149
standardLibrary: standardLibrary.modules.map(SSGC.ModuleLayout.init(toolchain:)),
151150
sparseEdges: self.sparseEdges,

Sources/SymbolGraphBuilder/Sources/SSGC.DocumentationSources.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ extension SSGC.DocumentationSources
115115
{
116116
$0 + $1.declarations.reduce(0) { $0 + $1.decls.count }
117117
})
118+
re-exports : \(moduleIndexes.reduce(0) { $0 + $1.reexports.count })
118119
extensions : \(moduleIndexes.reduce(0) { $0 + $1.extensions.count })
119120
""")
120121
}
@@ -169,7 +170,11 @@ extension SSGC.DocumentationSources
169170
Linked documentation!
170171
time loading sources : \(profiler.loadingSources)
171172
time linking : \(profiler.linking)
172-
symbols : \(graph.decls.symbols.count)
173+
symbols : \(graph.decls.symbols.count)
174+
redirects : \
175+
\(graph.cultures.reduce(0) { $0 + $1.reexports.unhashed.count })
176+
redirects (hashed) : \
177+
\(graph.cultures.reduce(0) { $0 + $1.reexports.hashed.count })
173178
""")
174179

175180
return graph

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

Lines changed: 127 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import SemanticVersions
12
import SymbolGraphs
23

34
extension SSGC
@@ -18,20 +19,22 @@ extension SSGC
1819
}
1920
extension SSGC.StandardLibrary
2021
{
21-
init(platform:SymbolGraphMetadata.Platform)
22+
init(platform:SymbolGraphMetadata.Platform, version:MinorVersion)
2223
{
23-
switch platform
24+
switch (platform, version)
2425
{
25-
case .macOS: self = .macOS
26-
case .linux: self = .linux
27-
default: fatalError("Unsupported platform: \(platform)")
26+
case (.linux, .v(6, 0)): self = .linux_6_0
27+
case (.linux, _): self = .linux_5_10
28+
case (.macOS, .v(6, 0)): self = .macOS_6_0
29+
case (.macOS, _): self = .macOS_5_10
30+
default: fatalError("Unsupported platform: \(platform)")
2831
}
2932
}
3033
}
3134
// https://forums.swift.org/t/dependency-graph-of-the-standard-library-modules/59267
3235
extension SSGC.StandardLibrary
3336
{
34-
static var macOS:Self
37+
static var macOS_5_10:Self
3538
{
3639
.init(
3740
products: [
@@ -71,7 +74,7 @@ extension SSGC.StandardLibrary
7174
])
7275
}
7376

74-
static var linux:Self
77+
static var linux_5_10:Self
7578
{
7679
.init(
7780
products: [
@@ -131,3 +134,120 @@ extension SSGC.StandardLibrary
131134
])
132135
}
133136
}
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+
}
184+
185+
static var linux_6_0:Self
186+
{
187+
.init(
188+
products: [
189+
.init(name: "__stdlib__", type: .library(.automatic),
190+
dependencies: [],
191+
cultures: [Int].init(0 ... 8)),
192+
.init(name: "__corelibs__", type: .library(.automatic),
193+
dependencies: [],
194+
cultures: [Int].init(0 ... 16)),
195+
],
196+
modules: [
197+
// 0:
198+
.toolchain(module: "Swift"),
199+
// 1:
200+
.toolchain(module: "_Concurrency",
201+
dependencies: 0),
202+
// 2:
203+
.toolchain(module: "Distributed",
204+
dependencies: 0, 1),
205+
206+
// 3:
207+
.toolchain(module: "_Differentiation",
208+
dependencies: 0),
209+
210+
// 4:
211+
.toolchain(module: "_RegexParser",
212+
dependencies: 0),
213+
// 5:
214+
.toolchain(module: "_StringProcessing",
215+
dependencies: 0, 4),
216+
// 6:
217+
.toolchain(module: "RegexBuilder",
218+
dependencies: 0, 4, 5),
219+
// 7:
220+
.toolchain(module: "Synchronization",
221+
dependencies: 0),
222+
// 8:
223+
.toolchain(module: "Cxx",
224+
dependencies: 0),
225+
226+
// 9:
227+
.toolchain(module: "Dispatch",
228+
dependencies: 0),
229+
// 10:
230+
.toolchain(module: "DispatchIntrospection",
231+
dependencies: 0, 9),
232+
// 11:
233+
.toolchain(module: "FoundationEssentials",
234+
dependencies: 0, 4, 5, 9),
235+
// 12:
236+
.toolchain(module: "FoundationInternationalization",
237+
dependencies: 0, 4, 5, 9, 11),
238+
// 13:
239+
.toolchain(module: "Foundation",
240+
dependencies: 0, 4, 5, 9, 11, 12),
241+
// 14:
242+
.toolchain(module: "FoundationNetworking",
243+
dependencies: 0, 4, 5, 9, 11, 12, 13),
244+
// 15:
245+
.toolchain(module: "FoundationXML",
246+
dependencies: 0, 4, 5, 9, 11, 12, 13),
247+
248+
// 16:
249+
.toolchain(module: "XCTest",
250+
dependencies: 0, 4, 5, 9, 11, 12, 13),
251+
])
252+
}
253+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ extension SSGC.StandardLibraryBuild:SSGC.DocumentationBuild
2424
with toolchain:SSGC.Toolchain,
2525
clean _:Bool) throws -> (SymbolGraphMetadata, any SSGC.DocumentationSources)
2626
{
27-
let standardLibrary:SSGC.StandardLibrary = .init(platform: try toolchain.platform())
27+
let standardLibrary:SSGC.StandardLibrary = .init(platform: try toolchain.platform(),
28+
version: toolchain.splash.swift.version.minor)
2829

2930
let artifacts:FilePath.Directory = try toolchain.dump(standardLibrary: standardLibrary,
3031
cache: cache)

0 commit comments

Comments
 (0)