automerge / automerge-swift

Swift language bindings presenting Automerge
https://automerge.org/automerge-swift/documentation/automerge/
MIT License
245 stars 14 forks source link

Support for watchOS platform? #74

Open c-st opened 1 year ago

c-st commented 1 year ago

I'm currently building an app based on Automerge and I'm using this Package for my iOS app. It has been working really well so far.

Now I'm about to start developing the Watch App counterpart for my app and it seems that automergeFFI.xcframework is not yet built for watchOS and watchOS simulator.

I don't know the Rust ecosystem well, but it seems that watchOS is supported as compile target: https://doc.rust-lang.org/rustc/platform-support/apple-watchos.html

Would it be possible to also compile the framework for these platforms?

heckj commented 1 year ago

hey @c-st - we can certainly give it a shot. If that's something you're familiar with, the core the logic would all be encapsulated within https://github.com/automerge/automerge-swift/blob/main/scripts/build-xcframework.sh, which we recently updated to move to a more recent nightly version of Swift to continue the macCatalyst support.

If you're game for a PR, definitely drop it in place, otherwise I'll try and circle back to this fairly shortly and see what I can do to try it out and see if it's as "easy" as I'd hope. (there's some creaki-ness in macCatalyst support - being a tier3 platform means that you need to use a nightly version of Rust to build it all).

heckj commented 1 year ago

I spent a few minutes today exploring, the the Rust nightlies are reporting that the watchOS specific targets aren't supported for their version. This isn't a space I'm super familiar with, but when I dug around, I did find an explicit list of "supported targets" using rustup target list - and none of the ones listed at https://doc.rust-lang.org/rustc/platform-support/apple-watchos.html were available.

I'm going to continue digging to see how/where they ARE supported, as they're clearly in there somewhere based on those docs, but it doesn't appear to be well defined. The issue https://github.com/rust-lang/rust/issues/48862 makes somewhat conflicting statements, including that Apple's LLVM being required for some of the watchOS based targets - so that information may be incorrect. I'll keep digging, but wanted to put up an update.

heckj commented 1 year ago

Still tucking around - there's an option for printing Rust's target supports that I found on StackOverflow - the result of this makes me think it IS there in the nightly we're using, I just haven't sorted out how to unlock it.

rustc +nightly -Z unstable-options --print all-target-specs-json | jq '[ to_entries[] | { "target": .key, "arch": .value.arch, "os": .value.os, "target-family": .value."target-family" } ]'