Skip to content

Commit fdf22cd

Browse files
committed
no reason for these types to be associated with SPM, or public, or frozen
1 parent e36692d commit fdf22cd

13 files changed

+85
-105
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import System
2+
3+
struct ArtifactDirectory:SystemWorkspace
4+
{
5+
let path:FilePath
6+
7+
init(path:FilePath)
8+
{
9+
self.path = path
10+
}
11+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import System
2+
import TraceableErrors
3+
4+
struct ArtifactError:Error, Sendable
5+
{
6+
public
7+
let underlying:any Error
8+
public
9+
let path:FilePath
10+
11+
public
12+
init(underlying:any Error, path:FilePath)
13+
{
14+
self.underlying = underlying
15+
self.path = path
16+
}
17+
}
18+
extension ArtifactError:Equatable
19+
{
20+
static
21+
func == (lhs:Self, rhs:Self) -> Bool
22+
{
23+
lhs.path == rhs.path && lhs.underlying == rhs.underlying
24+
}
25+
}
26+
extension ArtifactError:TraceableError
27+
{
28+
var notes:[String]
29+
{
30+
["while processing artifact '\(self.path)'"]
31+
}
32+
}

Sources/SymbolGraphBuilder/Artifacts/SPM.Artifacts.Culture.swift renamed to Sources/SymbolGraphBuilder/Artifacts/Artifacts.Culture.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import SymbolGraphs
66
import Symbols
77
import System
88

9-
extension SPM.Artifacts
9+
extension Artifacts
1010
{
1111
struct Culture
1212
{
@@ -29,14 +29,14 @@ extension SPM.Artifacts
2929
}
3030
}
3131
}
32-
extension SPM.Artifacts.Culture:Identifiable
32+
extension Artifacts.Culture:Identifiable
3333
{
3434
var id:Symbol.Module
3535
{
3636
self.module.id
3737
}
3838
}
39-
extension SPM.Artifacts.Culture
39+
extension Artifacts.Culture
4040
{
4141
func loadArticles(root:Symbol.FileBase) throws -> [MarkdownSourceFile]
4242
{
@@ -83,7 +83,7 @@ extension SPM.Artifacts.Culture
8383
}
8484
catch let error
8585
{
86-
throw SPM.ArtifactError.init(underlying: error, path: path)
86+
throw ArtifactError.init(underlying: error, path: path)
8787
}
8888
}
8989
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import PackageGraphs
2+
import PackageMetadata
3+
import SymbolGraphParts
4+
import SymbolGraphs
5+
import Symbols
6+
import System
7+
8+
struct Artifacts
9+
{
10+
let cultures:[Culture]
11+
var root:Symbol.FileBase?
12+
13+
init(cultures:[Culture], root:Symbol.FileBase? = nil)
14+
{
15+
self.cultures = cultures
16+
self.root = root
17+
}
18+
}

Sources/SymbolGraphBuilder/Artifacts/SPM.ArtifactDirectory.swift

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

Sources/SymbolGraphBuilder/Artifacts/SPM.ArtifactError.swift

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

Sources/SymbolGraphBuilder/Artifacts/SPM.Artifacts.swift

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

Sources/SymbolGraphBuilder/Builds/DocumentationBuild.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ protocol DocumentationBuild
44
{
55
mutating
66
func compile(with swift:Toolchain,
7-
pretty:Bool) async throws -> (SymbolGraphMetadata, SPM.Artifacts)
7+
pretty:Bool) async throws -> (SymbolGraphMetadata, Artifacts)
88
}

