Skip to content

Commit 9c48e70

Browse files
authored
Merge pull request #7 from tayloraswift/package-indexing
Package indexing
2 parents ef31c79 + 30b2ce1 commit 9c48e70

File tree

180 files changed

+2809
-2099
lines changed

Some content is hidden

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

180 files changed

+2809
-2099
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.build
2+
.massbuild
23
.testing
34
.unidoc
45
.vscode

Assets/css/Main.css

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

Assets/css/Main.css.map

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

Assets/js/Main.js

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

Assets/js/Main.js.map

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

Package.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,12 @@ let package:Package = .init(
347347
[
348348
.target(name: "FNV1"),
349349
.target(name: "SymbolGraphs"),
350-
.target(name: "URI"),
351350
]),
352351

353352
.target(name: "UnidocSelectors", dependencies:
354353
[
355354
.target(name: "UnidocRecords"),
355+
.target(name: "URI"),
356356
]),
357357

358358
.target(name: "URI", dependencies:
@@ -367,6 +367,11 @@ let package:Package = .init(
367367
]),
368368

369369

370+
.executableTarget(name: "Massbuild", dependencies:
371+
[
372+
.target(name: "SymbolGraphBuilder"),
373+
]),
374+
370375
.executableTarget(name: "UnidocServer", dependencies:
371376
[
372377
.target(name: "Multiparts"),
@@ -496,12 +501,6 @@ let package:Package = .init(
496501
.product(name: "MongoTesting", package: "swift-mongodb"),
497502
]),
498503

499-
.executableTarget(name: "UnidocSelectorTests", dependencies:
500-
[
501-
.target(name: "UnidocSelectors"),
502-
.product(name: "Testing", package: "swift-grammar"),
503-
]),
504-
505504
.executableTarget(name: "URITests", dependencies:
506505
[
507506
.target(name: "URI"),

Sources/HTMLStreaming/Optional (ext).swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import HTMLDOM
22

3-
infix operator ?= : AssignmentPrecedence
4-
53
extension Optional where Wrapped:HyperTextOutputStreamable
64
{
75
@inlinable public static

Sources/HTMLStreaming/lexemes.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
infix operator ?= : AssignmentPrecedence

Sources/Massbuild/Main.swift

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
import SymbolGraphBuilder
2+
3+
@main
4+
enum Main
5+
{
6+
public static
7+
func main() async throws
8+
{
9+
let builder:Massbuilder = try await .init()
10+
11+
try await builder.buildStandardLibrary()
12+
13+
try await builder.buildLiterature()
14+
15+
try await builder.build("swift-atomics",
16+
repository: "https://github.com/apple/swift-atomics.git",
17+
versions:
18+
"1.0.2",
19+
"1.1.0")
20+
21+
try await builder.build("swift-collections",
22+
repository: "https://github.com/apple/swift-collections.git",
23+
versions:
24+
"1.0.2")
25+
26+
try await builder.build("swift-numerics",
27+
repository: "https://github.com/apple/swift-numerics.git",
28+
versions:
29+
"1.0.2")
30+
31+
try await builder.build("swift-algorithms",
32+
repository: "https://github.com/apple/swift-algorithms.git",
33+
versions:
34+
"1.0.0")
35+
36+
try await builder.build("swift-argument-parser",
37+
repository: "https://github.com/apple/swift-argument-parser.git",
38+
versions:
39+
"1.1.3")
40+
41+
try await builder.build("swift-markdown",
42+
repository: "https://github.com/apple/swift-markdown.git",
43+
versions:
44+
"0.2.0")
45+
46+
try await builder.build("swift-syntax",
47+
repository: "https://github.com/apple/swift-syntax.git",
48+
versions:
49+
"508.0.1")
50+
51+
try await builder.build("swift-system",
52+
repository: "https://github.com/apple/swift-system.git",
53+
versions:
54+
"1.1.0",
55+
"1.1.1",
56+
"1.2.0",
57+
"1.2.1")
58+
59+
try await builder.build("swift-nio",
60+
repository: "https://github.com/apple/swift-nio.git",
61+
versions:
62+
"2.38.0",
63+
"2.39.0",
64+
"2.40.0",
65+
"2.41.0",
66+
"2.42.0",
67+
"2.43.0",
68+
"2.44.0",
69+
"2.45.0",
70+
"2.46.0",
71+
"2.47.0",
72+
"2.48.0")
73+
74+
try await builder.build("swift-nio-ssl",
75+
repository: "https://github.com/apple/swift-nio-ssl.git",
76+
versions:
77+
"2.20.2",
78+
"2.21.0",
79+
"2.22.0",
80+
"2.23.0",
81+
"2.24.0",
82+
"2.25.0")
83+
84+
try await builder.build("swift-log",
85+
repository: "https://github.com/apple/swift-log.git",
86+
versions:
87+
"1.4.2",
88+
"1.4.3",
89+
"1.4.4",
90+
"1.5.0",
91+
"1.5.1",
92+
"1.5.2",
93+
"1.5.3")
94+
95+
try await builder.build("swift-metrics",
96+
repository: "https://github.com/apple/swift-metrics.git",
97+
versions:
98+
"2.3.1",
99+
"2.3.2",
100+
"2.3.3",
101+
"2.3.4",
102+
"2.4.0",
103+
"2.4.1")
104+
105+
try await builder.build("swift-hash",
106+
repository: "https://github.com/tayloraswift/swift-hash.git",
107+
versions:
108+
"v0.2.3")
109+
110+
try await builder.build("swift-dom",
111+
repository: "https://github.com/tayloraswift/swift-dom.git",
112+
versions:
113+
"v0.5.0")
114+
115+
try await builder.build("swift-grammar",
116+
repository: "https://github.com/tayloraswift/swift-grammar.git",
117+
versions:
118+
"v0.1.4",
119+
"v0.1.5",
120+
"v0.2.0")
121+
122+
try await builder.build("swift-json",
123+
repository: "https://github.com/tayloraswift/swift-json.git",
124+
versions:
125+
"v0.2.2",
126+
"v0.3.0")
127+
128+
try await builder.build("bson",
129+
repository: "https://github.com/orlandos-nl/bson.git",
130+
versions:
131+
"8.0.1",
132+
"8.0.10")
133+
134+
try await builder.build("dnsclient",
135+
repository: "https://github.com/orlandos-nl/dnsclient.git",
136+
versions:
137+
"2.4.1")
138+
139+
try await builder.build("mongokitten",
140+
repository: "https://github.com/orlandos-nl/mongokitten.git",
141+
versions:
142+
"7.0.1",
143+
"7.1.0",
144+
"7.2.0",
145+
"7.2.1",
146+
"7.2.2")
147+
// "7.7.1"
148+
}
149+
}

Sources/Massbuild/Massbuilder.swift

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import BSONEncoding
2+
import ModuleGraphs
3+
import SymbolGraphs
4+
import SymbolGraphBuilder
5+
import System
6+
7+
struct Massbuilder
8+
{
9+
let toolchain:Toolchain
10+
let workspace:Workspace
11+
12+
init() async throws
13+
{
14+
self.toolchain = try await .detect()
15+
self.workspace = try await .create(at: ".massbuild")
16+
}
17+
}
18+
extension Massbuilder
19+
{
20+
func build(_ package:PackageIdentifier, repository:String, versions:String...) async throws
21+
{
22+
for version:String in versions
23+
{
24+
try await self.build(package, repository: repository, at: version)
25+
}
26+
}
27+
28+
func build(_ package:PackageIdentifier,
29+
repository:String,
30+
at version:String) async throws
31+
{
32+
guard let file:FilePath = self.output(for: package, at: version)
33+
else
34+
{
35+
return
36+
}
37+
38+
let docs:Documentation = try await self.toolchain.generateDocs(for: try await .remote(
39+
package: package,
40+
from: repository,
41+
at: version,
42+
in: self.workspace,
43+
clean: true),
44+
pretty: true)
45+
46+
let bson:BSON.Document = .init(encoding: docs)
47+
try file.overwrite(with: bson.bytes)
48+
}
49+
50+
func buildLiterature() async throws
51+
{
52+
guard let file:FilePath = self.output(for: "__swiftinit", at: "0.0.0")
53+
else
54+
{
55+
return
56+
}
57+
58+
var docs:Documentation = try await toolchain.generateDocs(
59+
for: try await .local(package: "swiftinit",
60+
from: "TestPackages",
61+
in: workspace,
62+
clean: true),
63+
pretty: false)
64+
65+
docs.metadata.package = "__swiftinit"
66+
docs.metadata.version = "0.0.0"
67+
68+
let bson:BSON.Document = .init(encoding: docs)
69+
try file.overwrite(with: bson.bytes)
70+
}
71+
72+
func buildStandardLibrary() async throws
73+
{
74+
guard let file:FilePath = self.output(for: .swift, at: "\(toolchain.version)")
75+
else
76+
{
77+
return
78+
}
79+
80+
let docs:Documentation = try await self.toolchain.generateDocs(for: try await .swift(
81+
in: self.workspace,
82+
clean: true),
83+
pretty: false)
84+
85+
let bson:BSON.Document = .init(encoding: docs)
86+
try file.overwrite(with: bson.bytes)
87+
}
88+
}
89+
extension Massbuilder
90+
{
91+
private
92+
func output(for package:PackageIdentifier, at version:String) -> FilePath?
93+
{
94+
let file:FilePath = self.workspace.path / "\(package)@\(version).ss"
95+
96+
if let status:FileStatus = try? .status(of: file),
97+
status.is(.regular)
98+
{
99+
print("Skipping \(package)@\(version) (already built)")
100+
return nil
101+
}
102+
else
103+
{
104+
print("Building \(package)@\(version)...")
105+
return file
106+
}
107+
}
108+
}

0 commit comments

Comments
 (0)