Skip to content

Commit 2eb2299

Browse files
authored
Fix backwards compatibility issue with Swift 5.7 (#96)
* 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. * Set minimum supported version to Swift 5.7. swift-docc-plugin does not support Swift 5.6 -- increasing the tool version in Package.swift to clearly indicate this. --- Fixes #94 and rdar://134859979.
1 parent 0510d91 commit 2eb2299

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.6
1+
// swift-tools-version:5.7
22
//
33
// This source file is part of the Swift.org open source project
44
//

Plugins/Swift-DocC Convert/SwiftDocCConvert.swift

+1-5
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

+2-2
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

+4-3
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)