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 #117
Add Linux support #117
Conversation
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.
Thank you for the contribution @drewag!
LGTM in general, but I think this should not break compatibility with Xcode 10.0 if possible. This also should document and link bug reports about existing incompatibilities with regards to namespace handling and error reporting. As far as I understand this doesn't add Linux images to the CI matrix in azure-pipelines.yml
? Would this change be compatible with Swift 4.2 on Linux by the way? We could add both 4.2 and 5.0 on Linux to the CI matrix if so. README.md
could be updated accordingly to indicate the supported Linux versions.
I wonder if we could instruct SwiftLint to ignore the auto-generated test manifest file, so that linting passes on CI again?
Thanks for the feedback. Can I just confirm that supporting Linux moving forward is a goal worth pursuing before I make these changes? |
@drewag yes, absolutely, I'd be super happy to merge and maintain Linux support, as long as we can see a clear path towards unifying the behaviour across all platforms. I previously did plan to add support for Linux to XMLCoder, but I wasn't sure if Foundation had the feature parity on Linux, especially in terms of XML namespaces support. I'm fine with having small inconsistencies in |
Ok great, I'll work on it. |
There are two failing tests on Linux if I revert to Swift 4.2. Looking into what the problems are now. |
One failed test is NoteTest.testInvalidXML. The 4.2 parser fails to catch the "Ffrom" inconsistency. Not sure what to do about that except ignore that test on versions before 5.0. The harder one is ErrorContextTest.testErrorContext. There we are getting the wrong error type:
That one is a bit above my pay grade. Any ideas? |
Are both of those errors reproducible on 4.2, but only on Linux? If so, we could keep 4.2 compatibility on Apple platforms, but require 5.0 on Linux. This would mean not testing 4.2 Linux on CI and mentioning that Linux support requires 5.0 in |
Yup that's correct, all tests pass on Linux with Swift 5. I'll update the README and then we should be ready to merge. |
Sorry for all the commits (Azure Pipelines is new to me). This should finally be ready to merge. |
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.
Fantastic, thank you so much!
Only a few minor changes needed to be made for this to work properly on Linux. - Upgraded to Swift 5.0.1 - There was a logical error in XMLStackParser causing a crash on forced unwrapping - Element names returned from the XMLParser on linux have the namespace coming after the name. I put a hack in to reverse them back. - The allTests definitions are no longer relevant. Instead, I used `swift test --generate-linuxmain`
Only a few minor changes needed to be made for this to work properly on Linux.
swift test --generate-linuxmain