Sources/SymbolGraphBuilder/Builds/SPM.Build.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ extension SPM.Build
128128
let container:SPM.Workspace = try await shared.create("\(package)")
129129
let checkouts:SPM.CheckoutDirectory = try await container.create("checkouts",
130130
clean: clean.contains(.checkouts))
131-
let artifacts:SPM.ArtifactDirectory = try await container.create("artifacts@\(refname)",
131+
let artifacts:ArtifactDirectory = try await container.create("artifacts@\(refname)",
132132
clean: clean.contains(.artifacts))
133133

134134
let cloned:FilePath = checkouts.path / "\(package)"
@@ -189,7 +189,7 @@ extension SPM.Build:DocumentationBuild
189189
{
190190
mutating
191191
func compile(with swift:Toolchain,
192-
pretty:Bool) async throws -> (SymbolGraphMetadata, SPM.Artifacts)
192+
pretty:Bool) async throws -> (SymbolGraphMetadata, Artifacts)
193193
{
194194
switch self.id
195195
{
@@ -295,7 +295,7 @@ extension SPM.Build:DocumentationBuild
295295
display: manifest.name,
296296
root: manifest.root)
297297

298-
let artifacts:SPM.Artifacts = try await swift.dump(from: flatNode,
298+
let artifacts:Artifacts = try await swift.dump(from: flatNode,
299299
include: &include,
300300
output: self.output,
301301
triple: swift.triple,

Sources/SymbolGraphBuilder/Builds/Toolchain.Build.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import SymbolGraphs
22

33
extension Toolchain
44
{
5-
@frozen public
5+
public
66
struct Build
77
{
88
/// Where to emit documentation artifacts to.
9-
let output:SPM.ArtifactDirectory
9+
let output:ArtifactDirectory
1010

1111
private
12-
init(output:SPM.ArtifactDirectory)
12+
init(output:ArtifactDirectory)
1313
{
1414
self.output = output
1515
}
@@ -27,10 +27,10 @@ extension Toolchain.Build
2727
extension Toolchain.Build:DocumentationBuild
2828
{
2929
func compile(with swift:Toolchain,
30-
pretty:Bool) async throws -> (SymbolGraphMetadata, SPM.Artifacts)
30+
pretty:Bool) async throws -> (SymbolGraphMetadata, Artifacts)
3131
{
3232
// https://forums.swift.org/t/dependency-graph-of-the-standard-library-modules/59267
33-
let artifacts:SPM.Artifacts = try await swift.dump(
33+
let artifacts:Artifacts = try await swift.dump(
3434
modules:
3535
[
3636
// 0:

Sources/SymbolGraphBuilder/Builds/Toolchain.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,16 @@ extension Toolchain
238238
{
239239
/// Dumps the symbols for the given package, using the `output` workspace as the
240240
/// output directory.
241-
public
242241
func dump(from package:PackageNode,
243242
include:inout [FilePath],
244-
output:SPM.ArtifactDirectory,
243+
output:ArtifactDirectory,
245244
triple:Triple,
246-
pretty:Bool = false) async throws -> SPM.Artifacts
245+
pretty:Bool = false) async throws -> Artifacts
247246
{
248247
// Note: the manifest root is the root we want; the repository root may
249248
// be a relative path.
250249
let sources:SPM.Build.Sources = try .init(scanning: package)
251-
let cultures:[SPM.Artifacts.Culture] = try await self.dump(
250+
let cultures:[Artifacts.Culture] = try await self.dump(
252251
modules: sources.modules,
253252
include: &include,
254253
output: output,
@@ -260,12 +259,12 @@ extension Toolchain
260259
/// Dumps the symbols for the given targets, using the `output` workspace as the
261260
/// output directory.
262261
func dump(modules:[SPM.Build.Sources.Module],
263-
output:SPM.ArtifactDirectory,
262+
output:ArtifactDirectory,
264263
triple:Triple,
265-
pretty:Bool = false) async throws -> SPM.Artifacts
264+
pretty:Bool = false) async throws -> Artifacts
266265
{
267266
var include:[FilePath] = []
268-
let cultures:[SPM.Artifacts.Culture] = try await self.dump(
267+
let cultures:[Artifacts.Culture] = try await self.dump(
269268
modules: modules,
270269
include: &include,
271270
output: output,
@@ -278,9 +277,9 @@ extension Toolchain
278277
private
279278
func dump(modules:[SPM.Build.Sources.Module],
280279
include:inout [FilePath],
281-
output:SPM.ArtifactDirectory,
280+
output:ArtifactDirectory,
282281
triple:Triple,
283-
pretty:Bool) async throws -> [SPM.Artifacts.Culture]
282+
pretty:Bool) async throws -> [Artifacts.Culture]
284283
{
285284
for sources:SPM.Build.Sources.Module in modules
286285
{

Sources/SymbolGraphBuilder/SymbolGraph (ext).swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import UnidocDiagnostics
1111
extension SymbolGraph
1212
{
1313
static
14-
func build(from artifacts:SPM.Artifacts) async throws -> Self
14+
func build(from artifacts:Artifacts) async throws -> Self
1515
{
1616
let (namespaces, nominations):([[Compiler.Namespace]], Compiler.Nominations)
1717
let (extensions):[Compiler.Extension]
@@ -25,7 +25,7 @@ extension SymbolGraph
2525

2626
var compiler:Compiler = .init(root: artifacts.root)
2727

28-
for culture:SPM.Artifacts.Culture in artifacts.cultures
28+
for culture:Artifacts.Culture in artifacts.cultures
2929
{
3030
let parts:[SymbolGraphPart] = try culture.loadSymbols()
3131

Sources/SymbolGraphBuilder/SymbolGraphObject (ext).swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extension SymbolGraphObject<Void>
2424
pretty:Bool) async throws
2525
{
2626
let metadata:SymbolGraphMetadata
27-
let artifacts:SPM.Artifacts
27+
let artifacts:Artifacts
2828

2929
(metadata, artifacts) = try await build.compile(with: swift, pretty: pretty)
3030

0 commit comments

Comments
 (0)