Skip to content

Commit 962d0e4

Browse files
committed
Remove input parameters where context parameter exists
1 parent 59a8290 commit 962d0e4

File tree

84 files changed

+826
-937
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+826
-937
lines changed

Sources/SwiftDocC/Converter/DocumentationContextConverter.swift

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ public class DocumentationContextConverter {
2020
/// The context the converter uses to resolve references it finds in the documentation node's content.
2121
let context: DocumentationContext
2222

23-
/// The input files that contains the content from which the documentation node originated.
24-
let inputs: DocumentationContext.Inputs
25-
2623
/// A context that contains common pre-rendered pieces of content.
2724
let renderContext: RenderContext
2825

@@ -48,7 +45,6 @@ public class DocumentationContextConverter {
4845
/// The converter uses bundle and context to resolve references to other documentation and describe the documentation hierarchy.
4946
///
5047
/// - Parameters:
51-
/// - inputs: The inputs files that the documentation node originated from.
5248
/// - context: The context that the converter uses to to resolve references it finds in the documentation node's content.
5349
/// - renderContext: A context that contains common pre-rendered pieces of content.
5450
/// - emitSymbolSourceFileURIs: Whether the documentation converter should include
@@ -61,15 +57,13 @@ public class DocumentationContextConverter {
6157
/// - sourceRepository: The source repository where the documentation's sources are hosted.
6258
/// - symbolIdentifiersWithExpandedDocumentation: A list of symbol IDs that have version of their documentation page with more content that a renderer can link to.
6359
public init(
64-
inputs: DocumentationContext.Inputs,
6560
context: DocumentationContext,
6661
renderContext: RenderContext,
6762
emitSymbolSourceFileURIs: Bool = false,
6863
emitSymbolAccessLevels: Bool = false,
6964
sourceRepository: SourceRepository? = nil,
7065
symbolIdentifiersWithExpandedDocumentation: [String]? = nil
7166
) {
72-
self.inputs = inputs
7367
self.context = context
7468
self.renderContext = renderContext
7569
self.shouldEmitSymbolSourceFileURIs = emitSymbolSourceFileURIs
@@ -78,9 +72,9 @@ public class DocumentationContextConverter {
7872
self.symbolIdentifiersWithExpandedDocumentation = symbolIdentifiersWithExpandedDocumentation
7973
}
8074

81-
@available(*, deprecated, renamed: "init(inputs:context:renderContext:emitSymbolSourceFileURIs:emitSymbolAccessLevels:sourceRepository:symbolIdentifiersWithExpandedDocumentation:)", message: "Use 'init(inputs:context:renderContext:emitSymbolSourceFileURIs:emitSymbolAccessLevels:sourceRepository:symbolIdentifiersWithExpandedDocumentation:)' instead. This deprecated API will be removed after 6.3 is released")
75+
@available(*, deprecated, renamed: "init(context:renderContext:emitSymbolSourceFileURIs:emitSymbolAccessLevels:sourceRepository:symbolIdentifiersWithExpandedDocumentation:)", message: "Use 'init(context:renderContext:emitSymbolSourceFileURIs:emitSymbolAccessLevels:sourceRepository:symbolIdentifiersWithExpandedDocumentation:)' instead. This deprecated API will be removed after 6.3 is released")
8276
public convenience init(
83-
bundle: DocumentationBundle,
77+
bundle _: DocumentationBundle,
8478
context: DocumentationContext,
8579
renderContext: RenderContext,
8680
emitSymbolSourceFileURIs: Bool = false,
@@ -89,7 +83,6 @@ public class DocumentationContextConverter {
8983
symbolIdentifiersWithExpandedDocumentation: [String]? = nil
9084
) {
9185
self.init(
92-
inputs: bundle,
9386
context: context,
9487
renderContext: renderContext,
9588
emitSymbolSourceFileURIs: emitSymbolSourceFileURIs,
@@ -112,7 +105,6 @@ public class DocumentationContextConverter {
112105

113106
var translator = RenderNodeTranslator(
114107
context: context,
115-
inputs: inputs,
116108
identifier: node.reference,
117109
renderContext: renderContext,
118110
emitSymbolSourceFileURIs: shouldEmitSymbolSourceFileURIs,

Sources/SwiftDocC/Converter/DocumentationNodeConverter.swift

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,19 @@ public struct DocumentationNodeConverter {
1515
/// The context the converter uses to resolve references it finds in the documentation node's content.
1616
let context: DocumentationContext
1717

18-
/// The input files that contains the content from which the documentation node originated.
19-
let inputs: DocumentationContext.Inputs
20-
21-
/// Creates a new node converter for the given bundle and context.
18+
/// Creates a new node converter for the given context.
2219
///
23-
/// The converter uses bundle and context to resolve references to other documentation and describe the documentation hierarchy.
20+
/// The converter uses context to resolve references to other documentation and describe the documentation hierarchy.
2421
///
2522
/// - Parameters:
26-
/// - inputs: The input files that contains the content from which the documentation node originated.
2723
/// - context: The context that the converter uses to to resolve references it finds in the documentation node's content.
28-
public init(inputs: DocumentationContext.Inputs, context: DocumentationContext) {
29-
self.inputs = inputs
24+
public init(context: DocumentationContext) {
3025
self.context = context
3126
}
3227

33-
@available(*, deprecated, renamed: "init(inputs:context:)", message: "Use 'init(inputs:context:)' instead. This deprecated API will be removed after 6.3 is released")
34-
public init(bundle: DocumentationBundle, context: DocumentationContext) {
35-
self.init(inputs: bundle, context: context)
28+
@available(*, deprecated, renamed: "init(context:)", message: "Use 'init(context:)' instead. This deprecated API will be removed after 6.3 is released")
29+
public init(bundle _: DocumentationBundle, context: DocumentationContext) {
30+
self.init(context: context)
3631
}
3732

3833
/// Converts a documentation node to a render node.
@@ -42,7 +37,7 @@ public struct DocumentationNodeConverter {
4237
/// - node: The documentation node to convert.
4338
/// - Returns: The render node representation of the documentation node.
4439
public func convert(_ node: DocumentationNode) -> RenderNode {
45-
var translator = RenderNodeTranslator(context: context, inputs: inputs, identifier: node.reference)
40+
var translator = RenderNodeTranslator(context: context, identifier: node.reference)
4641
return translator.visit(node.semantic) as! RenderNode
4742
}
4843
}

Sources/SwiftDocC/DocumentationService/Convert/ConvertService.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public struct ConvertService: DocumentationService {
158158
let context = try await DocumentationContext(inputs: inputs, dataProvider: dataProvider, configuration: configuration)
159159

160160
// Precompute the render context
161-
let renderContext = RenderContext(documentationContext: context, inputs: inputs)
161+
let renderContext = RenderContext(documentationContext: context)
162162

163163
let symbolIdentifiersMeetingRequirementsForExpandedDocumentation: [String]? = request.symbolIdentifiersWithExpandedDocumentation?.compactMap { identifier, expandedDocsRequirement in
164164
guard let documentationNode = context.documentationCache[identifier] else {
@@ -168,7 +168,6 @@ public struct ConvertService: DocumentationService {
168168
return documentationNode.meetsExpandedDocumentationRequirements(expandedDocsRequirement) ? identifier : nil
169169
}
170170
let converter = DocumentationContextConverter(
171-
inputs: inputs,
172171
context: context,
173172
renderContext: renderContext,
174173
emitSymbolSourceFileURIs: request.emitSymbolSourceFileURIs,
@@ -245,7 +244,7 @@ public struct ConvertService: DocumentationService {
245244

246245
let inputs = context.inputs
247246
guard inputs.id == topicReference.bundleID else { return nil }
248-
let renderer = DocumentationContentRenderer(documentationContext: context, inputs: inputs)
247+
let renderer = DocumentationContentRenderer(documentationContext: context)
249248

250249
let documentationNodeKind: DocumentationNode.Kind = isDocumentationExtensionContent ? .unknownSymbol : .article
251250
let overridingDocumentationNode = DocumentationContext.documentationNodeAndTitle(for: article, kind: documentationNodeKind, in: inputs)?.node

Sources/SwiftDocC/Infrastructure/ConvertActionConverter.swift

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ package enum ConvertActionConverter {
2424
/// Converts the documentation bundle in the given context and passes its output to a given consumer.
2525
///
2626
/// - Parameters:
27-
/// - inputs: The collection of inputs files that the context is created from.
2827
/// - context: The context of documentation information to convert.
2928
/// - outputConsumer: The consumer that the conversion passes outputs of the conversion to.
3029
/// - sourceRepository: The source repository where the documentation's sources are hosted.
3130
/// - emitDigest: Whether the conversion should pass additional metadata output––such as linkable entities information, indexing information, or asset references by asset type––to the consumer.
3231
/// - documentationCoverageOptions: The level of experimental documentation coverage information that the conversion should pass to the consumer.
3332
/// - Returns: A list of problems that occurred during the conversion (excluding the problems that the context already encountered).
3433
package static func convert(
35-
inputs: DocumentationContext.Inputs,
3634
context: DocumentationContext,
3735
outputConsumer: some ConvertOutputConsumer & ExternalNodeConsumer,
3836
sourceRepository: SourceRepository?,
@@ -61,15 +59,14 @@ package enum ConvertActionConverter {
6159

6260
// Precompute the render context
6361
let renderContext = signposter.withIntervalSignpost("Build RenderContext", id: signposter.makeSignpostID()) {
64-
RenderContext(documentationContext: context, inputs: inputs)
62+
RenderContext(documentationContext: context)
6563
}
6664
try outputConsumer.consume(renderReferenceStore: renderContext.store)
6765

6866
// Copy images, sample files, and other static assets.
69-
try outputConsumer.consume(assetsInInputs: inputs)
67+
try outputConsumer.consume(assetsInInputs: context.inputs)
7068

7169
let converter = DocumentationContextConverter(
72-
inputs: inputs,
7370
context: context,
7471
renderContext: renderContext,
7572
sourceRepository: sourceRepository
@@ -104,12 +101,14 @@ package enum ConvertActionConverter {
104101
let resultsSyncQueue = DispatchQueue(label: "Convert Serial Queue", qos: .unspecified, attributes: [])
105102
let resultsGroup = DispatchGroup()
106103

104+
let id = context.inputs.id
105+
107106
// Consume external links and add them into the sidebar.
108107
for externalLink in context.externalCache {
109108
// Here we're associating the external node with the **current** bundle's bundle ID.
110109
// This is needed because nodes are only considered children if the parent and child's bundle ID match.
111110
// Otherwise, the node will be considered as a separate root node and displayed separately.
112-
let externalRenderNode = ExternalRenderNode(externalEntity: externalLink.value, bundleIdentifier: inputs.id)
111+
let externalRenderNode = ExternalRenderNode(externalEntity: externalLink.value, bundleIdentifier: id)
113112
try outputConsumer.consume(externalRenderNode: externalRenderNode)
114113
}
115114

@@ -192,7 +191,7 @@ package enum ConvertActionConverter {
192191
if FeatureFlags.current.isExperimentalLinkHierarchySerializationEnabled {
193192
signposter.withIntervalSignpost("Serialize link hierarchy", id: signposter.makeSignpostID()) {
194193
do {
195-
let serializableLinkInformation = try context.linkResolver.localResolver.prepareForSerialization(bundleID: inputs.id)
194+
let serializableLinkInformation = try context.linkResolver.localResolver.prepareForSerialization(bundleID: id)
196195
try outputConsumer.consume(linkResolutionInformation: serializableLinkInformation)
197196

198197
if !emitDigest {
@@ -225,7 +224,7 @@ package enum ConvertActionConverter {
225224
break
226225
}
227226

228-
try outputConsumer.consume(buildMetadata: BuildMetadata(bundleDisplayName: inputs.displayName, bundleID: inputs.id))
227+
try outputConsumer.consume(buildMetadata: BuildMetadata(bundleDisplayName: context.inputs.displayName, bundleID: id))
229228

230229
// Log the finalized topic graph checksum.
231230
benchmark(add: Benchmark.TopicGraphHash(context: context))

0 commit comments

Comments
 (0)