-
Notifications
You must be signed in to change notification settings - Fork 126
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
Relax dependency on SwiftSyntax and SwiftFormat to 508..<510 #331
Conversation
Hi @mbrandonw - thanks so much! Regarding the tests, let's keep with the times and make the tests pass with 5.9 instead, as that's what happens for a new project. If someone gets 5.8 resolved, that's okay, we know it's worked till now. Otherwise looks great! |
@czechboy0 No problem, pushed fixes to the tests for SwiftFormat 509. |
Tests/OpenAPIGeneratorReferenceTests/FileBasedReferenceTests.swift
Outdated
Show resolved
Hide resolved
@swift-server-bot add to allowlist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, thanks! Please just check the CI failures, we'll need to get them to green before landing.
Hi @czechboy0, I don't know why the build is failing. The Jenkins logs show that all tests pass, yet it then says:
Maybe someone more familiar with y'alls CI should take this over. I don't think there's much I can do to help. |
I can take a look Monday, but first thing I search for is "error:". |
Looks like something for SwiftSyntax to address, or for OpenAPIGenerator to ignore: |
Okay, unfortunately it seems that swift-syntax has some missing dependencies, filed here: swiftlang/swift-syntax#2287 To make this PR pass, can you comment out the line |
Looks like it's now passing. 🙂 |
Thank you @mbrandonw and @groue! |
Motivation
Currently this project pins to a specific major version of SwiftSyntax and SwiftFormat, which is 508. That means anyone depending on this project cannot also use macros, because that typically requires depending on SwiftSyntax 509.
Modifications
I relaxed the dependency constraint to be
"508.0.1"..<"510.0.0"
.Result
There is only one small change that needs to be done to support SwiftSyntax 509, and it can easily be worked around by checking
#if canImport(SwiftSyntax509)
.Test Plan
This change does complicate testing a bit since there are subtle formatting changes in SwiftFormat 508 vs 509. In particular, the Client.swift file has a few lines that get formatted onto 2 lines, whereas previously they were allowed to be on a single line.
This means the test suite will pass when SwiftFormat 508 is used but fail when 509 is used. So, for now, I've decided to just omit the test when 509 is available, but maybe there is some way to support both Swift versions in the test. I am not very familiar with this library or how it's tests are set up.