Skip to content

Commit

Permalink
Fix backwards compatibility issue with Swift 5.7 (#96)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
anferbui authored Aug 29, 2024
1 parent 0510d91 commit 2eb2299
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.6
// swift-tools-version:5.7
//
// This source file is part of the Swift.org open source project
//
Expand Down
6 changes: 1 addition & 5 deletions Plugins/Swift-DocC Convert/SwiftDocCConvert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,7 @@ import PackagePlugin
}

let archiveOutputPath = archiveOutputDir(for: target)
let dependencyArchivePaths: [String] = if isCombinedDocumentationEnabled {
task.dependencies.map { archiveOutputDir(for: $0.target) }
} else {
[]
}
let dependencyArchivePaths: [String] = isCombinedDocumentationEnabled ? task.dependencies.map { archiveOutputDir(for: $0.target) } : []

if verbose {
print("documentation archive output path: '\(archiveOutputPath)'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public struct CommandLineArguments {
}

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

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

// MARK: Extract

Expand Down
7 changes: 4 additions & 3 deletions Sources/SwiftDocCPluginUtilities/HelpInformation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,16 @@ private extension DocumentedFlag {
flagListText += " / \(inverseNames.listForHelpDescription)"
}

var description = if flagListText.count < 23 {
var description: String
if flagListText.count < 23 {
// The flag is short enough to fit the abstract on the same line
"""
description = """
\(flagListText.padding(toLength: 23, withPad: " ", startingAt: 0)) \(abstract)
"""
} else {
// The flag is too long to fit the abstract on the same line
"""
description = """
\(flagListText)
\(abstract)
Expand Down

0 comments on commit 2eb2299

Please sign in to comment.