Skip to content

Commit 7fc8b83

Browse files
Merge pull request #161 from marcprux/main
Android support
2 parents 2b0db26 + 886fd72 commit 7fc8b83

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ jobs:
5656
name: test-coverage-report
5757
path: .test-coverage
5858

59+
android:
60+
name: Test on Android
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v4
64+
- name: Test
65+
uses: skiptools/swift-android-action@v2
66+
5967
backcompat-ubuntu-22_04:
6068
name: Test Swift ${{ matrix.swift }} on Ubuntu 22.04
6169
runs-on: ubuntu-22.04

Package.resolved

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/GraphQL/Instrumentation/Instrumentation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public extension Instrumentation {
6262
}
6363

6464
func threadId() -> Int {
65-
#if os(Linux)
65+
#if os(Linux) || os(Android)
6666
return Int(pthread_self())
6767
#else
6868
return Int(pthread_mach_thread_np(pthread_self()))

Sources/GraphQL/Map/AnyCoder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2699,7 +2699,7 @@ private extension _AnyDecoder {
26992699
func unbox(_ value: Any, as type: Bool.Type) throws -> Bool? {
27002700
guard !(value is NSNull) else { return nil }
27012701

2702-
#if DEPLOYMENT_RUNTIME_SWIFT || os(Linux)
2702+
#if DEPLOYMENT_RUNTIME_SWIFT || os(Linux) || os(Android)
27032703
// Bridging differences require us to split implementations here
27042704
guard let number = __SwiftValue.store(value) as? NSNumber else {
27052705
throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)

Sources/GraphQL/Map/MapCoder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2707,7 +2707,7 @@ private extension _MapDecoder {
27072707
func unbox(_ value: Any, as type: Bool.Type) throws -> Bool? {
27082708
guard !(value is NSNull) else { return nil }
27092709

2710-
#if DEPLOYMENT_RUNTIME_SWIFT || os(Linux)
2710+
#if DEPLOYMENT_RUNTIME_SWIFT || os(Linux) || os(Android)
27112711
// Bridging differences require us to split implementations here
27122712
guard let number = __SwiftValue.store(value) as? NSNumber else {
27132713
throw DecodingError._typeMismatch(at: codingPath, expectation: type, reality: value)

Tests/GraphQLTests/InstrumentationTests/InstrumentationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class InstrumentationTests: XCTestCase, Instrumentation {
148148
}
149149

150150
func testInstrumentationCalls() throws {
151-
// #if os(Linux)
151+
// #if os(Linux) || os(Android)
152152
// expectedThreadId = Int(pthread_self())
153153
// #else
154154
// expectedThreadId = Int(pthread_mach_thread_np(pthread_self()))
@@ -172,7 +172,7 @@ class InstrumentationTests: XCTestCase, Instrumentation {
172172

173173
func testDispatchQueueInstrumentationWrapper() throws {
174174
// let dispatchGroup = DispatchGroup()
175-
// #if os(Linux)
175+
// #if os(Linux) || os(Android)
176176
// expectedThreadId = Int(pthread_self())
177177
// #else
178178
// expectedThreadId = Int(pthread_mach_thread_np(pthread_self()))

0 commit comments

Comments
 (0)