Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
strategy:
fail-fast: false
matrix:
swift: ['6.2.3']
arch: ['aarch64', 'x86_64']
swift: ['6.2.3', 'nightly-6.3']
arch: ['aarch64', 'x86_64', 'armv7']
sdk: ['28', '29', '31', '33']
runs-on: macos-15
timeout-minutes: 30
Expand All @@ -18,4 +18,4 @@ jobs:
run: |
brew install skiptools/skip/skip || (brew update && brew install skiptools/skip/skip)
skip android sdk install --version ${{ matrix.swift }}
ANDROID_NDK_ROOT="" ANDROID_SDK_VERSION=${{ matrix.sdk }} skip android build --arch ${{ matrix.arch }} --android-api-level ${{ matrix.sdk }}
ANDROID_NDK_ROOT="" ANDROID_SDK_VERSION=${{ matrix.sdk }} skip android build --arch ${{ matrix.arch }} --android-api-level ${{ matrix.sdk }}
24 changes: 12 additions & 12 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ var package = Package(
name: "AndroidLooper", targets: ["AndroidLooper"]
),
.library(
name: "AndroidNDK", targets: ["AndroidNDK"]
name: "CAndroidNDK", targets: ["CAndroidNDK"]
),
.library(
name: "AndroidHardware", targets: ["AndroidHardware"]
Expand Down Expand Up @@ -143,7 +143,7 @@ var package = Package(
name: "JavaLangReflect",
package: "swift-java"
),
"AndroidNDK",
"CAndroidNDK",
"AndroidJava",
"AndroidManifest",
"AndroidR",
Expand Down Expand Up @@ -265,7 +265,7 @@ var package = Package(
name: "AndroidOS",
dependencies: [
"AndroidJava",
"AndroidNDK"
"CAndroidNDK"
],
exclude: ["swift-java.config"],
swiftSettings: [
Expand Down Expand Up @@ -293,7 +293,7 @@ var package = Package(
"AndroidJava",
"AndroidUtil",
"AndroidOS",
"AndroidNDK",
"CAndroidNDK",
"AndroidFileManager",
],
exclude: ["swift-java.config"],
Expand Down Expand Up @@ -434,7 +434,7 @@ var package = Package(
name: "Socket",
package: "Socket"
),
"AndroidNDK"
"CAndroidNDK"
],
swiftSettings: [
.swiftLanguageMode(.v6),
Expand All @@ -446,7 +446,7 @@ var package = Package(
]
),
.target(
name: "AndroidNDK",
name: "CAndroidNDK",
cxxSettings: [
.define("ANDROID_NDK_VERSION", to: ndkVersion.description),
.define("ANDROID_SDK_VERSION", to: sdkVersion.description)
Expand All @@ -458,7 +458,7 @@ var package = Package(
.target(
name: "AndroidHardware",
dependencies: [
"AndroidNDK",
"CAndroidNDK",
"AndroidLooper"
],
swiftSettings: [
Expand All @@ -473,7 +473,7 @@ var package = Package(
.target(
name: "AndroidFileManager",
dependencies: [
"AndroidNDK"
"CAndroidNDK"
],
swiftSettings: [
.swiftLanguageMode(.v6),
Expand All @@ -487,7 +487,7 @@ var package = Package(
.target(
name: "AndroidManifest",
dependencies: [
"AndroidNDK"
"CAndroidNDK"
],
swiftSettings: [
.swiftLanguageMode(.v6),
Expand All @@ -501,7 +501,7 @@ var package = Package(
.target(
name: "AndroidNativeActivity",
dependencies: [
"AndroidNDK",
"CAndroidNDK",
"AndroidLooper",
"AndroidFileManager",
"AndroidInput",
Expand All @@ -522,7 +522,7 @@ var package = Package(
.target(
name: "AndroidInput",
dependencies: [
"AndroidNDK",
"CAndroidNDK",
"AndroidLooper"
],
swiftSettings: [
Expand Down Expand Up @@ -551,7 +551,7 @@ if ndkBinder {
name: "Binder",
package: "Binder"
),
"AndroidNDK"
"CAndroidNDK"
],
swiftSettings: [
.swiftLanguageMode(.v6)
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidBinder/AndroidBinder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if canImport(Android)
import Android
import AndroidNDK
import CAndroidNDK
#elseif canImport(Darwin)
import Darwin
#elseif canImport(Glibc)
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidBinder/BinderClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if canImport(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

public struct BinderClass: ~Copyable {
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidBinder/Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if canImport(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// Android NDK Binder Error
Expand Down
6 changes: 5 additions & 1 deletion Sources/AndroidBinder/Parcel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if canImport(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif
import Binder

Expand Down Expand Up @@ -132,6 +132,7 @@ public extension Parcel {
* \param length number of bytes to marshal, or nil to marshal from \p start to end.
* \return the marshaled bytes.
*/
@available(Android 33, *)
func marshal(start: Int = 0, length: Int? = nil) throws(AndroidBinderError) -> [UInt8] {
let len = length ?? (dataSize - start)
var buffer = [UInt8](repeating: 0, count: len)
Expand All @@ -148,6 +149,7 @@ public extension Parcel {
*
* \param data the bytes to unmarshal.
*/
@available(Android 33, *)
func unmarshal(_ data: [UInt8]) throws(AndroidBinderError) {
if let base = data.withUnsafeBufferPointer({ $0.baseAddress }) {
try handle.unmarshal(base, length: data.count).get()
Expand Down Expand Up @@ -671,6 +673,7 @@ internal extension Parcel.Handle {
*
* Available since API level 33.
*/
@available(Android 33, *)
func marshal(into buffer: UnsafeMutablePointer<UInt8>, start: Int, length: Int) -> Result<Void, AndroidBinderError> {
AParcel_marshal(pointer, buffer, start, length).mapError()
}
Expand All @@ -680,6 +683,7 @@ internal extension Parcel.Handle {
*
* Available since API level 33.
*/
@available(Android 33, *)
func unmarshal(_ data: UnsafePointer<UInt8>, length: Int) -> Result<Void, AndroidBinderError> {
AParcel_unmarshal(pointer, data, length).mapError()
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidBinder/Status.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if canImport(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/**
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidContent/AssetManagerNDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if canImport(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif
import SwiftJava
import CSwiftJavaJNI
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidFileManager/AndroidFileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

2 changes: 1 addition & 1 deletion Sources/AndroidFileManager/Asset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// A handle to an `AAsset`.
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidFileManager/AssetManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// Wrapper around Android `AAssetManager`.
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidFileManager/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// Wrapper around Android NDK `AConfiguration`.
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidFileManager/StorageManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// Wrapper around Android `AStorageManager`.
Expand Down
3 changes: 2 additions & 1 deletion Sources/AndroidHardware/Sensor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// A reference to a hardware sensor.
Expand Down Expand Up @@ -82,6 +82,7 @@ public extension Sensor {
}

/// The hardware sensor handle, unique within a device.
@available(Android 29, *)
var handle: Int32 {
ASensor_getHandle(pointer)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidHardware/SensorEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if canImport(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// A sensor event containing a measurement from a hardware sensor.
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidHardware/SensorEventQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// An event queue for receiving sensor events.
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidHardware/SensorManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif
import AndroidLooper

Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidInput/GameController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#if AGDK
#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// Swift wrapper for the Android Game Controller (Paddleboat) C API.
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidInput/InputEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// Input Event
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidInput/InputQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif
import AndroidLooper

Expand Down
10 changes: 2 additions & 8 deletions Sources/AndroidInput/Keycodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// Key code identifying a physical key on a keyboard or virtual key from an input device.
Expand Down Expand Up @@ -748,13 +748,7 @@ public extension KeyCode {

/// Recent Apps key.
static var recentApps: KeyCode { KeyCode(rawValue: AKEYCODE_RECENT_APPS) }

/// Screenshot key.
static var screenshot: KeyCode { KeyCode(rawValue: AKEYCODE_SCREENSHOT) }

/// Emoji Picker key.
static var emojiPicker: KeyCode { KeyCode(rawValue: AKEYCODE_EMOJI_PICKER) }


// MARK: System Navigation Gestures

/// System Navigation Up key.
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidKit/AndroidKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif
@_exported import SwiftJava
@_exported import JavaIO
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidLooper/AndroidMainActor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

import SystemPackage
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidLooper/Choreographer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

/// Choreographer coordinates the timing of frame rendering.
Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidLooper/Looper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif
import SystemPackage

Expand Down
2 changes: 1 addition & 1 deletion Sources/AndroidLooper/LooperEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if os(Android)
import Android
import AndroidNDK
import CAndroidNDK
#endif

public extension Looper {
Expand Down
Loading
Loading