Skip to content

Commit 2985a43

Browse files
authored
Merge pull request #389 from tayloraswift/warn-uninitialized-db
warn when no compatible versions of the standard library were found
2 parents 6700e6e + 20357f6 commit 2985a43

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/UnidocUI/Endpoints/Docs/Unidoc.DocsEndpoint.PackagePage.swift

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,26 @@ extension Unidoc.DocsEndpoint.PackagePage:Unidoc.ApicalPage
116116
} = "Repo details and more versions"
117117
}
118118

119-
if !self.volume.dependencies.isEmpty
119+
// Every package should have at least one dependency, the standard library.
120+
main[.h2] = Heading.dependencies
121+
main[.table]
120122
{
121-
main[.h2] = Heading.dependencies
122-
main[.table]
123+
$0.class = "dependencies"
124+
} = Unidoc.DependencyTable.init(
125+
dependencies: self.volume.dependencies,
126+
context: self.context)
127+
128+
if !(self.volume.dependencies.contains { $0.exonym == .swift })
129+
{
130+
main[.section, { $0.class = "signage deprecation" }]
123131
{
124-
$0.class = "dependencies"
125-
} = Unidoc.DependencyTable.init(
126-
dependencies: self.volume.dependencies,
127-
context: self.context)
132+
$0[.p] = """
133+
This symbol graph was not linked against the Swift standard library! \
134+
Check that you have correctly initialized the database with at least one copy \
135+
of a standard library generated from the same or a newer version of Swift as \
136+
was used to build this symbol graph.
137+
"""
138+
}
128139
}
129140

130141
main[.h2] = Heading.platforms

0 commit comments

Comments
 (0)