Skip to content

Get Android constants used by Channel from Bionic instead#2026

Merged
Lukasa merged 2 commits intoapple:mainfrom
finagolfin:droid
Jan 6, 2022
Merged

Get Android constants used by Channel from Bionic instead#2026
Lukasa merged 2 commits intoapple:mainfrom
finagolfin:droid

Conversation

@finagolfin
Copy link
Copy Markdown
Contributor

@finagolfin finagolfin commented Jan 5, 2022

Motivation:

An upcoming pull, swiftlang/swift#35707, moves Android to the same single-header modulemap for Bionic as used on linux, but that doesn't work unless this is changed. This approach works both with the current release toolchain and with that new modulemap.

Modifications:

Change how these Bionic constants are imported.

Result:

This repo compiles for Android and the tests pass with both modulemap approaches.

I've been using an earlier version of this pull to cross-compile this repo on my Android CI, where I apply that modulemap pull to the trunk SDK. Without it, I get the following error with the new modulemap, because of this definition:

swift-nio/Sources/NIOCore/Interfaces.swift:102:31: error: initializer 'init(_:)' requires that 'net_device_flags' conform to 'BinaryInteger'

That Bionic pull should be merged into trunk soon, once Daniel, who maintains the community Android CI, approves it. In the meantime, this pull gets this repo working with both approaches.

Motivation:

An upcoming pull, swiftlang/swift#35707, moves Android to the same single-header
modulemap for Bionic as used on linux, but that doesn't work unless this is
changed. This approach works both with the current release toolchain and
with that new modulemap.

Modifications:

Change how these Bionic constants are imported.

Result:

This repo compiles for Android and the tests pass with both modulemap approaches.
@finagolfin
Copy link
Copy Markdown
Contributor Author

I had not tested with old toolchains like 5.2, let's see if this new approach works.

@finagolfin finagolfin changed the title Cast Android constants used by Channel differently Get Android constants used by Channel from Bionic instead Jan 5, 2022
@finagolfin
Copy link
Copy Markdown
Contributor Author

Single failing test on 5.2 looks like a flake: EventLoopTest.testCancelledScheduledTasksDoNotHoldOnToRunClosure : failed - condition not satisfied in time.

@Lukasa
Copy link
Copy Markdown
Contributor

Lukasa commented Jan 5, 2022

@swift-nio-bot test this please

@Lukasa
Copy link
Copy Markdown
Contributor

Lukasa commented Jan 5, 2022

Blocked by #2027.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants