Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
uses: skiptools/actions/.github/workflows/skip-framework.yml@v1
with:
# disable export because there are currently problems with shared PCH module cache files with multi-module native export
runs-on: "['macos-15-intel', 'ubuntu-24.04']"
run-export: false
#run-local-tests: false

21 changes: 20 additions & 1 deletion Sources/SkipAndroidBridge/AndroidBridgeBootstrap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ import Foundation
@_exported import AndroidLogging
#elseif canImport(OSLog)
@_exported import OSLog
#else
// e.g., for Linux define a local logging stub
class Logger {
let subsystem: String
let category: String

init(subsystem: String, category: String) {
self.subsystem = subsystem
self.category = category
}

func log(_ string: String) {
print("\(subsystem)/\(category): \(string)")
}

func debug(_ string: String) {
print("\(subsystem)/\(category): \(string)")
}
}
#endif
#if canImport(AndroidLooper)
@_exported import AndroidLooper
Expand Down Expand Up @@ -127,7 +146,7 @@ private func bootstrapFileManagerProperties(filesDir: String, cacheDir: String)
}

// URL.applicationSupportDirectory exists in Darwin's Foundation but not in Android's Foundation
#if os(Android)
#if !canImport(Darwin)
// SKIP @nobridge
extension URL {
public static var applicationSupportDirectory: URL {
Expand Down
5 changes: 5 additions & 0 deletions Sources/SkipAndroidBridge/AndroidBundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation

#if os(Linux)
// Bundle subclass does not build on Linux due to https://github.com/swiftlang/swift-corelibs-foundation/issues/5108
public typealias AndroidBundle = Foundation.Bundle
#else
/// Override of native `Bundle` for Android that delegates to our `skip.foundation.Bundle` Kotlin object.
open class AndroidBundle : Foundation.Bundle, @unchecked Sendable {
#if os(Android) || ROBOLECTRIC
Expand Down Expand Up @@ -304,6 +308,7 @@ open class AndroidBundle : Foundation.Bundle, @unchecked Sendable {
}
#endif
}
#endif

#if os(Android) || ROBOLECTRIC

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public func setStringDefault(name: String, value: String?) {
UserDefaults.standard.set(value, forKey: name)
}

#if os(Linux)
// workaround for missing LocalizedStringResource on Linux
typealias LocalizedStringResource = AndroidLocalizedStringResource
#endif

public func localizedStringResourceLiteralKey() -> String {
let literal: LocalizedStringResource = "literal"
return literal.key
Expand Down
2 changes: 1 addition & 1 deletion Tests/SkipAndroidBridgeSamplesTests/XCSkipTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if os(macOS) // Skip transpiled tests only run on macOS targets
#if os(macOS) || os(Linux)
import SkipTest

/// This test case will run the transpiled tests for the Skip module.
Expand Down
2 changes: 1 addition & 1 deletion Tests/SkipAndroidBridgeTests/XCSkipTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if os(macOS) // Skip transpiled tests only run on macOS targets
#if os(macOS) || os(Linux)
import SkipTest

/// This test case will run the transpiled tests for the Skip module.
Expand Down
Loading