π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Switch to 1.27 ort on native options
laurenspriemccf1c9b3a4d8
diff --git a/mobile/apps/photos/android/app/build.gradle b/mobile/apps/photos/android/app/build.gradleindex 37197ed806..5e7a964d6a 100644--- a/mobile/apps/photos/android/app/build.gradle+++ b/mobile/apps/photos/android/app/build.gradle@@ -173,7 +173,7 @@ dependencies {implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0'implementation 'com.android.support:multidex:1.0.3'implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'- implementation 'com.microsoft.onnxruntime:onnxruntime-android:1.8.1'+ implementation 'com.microsoft.onnxruntime:onnxruntime-android:1.27.0'testImplementation 'junit:junit:4.12'androidTestImplementation 'androidx.test:runner:1.1.1'androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'diff --git a/mobile/apps/photos/ios/Podfile.lock b/mobile/apps/photos/ios/Podfile.lockindex fab5351778..c3c4ce8b1f 100644--- a/mobile/apps/photos/ios/Podfile.lock+++ b/mobile/apps/photos/ios/Podfile.lock@@ -173,14 +173,6 @@ PODS:- Flutter- native_video_player (4.0.0):- Flutter- - onnxruntime (0.0.1):- - Flutter- - onnxruntime-objc (= 1.18.0)- - onnxruntime-c (1.18.0)- - onnxruntime-objc (1.18.0):- - onnxruntime-objc/Core (= 1.18.0)- - onnxruntime-objc/Core (1.18.0):- - onnxruntime-c (= 1.18.0)- open_mail_app (0.0.1):- Flutter- OrderedSet (6.0.3)@@ -303,7 +295,6 @@ DEPENDENCIES:- move_to_background (from `.symlinks/plugins/move_to_background/ios`)- native_video_editor (from `.symlinks/plugins/native_video_editor/ios`)- native_video_player (from `.symlinks/plugins/native_video_player/ios`)- - onnxruntime (from `.symlinks/plugins/onnxruntime/ios`)- open_mail_app (from `.symlinks/plugins/open_mail_app/ios`)- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)@@ -338,8 +329,6 @@ SPEC REPOS:- libwebp- Mantle- nanopb- - onnxruntime-c- - onnxruntime-objc- OrderedSet- PromisesObjC- SDWebImage@@ -434,8 +423,6 @@ EXTERNAL SOURCES::path: ".symlinks/plugins/native_video_editor/ios"native_video_player::path: ".symlinks/plugins/native_video_player/ios"- onnxruntime:- :path: ".symlinks/plugins/onnxruntime/ios"open_mail_app::path: ".symlinks/plugins/open_mail_app/ios"package_info_plus:@@ -485,7 +472,7 @@ SPEC CHECKSUMS:cupertino_http: 94ac07f5ff090b8effa6c5e2c47871d48ab7c86cdart_ui_isolate: 46f6714abe6891313267153ef6f9748d8ecfcab1device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe- ente_photos_rust: a9e1166cc460dda69acd56fbed21afe87dfef562+ ente_photos_rust: 361e162c8d0d816ad94d8a80d41e8f8b96324d93ente_qr: 86beaf5d2644705db9b565b32dd8b82c05fb36afente_rust: d0197ebd5460e8f67576579452b073d698404abeente_screen_cover: 6792566774f1c83939f9c1d03ed0a1f1ded45ae4@@ -530,9 +517,6 @@ SPEC CHECKSUMS:nanopb: fad817b59e0457d11a5dfbde799381cd727c1275native_video_editor: 5af94a14017a00dcb0a0055abb869fce79e5493enative_video_player: 6809dec117e8997161dbfb42a6f90d6df71a504d- onnxruntime: f9b296392c96c42882be020a59dbeac6310d81b2- onnxruntime-c: a909204639a1f035f575127ac406f781ac797c9c- onnxruntime-objc: b6fab0f1787aa6f7190c2013f03037df4718bd8bopen_mail_app: 7314a609e88eed22d53671279e189af7a0ab0f11OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499diff --git a/mobile/apps/photos/rust_builder/cargokit/build_pod.sh b/mobile/apps/photos/rust_builder/cargokit/build_pod.shindex bb057239b7..3714ee190d 100755--- a/mobile/apps/photos/rust_builder/cargokit/build_pod.sh+++ b/mobile/apps/photos/rust_builder/cargokit/build_pod.sh@@ -35,56 +35,6 @@ export CARGOKIT_TOOL_TEMP_DIR=$TARGET_TEMP_DIR/build_tool# Directory inside root project. Not necessarily the top level directory of root project.export CARGOKIT_ROOT_PROJECT_DIR=$SRCROOT-# Configure ort-sys to link against the ONNX Runtime iOS xcframework instead of-# relying on runtime dylib loading.-if [[ -n "$PODS_ROOT" ]] && [[ -d "$PODS_ROOT/onnxruntime-c/onnxruntime.xcframework" ]]; then- ORT_XCFWK_LOCATION="$PODS_ROOT/onnxruntime-c/onnxruntime.xcframework"- export ORT_IOS_XCFWK_LOCATION="$ORT_XCFWK_LOCATION"-- # Keep ORT_LIB_LOCATION as a fallback for targets that ort-sys cannot link- # directly from the xcframework (for example, an x86_64 iOS simulator).- # Build a per-target static archive named libonnxruntime.a for that path.- ORT_ARCHIVE_SOURCE=""- ORT_ARCHIVE_ARCH=""- if [[ "$CARGOKIT_DARWIN_PLATFORM_NAME" == "iphoneos" ]]; then- ORT_ARCHIVE_SOURCE="$ORT_XCFWK_LOCATION/ios-arm64/onnxruntime.framework/onnxruntime"- ORT_ARCHIVE_ARCH="arm64"- elif [[ "$CARGOKIT_DARWIN_PLATFORM_NAME" == "iphonesimulator" ]]; then- ORT_ARCHIVE_SOURCE="$ORT_XCFWK_LOCATION/ios-arm64_x86_64-simulator/onnxruntime.framework/onnxruntime"- if [[ "$CARGOKIT_DARWIN_ARCHS" == *" "* ]]; then- # Xcode can request a universal simulator pod build (ARCHS="arm64 x86_64")- # even though cargokit compiles Rust for the active simulator target only.- ORT_ARCHIVE_ARCH="$NATIVE_ARCH_ACTUAL"- else- ORT_ARCHIVE_ARCH="$CARGOKIT_DARWIN_ARCHS"- fi- fi-- if [[ -n "$ORT_ARCHIVE_SOURCE" ]] && [[ -f "$ORT_ARCHIVE_SOURCE" ]]; then- ORT_LIB_TEMP_DIR="$TARGET_TEMP_DIR/ort_sys_${CARGOKIT_DARWIN_PLATFORM_NAME}_${CARGOKIT_DARWIN_ARCHS// /_}"- mkdir -p "$ORT_LIB_TEMP_DIR"- if [[ -n "$ORT_ARCHIVE_ARCH" ]]; then- lipo -thin "$ORT_ARCHIVE_ARCH" "$ORT_ARCHIVE_SOURCE" -output "$ORT_LIB_TEMP_DIR/libonnxruntime.a"- else- cp "$ORT_ARCHIVE_SOURCE" "$ORT_LIB_TEMP_DIR/libonnxruntime.a"- fi- export ORT_LIB_LOCATION="$ORT_LIB_TEMP_DIR"- fi-- # ONNX Runtime archives can reference availability helpers from clang runtime.- # Explicitly link the platform-appropriate clang runtime for Rust linking.- CLANG_RUNTIME_LIB=""- if [[ "$CARGOKIT_DARWIN_PLATFORM_NAME" == "iphoneos" ]]; then- CLANG_RUNTIME_LIB="clang_rt.ios"- elif [[ "$CARGOKIT_DARWIN_PLATFORM_NAME" == "iphonesimulator" ]]; then- CLANG_RUNTIME_LIB="clang_rt.iossim"- fi- CLANG_RESOURCE_DIR="$(xcrun clang --print-resource-dir 2>/dev/null || true)"- if [[ -n "$CLANG_RUNTIME_LIB" ]] && [[ -n "$CLANG_RESOURCE_DIR" ]] && [[ -d "$CLANG_RESOURCE_DIR/lib/darwin" ]]; then- export RUSTFLAGS="${RUSTFLAGS} -L native=${CLANG_RESOURCE_DIR}/lib/darwin -l ${CLANG_RUNTIME_LIB}"- fi-fi-FLUTTER_EXPORT_BUILD_ENVIRONMENT=("$PODS_ROOT/../Flutter/ephemeral/flutter_export_environment.sh" # macOS"$PODS_ROOT/../Flutter/flutter_export_environment.sh" # iOSdiff --git a/mobile/apps/photos/rust_builder/ios/ente_photos_rust.podspec b/mobile/apps/photos/rust_builder/ios/ente_photos_rust.podspecindex 1d4de48c02..4733c97cec 100644--- a/mobile/apps/photos/rust_builder/ios/ente_photos_rust.podspec+++ b/mobile/apps/photos/rust_builder/ios/ente_photos_rust.podspec@@ -32,14 +32,22 @@ A new Flutter FFI plugin project.:script => 'sh "$PODS_TARGET_SRCROOT/../cargokit/build_pod.sh" ../../../../../rust/bindings/frb/photos ente_photos_rust',:execution_position => :before_compile,:input_files => ['${BUILT_PRODUCTS_DIR}/cargokit_phony'],- # Let XCode know that the static library referenced in -force_load below is- # created by this build step.+ # Let Xcode know that the static library linked below is created by this+ # build step.:output_files => ["${BUILT_PRODUCTS_DIR}/libente_photos_rust.a"],}s.pod_target_xcconfig = {'DEFINES_MODULE' => 'YES',# Flutter.framework does not contain a i386 slice.'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386',- 'OTHER_LDFLAGS' => '-force_load ${BUILT_PRODUCTS_DIR}/libente_photos_rust.a -lc++',+ # Root the primary Flutter Rust Bridge dispatcher so the linker pulls in+ # the bridge and its transitive FFI exports without force-loading ONNX+ # Runtime's duplicate protobuf objects.+ 'OTHER_LDFLAGS' => [+ '$(inherited)',+ '${BUILT_PRODUCTS_DIR}/libente_photos_rust.a',+ '-lc++',+ '-Wl,-u,_frb_pde_ffi_dispatcher_primary',+ ].join(' '),}enddiff --git a/rust/crates/photos/Cargo.toml b/rust/crates/photos/Cargo.tomlindex b27f9a09d8..2245a483ea 100644--- a/rust/crates/photos/Cargo.toml+++ b/rust/crates/photos/Cargo.toml@@ -27,8 +27,6 @@ thiserror.workspace = true# per-target feature sets are declared here.[target.'cfg(target_os = "ios")'.dependencies]ort = { workspace = true, features = [- # "std" is implied by "load-dynamic" on the other targets, but iOS links- # ORT statically, so it must be enabled explicitly here."std","ndarray","half",@@ -36,6 +34,11 @@ ort = { workspace = true, features = [# when both Dart ONNXRuntime and Rust ONNXRuntime are linked.# Re-enable once we move to a single shared ORT runtime.# "coreml",+ "api-27",+ # Link the revision-pinned crate's verified 1.27 archive directly into the+ # Rust ML library.+ "download-binaries",+ "tls-native","xnnpack",] }@@ -43,6 +46,7 @@ ort = { workspace = true, features = [ort = { workspace = true, features = ["ndarray","half",+ "api-27","load-dynamic","copy-dylibs","coreml",