Skip to content

Commit 312ad0f

Browse files
committed
blacklist _CertificateInternals, it crashes the compiler
1 parent 833f534 commit 312ad0f

File tree

3 files changed

+63
-64
lines changed

3 files changed

+63
-64
lines changed

Sources/SymbolGraphBuilder/Artifacts/Artifacts.CultureError.swift

Lines changed: 0 additions & 21 deletions
This file was deleted.

Sources/SymbolGraphBuilder/Artifacts/Artifacts.swift

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,14 @@ extension Artifacts
7676
label = "\(language) module"
7777
}
7878

79-
print("Dumping symbols for module '\(sources.module.id)' (\(label))")
79+
switch sources.module.id
80+
{
81+
case "_CertificateInternals": // unbuildable, from swift-certificates 1.0.0
82+
continue
83+
84+
case let name:
85+
print("Dumping symbols for module '\(name)' (\(label))")
86+
}
8087

8188
var arguments:[String] =
8289
[
@@ -103,55 +110,47 @@ extension Artifacts
103110
try await SystemProcess.init(command: "swift", arguments: arguments)()
104111
}
105112

106-
let blacklisted:Set<ModuleIdentifier> =
107-
[
108-
"CDispatch", // too low-level
109-
"CFURLSessionInterface", // too low-level
110-
"CFXMLInterface", // too low-level
111-
"CoreFoundation", // too low-level
112-
"Glibc", // linux-gnu specific
113-
"SwiftGlibc", // linux-gnu specific
114-
"SwiftOnoneSupport", // contains no symbols
115-
"SwiftOverlayShims", // too low-level
116-
"SwiftShims", // contains no symbols
117-
"XCTest", // site policy
118-
"_Builtin_intrinsics", // contains only one symbol, free(_:)
119-
"_Builtin_stddef_max_align_t", // contains only two symbols
120-
"_InternalStaticMirror", // unbuildable
121-
"_InternalSwiftScan", // unbuildable
122-
"_SwiftConcurrencyShims", // contains only two symbols
123-
"std", // unbuildable
124-
]
125-
126113
var parts:[ModuleIdentifier: [SymbolGraphPart.ID]] = [:]
127114
for part:Result<FilePath.Component, any Error> in output.path.directory
128115
{
129116
// We don’t want to *parse* the JSON yet to discover the culture,
130117
// because the JSON can be very large, and parsing JSON is very
131118
// expensive (compared to parsing BSON). So we trust that the file
132119
// name is correct and indicates what is contained within the file.
133-
if let id:SymbolGraphPart.ID = .init("\(try part.get())"),
134-
!blacklisted.contains(id.namespace)
120+
if let id:SymbolGraphPart.ID = .init("\(try part.get())")
135121
{
136-
parts[id.culture, default: []].append(id)
122+
switch id.namespace
123+
{
124+
case "CDispatch", // too low-level
125+
"CFURLSessionInterface", // too low-level
126+
"CFXMLInterface", // too low-level
127+
"CoreFoundation", // too low-level
128+
"Glibc", // linux-gnu specific
129+
"SwiftGlibc", // linux-gnu specific
130+
"SwiftOnoneSupport", // contains no symbols
131+
"SwiftOverlayShims", // too low-level
132+
"SwiftShims", // contains no symbols
133+
"XCTest", // site policy
134+
"_Builtin_intrinsics", // contains only one symbol, free(_:)
135+
"_Builtin_stddef_max_align_t", // contains only two symbols
136+
"_InternalStaticMirror", // unbuildable
137+
"_InternalSwiftScan", // unbuildable
138+
"_SwiftConcurrencyShims", // contains only two symbols
139+
"std": // unbuildable
140+
continue
141+
142+
default:
143+
parts[id.culture, default: []].append(id)
144+
}
137145
}
138146
}
139147

140-
return try modules.map
148+
return modules.map
141149
{
142-
let parts:[SymbolGraphPart.ID]? = parts[$0.module.id]
143-
if case .swift = $0.language,
144-
case nil = parts
145-
{
146-
throw Artifacts.CultureError.empty($0.module.id)
147-
}
148-
else
149-
{
150-
return .init($0.module,
151-
articles: $0.articles,
152-
artifacts: output.path,
153-
parts: parts ?? [])
154-
}
150+
.init($0.module,
151+
articles: $0.articles,
152+
artifacts: output.path,
153+
parts: parts[$0.module.id, default: []])
155154
}
156155
}
157156
}

Sources/UnidocBuild/Main.swift

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ enum Main
2424
niossl: niossl,
2525
remote: options.remote)
2626

27-
let swiftinit:SwiftinitClient = .init(http2: http2)
27+
let swiftinit:SwiftinitClient = .init(http2: http2, cookie: options.cookie)
2828

2929
let status:PackageBuildStatus = try await swiftinit.get(
3030
from: "/api/build/\(options.package)")
@@ -42,12 +42,14 @@ extension Main
4242
struct Options
4343
{
4444
var package:PackageIdentifier
45+
var cookie:String
4546
var remote:String
4647

4748
private
4849
init(package:PackageIdentifier)
4950
{
5051
self.package = package
52+
self.cookie = ""
5153
self.remote = "swiftinit.org"
5254
}
5355
}
@@ -72,6 +74,16 @@ extension Main.Options
7274
{
7375
switch option
7476
{
77+
case "--cookie", "-i":
78+
guard
79+
let cookie:String = arguments.popFirst()
80+
else
81+
{
82+
fatalError("Expected cookie after '\(option)'")
83+
}
84+
85+
options.cookie = cookie
86+
7587
case "--remote", "-h":
7688
guard
7789
let remote:String = arguments.popFirst()
@@ -98,11 +110,14 @@ struct SwiftinitClient
98110
{
99111
@usableFromInline internal
100112
let http2:HTTP2Client
113+
@usableFromInline internal
114+
let cookie:String
101115

102116
@inlinable public
103-
init(http2:HTTP2Client)
117+
init(http2:HTTP2Client, cookie:String)
104118
{
105119
self.http2 = http2
120+
self.cookie = cookie
106121
}
107122
}
108123
extension SwiftinitClient
@@ -112,7 +127,9 @@ extension SwiftinitClient
112127
{
113128
try await self.http2.connect
114129
{
115-
try await body(Connection.init(http2: $0, to: self.http2.remote))
130+
try await body(Connection.init(http2: $0,
131+
cookie: self.cookie,
132+
remote: self.http2.remote))
116133
}
117134
}
118135
}
@@ -137,12 +154,15 @@ extension SwiftinitClient
137154
@usableFromInline internal
138155
let http2:HTTP2Client.Connection
139156
@usableFromInline internal
157+
let cookie:String
158+
@usableFromInline internal
140159
let remote:String
141160

142161
@inlinable internal
143-
init(http2:HTTP2Client.Connection, to remote:String)
162+
init(http2:HTTP2Client.Connection, cookie:String, remote:String)
144163
{
145164
self.http2 = http2
165+
self.cookie = cookie
146166
self.remote = remote
147167
}
148168
}
@@ -167,7 +187,8 @@ extension SwiftinitClient.Connection
167187
":path": endpoint,
168188

169189
"user-agent": "UnidocBuild",
170-
//"accept": "application/json"
190+
"accept": "application/json",
191+
"cookie": "__Host-session=\(self.cookie)",
171192
]
172193

173194
let response:HTTP2Client.Facet = try await self.http2.fetch(request)

0 commit comments

Comments
 (0)