Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat external content as pre-rendered #806

Merged
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9a1c383
Treat all externally resolved content as "pre-rendered"
d-ronnqvist Jan 18, 2024
c043a72
Collect external links grouped by bundle ID to avoid need to assert
d-ronnqvist Jan 18, 2024
7c4c28a
Use new cache struct for local content as well
d-ronnqvist Jan 18, 2024
244168e
Remove configuration that's never used
d-ronnqvist Jan 19, 2024
a92f237
Remove test resolver that's never used
d-ronnqvist Jan 19, 2024
6dbe338
Remove private types that are never used
d-ronnqvist Jan 19, 2024
638b5a4
Remove unused argument to problem factory method
d-ronnqvist Jan 19, 2024
7f76c83
Fix a performance regression
d-ronnqvist Jan 19, 2024
09117f7
Fix a bug where external resolved references with updated paths wasn'…
d-ronnqvist Jan 19, 2024
35c60df
Merge branch 'main' into treat-external-content-as-prerendered
d-ronnqvist Jan 22, 2024
71131cc
Merge branch 'main' into treat-external-content-as-prerendered
d-ronnqvist Jan 29, 2024
a7a7c58
Update test to expect relative URL
d-ronnqvist Jan 29, 2024
7322841
Add more documentation for ContentCache struct
d-ronnqvist Jan 29, 2024
994a063
Remove reserveSymbolIDCapacity parameters that was always passed true
d-ronnqvist Jan 29, 2024
733d228
Remove argument label for `value` parameter
d-ronnqvist Jan 29, 2024
014791d
Rename references to allReferences to make it explicit
d-ronnqvist Jan 29, 2024
91254dd
Document when the resolved reference doesn't match the authored link
d-ronnqvist Jan 29, 2024
aba61b3
More documentation for how the convert service fallback resolver works
d-ronnqvist Jan 29, 2024
3616630
More documentation for how the local and external content caches are …
d-ronnqvist Jan 29, 2024
bb1c7bb
Update new test to lookup nodes by symbol ID directly in the cache
d-ronnqvist Jan 29, 2024
bfd1a96
Consistently use `---` instead of em dashes in documentation comments
d-ronnqvist Jan 29, 2024
b1bc2ae
Merge branch 'main' into treat-external-content-as-prerendered
d-ronnqvist Feb 2, 2024
728413f
Merge branch 'main' into treat-external-content-as-prerendered
d-ronnqvist Feb 5, 2024
f16267c
Properly test automatic curation for extended symbols
d-ronnqvist Feb 5, 2024
3c858a0
Merge branch 'main' into treat-external-content-as-prerendered
d-ronnqvist Feb 7, 2024
f7804c1
Merge branch 'main' into treat-external-content-as-prerendered
d-ronnqvist Feb 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into treat-external-content-as-prerendered
# Conflicts:
#	Sources/SwiftDocC/Infrastructure/DocumentationConverter.swift
#	Tests/SwiftDocCTests/XCTestCase+LoadingTestData.swift
d-ronnqvist committed Feb 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit b1bc2ae55f0bb68f570c66f540c85651295d2d41
Original file line number Diff line number Diff line change
@@ -137,7 +137,7 @@ public struct GeneratedCurationWriter {
}

var contentsToWrite = [URL: String]()
for (usr, reference) in context.symbolIndex {
for (usr, reference) in context.documentationCache.referencesBySymbolID {
// Filter out symbols that aren't in the specified sub hierarchy.
if symbolLink != nil || depthLimit != nil {
guard reference == curationCrawlRoot || context.pathsTo(reference).contains(where: { path in path.suffix(depthLimit ?? .max).contains(curationCrawlRoot)}) else {
4 changes: 2 additions & 2 deletions Sources/SwiftDocC/Infrastructure/ContentCache.swift
Original file line number Diff line number Diff line change
@@ -17,11 +17,11 @@ extension DocumentationContext {
/// > The cache is not thread-safe. It's safe to read from the cache concurrently but writing needs to happen with exclusive access. It is the callers responsibility to synchronize write access.
struct ContentCache<Value> {
/// The main storage of cached values.
private var valuesByReference = [ResolvedTopicReference: Value]()
private(set) var valuesByReference = [ResolvedTopicReference: Value]()
/// A supplementary lookup of references by their symbol ID.
///
/// If a reference is found, ``valuesByReference`` will also have a value for that reference because ``add(_:reference:symbolID:)`` is the only place that writes to this lookup and it always adds the reference-value pair to ``valuesByReference``.
private var referencesBySymbolID = [String: ResolvedTopicReference]()
private(set) var referencesBySymbolID = [String: ResolvedTopicReference]()

/// Accesses the value for a given reference.
/// - Parameter reference: The reference to find in the cache.
4 changes: 2 additions & 2 deletions Tests/SwiftDocCTests/XCTestCase+LoadingTestData.swift
Original file line number Diff line number Diff line change
@@ -79,13 +79,13 @@ extension XCTestCase {
)
}

func testBundleAndContext(named name: String, codeListings: [String : AttributedCodeListing] = [:], externalResolvers: [String: ExternalDocumentationSource] = [:]) throws -> (DocumentationBundle, DocumentationContext) {
func testBundleAndContext(named name: String, codeListings: [String : AttributedCodeListing] = [:], externalResolvers: [String: ExternalDocumentationSource] = [:]) throws -> (URL, DocumentationBundle, DocumentationContext) {
let bundleURL = try XCTUnwrap(Bundle.module.url(
forResource: name, withExtension: "docc", subdirectory: "Test Bundles"))
return try loadBundle(from: bundleURL, codeListings: codeListings, externalResolvers: externalResolvers)
}

func testBundleAndContext(named name: String, codeListings: [String : AttributedCodeListing] = [:], externalResolvers: [String: ExternalReferenceResolver] = [:]) throws -> (DocumentationBundle, DocumentationContext) {
func testBundleAndContext(named name: String, codeListings: [String : AttributedCodeListing] = [:], externalResolvers: [String: ExternalDocumentationSource] = [:]) throws -> (DocumentationBundle, DocumentationContext) {
let (_, bundle, context) = try testBundleAndContext(named: name, codeListings: codeListings, externalResolvers: externalResolvers)
return (bundle, context)
}
You are viewing a condensed version of this merge commit. You can view the full changes here.