Skip to content

Commit 02138fc

Browse files
committed
Rename some additional "bundle" API
1 parent 2684e00 commit 02138fc

File tree

11 files changed

+137
-84
lines changed

11 files changed

+137
-84
lines changed

Sources/SwiftDocC/DocumentationService/Convert/ConvertService+DataProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extension ConvertService {
3838

3939
return (
4040
DocumentationContext.Inputs(
41-
info: request.bundleInfo,
41+
info: request.info,
4242
symbolGraphURLs: symbolGraphURLs,
4343
markupURLs: markupFileURL,
4444
miscResourceURLs: request.miscResourceURLs

Sources/SwiftDocC/DocumentationService/Convert/ConvertService.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public struct ConvertService: DocumentationService {
128128

129129
if let linkResolvingServer {
130130
let resolver = try OutOfProcessReferenceResolver(
131-
bundleID: request.bundleInfo.id,
131+
bundleID: request.info.id,
132132
server: linkResolvingServer,
133133
convertRequestIdentifier: messageIdentifier
134134
)
@@ -141,11 +141,11 @@ public struct ConvertService: DocumentationService {
141141
let dataProvider: any DataProvider
142142

143143
let inputProvider = DocumentationContext.InputsProvider()
144-
if let bundleLocation = request.bundleLocation,
145-
let catalogURL = try inputProvider.findCatalog(startingPoint: bundleLocation, allowArbitraryCatalogDirectories: allowArbitraryCatalogDirectories)
144+
if let catalogLocation = request.catalogLocation,
145+
let catalogURL = try inputProvider.findCatalog(startingPoint: catalogLocation, allowArbitraryCatalogDirectories: allowArbitraryCatalogDirectories)
146146
{
147147
let bundleDiscoveryOptions = try CatalogDiscoveryOptions(
148-
fallbackInfo: request.bundleInfo,
148+
fallbackInfo: request.info,
149149
additionalSymbolGraphFiles: []
150150
)
151151

Sources/SwiftDocC/DocumentationService/Models/Services/Convert/ConvertRequest.swift

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@ public struct ConvertRequest: Codable {
1616
/// Information about the documentation catalog to convert.
1717
///
1818
/// ## See Also
19-
public var bundleInfo: DocumentationContext.Inputs.Info
2019
/// - ``DocumentationContext/Inputs/Info``
20+
public var info: DocumentationContext.Inputs.Info
21+
22+
@available(*, deprecated, renamed: "info", message: "Use 'info' instead. This deprecated API will be removed after 6.3 is released.")
23+
public var bundleInfo: URL? {
24+
get { catalogLocation }
25+
set { catalogLocation = newValue }
26+
}
2127

2228
/// Feature flags to enable when performing this convert request.
2329
public var featureFlags: FeatureFlags
@@ -55,7 +61,13 @@ public struct ConvertRequest: Codable {
5561
public var includeRenderReferenceStore: Bool?
5662

5763
/// The file location of the catalog to convert, if any.
58-
public var bundleLocation: URL?
64+
public var catalogLocation: URL?
65+
66+
@available(*, deprecated, renamed: "catalogLocation", message: "Use 'catalogLocation' instead. This deprecated API will be removed after 6.3 is released.")
67+
public var bundleLocation: URL? {
68+
get { catalogLocation }
69+
set { catalogLocation = newValue }
70+
}
5971

6072
/// The symbols graph data included in the documentation catalog to convert.
6173
///
@@ -97,13 +109,13 @@ public struct ConvertRequest: Codable {
97109

98110
/// Creates a request to convert in-memory documentation.
99111
/// - Parameters:
100-
/// - bundleInfo: Information about the catalog to convert.
112+
/// - info: Information about the catalog to convert.
101113
/// - featureFlags: Feature flags to enable when performing this convert request.
102114
/// - externalIDsToConvert: The external IDs of the symbols to convert.
103115
/// - documentPathsToConvert: The paths of the documentation nodes to convert.
104116
/// - includeRenderReferenceStore: Whether the conversion's render reference store should be included in the
105117
/// response.
106-
/// - bundleLocation: The file location of the documentation catalog to convert, if any.
118+
/// - catalogLocation: The file location of the documentation catalog to convert, if any.
107119
/// - symbolGraphs: The symbols graph data included in the documentation catalog to convert.
108120
/// - overridingDocumentationComments: The mapping of external symbol identifiers to lines of a
109121
/// documentation comment that overrides the value in the symbol graph.
@@ -116,12 +128,12 @@ public struct ConvertRequest: Codable {
116128
/// - symbolIdentifiersWithExpandedDocumentation: A dictionary of identifiers to requirements for these symbols to have expanded
117129
/// documentation available.
118130
public init(
119-
bundleInfo: DocumentationContext.Inputs.Info,
131+
info: DocumentationContext.Inputs.Info,
120132
featureFlags: FeatureFlags = FeatureFlags(),
121133
externalIDsToConvert: [String]?,
122134
documentPathsToConvert: [String]? = nil,
123135
includeRenderReferenceStore: Bool? = nil,
124-
bundleLocation: URL? = nil,
136+
catalogLocation: URL? = nil,
125137
symbolGraphs: [Data],
126138
overridingDocumentationComments: [String: [Line]]? = nil,
127139
knownDisambiguatedSymbolPathComponents: [String: [String]]? = nil,
@@ -134,7 +146,7 @@ public struct ConvertRequest: Codable {
134146
self.externalIDsToConvert = externalIDsToConvert
135147
self.documentPathsToConvert = documentPathsToConvert
136148
self.includeRenderReferenceStore = includeRenderReferenceStore
137-
self.bundleLocation = bundleLocation
149+
self.catalogLocation = catalogLocation
138150
self.symbolGraphs = symbolGraphs
139151
self.overridingDocumentationComments = overridingDocumentationComments
140152
self.knownDisambiguatedSymbolPathComponents = knownDisambiguatedSymbolPathComponents
@@ -148,10 +160,45 @@ public struct ConvertRequest: Codable {
148160
self.markupFiles = markupFiles
149161
self.tutorialFiles = tutorialFiles
150162
self.miscResourceURLs = miscResourceURLs
151-
self.bundleInfo = bundleInfo
163+
self.info = info
152164
self.featureFlags = featureFlags
153165
self.symbolIdentifiersWithExpandedDocumentation = symbolIdentifiersWithExpandedDocumentation
154166
}
167+
168+
@available(*, deprecated, renamed: "init(info:featureFlags:externalIDsToConvert:documentPathsToConvert:includeRenderReferenceStore:catalogLocation:symbolGraphs:overridingDocumentationComments:knownDisambiguatedSymbolPathComponents:emitSymbolSourceFileURIs:markupFiles:tutorialFiles:miscResourceURLs:symbolIdentifiersWithExpandedDocumentation:)", message: "Use 'init(info:featureFlags:externalIDsToConvert:documentPathsToConvert:includeRenderReferenceStore:catalogLocation:symbolGraphs:overridingDocumentationComments:knownDisambiguatedSymbolPathComponents:emitSymbolSourceFileURIs:markupFiles:tutorialFiles:miscResourceURLs:symbolIdentifiersWithExpandedDocumentation:)' instead. This deprecated API will be removed after 6.3 is released.")
169+
public init(
170+
bundleInfo: DocumentationContext.Inputs.Info,
171+
featureFlags: FeatureFlags = FeatureFlags(),
172+
externalIDsToConvert: [String]?,
173+
documentPathsToConvert: [String]? = nil,
174+
includeRenderReferenceStore: Bool? = nil,
175+
bundleLocation: URL? = nil,
176+
symbolGraphs: [Data],
177+
overridingDocumentationComments: [String: [Line]]? = nil,
178+
knownDisambiguatedSymbolPathComponents: [String: [String]]? = nil,
179+
emitSymbolSourceFileURIs: Bool = true,
180+
markupFiles: [Data],
181+
tutorialFiles: [Data] = [],
182+
miscResourceURLs: [URL],
183+
symbolIdentifiersWithExpandedDocumentation: [String: ExpandedDocumentationRequirements]? = nil
184+
) {
185+
self.init(
186+
info: bundleInfo,
187+
featureFlags: featureFlags,
188+
externalIDsToConvert: externalIDsToConvert,
189+
documentPathsToConvert: documentPathsToConvert,
190+
includeRenderReferenceStore: includeRenderReferenceStore,
191+
catalogLocation: bundleLocation,
192+
symbolGraphs: symbolGraphs,
193+
overridingDocumentationComments: overridingDocumentationComments,
194+
knownDisambiguatedSymbolPathComponents: knownDisambiguatedSymbolPathComponents,
195+
emitSymbolSourceFileURIs: emitSymbolSourceFileURIs,
196+
markupFiles: markupFiles,
197+
tutorialFiles: tutorialFiles,
198+
miscResourceURLs: miscResourceURLs,
199+
symbolIdentifiersWithExpandedDocumentation: symbolIdentifiersWithExpandedDocumentation
200+
)
201+
}
155202
}
156203

157204
extension ConvertRequest {

Sources/SwiftDocC/Infrastructure/DocumentationContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2003,7 +2003,7 @@ public class DocumentationContext {
20032003
hierarchyBasedResolver = signposter.withIntervalSignpost("Build PathHierarchy", id: signposter.makeSignpostID()) {
20042004
PathHierarchyBasedLinkResolver(pathHierarchy: PathHierarchy(
20052005
symbolGraphLoader: symbolGraphLoader,
2006-
bundleName: urlReadablePath(inputs.displayName),
2006+
catalogName: urlReadablePath(inputs.displayName),
20072007
knownDisambiguatedPathComponents: configuration.convertServiceConfiguration.knownDisambiguatedSymbolPathComponents
20082008
))
20092009
}

Sources/SwiftDocC/Infrastructure/External Data/ExternalMetadata.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ public struct ExternalMetadata {
7777
public var inheritDocs = false
7878

7979
/// If `true`, there is no source catalog on disk and the inputs were passed via command line parameters.
80-
public var isGeneratedBundle = false
80+
public var isGeneratedCatalog = false
81+
82+
@available(*, deprecated, renamed: "isGeneratedCatalog", message: "Use 'isGeneratedCatalog' instead. This deprecated API will be removed after 6.3 is released.")
83+
public var isGeneratedBundle: Bool {
84+
get { isGeneratedCatalog }
85+
set { isGeneratedCatalog = newValue }
86+
}
8187

8288
/// The granularity of diagnostics to emit via the engine.
8389
public var diagnosticLevel: DiagnosticSeverity = .warning

Sources/SwiftDocC/Infrastructure/Input Discovery/DocumentationInputsProvider.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ extension DocumentationContext.InputsProvider {
149149

150150
let info = try DocumentationContext.Inputs.Info(
151151
from: infoPlistData,
152-
bundleDiscoveryOptions: options,
152+
catalogDiscoveryOptions: options,
153153
derivedDisplayName: url.deletingPathExtension().lastPathComponent
154154
)
155155

@@ -215,7 +215,7 @@ extension DocumentationContext.InputsProvider {
215215
}
216216
let derivedDisplayName = moduleNames.count == 1 ? moduleNames.first : nil
217217

218-
let info = try DocumentationContext.Inputs.Info(bundleDiscoveryOptions: options, derivedDisplayName: derivedDisplayName)
218+
let info = try DocumentationContext.Inputs.Info(catalogDiscoveryOptions: options, derivedDisplayName: derivedDisplayName)
219219

220220
let topLevelPages: [URL]
221221
let provider: any DataProvider

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ struct PathHierarchy {
5454
///
5555
/// - Parameters:
5656
/// - loader: The symbol graph loader that provides all symbols.
57-
/// - bundleName: The name of the documentation bundle, used as a container for articles and tutorials.
57+
/// - catalogName: The name of the documentation catalog, used as a container for articles and tutorials.
5858
/// - moduleKindDisplayName: The display name for the "module" kind of symbol.
5959
/// - knownDisambiguatedPathComponents: A list of path components with known required disambiguations.
6060
init(
6161
symbolGraphLoader loader: SymbolGraphLoader,
62-
bundleName: String,
62+
catalogName: String,
6363
moduleKindDisplayName: String = "Framework",
6464
knownDisambiguatedPathComponents: [String: [String]]? = nil
6565
) {
@@ -420,8 +420,8 @@ struct PathHierarchy {
420420
lookup[id] = node
421421
return node
422422
}
423-
self.articlesContainer = roots[bundleName] ?? newNode(bundleName)
424-
self.tutorialContainer = newNode(bundleName)
423+
self.articlesContainer = roots[catalogName] ?? newNode(catalogName)
424+
self.tutorialContainer = newNode(catalogName)
425425
self.tutorialOverviewContainer = newNode("tutorials")
426426

427427
assert(

Sources/SwiftDocC/Infrastructure/Workspace/DocumentationBundle+Info.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ extension DocumentationContext.Inputs {
103103
/// Creates documentation information from the given Info.plist data, falling back to the values in the given discovery options if necessary.
104104
init(
105105
from infoPlist: Data? = nil,
106-
bundleDiscoveryOptions options: CatalogDiscoveryOptions? = nil,
106+
catalogDiscoveryOptions options: CatalogDiscoveryOptions? = nil,
107107
derivedDisplayName: String? = nil
108108
) throws {
109109
if let infoPlist {
@@ -129,26 +129,26 @@ extension DocumentationContext.Inputs {
129129
} else {
130130
try self.init(
131131
with: nil,
132-
bundleDiscoveryOptions: options,
132+
catalogDiscoveryOptions: options,
133133
derivedDisplayName: derivedDisplayName
134134
)
135135
}
136136
}
137137

138138
public init(from decoder: any Decoder) throws {
139-
let bundleDiscoveryOptions = decoder.userInfo[.bundleDiscoveryOptions] as? CatalogDiscoveryOptions
139+
let catalogDiscoveryOptions = decoder.userInfo[.bundleDiscoveryOptions] as? CatalogDiscoveryOptions
140140
let derivedDisplayName = decoder.userInfo[.derivedDisplayName] as? String
141141

142142
try self.init(
143143
with: decoder.container(keyedBy: CodingKeys.self),
144-
bundleDiscoveryOptions: bundleDiscoveryOptions,
144+
catalogDiscoveryOptions: catalogDiscoveryOptions,
145145
derivedDisplayName: derivedDisplayName
146146
)
147147
}
148148

149149
private init(
150150
with values: KeyedDecodingContainer<DocumentationContext.Inputs.Info.CodingKeys>?,
151-
bundleDiscoveryOptions: CatalogDiscoveryOptions?,
151+
catalogDiscoveryOptions: CatalogDiscoveryOptions?,
152152
derivedDisplayName: String?
153153
) throws {
154154
// Here we define two helper functions that simplify
@@ -163,7 +163,7 @@ extension DocumentationContext.Inputs {
163163
with key: CodingKeys
164164
) throws -> T? where T : Decodable {
165165
try values?.decodeIfPresent(T.self, forKey: key)
166-
?? bundleDiscoveryOptions?.infoPlistFallbacks.decodeIfPresent(T.self, forKey: key.rawValue)
166+
?? catalogDiscoveryOptions?.infoPlistFallbacks.decodeIfPresent(T.self, forKey: key.rawValue)
167167
}
168168

169169
/// Helper function that decodes a value of the given type for the given key
@@ -172,9 +172,9 @@ extension DocumentationContext.Inputs {
172172
_ expectedType: T.Type,
173173
with key: CodingKeys
174174
) throws -> T where T : Decodable {
175-
if let bundleDiscoveryOptions {
175+
if let catalogDiscoveryOptions {
176176
return try values?.decodeIfPresent(T.self, forKey: key)
177-
?? bundleDiscoveryOptions.infoPlistFallbacks.decode(T.self, forKey: key.rawValue)
177+
?? catalogDiscoveryOptions.infoPlistFallbacks.decode(T.self, forKey: key.rawValue)
178178
} else if let values {
179179
return try values.decode(T.self, forKey: key)
180180
} else {
@@ -189,7 +189,7 @@ extension DocumentationContext.Inputs {
189189
// **all** missing required keys, instead of just the first one hit.
190190

191191
var givenKeys = Set(values?.allKeys ?? []).union(
192-
bundleDiscoveryOptions?.infoPlistFallbacks.keys.compactMap {
192+
catalogDiscoveryOptions?.infoPlistFallbacks.keys.compactMap {
193193
CodingKeys(stringValue: $0)
194194
} ?? []
195195
)

0 commit comments

Comments
 (0)