Skip to content

Commit 00742d8

Browse files
authored
Remove API that's been deprecated for more than a full minor release (#684)
* Remove API that's been deprecated since initial release * Briefly describe process for deprecating and removing API * Add comments to deprecated API to indicate when it can be removed * Remove API that was deprecated before the 5.6 release * Remove API that was deprecated before the 5.7 release * Rephrase contribution into to be more flexible and to signal removal timeline in deprecation message. * Move symbol removal information into deprecation message. * Add removal info to deprecated convert flags * Remove additional API that was deprecated during the 5.6 release. * Remove API that was deprecated during the 5.8 release. * Update additional deprecation attributes with when it will be removed * Remove additional API that was deprecated during the 5.7 release.
1 parent 7b72288 commit 00742d8

36 files changed

+90
-596
lines changed

CONTRIBUTING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,26 @@ If you do not have commit access, please ask one of the code owners to trigger t
168168
For more details on Swift-DocC's continuous integration, see the
169169
[Continous Integration](#continuous-integration) section below.
170170

171+
### Introducing source breaking changes
172+
173+
We try to avoid source breaking changes, for example:
174+
175+
- removing or renaming public API
176+
- adding protocol requirements to public API
177+
- renaming Render JSON keys or adding new required Render JSON keys
178+
179+
That said, sometimes there are good reasons to make these changes. In those cases we make an effort to offer
180+
a backwards compatible transition by deprecating the old API, alongside the new API, and keeping the deprecated
181+
API for at least one full minor release. For example, if we deprecate an API sometime after the 5.5 release we
182+
keep the deprecated API for the remainder of the upcoming release (5.6) and the entirety of the next release (5.7).
183+
184+
To indicate to API consumers how long the deprecated API will be available, include the version when we'll remove
185+
that API in the deprecation message. For example:
186+
187+
```swift
188+
@available(*, deprecated, message: "Use 'UpdatedSymbolName' instead. This deprecated API will be removed after 5.7 is released")
189+
```
190+
171191
## Testing Swift-DocC
172192
173193
Swift-DocC is committed to maintaining a high level of code quality.

Sources/SwiftDocC/Converter/DocumentationNodeConverter.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,6 @@ public struct DocumentationNodeConverter {
3030
self.context = context
3131
}
3232

33-
/// Converts a documentation node to a render node.
34-
///
35-
/// - Parameters:
36-
/// - node: The documentation node to convert.
37-
/// - source: The source file from which the documentation node's content originated.
38-
/// - bundle: The bundle that contains the content from which the documentation node originated.
39-
/// - Returns: The render node representation of the documentation node.
40-
@available(*, deprecated, message: "Please use convert(_:at:) instead.")
41-
public func convert(_ node: DocumentationNode, at source: URL?, from bundle: DocumentationBundle) throws -> RenderNode {
42-
var translator = RenderNodeTranslator(context: context, bundle: bundle, identifier: node.reference, source: source)
43-
return translator.visit(node.semantic) as! RenderNode
44-
}
45-
4633
/// Converts a documentation node to a render node.
4734
///
4835
/// Convert a documentation node into a render node to get a self-contained, persistable representation of a given topic's data, so you can write it to disk, send it over a network, or otherwise process it.
@@ -55,7 +42,3 @@ public struct DocumentationNodeConverter {
5542
return translator.visit(node.semantic) as! RenderNode
5643
}
5744
}
58-
59-
/// A converter that coverts documentation nodes to render nodes.
60-
@available(*, deprecated, message: "Please use DocumentationNodeConverter instead.")
61-
public typealias Converter = DocumentationNodeConverter

