feat: Make updater build on iOS (#22)

Doesn't work yet, but does at least build (and log).
This commit is contained in:
Eric Seidel
2023-05-31 15:44:35 -04:00
committed by GitHub
parent 11d8c22805
commit 4d2ec2e148
4 changed files with 30 additions and 3 deletions
+11
View File
@@ -134,3 +134,14 @@ When testing on my machine, I use something like:
$PATH_TO_ENGINE_SRC="$HOME/Documents/GitHub/engine/src"
shorebird --local-engine-src-path=$PATH_TO_ENGINE_SRC --local-engine=android_release_arm64 run
```
# For iOS
```
rustup target add aarch64-apple-ios x86_64-apple-ios
```
```
cargo build --target aarch64-apple-ios --target x86_64-apple-ios --release
```
+5
View File
@@ -48,6 +48,11 @@ android_logger = "0.13.0"
# Send panics to log (instead of stderr), thus logcat on Android.
log-panics = { version = "2", features = ["with-backtrace"]}
[target.'cfg(target_os = "ios")'.dependencies]
# Use stderr for logging on iOS.
simple-logging = "2.0.2"
# Send panics to syslog (instead of stderr).
log-panics = { version = "2", features = ["with-backtrace"]}
[dev-dependencies]
tempdir = "0.3.7"
+2
View File
@@ -220,5 +220,7 @@ pub fn current_platform() -> &'static str {
static PLATFORM: &str = "windows";
#[cfg(target_os = "android")]
static PLATFORM: &str = "android";
#[cfg(target_os = "ios")]
static PLATFORM: &str = "ios";
return PLATFORM;
}
+12 -3
View File
@@ -11,8 +11,17 @@ pub fn init_logging() {
debug!("Logging initialized");
}
#[cfg(not(target_os = "android"))]
#[cfg(target_os = "ios")]
pub fn init_logging() {
// Nothing to do on non-Android platforms.
// Eventually iOS/MacOS may need something here.
// I could not figure out how to get fancier logging set up on iOS
// but logging to stderr seems to work.
use log::LevelFilter;
use std::io;
simple_logging::log_to(io::stderr(), LevelFilter::Info);
debug!("Logging initialized");
}
#[cfg(all(not(target_os = "android"), not(target_os = "ios")))]
pub fn init_logging() {
// Nothing to do on non-Android, non-iOS platforms.
}