Skip to content

Commit 8714446

Browse files
committed
Deprecate DocumentationContextDataProvider
1 parent 0492f86 commit 8714446

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Sources/SwiftDocC/Infrastructure/DocumentationContext.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Markdown
1313
import SymbolKit
1414

1515
/// A type that provides information about documentation bundles and their content.
16+
@available(*, deprecated, message: "Pass the context its inputs at initialization instead. This deprecated API will be removed after 6.2 is released")
1617
public protocol DocumentationContextDataProvider {
1718
/// An object to notify when bundles are added or removed.
1819
var delegate: DocumentationContextDataProviderDelegate? { get set }
@@ -31,6 +32,7 @@ public protocol DocumentationContextDataProvider {
3132
}
3233

3334
/// An object that responds to changes in available documentation bundles for a specific provider.
35+
@available(*, deprecated, message: "Pass the context its inputs at initialization instead. This deprecated API will be removed after 6.2 is released")
3436
public protocol DocumentationContextDataProviderDelegate: AnyObject {
3537

3638
/// Called when the `dataProvider` has added a new documentation bundle to its list of `bundles`.
@@ -79,7 +81,7 @@ public typealias BundleIdentifier = String
7981
/// - ``children(of:kind:)``
8082
/// - ``parents(of:)``
8183
///
82-
public class DocumentationContext: DocumentationContextDataProviderDelegate {
84+
public class DocumentationContext {
8385

8486
/// An error that's encountered while interacting with a ``SwiftDocC/DocumentationContext``.
8587
public enum ContextError: DescribedError {
@@ -114,12 +116,14 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
114116
public var linkResolver: LinkResolver
115117

116118
private enum _Provider {
119+
@available(*, deprecated, message: "Use 'DataProvider' instead. This deprecated API will be removed after 6.2 is released")
117120
case legacy(DocumentationContextDataProvider)
118121
case new(DataProvider)
119122
}
120123
private var dataProvider: _Provider
121124

122125
/// The provider of documentation bundles for this context.
126+
@available(*, deprecated, message: "Use 'DataProvider' instead. This deprecated API will be removed after 6.2 is released")
123127
private var _legacyDataProvider: DocumentationContextDataProvider! {
124128
get {
125129
switch dataProvider {
@@ -284,6 +288,7 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
284288
/// - diagnosticEngine: The pre-configured engine that will collect problems encountered during compilation.
285289
/// - configuration: A collection of configuration for the created context.
286290
/// - Throws: If an error is encountered while registering a documentation bundle.
291+
@available(*, deprecated, message: "Pass the context its inputs at initialization instead. This deprecated API will be removed after 6.2 is released")
287292
public init(
288293
dataProvider: DocumentationContextDataProvider,
289294
diagnosticEngine: DiagnosticEngine = .init(),
@@ -330,6 +335,7 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
330335
/// - Parameters:
331336
/// - dataProvider: The provider that added this bundle.
332337
/// - bundle: The bundle that was added.
338+
@available(*, deprecated, message: "Pass the context its inputs at initialization instead. This deprecated API will be removed after 6.2 is released")
333339
public func dataProvider(_ dataProvider: DocumentationContextDataProvider, didAddBundle bundle: DocumentationBundle) throws {
334340
try benchmark(wrap: Benchmark.Duration(id: "bundle-registration")) {
335341
// Enable reference caching for this documentation bundle.
@@ -344,6 +350,7 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
344350
/// - Parameters:
345351
/// - dataProvider: The provider that removed this bundle.
346352
/// - bundle: The bundle that was removed.
353+
@available(*, deprecated, message: "Pass the context its inputs at initialization instead. This deprecated API will be removed after 6.2 is released")
347354
public func dataProvider(_ dataProvider: DocumentationContextDataProvider, didRemoveBundle bundle: DocumentationBundle) throws {
348355
linkResolver.localResolver?.unregisterBundle(identifier: bundle.identifier)
349356

@@ -3054,3 +3061,6 @@ extension DataAsset {
30543061
}
30553062
}
30563063
}
3064+
3065+
@available(*, deprecated, message: "This deprecated API will be removed after 6.2 is released")
3066+
extension DocumentationContext: DocumentationContextDataProviderDelegate {}

0 commit comments

Comments
 (0)