mirror of
https://github.com/apple/swift-nio-extras.git
synced 2025-05-14 08:52:42 +08:00
Android support (#244)
Add Android support ### Motivation: Support the Android platform. ### Modifications: Add Android imports and fix the default temporary directory to be correct for the OS. ### Result: The package will build and test on Android. --------- Co-authored-by: George Barnett <gbarnett@apple.com>
This commit is contained in:
parent
74a143a79f
commit
aa0d902637
@ -17,6 +17,8 @@ import NIOCore
|
||||
import Darwin
|
||||
#elseif canImport(Musl)
|
||||
import Musl
|
||||
#elseif canImport(Android)
|
||||
import Android
|
||||
#else
|
||||
import Glibc
|
||||
#endif
|
||||
|
@ -18,6 +18,8 @@ import NIOCore
|
||||
import Darwin
|
||||
#elseif canImport(Musl)
|
||||
import Musl
|
||||
#elseif canImport(Android)
|
||||
import Android
|
||||
#else
|
||||
import Glibc
|
||||
#endif
|
||||
|
@ -20,6 +20,8 @@ import NIOCore
|
||||
import Darwin
|
||||
#elseif canImport(Musl)
|
||||
import Musl
|
||||
#elseif canImport(Android)
|
||||
import Android
|
||||
#else
|
||||
import Glibc
|
||||
#endif
|
||||
|
@ -19,6 +19,8 @@ import NIOCore
|
||||
import Darwin
|
||||
#elseif canImport(Musl)
|
||||
import Musl
|
||||
#elseif canImport(Android)
|
||||
import Android
|
||||
#else
|
||||
import Glibc
|
||||
#endif
|
||||
|
@ -108,6 +108,8 @@ private func withTemporaryFile<T>(
|
||||
private var temporaryDirectory: String {
|
||||
#if os(Linux)
|
||||
return "/tmp"
|
||||
#elseif os(Android)
|
||||
return "/data/local/tmp"
|
||||
#else
|
||||
if #available(macOS 10.12, iOS 10, tvOS 10, watchOS 3, *) {
|
||||
return FileManager.default.temporaryDirectory.path
|
||||
|
@ -19,6 +19,10 @@ import XCTest
|
||||
|
||||
@testable import NIOExtras
|
||||
|
||||
#if canImport(Android)
|
||||
import Android
|
||||
#endif
|
||||
|
||||
class WritePCAPHandlerTest: XCTestCase {
|
||||
private var accumulatedPackets: [ByteBuffer]!
|
||||
private var channel: EmbeddedChannel!
|
||||
|
Loading…
x
Reference in New Issue
Block a user