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

Add Linux support #117

Merged
merged 16 commits into from Jul 23, 2019
Merged

Add Linux support #117

merged 16 commits into from Jul 23, 2019

Conversation

drewag
Copy link
Contributor

@drewag drewag commented Jul 22, 2019

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

.gitignore Outdated Show resolved Hide resolved
Copy link
Collaborator

@MaxDesiatov MaxDesiatov left a 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?

@drewag
Copy link
Contributor Author

drewag commented Jul 23, 2019

Thanks for the feedback. Can I just confirm that supporting Linux moving forward is a goal worth pursuing before I make these changes?

@MaxDesiatov
Copy link
Collaborator

@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 master and maybe even tagged versions, but this has to be clearly documented and tested on CI.

@drewag
Copy link
Contributor Author

drewag commented Jul 23, 2019

Ok great, I'll work on it.

@drewag
Copy link
Contributor Author

drewag commented Jul 23, 2019

There are two failing tests on Linux if I revert to Swift 4.2. Looking into what the problems are now.

@drewag
Copy link
Contributor Author

drewag commented Jul 23, 2019

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:

typeMismatch(Swift.Dictionary<Swift.String, Any>, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "value", intValue: nil)], debugDescription: "Expected to decode Dictionary<String, Any> but found SharedBox<Array> instead.", underlyingError: nil))

That one is a bit above my pay grade. Any ideas?

@MaxDesiatov
Copy link
Collaborator

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 README.md

@drewag
Copy link
Contributor Author

drewag commented Jul 23, 2019

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.

@drewag
Copy link
Contributor Author

drewag commented Jul 23, 2019

Sorry for all the commits (Azure Pipelines is new to me). This should finally be ready to merge.

Copy link
Collaborator

@MaxDesiatov MaxDesiatov left a 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!

@MaxDesiatov MaxDesiatov merged commit 3ae4113 into CoreOffice:master Jul 23, 2019
arjungupta0107 pushed a commit to salido/XMLCoder that referenced this pull request Jun 26, 2020
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`
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.

None yet

3 participants