Skip to content

Commit dca8187

Browse files
committed
fix more massbuild edge cases
1 parent b66d7e2 commit dca8187

File tree

6 files changed

+53
-24
lines changed

6 files changed

+53
-24
lines changed

Sources/Massbuild/Main.swift

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,25 @@ enum Main
105105
try await builder.build("swift-hash",
106106
repository: "https://github.com/tayloraswift/swift-hash.git",
107107
versions:
108-
"0.2.3")
108+
"v0.2.3")
109109

110110
try await builder.build("swift-dom",
111111
repository: "https://github.com/tayloraswift/swift-dom.git",
112112
versions:
113-
"0.5.0")
113+
"v0.5.0")
114114

115115
try await builder.build("swift-grammar",
116116
repository: "https://github.com/tayloraswift/swift-grammar.git",
117117
versions:
118-
"0.1.4",
119-
"0.1.5",
120-
"0.2.0")
118+
"v0.1.4",
119+
"v0.1.5",
120+
"v0.2.0")
121121

122122
try await builder.build("swift-json",
123123
repository: "https://github.com/tayloraswift/swift-json.git",
124124
versions:
125-
"0.2.2",
126-
"0.3.0")
125+
"v0.2.2",
126+
"v0.3.0")
127127

128128
try await builder.build("bson",
129129
repository: "https://github.com/orlandos-nl/bson.git",
@@ -134,7 +134,6 @@ enum Main
134134
try await builder.build("dnsclient",
135135
repository: "https://github.com/orlandos-nl/dnsclient.git",
136136
versions:
137-
"2.0.7",
138137
"2.4.1")
139138

140139
try await builder.build("mongokitten",
@@ -144,7 +143,7 @@ enum Main
144143
"7.1.0",
145144
"7.2.0",
146145
"7.2.1",
147-
"7.2.2",
148-
"7.7.1")
146+
"7.2.2")
147+
// "7.7.1"
149148
}
150149
}

Sources/Massbuild/Massbuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extension Massbuilder
4141
at: version,
4242
in: self.workspace,
4343
clean: true),
44-
pretty: false)
44+
pretty: true)
4545

4646
let bson:BSON.Document = .init(encoding: docs)
4747
try file.overwrite(with: bson.bytes)

Sources/ModuleGraphs/Repositories/Repository.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,33 @@ enum Repository:Hashable, Equatable, Sendable
66
/// A package in a remote git repository.
77
case remote(url:String)
88
}
9+
extension Repository
10+
{
11+
@inlinable public
12+
init(location:String)
13+
{
14+
self = location.first == "/" ?
15+
.local(root: .init(location)) :
16+
.remote(url: location)
17+
}
18+
}
19+
extension Repository
20+
{
21+
/// Returns the exact name of the repository, which is the last path component without the
22+
/// extension.
23+
public
24+
var name:Substring
25+
{
26+
let uri:String
27+
switch self
28+
{
29+
case .local(let root): uri = root.path
30+
case .remote(let url): uri = url
31+
}
32+
33+
let start:String.Index = uri.lastIndex(of: "/").map(uri.index(after:)) ??
34+
uri.startIndex
35+
36+
return uri[start...].prefix(while: { $0 != "." })
37+
}
38+
}

Sources/PackageMetadata/Resolutions/Repository.Pin.V1.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,10 @@ extension Repository.Pin.V1:JSONObjectDecodable
2929
public
3030
init(json:JSON.ObjectDecoder<CodingKey>) throws
3131
{
32-
let location:String = try json[.location].decode()
33-
let start:String.Index = location.lastIndex(of: "/").map(location.index(after:)) ??
34-
location.startIndex
32+
let repository:Repository = .init(location: try json[.location].decode())
3533

36-
self.init(value: .init(id: .init(location[start...].prefix(while: { $0 != "." })),
37-
location: location.first == "/" ?
38-
.local(root: .init(location)) :
39-
.remote(url: location),
34+
self.init(value: .init(id: .init(repository.name),
35+
location: repository,
4036
state: try json[.state].decode()))
4137
}
4238
}

Sources/SymbolGraphBuilder/Builds/Toolchain.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ extension Toolchain
194194
]
195195
for pin:Repository.Pin in pins
196196
{
197-
let checkout:FilePath = build.root / ".build" / "checkouts" / "\(pin.id)"
197+
let checkout:FilePath = build.root / ".build" / "checkouts" / "\(pin.location.name)"
198198

199199
let manifest:PackageManifest = try await .dump(from: .init(
200200
identity: .upstream(pin),

Sources/SymbolGraphCompiler/Compiler/Compiler.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,21 @@ extension Compiler
8282
with: symbol,
8383
in: culture)
8484

85+
case (.block(let block), excluded: true):
86+
// We *do* in fact care about extension blocks that only contain
87+
// internal/private members, because they might contain a conformance
88+
// to an internal protocol that inherits from a public protocol.
89+
// SymbolGraphGen probably shouldn’t be marking these extension blocks
90+
// as internal, but SymbolGraphGen doesn’t care what we think.
91+
fallthrough
92+
// continue
93+
8594
case (.block(let block), excluded: false):
8695
try self.extensions.include(block: block,
8796
extending: try extensions.extendee(of: block),
8897
namespace: namespace,
8998
with: symbol,
9099
in: culture)
91-
92-
case (.block, excluded: true):
93-
// We do not care about extension blocks that only contain
94-
// internal/private members.
95-
continue
96100
}
97101
}
98102
catch let error

0 commit comments

Comments
 (0)