Skip to content

Commit 6f2b300

Browse files
committed
correct wrong source file search paths for non-library targets
1 parent df26801 commit 6f2b300

File tree

6 files changed

+91
-22
lines changed

6 files changed

+91
-22
lines changed

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.

Sources/SymbolGraphBuilder/Builds/PackageBuild.Sources.Module.swift

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,47 @@ extension PackageBuild.Sources.Module
4141
exclude:borrowing [String],
4242
root:borrowing FilePath) throws
4343
{
44-
try self.init(scanning: module, exclude: exclude,
45-
path: module.location.map { root / $0 } ?? root / "Sources" / "\(module.name)")
44+
self.init(module, path: nil)
45+
46+
if let location:String = module.location
47+
{
48+
self.path = root / location
49+
}
50+
else
51+
{
52+
let directory:String
53+
switch module.type
54+
{
55+
case .binary: return
56+
case .executable: directory = "Sources"
57+
case .regular: directory = "Sources"
58+
case .macro: directory = "Sources"
59+
case .plugin: directory = "Plugins"
60+
case .snippet: directory = "Snippets"
61+
case .system: return
62+
case .test: directory = "Tests"
63+
}
64+
65+
self.path = root / directory / module.name
66+
}
67+
68+
try self.scan(excluding: exclude)
4669
}
4770

48-
private
49-
init(scanning module:SymbolGraph.Module,
50-
exclude:borrowing [String],
51-
path:FilePath) throws
71+
private mutating
72+
func scan(excluding exclude:[String]) throws
5273
{
74+
guard
75+
let path:FilePath = self.path
76+
else
77+
{
78+
return
79+
}
80+
5381
let exclude:Set<FilePath> = exclude.reduce(into: []) { $0.insert(path / $1) }
5482
var include:Set<FilePath> = []
55-
var language:SymbolGraph.ModuleLanguage = module.language ?? .swift
83+
var language:SymbolGraph.ModuleLanguage = self.module.language ?? .swift
5684

57-
self.init(module, path: path)
5885
defer
5986
{
6087
self.articles.sort { $0.string < $1.string }

Sources/SymbolGraphBuilder/Builds/SPM.Manifest (ext).swift

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,28 @@ extension SPM.Manifest
1919
// The manifest can be very large, possibly larger than the 64 KB pipe buffer
2020
// limit. So instead of getting the `dump-package` output from a pipe, we
2121
// tell the subprocess to write it to a file, and read back the file afterwards.
22-
let path:FilePath = build.output.path / "\(build.id.package).package.json"
23-
let utf8:[UInt8] = try await path.open(.readWrite,
24-
permissions: (.rw, .r, .r),
25-
options: [.create, .truncate])
22+
let json:JSON
23+
do
2624
{
27-
let dump:SystemProcess = try .init(command: "swift", "package", "dump-package",
28-
"--package-path", "\(build.root)",
29-
stdout: $0)
30-
try await dump()
31-
return try $0.readAll()
25+
let path:FilePath = build.output.path / "\(build.id.package).package.json"
26+
let utf8:[UInt8] = try await path.open(.readWrite,
27+
permissions: (.rw, .r, .r),
28+
options: [.create, .truncate])
29+
{
30+
let dump:SystemProcess = try .init(command: "swift", "package", "dump-package",
31+
"--package-path", "\(build.root)",
32+
stdout: $0)
33+
try await dump()
34+
return try $0.readAll()
35+
}
36+
37+
json = .init(utf8: utf8)
38+
}
39+
catch let error
40+
{
41+
throw SPM.ManifestDumpError.init(underlying: error, root: build.root)
3242
}
33-
let json:JSON = .init(utf8: utf8)
43+
3444
return try json.decode()
3545
}
3646
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import PackageMetadata
2+
import System
3+
import TraceableErrors
4+
5+
extension SPM
6+
{
7+
public
8+
struct ManifestDumpError:Error
9+
{
10+
public
11+
let underlying:any Error
12+
public
13+
let root:FilePath
14+
15+
public
16+
init(underlying:any Error, root:FilePath)
17+
{
18+
self.underlying = underlying
19+
self.root = root
20+
}
21+
}
22+
}
23+
extension SPM.ManifestDumpError:TraceableError
24+
{
25+
public
26+
var notes:[String]
27+
{
28+
["while dumping manifest for package at '\(self.root)'"]
29+
}
30+
}

Stylesheets/_Tables.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
section.details table
22
{
3-
width: 100%;
4-
53
th
64
{
75
text-align: left;
@@ -28,6 +26,8 @@ section.details table
2826
}
2927
section.details table.dependencies
3028
{
29+
width: 100%;
30+
3131
td:first-child
3232
{
3333
font-style: italic;
@@ -39,6 +39,8 @@ section.details table.dependencies
3939
}
4040
section.details table.tags
4141
{
42+
width: 100%;
43+
4244
tr.modern
4345
{
4446
font-weight: 700;

0 commit comments

Comments
 (0)