Repository navigation
[Proposal] Android support - #2
Draft
gevartosky wants to merge 5 commits into
Draft
gevartosky wants to merge 5 commits into
gevartosky wants to merge 5 commits into
Conversation
Make the whole package and the PatchSDKTests bundle compile and link for aarch64-unknown-linux-android28 (Swift SDK for Android / `skip android build`), with no behaviour change on Apple platforms. - Vendor Google's reference Brotli decoder (v1.2.0, MIT) as CBrotliDec and rewrite Brotli.swift on its streaming API, replacing Apple's Compression framework. Truncated streams and trailing bytes are now rejected. - Vendor the reference libbzip2 (1.0.8, sourceware.org) as the CBZ2 target, replacing the system-library shim; the Android NDK ships no libbz2. - Use apple/swift-crypto for SHA-256 where CryptoKit is unavailable (linked only on Android/Linux). - Import FoundationNetworking where URLSession/URLRequest are used. - Guard Darwin-only APIs: CoreFoundation number checks, Combine in UpdateState, ProcessInfo thermal/low-power, ObjC swizzles, Handoff. - Do not register KeychainBridge or relative_date_format off Apple platforms: a module importing them fails to instantiate and falls back, instead of pretending to work. - Tests that exercise Apple-only code use the same guard as that code. - Add proposals/android-support.md describing the approach and options. Verified: macOS suite 1031 tests, 0 failures; iOS Simulator build; Android build of all targets and the test bundle. Not yet run on a device/emulator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`skip android test` on an Android 17 arm64 emulator: 771 tests, 0 failures, 6 skipped (the same skips as on macOS). FoundationNetworking on Android rejects file:// URLs with NSURLErrorUnsupportedURL, so FileDownloadBridge.syncDownload now copies local files directly off Apple platforms. Apple platforms keep using URLSession. HTTPS through URLSession was verified to work on the emulator. Update the Android proposal with the device results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add an `android` job that cross-compiles the package with the official Swift SDK for Android (6.4) and runs PatchSDKTests on an emulator via skiptools/swift-android-action, alongside the existing macOS + iOS job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Package.resolved: restore main's lockfile. The branch had pinned swift-crypto 5.0.0 and swift-asn1 1.7.3 (resolved with Swift 6.4), which need tools 6.1/6.2 and broke `swift build` on the macOS job's Swift 6.0.3. Left unpinned, SwiftPM picks versions compatible with the toolchain, as it already does for swift-nio/swift-log on main. - Android job: use swift-version "6.4.0". "6.4" maps to a download URL that does not exist (curl exit 22). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Swift 6.4's swift-build backend names the test resource bundle `PatchSDK_PatchSDKTests.bundle`, while skiptools/swift-android-action only copies `*.resources`, so the first fixture-loading test hit "unable to find bundle named PatchSDK_PatchSDKTests". Pass the .bundle via the action's copy-files input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi
I wanted to propose support for Swift on Android as adoption has been growing and I really believe Patch would come ahead if such support becomes a reality.
I'm personally excited for Patch and it would be a great fit for my client application.
You can find a deeper dive of this proposal in
proposals/android-support.md, but in essence I believe we could split the package into a Core package + Platform specific packages. This way we can initially support swift business logic on Android while UI and Apple specific API stay on a separate packages.I'm leaving the PR in Draft for now and I'm happy to take any feedback and help with anything necessary.