π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][locker] Wire flutter_rust_bridge into Locker
laurenspriemb8efcc21b58f
diff --git a/.github/workflows/locker-build.yml b/.github/workflows/locker-build.ymlindex 4f233eb134..481963c6ad 100644--- a/.github/workflows/locker-build.yml+++ b/.github/workflows/locker-build.yml@@ -121,7 +121,9 @@ jobs:- run: flutter pub get --enforce-lockfile- - run: cargo codegen frb shared+ - run: |+ cargo codegen frb shared+ cargo codegen frb lockerworking-directory: rust- name: Prepare whatsnew@@ -241,7 +243,9 @@ jobs:- name: Set up Rive iOS binariesrun: dart run rive_native:setup --clean --platform ios- - run: cargo codegen frb shared+ - run: |+ cargo codegen frb shared+ cargo codegen frb lockerworking-directory: rust- name: Install iOS podsdiff --git a/mobile/apps/locker/.gitignore b/mobile/apps/locker/.gitignoreindex 7a8d5c1712..2c9f65554d 100644--- a/mobile/apps/locker/.gitignore+++ b/mobile/apps/locker/.gitignore@@ -9,3 +9,6 @@ lib/l10n/untranslated_messages.json# Generated localization fileslib/l10n/app_localizations*.dart++# Generated Flutter Rust Bridge bindings+lib/src/rust/*diff --git a/mobile/apps/locker/analysis_options.yaml b/mobile/apps/locker/analysis_options.yamlindex 410bab51e3..953daaf0a7 100644--- a/mobile/apps/locker/analysis_options.yaml+++ b/mobile/apps/locker/analysis_options.yaml@@ -3,3 +3,6 @@ include: ../../analysis_options.yamlanalyzer:errors:use_build_context_synchronously: error+ exclude:+ - rust_builder/**+ - lib/src/rust/**diff --git a/mobile/apps/locker/flutter_rust_bridge.yaml b/mobile/apps/locker/flutter_rust_bridge.yamlnew file mode 100644index 0000000000..cf324bf3c8--- /dev/null+++ b/mobile/apps/locker/flutter_rust_bridge.yaml@@ -0,0 +1,9 @@+rust_input: crate::api+rust_root: ../../../rust/bindings/frb/locker/+dart_output: lib/src/rust+dart_entrypoint_class_name: EnteLockerRust++dart_preamble: |+ // ignore_for_file: require_trailing_commas++web: falsediff --git a/mobile/apps/locker/ios/Podfile b/mobile/apps/locker/ios/Podfileindex 7e99f94391..219b124ae0 100644--- a/mobile/apps/locker/ios/Podfile+++ b/mobile/apps/locker/ios/Podfile@@ -45,6 +45,11 @@ post_install do |installer|flutter_additional_ios_build_settings(target)target.build_configurations.each do |config|config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'++ if ['ente_locker_rust', 'ente_rust'].include?(target.name) && config.name == 'Debug'+ config.build_settings['ONLY_ACTIVE_ARCH[sdk=iphonesimulator*]'] = 'YES'+ end+config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)',diff --git a/mobile/apps/locker/ios/Podfile.lock b/mobile/apps/locker/ios/Podfile.lockindex 86dc8e418c..2b86769b69 100644--- a/mobile/apps/locker/ios/Podfile.lock+++ b/mobile/apps/locker/ios/Podfile.lock@@ -37,6 +37,8 @@ PODS:- DKPhotoGallery/Resource (0.0.19):- SDWebImage- SwiftyGif+ - ente_locker_rust (0.0.1):+ - Flutter- ente_mail (0.0.1):- Flutter- ente_rust (0.0.1):@@ -95,6 +97,7 @@ DEPENDENCIES:- app_links (from `.symlinks/plugins/app_links/ios`)- cupertino_http (from `.symlinks/plugins/cupertino_http/darwin`)- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)+ - ente_locker_rust (from `.symlinks/plugins/ente_locker_rust/ios`)- ente_mail (from `.symlinks/plugins/ente_mail/ios`)- ente_rust (from `.symlinks/plugins/ente_rust/ios`)- ente_screen_cover (from `.symlinks/plugins/ente_screen_cover/ios`)@@ -132,6 +135,8 @@ EXTERNAL SOURCES::path: ".symlinks/plugins/cupertino_http/darwin"device_info_plus::path: ".symlinks/plugins/device_info_plus/ios"+ ente_locker_rust:+ :path: ".symlinks/plugins/ente_locker_rust/ios"ente_mail::path: ".symlinks/plugins/ente_mail/ios"ente_rust:@@ -181,6 +186,7 @@ SPEC CHECKSUMS:device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbeDKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3cDKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60+ ente_locker_rust: a299b4450d8ed041499171ddb182a42107719e74ente_mail: 90753dd584f49ee092759a32d4143ca51db69641ente_rust: d0197ebd5460e8f67576579452b073d698404abeente_screen_cover: 6792566774f1c83939f9c1d03ed0a1f1ded45ae4@@ -206,6 +212,6 @@ SPEC CHECKSUMS:ua_client_hints: 92fe0d139619b73ec9fcb46cc7e079a26178f586url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b-PODFILE CHECKSUM: d2d3220ea22664a259778d9e314054751db31361+PODFILE CHECKSUM: 5705e3b102f97037a25602dd270df9935079a3caCOCOAPODS: 1.17.0diff --git a/mobile/apps/locker/lib/main.dart b/mobile/apps/locker/lib/main.dartindex a498899109..e4ed8691c7 100644--- a/mobile/apps/locker/lib/main.dart+++ b/mobile/apps/locker/lib/main.dart@@ -37,6 +37,8 @@ import 'package:locker/services/files/offline/offline_files_service.dart';import 'package:locker/services/local_settings.dart';import 'package:locker/services/trash/trash_service.dart';import 'package:locker/services/update_service.dart';+import 'package:locker/src/rust/api/log.dart' as locker_rust_log;+import 'package:locker/src/rust/frb_generated.dart';import 'package:locker/ui/pages/home_page.dart';import 'package:package_info_plus/package_info_plus.dart';import 'package:path_provider/path_provider.dart';@@ -47,6 +49,7 @@ final _logger = Logger("main");bool _isRustInitialized = false;Future<void>? _rustInitFuture;late final LogSinkGuard _rustLogSinkGuard;+late final locker_rust_log.LogSinkGuard _lockerRustLogSinkGuard;void main() async {WidgetsFlutterBinding.ensureInitialized();@@ -115,7 +118,7 @@ Future<void> _ensureRustInitialized() async {await inFlightInit;return;}- final initFuture = EnteRust.init();+ final initFuture = Future.wait([EnteLockerRust.init(), EnteRust.init()]);_rustInitFuture = initFuture;try {await initFuture;@@ -130,18 +133,26 @@ void _attachRustLogStream() {final logger = Logger("rust");_rustLogSinkGuard = LogSinkGuard();_rustLogSinkGuard.attachLogStream().listen((entry) {- final message = "[${entry.target}] ${entry.message}";- switch (entry.level) {- case LogLevel.error:- logger.severe(message);- case LogLevel.warn:- logger.warning(message);- case LogLevel.info:- logger.info(message);- }+ _logRustEntry(logger, entry.level.name, entry.target, entry.message);+ });+ _lockerRustLogSinkGuard = locker_rust_log.LogSinkGuard();+ _lockerRustLogSinkGuard.attachLogStream().listen((entry) {+ _logRustEntry(logger, entry.level.name, entry.target, entry.message);});}+void _logRustEntry(Logger logger, String level, String target, String body) {+ final message = "[$target] $body";+ switch (level) {+ case "error":+ logger.severe(message);+ case "warn":+ logger.warning(message);+ case "info":+ logger.info(message);+ }+}+ThemeMode _themeMode(AdaptiveThemeMode? savedThemeMode) {if (savedThemeMode == null) return ThemeMode.system;if (savedThemeMode.isLight) return ThemeMode.light;diff --git a/mobile/apps/locker/pubspec.yaml b/mobile/apps/locker/pubspec.yamlindex 18188253b1..d8484e8276 100644--- a/mobile/apps/locker/pubspec.yaml+++ b/mobile/apps/locker/pubspec.yaml@@ -44,6 +44,8 @@ dependencies:path: ../../packages/legacyente_lock_screen:path: ../../packages/lock_screen+ ente_locker_rust:+ path: rust_builderente_logging:path: ../../packages/loggingente_network:@@ -70,6 +72,7 @@ dependencies:flutter_displaymode: 0.6.0flutter_localizations:sdk: flutter+ flutter_rust_bridge: 2.12.0flutter_svg: 2.3.0hugeicons: 1.1.7intl: 0.20.2diff --git a/mobile/apps/locker/rust_builder/.gitignore b/mobile/apps/locker/rust_builder/.gitignorenew file mode 100644index 0000000000..c09f3f9110--- /dev/null+++ b/mobile/apps/locker/rust_builder/.gitignore@@ -0,0 +1 @@+/pubspec.lockdiff --git a/mobile/apps/locker/rust_builder/README.md b/mobile/apps/locker/rust_builder/README.mdnew file mode 100644index 0000000000..bc160a960a--- /dev/null+++ b/mobile/apps/locker/rust_builder/README.md@@ -0,0 +1 @@+Please ignore this folder, which is just glue to build Rust with Flutter.diff --git a/mobile/apps/locker/rust_builder/android/build.gradle b/mobile/apps/locker/rust_builder/android/build.gradlenew file mode 100644index 0000000000..eaf64b14d6--- /dev/null+++ b/mobile/apps/locker/rust_builder/android/build.gradle@@ -0,0 +1,56 @@+// The Android Gradle Plugin builds the native code with the Android NDK.++group 'com.flutter_rust_bridge.ente_locker_rust'+version '1.0'++buildscript {+ repositories {+ google()+ mavenCentral()+ }++ dependencies {+ // The Android Gradle Plugin knows how to build native code with the NDK.+ classpath 'com.android.tools.build:gradle:7.3.0'+ }+}++rootProject.allprojects {+ repositories {+ google()+ mavenCentral()+ }+}++apply plugin: 'com.android.library'++android {+ if (project.android.hasProperty("namespace")) {+ namespace 'com.flutter_rust_bridge.ente_locker_rust'+ }++ // Bumping the plugin compileSdkVersion requires all clients of this plugin+ // to bump the version in their app.+ compileSdkVersion 33++ // Use the NDK version+ // declared in /android/app/build.gradle file of the Flutter project.+ // Replace it with a version number if this plugin requires a specfic NDK version.+ // (e.g. ndkVersion "23.1.7779620")+ ndkVersion "28.2.13676358"++ compileOptions {+ sourceCompatibility JavaVersion.VERSION_1_8+ targetCompatibility JavaVersion.VERSION_1_8+ }++ defaultConfig {+ minSdkVersion 19+ }+}++apply from: "../../../../cargokit/gradle/plugin.gradle"+cargokit {+ manifestDir = "../../../../../rust/bindings/frb/locker"+ libname = "ente_locker_rust"+}diff --git a/mobile/apps/locker/rust_builder/android/settings.gradle b/mobile/apps/locker/rust_builder/android/settings.gradlenew file mode 100644index 0000000000..b114b03fb9--- /dev/null+++ b/mobile/apps/locker/rust_builder/android/settings.gradle@@ -0,0 +1 @@+rootProject.name = 'ente_locker_rust'diff --git a/mobile/apps/locker/rust_builder/android/src/main/AndroidManifest.xml b/mobile/apps/locker/rust_builder/android/src/main/AndroidManifest.xmlnew file mode 100644index 0000000000..742fce54d3--- /dev/null+++ b/mobile/apps/locker/rust_builder/android/src/main/AndroidManifest.xml@@ -0,0 +1,3 @@+<manifest xmlns:android="http://schemas.android.com/apk/res/android"+ package="com.flutter_rust_bridge.ente_locker_rust">+</manifest>diff --git a/mobile/apps/locker/rust_builder/ios/Classes/dummy_file.c b/mobile/apps/locker/rust_builder/ios/Classes/dummy_file.cnew file mode 100644index 0000000000..e06dab9968--- /dev/null+++ b/mobile/apps/locker/rust_builder/ios/Classes/dummy_file.c@@ -0,0 +1 @@+// This is an empty file to force CocoaPods to create a framework.diff --git a/mobile/apps/locker/rust_builder/ios/ente_locker_rust.podspec b/mobile/apps/locker/rust_builder/ios/ente_locker_rust.podspecnew file mode 100644index 0000000000..2f1e2a8adf--- /dev/null+++ b/mobile/apps/locker/rust_builder/ios/ente_locker_rust.podspec@@ -0,0 +1,42 @@+#+# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.+# Run `pod lib lint ente_locker_rust.podspec` to validate before publishing.+#+Pod::Spec.new do |s|+ s.name = 'ente_locker_rust'+ s.version = '0.0.1'+ s.summary = 'A new Flutter FFI plugin project.'+ s.description = <<-DESC+A new Flutter FFI plugin project.+ DESC+ s.homepage = 'http://example.com'+ s.license = { :file => '../LICENSE' }+ s.author = { 'Your Company' => '[email protected]' }++ # This will ensure the source files in Classes/ are included in the native+ # builds of apps using this FFI plugin. Podspec does not support relative+ # paths, so Classes contains a forwarder C file that relatively imports+ # `../src/*` so that the C sources can be shared among all target platforms.+ s.source = { :path => '.' }+ s.source_files = 'Classes/**/*'+ s.dependency 'Flutter'+ s.platform = :ios, '13.0'+ s.swift_version = '5.0'++ s.script_phase = {+ :name => 'Build Rust library',+ # First argument is relative path to the `rust` folder, second is name of rust library+ :script => 'sh "$(cd -P "$PODS_TARGET_SRCROOT" && pwd)/../../../../cargokit/build_pod.sh" ../../../../../rust/bindings/frb/locker ente_locker_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.+ :output_files => ["${BUILT_PRODUCTS_DIR}/libente_locker_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_locker_rust.a',+ }+enddiff --git a/mobile/apps/locker/rust_builder/linux/CMakeLists.txt b/mobile/apps/locker/rust_builder/linux/CMakeLists.txtnew file mode 100644index 0000000000..432fdc38f7--- /dev/null+++ b/mobile/apps/locker/rust_builder/linux/CMakeLists.txt@@ -0,0 +1,19 @@+# The Flutter tooling requires that developers have CMake 3.10 or later+# installed. You should not increase this version, as doing so will cause+# the plugin to fail to compile for some customers of the plugin.+cmake_minimum_required(VERSION 3.10)++# Project-level configuration.+set(PROJECT_NAME "ente_locker_rust")+project(${PROJECT_NAME} LANGUAGES CXX)++include("../../../../cargokit/cmake/cargokit.cmake")+apply_cargokit(${PROJECT_NAME} ../../../../../rust/bindings/frb/locker ente_locker_rust "")++# List of absolute paths to libraries that should be bundled with the plugin.+# This list could contain prebuilt libraries, or libraries created by an+# external build triggered from this build file.+set(ente_locker_rust_bundled_libraries+ "${${PROJECT_NAME}_cargokit_lib}"+ PARENT_SCOPE+)diff --git a/mobile/apps/locker/rust_builder/macos/Classes/dummy_file.c b/mobile/apps/locker/rust_builder/macos/Classes/dummy_file.cnew file mode 100644index 0000000000..e06dab9968--- /dev/null+++ b/mobile/apps/locker/rust_builder/macos/Classes/dummy_file.c@@ -0,0 +1 @@+// This is an empty file to force CocoaPods to create a framework.diff --git a/mobile/apps/locker/rust_builder/macos/ente_locker_rust.podspec b/mobile/apps/locker/rust_builder/macos/ente_locker_rust.podspecnew file mode 100644index 0000000000..aaaa31604f--- /dev/null+++ b/mobile/apps/locker/rust_builder/macos/ente_locker_rust.podspec@@ -0,0 +1,41 @@+#+# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.+# Run `pod lib lint ente_locker_rust.podspec` to validate before publishing.+#+Pod::Spec.new do |s|+ s.name = 'ente_locker_rust'+ s.version = '0.0.1'+ s.summary = 'A new Flutter FFI plugin project.'+ s.description = <<-DESC+A new Flutter FFI plugin project.+ DESC+ s.homepage = 'http://example.com'+ s.license = { :file => '../LICENSE' }+ s.author = { 'Your Company' => '[email protected]' }++ # This will ensure the source files in Classes/ are included in the native+ # builds of apps using this FFI plugin. Podspec does not support relative+ # paths, so Classes contains a forwarder C file that relatively imports+ # `../src/*` so that the C sources can be shared among all target platforms.+ s.source = { :path => '.' }+ s.source_files = 'Classes/**/*'+ s.dependency 'FlutterMacOS'++ s.platform = :osx, '10.11'+ s.swift_version = '5.0'++ s.script_phase = {+ :name => 'Build Rust library',+ # First argument is relative path to the `rust` folder, second is name of rust library+ :script => 'sh "$(cd -P "$PODS_TARGET_SRCROOT" && pwd)/../../../../cargokit/build_pod.sh" ../../../../../rust/bindings/frb/locker ente_locker_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.+ :output_files => ["${BUILT_PRODUCTS_DIR}/libente_locker_rust.a"],+ }+ s.pod_target_xcconfig = {+ 'DEFINES_MODULE' => 'YES',+ 'OTHER_LDFLAGS' => '-force_load ${BUILT_PRODUCTS_DIR}/libente_locker_rust.a',+ }+enddiff --git a/mobile/apps/locker/rust_builder/pubspec.yaml b/mobile/apps/locker/rust_builder/pubspec.yamlnew file mode 100644index 0000000000..9365ecfe36--- /dev/null+++ b/mobile/apps/locker/rust_builder/pubspec.yaml@@ -0,0 +1,34 @@+name: ente_locker_rust+description: "Utility to build Rust code"+version: 0.0.1+publish_to: none++environment:+ sdk: ">=3.10.0 <4.0.0"+ flutter: ">=3.3.0"++dependencies:+ flutter:+ sdk: flutter+ plugin_platform_interface: ^2.0.2++dev_dependencies:+ ffi: ^2.0.2+ ffigen: ^11.0.0+ flutter_lints: 6.0.0+ flutter_test:+ sdk: flutter++flutter:+ plugin:+ platforms:+ android:+ ffiPlugin: true+ ios:+ ffiPlugin: true+ linux:+ ffiPlugin: true+ macos:+ ffiPlugin: true+ windows:+ ffiPlugin: truediff --git a/mobile/apps/locker/rust_builder/windows/.gitignore b/mobile/apps/locker/rust_builder/windows/.gitignorenew file mode 100644index 0000000000..f68e1be09f--- /dev/null+++ b/mobile/apps/locker/rust_builder/windows/.gitignore@@ -0,0 +1 @@+flutter/diff --git a/mobile/apps/locker/rust_builder/windows/CMakeLists.txt b/mobile/apps/locker/rust_builder/windows/CMakeLists.txtnew file mode 100644index 0000000000..ac95333db5--- /dev/null+++ b/mobile/apps/locker/rust_builder/windows/CMakeLists.txt@@ -0,0 +1,20 @@+# The Flutter tooling requires that developers have a version of Visual Studio+# installed that includes CMake 3.14 or later. You should not increase this+# version, as doing so will cause the plugin to fail to compile for some+# customers of the plugin.+cmake_minimum_required(VERSION 3.14)++# Project-level configuration.+set(PROJECT_NAME "ente_locker_rust")+project(${PROJECT_NAME} LANGUAGES CXX)++include("../../../../cargokit/cmake/cargokit.cmake")+apply_cargokit(${PROJECT_NAME} ../../../../../../../../../rust/bindings/frb/locker ente_locker_rust "")++# List of absolute paths to libraries that should be bundled with the plugin.+# This list could contain prebuilt libraries, or libraries created by an+# external build triggered from this build file.+set(ente_locker_rust_bundled_libraries+ "${${PROJECT_NAME}_cargokit_lib}"+ PARENT_SCOPE+)diff --git a/mobile/pubspec.lock b/mobile/pubspec.lockindex d791bdc3ab..4bcc2625d2 100644--- a/mobile/pubspec.lock+++ b/mobile/pubspec.lock@@ -611,6 +611,13 @@ packages:url: "https://github.com/ente/ente_crypto_dart.git"source: gitversion: "1.0.0"+ ente_locker_rust:+ dependency: transitive+ description:+ path: "apps/locker/rust_builder"+ relative: true+ source: path+ version: "0.0.1"ente_photos_rust:dependency: transitivedescription:diff --git a/rust/Cargo.lock b/rust/Cargo.lockindex 3d29ca07d5..216958e40c 100644--- a/rust/Cargo.lock+++ b/rust/Cargo.lock@@ -2680,6 +2680,14 @@ dependencies = ["web-sys",]+[[package]]+name = "ente_locker_rust"+version = "0.0.0"+dependencies = [+ "ente-frb-log",+ "flutter_rust_bridge",+]+[[package]]name = "ente_photos_napi"version = "0.0.0"diff --git a/rust/Cargo.toml b/rust/Cargo.tomlindex 1c29cccf07..ff23229c42 100644--- a/rust/Cargo.toml+++ b/rust/Cargo.toml@@ -5,6 +5,7 @@ members = ["apps/codegen","apps/ensu/src-tauri","bindings/frb/ente-rust",+ "bindings/frb/locker","bindings/frb/log","bindings/frb/photos","bindings/napi/photos",diff --git a/rust/apps/codegen/src/main.rs b/rust/apps/codegen/src/main.rsindex d0fd46b3bf..8597999443 100644--- a/rust/apps/codegen/src/main.rs+++ b/rust/apps/codegen/src/main.rs@@ -31,6 +31,7 @@ enum FrbTarget {All,Shared,Photos,+ Locker,}fn main() {@@ -60,6 +61,7 @@ fn run() -> Result<(), DynError> {None => FrbTarget::All,Some("shared") => FrbTarget::Shared,Some("photos") => FrbTarget::Photos,+ Some("locker") => FrbTarget::Locker,_ => return Err(usage_error()),};if args.next().is_some() {@@ -78,7 +80,7 @@ fn run() -> Result<(), DynError> {}fn usage_error() -> DynError {- "usage: cargo codegen <native [ensu|cast]|frb [shared|photos]|napi>".into()+ "usage: cargo codegen <native [ensu|cast]|frb [shared|photos|locker]|napi>".into()}fn generate_native(target: NativeTarget) -> Result<(), DynError> {@@ -170,6 +172,9 @@ fn generate_frb(target: FrbTarget) -> Result<(), DynError> {if matches!(target, FrbTarget::All | FrbTarget::Photos) {generate_frb_package(&repo_root.join("mobile/apps/photos"))?;}+ if matches!(target, FrbTarget::All | FrbTarget::Locker) {+ generate_frb_package(&repo_root.join("mobile/apps/locker"))?;+ }format_frb_bindings(target)}@@ -299,7 +304,9 @@ fn format_frb_bindings(target: FrbTarget) -> Result<(), DynError> {.arg("-p").arg("ente_rust").arg("-p")- .arg("ente_photos_rust");+ .arg("ente_photos_rust")+ .arg("-p")+ .arg("ente_locker_rust");}FrbTarget::Shared => {command.arg("-p").arg("ente_rust");@@ -307,6 +314,9 @@ fn format_frb_bindings(target: FrbTarget) -> Result<(), DynError> {FrbTarget::Photos => {command.arg("-p").arg("ente_photos_rust");}+ FrbTarget::Locker => {+ command.arg("-p").arg("ente_locker_rust");+ }}command.current_dir(rust_root);run_command(diff --git a/rust/bindings/frb/locker/Cargo.toml b/rust/bindings/frb/locker/Cargo.tomlnew file mode 100644index 0000000000..bdac39c34d--- /dev/null+++ b/rust/bindings/frb/locker/Cargo.toml@@ -0,0 +1,17 @@+[package]+name = "ente_locker_rust"+edition = "2024"++[lib]+crate-type = ["cdylib", "staticlib"]++[dependencies]+ente-frb-log.workspace = true+flutter_rust_bridge.workspace = true++[lints.rust]+unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }++[features]+default = []+flutter = []diff --git a/rust/bindings/frb/locker/cargokit.yaml b/rust/bindings/frb/locker/cargokit.yamlnew file mode 100644index 0000000000..56a90aa824--- /dev/null+++ b/rust/bindings/frb/locker/cargokit.yaml@@ -0,0 +1,7 @@+cargo:+ debug:+ extra_flags: ["--features", "flutter"]+ profile:+ extra_flags: ["--features", "flutter"]+ release:+ extra_flags: ["--features", "flutter"]diff --git a/rust/bindings/frb/locker/src/api/init.rs b/rust/bindings/frb/locker/src/api/init.rsnew file mode 100644index 0000000000..44433ef339--- /dev/null+++ b/rust/bindings/frb/locker/src/api/init.rs@@ -0,0 +1,7 @@+#[flutter_rust_bridge::frb(init)]+pub fn init_app() {+ // Install before FRB claims the process logger.+ #[cfg(feature = "flutter")]+ crate::api::log::install();+ flutter_rust_bridge::setup_default_user_utils();+}diff --git a/rust/bindings/frb/locker/src/api/log.rs b/rust/bindings/frb/locker/src/api/log.rsnew file mode 100644index 0000000000..d7dc13d971--- /dev/null+++ b/rust/bindings/frb/locker/src/api/log.rs@@ -0,0 +1 @@+ente_frb_log::setup!(crate::frb_generated::StreamSink);diff --git a/rust/bindings/frb/locker/src/api/mod.rs b/rust/bindings/frb/locker/src/api/mod.rsnew file mode 100644index 0000000000..f4ba0587c7--- /dev/null+++ b/rust/bindings/frb/locker/src/api/mod.rs@@ -0,0 +1,3 @@+pub mod init;+#[cfg(any(feature = "flutter", frb_expand))]+pub mod log;diff --git a/rust/bindings/frb/locker/src/lib.rs b/rust/bindings/frb/locker/src/lib.rsnew file mode 100644index 0000000000..0a29e8ff92--- /dev/null+++ b/rust/bindings/frb/locker/src/lib.rs@@ -0,0 +1,5 @@+pub mod api;++#[cfg(feature = "flutter")]+#[rustfmt::skip]+mod frb_generated;