From 8ef1bf972096f2802486b17736eaade5dfc7a819 Mon Sep 17 00:00:00 2001 From: Andrea Fernandez Buitrago <15234535+anferbui@users.noreply.github.com> Date: Thu, 29 Aug 2024 11:30:15 +0100 Subject: [PATCH 1/2] 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 https://github.com/swiftlang/swift-docc-plugin/issues/94 and rdar://134859979. --- Plugins/Swift-DocC Convert/SwiftDocCConvert.swift | 6 +----- .../CommandLineArguments/CommandLineArguments.swift | 4 ++-- Sources/SwiftDocCPluginUtilities/HelpInformation.swift | 7 ++++--- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Plugins/Swift-DocC Convert/SwiftDocCConvert.swift b/Plugins/Swift-DocC Convert/SwiftDocCConvert.swift index 1320352..4dae8c9 100644 --- a/Plugins/Swift-DocC Convert/SwiftDocCConvert.swift +++ b/Plugins/Swift-DocC Convert/SwiftDocCConvert.swift @@ -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)'") diff --git a/Sources/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift b/Sources/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift index 1cc7818..8463ea3 100644 --- a/Sources/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift +++ b/Sources/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift @@ -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.SubSequence /// All literals after the first `--` separator (if there is one). - private var literalValues: [String].SubSequence + private var literalValues: Array.SubSequence // MARK: Extract diff --git a/Sources/SwiftDocCPluginUtilities/HelpInformation.swift b/Sources/SwiftDocCPluginUtilities/HelpInformation.swift index e6dd5a4..56c8f7b 100644 --- a/Sources/SwiftDocCPluginUtilities/HelpInformation.swift +++ b/Sources/SwiftDocCPluginUtilities/HelpInformation.swift @@ -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) From 6d49da8c531da6dbed4f61fcfd86bba6eb4e6f94 Mon Sep 17 00:00:00 2001 From: Andrea Fernandez Buitrago <15234535+anferbui@users.noreply.github.com> Date: Thu, 29 Aug 2024 11:54:06 +0100 Subject: [PATCH 2/2] 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. --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 0dca27c..ef103c9 100644 --- a/Package.swift +++ b/Package.swift @@ -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 //