swiftlang / swift-docc-plugin

Swift Package Manager command plugin for Swift-DocC
https://swiftpackageindex.com/apple/swift-docc-plugin/1.3.0/documentation/swiftdoccplugin
Apache License 2.0
316 stars 54 forks source link

Fix backwards compatibility issue with Swift 5.7 #96

Closed anferbui closed 2 weeks ago

anferbui commented 2 weeks ago

Bug/issue #, if applicable: fixes https://github.com/swiftlang/swift-docc-plugin/issues/94, rdar://134859979

Summary

swift-docc-plugin was not building with Swift 5.7 due to using newer syntax which did not exist yet.

Fixes the compilation issues by using older Swift syntax.

I've also updated our minimum supported version to Swift 5.7; older versions are no longer supported.

Dependencies

N/A

Testing

Steps:

  1. Clone repository and set up docker image with Swift 5.7
  2. Try to build swift-docc-plugin and it should fail without these changes, and succeed with them
docker run -v /local/path/to/swift-docc-plugin:/swift-docc-plugin -it swift:5.7-amazonlinux2
cd /swift-docc-plugin
swift build

Before:

/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:31:50: error: consecutive declarations on a line must be separated by ';'
    private var remainingOptionsOrFlags: [String].SubSequence
                                                 ^
[...]
/swift-docc-plugin/Plugins/Swift-DocC Convert/SwiftDocCConvert.swift:111:52: error: expected initial value after '='
            let dependencyArchivePaths: [String] = if isCombinedDocumentationEnabled {
                                                   ^
[...]
/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/HelpInformation.swift:139:27: error: expected initial value after '='
        var description = if flagListText.count < 23 {
                          ^

After:

[85/85] Linking snippet-extract
Build complete! (4.95s)

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

sofiaromorales commented 2 weeks ago

@swift-ci please test

anferbui commented 2 weeks ago

@swift-ci please test