Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix backwards compatibility issue with Swift 5.7 #96

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

anferbui
Copy link
Contributor

@anferbui anferbui commented Aug 29, 2024

Bug/issue #, if applicable: fixes #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.

  • [ ] Added tests Not needed
  • Ran the ./bin/test script and it succeeded
  • [ ] Updated documentation if necessary Not needed

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.
Copy link
Contributor

@sofiaromorales sofiaromorales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sofiaromorales
Copy link
Contributor

@swift-ci please test

swift-docc-plugin does not support Swift 5.6 -- increasing the tool version in Package.swift to clearly indicate this.
@anferbui
Copy link
Contributor Author

@swift-ci please test

@anferbui anferbui merged commit 2eb2299 into main Aug 29, 2024
2 checks passed
@anferbui anferbui deleted the fix-swift-5.7-compilation-issues branch August 29, 2024 13:05
Lukasa pushed a commit to apple/swift-nio-http2 that referenced this pull request Aug 30, 2024
Updates the swift-docc-plugin dependency to remove the upper bound
(fixed by swiftlang/swift-docc-plugin#96).

~~This PR is in a draft state so that we can verify that
swiftlang/swift-docc-plugin#96 resolves this
issue in this project before merging and creating a tag.~~

We've created the tag and I updated the PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fatal compiler error on swift 5.7 and Swift 5.8
2 participants