-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[6.0] Add support for new Bionic module from Android overlay (import Bionic
) (#7615)
#7752
Conversation
@kateinoigakukun, need a CI run here. |
@swift-ci test |
@kateinoigakukun, passed CI, ready for merge. I need this so the upcoming Swift 6.0 compiler snapshots with this overlay have a SwiftPM that can generate the test file with this new overlay. |
Hold off, missed one more import which I just submitted in #7755, will add that here once it's in trunk. |
@@ -4,6 +4,8 @@ import Darwin | |||
import Glibc | |||
#elseif canImport(Musl) | |||
import Musl | |||
#elseif canImport(Android) | |||
import Android |
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.
Can this be Bionic
? The other platforms seem to be importing the C library rather than the platform module.
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.
Is this relevant to the swift argument parser support pr as well?
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.
Done
@@ -2,6 +2,8 @@ | |||
import Glibc | |||
#elseif canImport(Musl) | |||
import Musl | |||
#elseif canImport(Android) | |||
import Android |
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.
Likewise.
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.
Miscellaneous_EchoExecutable/Sources/secho/main.swift:11:11: error: cannot find 'getcwd' in scope
9 | #endif
10 |
11 | let cwd = getcwd(nil, Int(PATH_MAX))
| `- error: cannot find 'getcwd' in scope
12 | defer { free(cwd) }
13 | let workingDirectory = String(validatingUTF8: cwd!)!
getcwd()
is declared in unistd.h
, which is in the Android overlay but not in the Bionic module that Swift uses.
The rest may work as import Bionic
though, I will do more testing and let you know.
Sources/Build/TestObservation.swift
Outdated
@@ -132,6 +132,8 @@ public func generateTestObservationCode(buildParameters: BuildParameters) -> Str | |||
@_exported import WinSDK | |||
#elseif os(WASI) | |||
@_exported import WASILibc | |||
#elseif canImport(Android) | |||
@_exported import Android |
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 one potentially as well - the Windows case is probably for additional Win32 APIs that are needed, but I am unsure about the re-export there 🤔.
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.
Done
@@ -39,6 +39,8 @@ import Darwin | |||
import Glibc | |||
#elseif canImport(Musl) | |||
import Musl | |||
#elseif canImport(Android) | |||
import Android |
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.
Seems at all the sources?
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.
I'll check.
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.
Done
This adds the overlay to four of the six files that currently `import Glibc`, with those last two showing no difference if this _wasn't_ added, like `PackageDescription.swift`.
Also, add the import in `Environment.swift` too
import Android
) (#7615)import Bionic
) (#7615)
@swift-ci please test |
@swift-ci please test Windows platform |
@MaxDesiatov, passed CI, ready for merge. |
Thanks for the quick review, @bnbarham and @compnerd, now I can stop patching the prebuilt |
Explanation: Now that this new overlay was merged into the 6.0 compiler too in swiftlang/swift#74758, this adds the overlay to five of the seven files that currently
import Glibc
, with those last two showing no difference if this wasn't added, likePackageDescription.swift
, so remove most of those imports.Scope: Add imports on Android and remove a handful in two files that were unused
Issue: None
Original PRs: #7615 and #7755
Risk: Very low
Testing: Passed all CI on trunk, plus on my daily Android CI
Reviewer: @bnbarham