Skip to content

Commit 8ef1bf9

Browse files
committed
Fix backwards compatibility issue with Swift 5.7
swift-docc-plugin was not building with Swift 5.7 due to using newer syntax which did not exist yet. Fixes the compilation issues to use older Swift syntax. Fixes #94 and rdar://134859979.
1 parent 0510d91 commit 8ef1bf9

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

Plugins/Swift-DocC Convert/SwiftDocCConvert.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,7 @@ import PackagePlugin
108108
}
109109

110110
let archiveOutputPath = archiveOutputDir(for: target)
111-
let dependencyArchivePaths: [String] = if isCombinedDocumentationEnabled {
112-
task.dependencies.map { archiveOutputDir(for: $0.target) }
113-
} else {
114-
[]
115-
}
111+
let dependencyArchivePaths: [String] = isCombinedDocumentationEnabled ? task.dependencies.map { archiveOutputDir(for: $0.target) } : []
116112

117113
if verbose {
118114
print("documentation archive output path: '\(archiveOutputPath)'")

Sources/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public struct CommandLineArguments {
2828
}
2929

3030
/// All remaining (not-yet extracted) options or flags, up to the the first `--` separator (if there is one).
31-
private var remainingOptionsOrFlags: [String].SubSequence
31+
private var remainingOptionsOrFlags: Array<String>.SubSequence
3232

3333
/// All literals after the first `--` separator (if there is one).
34-
private var literalValues: [String].SubSequence
34+
private var literalValues: Array<String>.SubSequence
3535

3636
// MARK: Extract
3737

Sources/SwiftDocCPluginUtilities/HelpInformation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,16 @@ private extension DocumentedFlag {
136136
flagListText += " / \(inverseNames.listForHelpDescription)"
137137
}
138138

139-
var description = if flagListText.count < 23 {
139+
var description: String
140+
if flagListText.count < 23 {
140141
// The flag is short enough to fit the abstract on the same line
141-
"""
142+
description = """
142143
\(flagListText.padding(toLength: 23, withPad: " ", startingAt: 0)) \(abstract)
143144
144145
"""
145146
} else {
146147
// The flag is too long to fit the abstract on the same line
147-
"""
148+
description = """
148149
\(flagListText)
149150
\(abstract)
150151

0 commit comments

Comments
 (0)