Skip to content

Commit b66d7e2

Browse files
committed
fix massbuild bug related to faulty parsing of legacy Package.resolved format
1 parent 3d972fb commit b66d7e2

File tree

4 files changed

+111
-4
lines changed

4 files changed

+111
-4
lines changed

Sources/Massbuild/Main.swift

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,29 @@ enum Main
3333
versions:
3434
"1.0.0")
3535

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+
3659
try await builder.build("swift-nio",
3760
repository: "https://github.com/apple/swift-nio.git",
3861
versions:
@@ -47,5 +70,81 @@ enum Main
4770
"2.46.0",
4871
"2.47.0",
4972
"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+
"0.2.3")
109+
110+
try await builder.build("swift-dom",
111+
repository: "https://github.com/tayloraswift/swift-dom.git",
112+
versions:
113+
"0.5.0")
114+
115+
try await builder.build("swift-grammar",
116+
repository: "https://github.com/tayloraswift/swift-grammar.git",
117+
versions:
118+
"0.1.4",
119+
"0.1.5",
120+
"0.2.0")
121+
122+
try await builder.build("swift-json",
123+
repository: "https://github.com/tayloraswift/swift-json.git",
124+
versions:
125+
"0.2.2",
126+
"0.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.0.7",
138+
"2.4.1")
139+
140+
try await builder.build("mongokitten",
141+
repository: "https://github.com/orlandos-nl/mongokitten.git",
142+
versions:
143+
"7.0.1",
144+
"7.1.0",
145+
"7.2.0",
146+
"7.2.1",
147+
"7.2.2",
148+
"7.7.1")
50149
}
51150
}

Sources/PackageMetadata/Resolutions/Repository.Pin.State (ext).swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ extension Repository.Pin.State:JSONObjectDecodable
1515
init(json:JSON.ObjectDecoder<CodingKey>) throws
1616
{
1717
let version:AnyVersion
18-
if let stable:SemanticVersion = try json[.version]?.decode(
18+
// `try?` because sometimes we have explicit JSON null
19+
if let stable:SemanticVersion = try? json[.version]?.decode(
1920
as: JSON.StringRepresentation<SemanticVersion>.self,
2021
with: \.value)
2122
{

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,20 @@ extension Repository.Pin.V1:JSONObjectDecodable
2020
public
2121
enum CodingKey:String
2222
{
23-
case id = "package"
23+
// this field is completely useless!
24+
// case id = "package"
25+
2426
case location = "repositoryURL"
2527
case state
2628
}
2729
public
2830
init(json:JSON.ObjectDecoder<CodingKey>) throws
2931
{
3032
let location:String = try json[.location].decode()
31-
self.init(value: .init(id: try json[.id].decode(),
33+
let start:String.Index = location.lastIndex(of: "/").map(location.index(after:)) ??
34+
location.startIndex
35+
36+
self.init(value: .init(id: .init(location[start...].prefix(while: { $0 != "." })),
3237
location: location.first == "/" ?
3338
.local(root: .init(location)) :
3439
.remote(url: location),

Sources/SymbolGraphBuilder/Builds/Toolchain.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,12 @@ extension Toolchain
194194
]
195195
for pin:Repository.Pin in pins
196196
{
197+
let checkout:FilePath = build.root / ".build" / "checkouts" / "\(pin.id)"
198+
197199
let manifest:PackageManifest = try await .dump(from: .init(
198200
identity: .upstream(pin),
199201
output: build.output,
200-
root: build.root / ".build" / "checkouts" / "\(pin.id)"))
202+
root: checkout))
201203

202204
let upstream:PackageNode = try .libraries(as: pin.id,
203205
flattening: manifest,

0 commit comments

Comments
 (0)