Skip to content

Commit 410efc3

Browse files
committed
Use new Identifier type in SerializableLinkResolutionInformation
1 parent 7823d39 commit 410efc3

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

Sources/SwiftDocC/Infrastructure/ConvertActionConverter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ package enum ConvertActionConverter {
157157

158158
if FeatureFlags.current.isExperimentalLinkHierarchySerializationEnabled {
159159
do {
160-
let serializableLinkInformation = try context.linkResolver.localResolver.prepareForSerialization(bundleID: bundle.id.rawValue)
160+
let serializableLinkInformation = try context.linkResolver.localResolver.prepareForSerialization(bundleID: bundle.id)
161161
try outputConsumer.consume(linkResolutionInformation: serializableLinkInformation)
162162

163163
if !emitDigest {

Sources/SwiftDocC/Infrastructure/DocumentationConverter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public struct DocumentationConverter: DocumentationConverterProtocol {
354354

355355
if FeatureFlags.current.isExperimentalLinkHierarchySerializationEnabled {
356356
do {
357-
let serializableLinkInformation = try context.linkResolver.localResolver.prepareForSerialization(bundleID: bundle.identifier)
357+
let serializableLinkInformation = try context.linkResolver.localResolver.prepareForSerialization(bundleID: bundle.id)
358358
try outputConsumer.consume(linkResolutionInformation: serializableLinkInformation)
359359

360360
if !emitDigest {

Sources/SwiftDocC/Infrastructure/Link Resolution/ExternalPathHierarchyResolver.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ final class ExternalPathHierarchyResolver {
150150
continue
151151
}
152152
let identifier = identifiers[index]
153-
self.resolvedReferences[identifier] = ResolvedTopicReference(id: .init(rawValue: fileRepresentation.bundleID), path: url.path, fragment: url.fragment, sourceLanguage: .swift)
153+
self.resolvedReferences[identifier] = ResolvedTopicReference(id: fileRepresentation.bundleID, path: url.path, fragment: url.fragment, sourceLanguage: .swift)
154154
}
155155
}
156156
// Finally, the Identifier -> Symbol mapping can be constructed by iterating over the nodes and looking up the reference for each USR.

Sources/SwiftDocC/Infrastructure/Link Resolution/PathHierarchy+Serialization.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public struct SerializableLinkResolutionInformation: Codable {
148148
// This type is public so that it can be an argument to a function in `ConvertOutputConsumer`
149149

150150
var version: SemanticVersion
151-
var bundleID: String
151+
var bundleID: DocumentationBundle.Identifier
152152
var pathHierarchy: PathHierarchy.FileRepresentation
153153
// Separate storage of node data because the path hierarchy doesn't know the resolved references for articles.
154154
var nonSymbolPaths: [Int: String]
@@ -158,7 +158,7 @@ extension PathHierarchyBasedLinkResolver {
158158
/// Create a file representation of the link resolver.
159159
///
160160
/// The file representation can be decoded in later documentation builds to resolve external links to the content where the link resolver was originally created for.
161-
func prepareForSerialization(bundleID: String) throws -> SerializableLinkResolutionInformation {
161+
func prepareForSerialization(bundleID: DocumentationBundle.Identifier) throws -> SerializableLinkResolutionInformation {
162162
var nonSymbolPaths: [Int: String] = [:]
163163
let hierarchyFileRepresentation = PathHierarchy.FileRepresentation(pathHierarchy) { identifiers in
164164
nonSymbolPaths.reserveCapacity(identifiers.count)

Tests/SwiftDocCTests/Infrastructure/DocumentationContext/DocumentationContextTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5283,7 +5283,7 @@ let expected = """
52835283

52845284
return entity.externallyLinkableElementSummaries(context: context, renderNode: renderNode, includeTaskGroups: false)
52855285
}
5286-
let linkResolutionInformation = try context.linkResolver.localResolver.prepareForSerialization(bundleID: bundle.id.rawValue)
5286+
let linkResolutionInformation = try context.linkResolver.localResolver.prepareForSerialization(bundleID: bundle.id)
52875287

52885288
return (linkResolutionInformation, linkSummaries)
52895289
}

Tests/SwiftDocCTests/Infrastructure/ExternalPathHierarchyResolverTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ class ExternalPathHierarchyResolverTests: XCTestCase {
715715

716716
return entity.externallyLinkableElementSummaries(context: dependencyContext, renderNode: renderNode, includeTaskGroups: false)
717717
}
718-
let linkResolutionInformation = try dependencyContext.linkResolver.localResolver.prepareForSerialization(bundleID: dependencyBundle.id.rawValue)
718+
let linkResolutionInformation = try dependencyContext.linkResolver.localResolver.prepareForSerialization(bundleID: dependencyBundle.id)
719719

720720
XCTAssertEqual(linkResolutionInformation.pathHierarchy.nodes.count - linkResolutionInformation.nonSymbolPaths.count, 5 /* 4 symbols & 1 module */)
721721
XCTAssertEqual(linkSummaries.count, 5 /* 4 symbols & 1 module */)
@@ -995,7 +995,7 @@ class ExternalPathHierarchyResolverTests: XCTestCase {
995995

996996
let localResolver = try XCTUnwrap(context.linkResolver.localResolver)
997997

998-
let resolverInfo = try localResolver.prepareForSerialization(bundleID: bundle.id.rawValue)
998+
let resolverInfo = try localResolver.prepareForSerialization(bundleID: bundle.id)
999999
let resolverData = try JSONEncoder().encode(resolverInfo)
10001000
let roundtripResolverInfo = try JSONDecoder().decode(SerializableLinkResolutionInformation.self, from: resolverData)
10011001

0 commit comments

Comments
 (0)