Sources/SwiftDocC/Converter/Rewriter/RenderNodeTransforming.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,3 @@ extension RenderNodeTransforming {
3131
return RenderNodeTransformationComposition(first: self, second: otherTransformation)
3232
}
3333
}
34-
35-
/// A type that modifies a render node.
36-
@available(*, deprecated, message: "Please use RenderNodeTransforming instead.")
37-
public typealias RenderNodeTransformation = RenderNodeTransforming

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

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -57,48 +57,6 @@ public struct ConvertRequest: Codable {
5757
/// The file location of the bundle to convert, if any.
5858
public var bundleLocation: URL?
5959

60-
/// The display name of the documentation bundle to convert.
61-
///
62-
/// ## See Also
63-
/// - ``DocumentationBundle/displayName``
64-
@available(*, deprecated, message: "Use 'bundleInfo.displayName' instead.")
65-
public var displayName: String {
66-
get {
67-
return bundleInfo.displayName
68-
}
69-
set {
70-
bundleInfo.displayName = newValue
71-
}
72-
}
73-
74-
/// The identifier of the documentation bundle to convert.
75-
///
76-
/// ## See Also
77-
/// - ``DocumentationBundle/identifier``
78-
@available(*, deprecated, message: "Use 'bundleInfo.identifier' instead.")
79-
public var identifier: String {
80-
get {
81-
return bundleInfo.identifier
82-
}
83-
set {
84-
bundleInfo.identifier = newValue
85-
}
86-
}
87-
88-
/// The version of the documentation bundle to convert.
89-
///
90-
/// ## See Also
91-
/// - ``DocumentationBundle/version``
92-
@available(*, deprecated, message: "Use 'bundleInfo.version' instead.")
93-
public var version: String {
94-
get {
95-
return bundleInfo.version ?? "0.0.1"
96-
}
97-
set {
98-
bundleInfo.version = newValue
99-
}
100-
}
101-
10260
/// The symbols graph data included in the documentation bundle to convert.
10361
///
10462
/// ## See Also
@@ -137,57 +95,6 @@ public struct ConvertRequest: Codable {
13795
/// a "View More" link that navigates the user to the full version of the documentation page.
13896
public var symbolIdentifiersWithExpandedDocumentation: [String: ExpandedDocumentationRequirements]?
13997

140-
/// The default code listing language for the documentation bundle to convert.
141-
///
142-
/// ## See Also
143-
/// - ``DocumentationBundle/defaultCodeListingLanguage``
144-
@available(*, deprecated, message: "Use 'bundleInfo.defaultCodeListingLanguage' instead.")
145-
public var defaultCodeListingLanguage: String? {
146-
get {
147-
return bundleInfo.defaultCodeListingLanguage
148-
}
149-
set {
150-
bundleInfo.defaultCodeListingLanguage = newValue
151-
}
152-
}
153-
154-
@available(*, deprecated, message: "Use 'init(bundleInfo:externalIDsToConvert:...)' instead.")
155-
public init(
156-
externalIDsToConvert: [String]?,
157-
documentPathsToConvert: [String]? = nil,
158-
includeRenderReferenceStore: Bool? = nil,
159-
bundleLocation: URL? = nil,
160-
displayName: String,
161-
identifier: String,
162-
version: String,
163-
symbolGraphs: [Data],
164-
knownDisambiguatedSymbolPathComponents: [String: [String]]? = nil,
165-
markupFiles: [Data],
166-
miscResourceURLs: [URL],
167-
defaultCodeListingLanguage: String?
168-
) {
169-
self.externalIDsToConvert = externalIDsToConvert
170-
self.documentPathsToConvert = documentPathsToConvert
171-
self.includeRenderReferenceStore = includeRenderReferenceStore
172-
self.bundleLocation = bundleLocation
173-
self.symbolGraphs = symbolGraphs
174-
self.knownDisambiguatedSymbolPathComponents = knownDisambiguatedSymbolPathComponents
175-
self.markupFiles = markupFiles
176-
self.tutorialFiles = []
177-
self.miscResourceURLs = miscResourceURLs
178-
self.featureFlags = FeatureFlags()
179-
self.emitSymbolSourceFileURIs = true
180-
181-
self.bundleInfo = DocumentationBundle.Info(
182-
displayName: displayName,
183-
identifier: identifier,
184-
version: version,
185-
defaultCodeListingLanguage: defaultCodeListingLanguage
186-
)
187-
188-
self.symbolIdentifiersWithExpandedDocumentation = nil
189-
}
190-
19198
/// Creates a request to convert in-memory documentation.
19299
/// - Parameters:
193100
/// - bundleInfo: Information about the bundle to convert.

Sources/SwiftDocC/Indexing/Navigator/AvailabilityIndex+Ext.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,6 @@ public struct InterfaceLanguage: Hashable, CustomStringConvertible, Codable, Equ
124124
self.mask = try values.decode(ID.self, forKey: .mask)
125125
}
126126

127-
/**
128-
Initialize a platform with the given display name and id.
129-
Id is an integer used to shift bits and generate a mask for fast processing.
130-
131-
- Parameters:
132-
- name: The name of the platform used also for display. Note: case sensitive.
133-
- id: The ID of the platform.
134-
*/
135-
@available(*, deprecated, renamed: "init(_:id:mask:)")
136-
public init(_ name: String, id: Int) {
137-
self.init(name, id: name, mask: id)
138-
}
139-
140127
/// Create an interface language with the given display name, id, and integer mask.
141128
///
142129
/// - Parameters:

Sources/SwiftDocC/Indexing/Navigator/NavigatorIndex.swift

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class NavigatorIndex {
6565
/// Missing bundle identifier.
6666
case missingBundleIdentifier
6767

68-
@available(*, deprecated, renamed: "missingBundleIdentifier")
68+
@available(*, deprecated, renamed: "missingBundleIdentifier", message: "Use 'missingBundleIdentifier' instead. This deprecated API will be removed after 5.11 is released")
6969
case missingBundleIndentifier
7070

7171
/// A RenderNode has no title and won't be indexed.
@@ -233,41 +233,6 @@ public class NavigatorIndex {
233233
self.pathHasher = pathHasher
234234
self.navigatorTree = navigatorTree
235235
}
236-
/**
237-
Initialize an `NavigatorIndex` from a given path.
238-
239-
- Parameters:
240-
- url: The URL pointing to the path from which the index should be read.
241-
- bundleIdentifier: The name of the bundle the index is referring to.
242-
- readNavigatorTree: Indicates if the init needs to read the navigator tree from the disk, if false, then `readNavigatorTree` needs to be called later. Default: `true`.
243-
- presentationIdentifier: Indicates if the index has an identifier useful for presentation contexts.
244-
245-
- Throws: A `NavigatorIndex.Error` describing the nature of the problem.
246-
247-
- Note: The index powered by LMDB opens in `readOnly` mode to avoid performing a filesystem lock which fails without writing permissions. As this initializer opens a built index, write permission is not expected.
248-
*/
249-
@available(*, deprecated, message: "Use NavigatorIndex.readNavigatorIndex instead")
250-
public convenience init(url: URL, bundleIdentifier: String? = nil, readNavigatorTree: Bool = true, presentationIdentifier: String? = nil) throws {
251-
let navigator = try NavigatorIndex.readNavigatorIndex(
252-
url: url,
253-
bundleIdentifier: bundleIdentifier,
254-
readNavigatorTree: readNavigatorTree,
255-
presentationIdentifier: presentationIdentifier
256-
)
257-
258-
self.init(
259-
url: navigator.url,
260-
presentationIdentifier: navigator.presentationIdentifier,
261-
bundleIdentifier: navigator.bundleIdentifier,
262-
environment: navigator.environment!,
263-
database: navigator.database!,
264-
availability: navigator.availability!,
265-
information: navigator.information!,
266-
availabilityIndex: navigator.availabilityIndex,
267-
pathHasher: navigator.pathHasher,
268-
navigatorTree: navigator.navigatorTree
269-
)
270-
}
271236

272237
/**
273238
Initialize an `NavigatorIndex` from a given path with an empty tree.
@@ -344,50 +309,6 @@ public class NavigatorIndex {
344309
case languageGroup = 127
345310
case container = 254
346311
case groupMarker = 255 // UInt8.max
347-
348-
@available(*, deprecated, message: "Please use instanceProperty.")
349-
public static let property = PageType.instanceProperty
350-
351-
@available(*, deprecated, message: "Please use tutorial.")
352-
public static let project = PageType.tutorial
353-
354-
/// Initialize a page type from a `roleHeading` returning the Symbol type.
355-
/// - Note: This initializer works only for symbol pages.
356-
@available(*, deprecated, message: "Please use init(role:) or init(symbolKind:)")
357-
init(roleHeading: String) {
358-
switch roleHeading.lowercased() {
359-
case "framework": self = .framework
360-
case "class": self = .class
361-
case "structure": self = .structure
362-
case "protocol": self = .protocol
363-
case "enumeration": self = .enumeration
364-
case "function": self = .function
365-
case "extension": self = .extension
366-
case "local variable": self = .localVariable
367-
case "global variable": self = .globalVariable
368-
case "type alias": self = .typeAlias
369-
case "associated type": self = .associatedType
370-
case "operator": self = .operator
371-
case "macro": self = .macro
372-
case "union": self = .union
373-
case "enumeration case": self = .enumerationCase
374-
case "initializer", "init": self = .initializer
375-
case "instance method": self = .instanceMethod
376-
case "instance property": self = .instanceProperty
377-
case "instance variable": self = .instanceVariable
378-
case "subscript": self = .subscript
379-
case "type method": self = .typeMethod
380-
case "type property": self = .typeProperty
381-
case "property": self = .instanceProperty
382-
case "sample code": self = .sampleCode
383-
case "build setting": self = .buildSetting
384-
case "property list key": self = .propertyListKey
385-
case "property list key reference": self = .propertyListKeyReference
386-
case "web service endpoint": self = .httpRequest
387-
case "dictionary symbol": self = .dictionarySymbol
388-
default:self = .symbol // Generic Symbol.
389-
}
390-
}
391312

392313
/// Initialize a page type from a `role` and a `symbolKind` returning the Symbol type.
393314
init(symbolKind: String) {

Sources/SwiftDocC/Indexing/Navigator/NavigatorTree.swift

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,6 @@ public class NavigatorTree {
6161
/// The root node of the tree.
6262
public private(set) var root: Node
6363

64-
/// A map holding the mapping from topicIdentifier to the node.
65-
/// - Note: This has been deprecated as the mapping is expensive to build and the path for creating
66-
/// a `ResolvedTopicReference` is not served by the navigator item anymore.
67-
@available(*, deprecated)
68-
public private(set) var identifierToNode: [ResolvedTopicReference: Node] = [:]
69-
70-
/// A map holding the mapping from node to the topicIdentifier.
71-
/// - Note: This has been deprecated as the mapping is expensive to build and the path for creating
72-
/// a `ResolvedTopicReference` is not served by the navigator item anymore.
73-
@available(*, deprecated)
74-
public private(set) var nodeToIdentifier: [Node: ResolvedTopicReference] = [:]
75-
7664
/// A map holding the mapping from the numeric identifier to the node.
7765
public private(set) var numericIdentifierToNode: [UInt32: Node] = [:]
7866

@@ -432,17 +420,6 @@ public class NavigatorTree {
432420

433421
/// Storage for additional information in the nodes.
434422
public var attributes: [String: Any] = [:]
435-
436-
/// A value that can be used for disambiguation purposes in presentation contexts.
437-
@available(*, deprecated, message: "Use presentationIdentifier instead.")
438-
public var presentationDisambiguator: String? {
439-
get {
440-
return presentationIdentifier
441-
}
442-
set {
443-
presentationIdentifier = newValue
444-
}
445-
}
446423

447424
/**
448425
Initialize a node with the given `NavigatorItem`.

Sources/SwiftDocC/Infrastructure/Bundle Assets/DataAssetManager.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,6 @@ public struct DataAsset: Codable, Equatable {
205205
self.metadata[url] = metadata
206206
}
207207

208-
/// Returns the data that is registered to the data asset that best matches the given trait collection.
209-
@available(*, deprecated, renamed: "data(bestMatching:)")
210-
public func data(with traitCollection: DataTraitCollection) -> BundleData {
211-
return data(bestMatching: traitCollection)
212-
}
213-
214208
/// Returns the data that is registered to the data asset that best matches the given trait collection.
215209
///
216210
/// If no variant with the exact given trait collection is found, the variant that has the largest trait collection overlap with the

Sources/SwiftDocC/Infrastructure/Diagnostics/Diagnostic.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ import Foundation
1212
import Markdown
1313
import SymbolKit
1414

15-
// Keeping this around for backwards compatibility with older clients (rdar://73049176)
16-
@available(*, deprecated, message: "This typealias will be removed in the future. Use Diagnostic instead.")
17-
public typealias BasicDiagnostic = Diagnostic
18-
1915
/// A diagnostic explains a problem or issue that needs the end-user's attention.
2016
public struct Diagnostic {
2117
/// The origin of the diagnostic, such as a file or process.
@@ -37,15 +33,15 @@ public struct Diagnostic {
3733
/// A brief summary that describe the problem or issue.
3834
public var summary: String
3935

40-
@available(*, deprecated, renamed: "summary")
36+
@available(*, deprecated, renamed: "summary", message: "Use 'summary' instead. This deprecated API will be removed after 5.10 is released")
4137
public var localizedSummary: String {
4238
return summary
4339
}
4440

4541
/// Additional details that explain the problem or issue to the end-user in plain language.
4642
public var explanation: String?
4743

48-
@available(*, deprecated, renamed: "explanation")
44+
@available(*, deprecated, renamed: "explanation", message: "Use 'explanation' instead. This deprecated API will be removed after 5.10 is released")
4945
public var localizedExplanation: String? {
5046
return explanation
5147
}
@@ -89,14 +85,14 @@ public extension Diagnostic {
8985

9086
// MARK: Deprecated
9187

92-
@available(*, deprecated, message: "Use 'DiagnosticConsoleWriter.formattedDescription(for:options:)' instead.")
88+
@available(*, deprecated, message: "Use 'DiagnosticConsoleWriter.formattedDescription(for:options:)' instead. This deprecated API will be removed after 5.10 is released")
9389
extension Diagnostic: DescribedError {
94-
@available(*, deprecated, message: "Use 'DiagnosticConsoleWriter.formattedDescription(for:options:)' instead.")
90+
@available(*, deprecated, message: "Use 'DiagnosticConsoleWriter.formattedDescription(for:options:)' instead. This deprecated API will be removed after 5.10 is released")
9591
var localizedDescription: String {
9692
return DiagnosticConsoleWriter.formattedDescription(for: self)
9793
}
9894

99-
@available(*, deprecated, message: "Use 'DiagnosticConsoleWriter.formattedDescription(for:options:)' instead.")
95+
@available(*, deprecated, message: "Use 'DiagnosticConsoleWriter.formattedDescription(for:options:)' instead. This deprecated API will be removed after 5.10 is released")
10096
public var errorDescription: String {
10197
return DiagnosticConsoleWriter.formattedDescription(for: self)
10298
}

0 commit comments

Comments
 (0)