Skip to content

Commit f0b4307

Browse files
authored
Deprecate additionalSymbolGraphFiles (#777)
1 parent d958114 commit f0b4307

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Sources/SwiftDocCUtilities/ArgumentParsing/ActionExtensions/ConvertAction+CommandInitialization.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extension ConvertAction {
4141
// into a dictionary. This will throw with a descriptive error upon failure.
4242
let parsedPlatforms = try PlatformArgumentParser.parse(convert.platforms)
4343

44-
let additionalSymbolGraphFiles = convert.additionalSymbolGraphFiles + symbolGraphFiles(
44+
let additionalSymbolGraphFiles = (convert as _DeprecatedSymbolGraphFilesAccess).additionalSymbolGraphFiles + symbolGraphFiles(
4545
in: convert.additionalSymbolGraphDirectory
4646
)
4747

@@ -100,3 +100,8 @@ private func symbolGraphFiles(in directory: URL?) -> [URL] {
100100
return subpaths.map { directory.appendingPathComponent($0) }
101101
.filter { DocumentationBundleFileTypes.isSymbolGraphFile($0) }
102102
}
103+
104+
private protocol _DeprecatedSymbolGraphFilesAccess {
105+
var additionalSymbolGraphFiles: [URL] { get }
106+
}
107+
extension Docc.Convert: _DeprecatedSymbolGraphFilesAccess {}

Sources/SwiftDocCUtilities/ArgumentParsing/Subcommands/Convert.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ extension Docc {
6868
help: .hidden,
6969
transform: URL.init(fileURLWithPath:)
7070
)
71+
@available(*, deprecated, renamed: "additionalSymbolGraphDirectory", message: "Use 'additionalSymbolGraphDirectory' instead. This deprecated API will be removed after 5.12 is released")
7172
var additionalSymbolGraphFiles: [URL] = [] // Remove when other tools no longer use it. (rdar://72449411)
7273

7374
@Option(
@@ -107,7 +108,7 @@ extension Docc {
107108
set { inputsAndOutputs.additionalSymbolGraphDirectory = newValue }
108109
}
109110

110-
/// A user-provided list o path to additional symbol graph files that the convert action will process.
111+
@available(*, deprecated, renamed: "additionalSymbolGraphDirectory", message: "Use 'additionalSymbolGraphDirectory' instead. This deprecated API will be removed after 5.12 is released")
111112
public var additionalSymbolGraphFiles: [URL] { // Remove when other tools no longer use it. (rdar://72449411)
112113
get { inputsAndOutputs.additionalSymbolGraphFiles }
113114
set { inputsAndOutputs.additionalSymbolGraphFiles = newValue }

Tests/SwiftDocCUtilitiesTests/ArgumentParsing/ConvertSubcommandTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ class ConvertSubcommandTests: XCTestCase {
222222
}
223223
}
224224

225+
// This test calls ``ConvertOptions.additionalSymbolGraphFiles`` which is deprecated.
226+
// Deprecating the test silences the deprecation warning when running the tests. It doesn't skip the test.
227+
@available(*, deprecated)
225228
func testAdditionalSymbolGraphFiles() throws {
226229
SetEnvironmentVariable(TemplateOption.environmentVariableKey, testTemplateURL.path)
227230

0 commit comments

Comments
 (0)