Skip to content

Port to Android #5

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

Merged
merged 2 commits into from
Nov 4, 2021
Merged

Port to Android #5

merged 2 commits into from
Nov 4, 2021

Conversation

finagolfin
Copy link
Member

Summary

This pull gets this repo to build natively on Android and pass all its tests.

Dependencies

None

Testing

Install the Termux app on an Android phone or tablet, install the Swift 5.5 and git packages with pkg install git swift, clone this repo, and run swift test -j 9 as you would elsewhere.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests - no need as the goal is to just get the existing tests running
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary - nothing extra to be noted

Since this pull mostly consists of adding conditional compilation checks for Android where needed, let me point out where I didn't add them:

In addition, I ran all the tests on Android first and only disabled the tests that failed, so three tests that are disabled for Linux in ConvertServiceTests.swift and eight tests in NavigatorIndexTests.swift are enabled for Android. There's a strange issue where if I run the tests in parallel, two LogHandle tests fail only because they're grabbing extra lines from stdout, which may be an XCTest bug.

When I run the tests serially, it reports all 976 tests passing.

@@ -26,7 +26,7 @@ class PreviewServerTests: XCTestCase {
])
try tempFolder.write(to: URL(fileURLWithPath: NSTemporaryDirectory().appending(UUID().uuidString)))

let socketURL = URL(fileURLWithPath: "/var/tmp").appendingPathComponent(UUID().uuidString).appendingPathExtension("sock")
let socketURL = URL(fileURLWithPath: FileManager.default.temporaryDirectory.path).appendingPathComponent(UUID().uuidString).appendingPathExtension("sock")
Copy link
Member Author

Choose a reason for hiding this comment

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

No /var/tmp on Android.

@ethan-kusters
Copy link
Contributor

Hi @buttaface- thank you so much for opening this! It looks great overall and I’m excited to land support here.
We actually have a related bug tracking supporting Android toolchain builds (https://bugs.swift.org/browse/SR-15321). Is that something we should consider addressing in this PR as well?


There’s a strange issue where if I run the tests in parallel, two LogHandle tests fail only because they’re grabbing extra lines from stdout, which may be an XCTest bug. When I run the tests serially, it reports all 976 tests passing.

DocC’s bin/test script that we encourage contributors to use runs tests in parallel so I’d prefer if we continue to disable these tests for now and file a bug to track the issue with LogHandle.


Just so you’re aware, we’re currently working on landing Swift-DocC in the nightly toolchain builds produced by Swift.org (swiftlang/swift#39723), so I think we’ll likely want to hold off on merging this (and the other PR you opened) until we finalize that work. But would love to land this PR immediately afterwards. Thank you again!

@ethan-kusters
Copy link
Contributor

@swift-ci please test

@finagolfin
Copy link
Member Author

We actually have a related bug tracking supporting Android toolchain builds (https://bugs.swift.org/browse/SR-15321). Is that something we should consider addressing in this PR as well?

Yes, I was surprised to see that. 😄 I have only built this repo with the Termux Swift toolchain as detailed above, not with your Python script. I will try it with your script later and submit a separate pull for that.

DocC’s bin/test script that we encourage contributors to use runs tests in parallel so I’d prefer if we continue to disable these tests for now and file a bug to track the issue with LogHandle.

I simply modified bin/test so that step passed, and all subsequent steps passed too. No need to disable LogHandle for Android, as it passes when run serially. I cannot reproduce that issue on linux, so this may be a bug that crept into XCTest on Android. I will investigate it further, but it shouldn't affect getting this pull in.

No problem on waiting till this gets into the trunk toolchain, looks like the linux CI is broken right now.

@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Oct 22, 2021

No problem on waiting till this gets into the trunk toolchain, looks like the linux CI is broken right now.

The Linux CI is broken tracked by the SR https://bugs.swift.org/browse/SR-15362 and is now fixed into main branch of Swift. Will be fix on Linux CI once the next snapshot is released. (Usually a few days to a week time)

Copy link
Contributor

@ethan-kusters ethan-kusters 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 @buttaface! This looks great.

As, @Kyle-Ye mentioned, the Linux builds are currently failing because of https://bugs.swift.org/browse/SR-15362. Once that has landed in a toolchain I will rerun the tests.

I’ll then merge this PR once CI has passed and we’ve merged the integration of Swift-DocC in the Toolchain with swiftlang/swift#39723.

@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Oct 28, 2021

Thank you @buttaface! This looks great.

As, @Kyle-Ye mentioned, the Linux builds are currently failing because of bugs.swift.org/browse/SR-15362. Once that has landed in a toolchain I will rerun the tests.

I’ll then merge this PR once CI has passed and we’ve merged the integration of Swift-DocC in the Toolchain with apple/swift#39723.

The new Toolchain is landed. Please solve the conflict and we can test again. @buttaface

@finagolfin
Copy link
Member Author

Rebased and ready for CI.

@rauhul
Copy link
Member

rauhul commented Oct 28, 2021

@swift-ci please test

@ethan-kusters
Copy link
Contributor

@swift-ci please test

@ethan-kusters
Copy link
Contributor

Thank you again @buttaface! I think we are good to merge.

@ethan-kusters ethan-kusters merged commit f202411 into swiftlang:main Nov 4, 2021
@finagolfin finagolfin deleted the droid branch November 4, 2021 18:08
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.

4 participants