-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add Linux support #9
Conversation
f0c90b3
to
4e19b63
Compare
a06486e
to
9d4225d
Compare
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 |
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.
This isn't a directly related change but I figured I'd bump while I was here.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #9 +/- ##
==========================================
- Coverage 97.63% 97.47% -0.17%
==========================================
Files 37 37
Lines 7324 7333 +9
==========================================
- Hits 7151 7148 -3
- Misses 173 185 +12
|
29dd651
to
9fa58d4
Compare
@@ -54,7 +54,7 @@ public final class DependencyTreeGenerator { | |||
for try await generatedRoot in taskGroup { | |||
generatedRoots.append(generatedRoot) | |||
} | |||
return generatedRoots.sorted().joined(separator: "\n\n").trimmingCharacters(in: .whitespacesAndNewlines) |
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.
trimmingCharacters
exists on NSString
, which doesn't exist in Swift on Linux. Turns out we didn't need this call anyways though.
enum DependencyTreeGeneratorError: Error, CustomStringConvertible { | ||
private enum DependencyTreeGeneratorError: Error, CustomStringConvertible { |
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.
not a necessary change but noticed that I'd forgotten to make this private
while I was here.
@@ -121,7 +121,7 @@ public enum TypeDescription: Codable, Hashable, Comparable, Sendable { | |||
case let .closure(arguments, isAsync, doesThrow, returnType): | |||
return "(\(arguments.map { $0.asSource }.joined(separator: ", ")))\([isAsync ? " async" : "", doesThrow ? " throws" : ""].filter { !$0.isEmpty }.joined()) -> \(returnType.asSource)" | |||
case let .unknown(text): | |||
return text.trimmingCharacters(in: .whitespacesAndNewlines) |
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.
since trimmingCharacters
doesn't exist on Linux, we now initialize this type with a trimmedDescription
which does effectively the same thing (and we've got a test to prove it!)
"SafeDICore", | ||
"ZippyJSON", |
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.
ZippyJSON
does not support Linux (or technically watchOS
, visionOS
, and a few other platforms)
@@ -476,9 +476,8 @@ extension TypeSyntax { | |||
returnType: typeIdentifier.returnClause.type.typeDescription) | |||
|
|||
} else { | |||
assertionFailure("TypeSyntax of unknown type. Defaulting to `description`.") |
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.
We haven't gotten any value out of this assertionFailure
in multiple years of development on this type across multiple projects. Time to remove.
} catch { | ||
didThrow = true | ||
XCTAssertEqual((error as CustomStringConvertible).description, errorDescription, line: line) | ||
XCTAssertEqual("\(error)", errorDescription, line: line) |
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.
This change was required to get tests working on Linux. (error as CustomStringConvertible).description
was not finding our var description: String
code on Linux for unknown reasons.
a28ae2f
to
972e650
Compare
Merging this since we aren't really changing functionality, and we have good test coverage on the changed code. As always, happy to take feedback post merge. |
We're failing to build on Linux today. This PR gets us working on Linux by making ZippyJSON a platform-conditioned dependency, as well as fixing a host of other issues. I added Linux checks to CI as well.
When we merge, I'll need to add the linux check as required on all PRs.