Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Update FRB codegen workflows

Manav Rathi872158dbfb86
diff --git a/.github/workflows/locker-internal-release.yml b/.github/workflows/locker-internal-release.yml
index b550e25ccb..f03438cc1f 100644
--- a/.github/workflows/locker-internal-release.yml
+++ b/.github/workflows/locker-internal-release.yml
@@ -46,12 +46,8 @@ jobs:
- name: Resolve dependencies with lockfile enforcement
run: flutter pub get --enforce-lockfile
- - name: Install Flutter Rust Bridge
- run: cargo install flutter_rust_bridge_codegen
-
- - name: Generate Rust bindings (Core package)
- run: flutter_rust_bridge_codegen generate
- working-directory: mobile/packages/rust
+ - run: cargo codegen frb
+ working-directory: rust
- name: Increment version code for build
run: |
diff --git a/.github/workflows/locker-lint.yml b/.github/workflows/locker-lint.yml
index c48ffd58a5..f8ef60a77d 100644
--- a/.github/workflows/locker-lint.yml
+++ b/.github/workflows/locker-lint.yml
@@ -9,6 +9,10 @@ on:
- "mobile/packages/legacy/**"
- "mobile/packages/rust/**"
- "mobile/packages/sharing/**"
+ - "rust/bindings/frb/ente-rust/**"
+ - "rust/apps/codegen/**"
+ - "rust/Cargo.lock"
+ - "rust/Cargo.toml"
- ".github/workflows/locker-lint.yml"
- "mobile/scripts/check_source_arb_plurals.rb"
@@ -55,15 +59,11 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
- mobile/packages/rust/rust/target
- key: ${{ runner.os }}-cargo-locker-${{ hashFiles('mobile/packages/**/Cargo.lock') }}
+ rust/target
+ key: ${{ runner.os }}-cargo-locker-${{ hashFiles('rust/Cargo.lock') }}
- - name: Install Flutter Rust Bridge
- run: cargo install flutter_rust_bridge_codegen
-
- - name: Generate Rust bindings (Core package)
- run: flutter_rust_bridge_codegen generate
- working-directory: mobile/packages/rust
+ - run: cargo codegen frb
+ working-directory: rust
- name: Generate strings localizations
run: flutter gen-l10n
diff --git a/.github/workflows/locker-release.yml b/.github/workflows/locker-release.yml
index 3b88521de1..aaf8d53eff 100644
--- a/.github/workflows/locker-release.yml
+++ b/.github/workflows/locker-release.yml
@@ -83,12 +83,8 @@ jobs:
- name: Resolve dependencies with lockfile enforcement
run: flutter pub get --enforce-lockfile
- - name: Install Flutter Rust Bridge
- run: cargo install flutter_rust_bridge_codegen
-
- - name: Generate Rust bindings (Core package)
- run: flutter_rust_bridge_codegen generate
- working-directory: mobile/packages/rust
+ - run: cargo codegen frb
+ working-directory: rust
- name: Add keystore
run: echo "${{ secrets.SIGNING_KEY_LOCKER }}" | base64 -d > "$RUNNER_TEMP/ente_locker_key.jks"
diff --git a/.github/workflows/mobile-daily-internal.yml b/.github/workflows/mobile-daily-internal.yml
index b9e1383b07..c1d22e5f60 100644
--- a/.github/workflows/mobile-daily-internal.yml
+++ b/.github/workflows/mobile-daily-internal.yml
@@ -66,15 +66,8 @@ jobs:
- name: Resolve dependencies with lockfile enforcement
run: flutter pub get --enforce-lockfile
- - name: Install Flutter Rust Bridge
- run: cargo install flutter_rust_bridge_codegen
-
- - name: Generate Rust bindings (Core)
- run: flutter_rust_bridge_codegen generate
- working-directory: mobile/packages/rust
-
- - name: Generate Rust bindings
- run: flutter_rust_bridge_codegen generate
+ - run: cargo codegen frb
+ working-directory: rust
- name: Increment version code for build
run: |
diff --git a/.github/workflows/mobile-lint.yml b/.github/workflows/mobile-lint.yml
index 308314800d..9418887468 100644
--- a/.github/workflows/mobile-lint.yml
+++ b/.github/workflows/mobile-lint.yml
@@ -10,6 +10,10 @@ on:
- "rust/crates/core/**"
- "rust/crates/contacts/**"
- "rust/crates/image/**"
+ - "rust/bindings/frb/**"
+ - "rust/apps/codegen/**"
+ - "rust/Cargo.lock"
+ - "rust/Cargo.toml"
- ".github/workflows/mobile-lint.yml"
- "mobile/scripts/check_source_arb_plurals.rb"
@@ -42,13 +46,13 @@ jobs:
while IFS= read -r file; do
case "$file" in
- .github/workflows/mobile-lint.yml|mobile/packages/rust/*|rust/crates/core/*|rust/crates/contacts/*)
+ .github/workflows/mobile-lint.yml|mobile/packages/rust/*|rust/bindings/frb/ente-rust/*|rust/crates/core/*|rust/crates/contacts/*|rust/apps/codegen/*|rust/Cargo.lock|rust/Cargo.toml)
ente_rust=true
;;
esac
case "$file" in
- .github/workflows/mobile-lint.yml|mobile/apps/photos/rust/*|mobile/apps/photos/rust_builder/*|rust/photos/*|rust/crates/image/*)
+ .github/workflows/mobile-lint.yml|mobile/apps/photos/rust_builder/*|rust/bindings/frb/photos/*|rust/photos/*|rust/crates/image/*|rust/apps/codegen/*|rust/Cargo.lock|rust/Cargo.toml)
ente_photos_rust=true
;;
esac
@@ -90,21 +94,13 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
- mobile/packages/rust/rust/target
- mobile/apps/photos/rust/target
- key: ${{ runner.os }}-cargo-mobile-${{ hashFiles('mobile/**/Cargo.lock') }}
+ rust/target
+ key: ${{ runner.os }}-cargo-mobile-${{ hashFiles('rust/Cargo.lock') }}
- run: flutter pub get --enforce-lockfile
- - name: Install Flutter Rust Bridge
- run: cargo install flutter_rust_bridge_codegen
-
- - name: Generate Rust bindings (Core)
- run: flutter_rust_bridge_codegen generate
- working-directory: mobile/packages/rust
-
- - name: Generate Rust bindings
- run: flutter_rust_bridge_codegen generate
+ - run: cargo codegen frb
+ working-directory: rust
- run: flutter analyze --no-fatal-infos
@@ -113,40 +109,40 @@ jobs:
- name: Check formatting (ente_rust)
if: steps.rust_changes.outputs.ente_rust == 'true'
- working-directory: mobile/packages/rust/rust
- run: cargo fmt -- src/frb_generated.rs && cargo fmt --check
+ working-directory: rust
+ run: cargo fmt --check -p ente_rust
- name: Run clippy (ente_rust)
if: steps.rust_changes.outputs.ente_rust == 'true'
- working-directory: mobile/packages/rust/rust
- run: cargo clippy --all-targets --all-features
+ working-directory: rust
+ run: cargo clippy -p ente_rust --all-targets --all-features
- name: Build (ente_rust)
if: steps.rust_changes.outputs.ente_rust == 'true'
- working-directory: mobile/packages/rust/rust
- run: cargo build
+ working-directory: rust
+ run: cargo build -p ente_rust
- name: Test (ente_rust)
if: steps.rust_changes.outputs.ente_rust == 'true'
- working-directory: mobile/packages/rust/rust
- run: cargo test
+ working-directory: rust
+ run: cargo test -p ente_rust
- name: Check formatting (ente_photos_rust)
if: steps.rust_changes.outputs.ente_photos_rust == 'true'
- working-directory: mobile/apps/photos/rust
- run: cargo fmt -- src/frb_generated.rs && cargo fmt --check
+ working-directory: rust
+ run: cargo fmt --check -p ente_photos_rust
- name: Run clippy (ente_photos_rust)
if: steps.rust_changes.outputs.ente_photos_rust == 'true'
- working-directory: mobile/apps/photos/rust
- run: cargo clippy --all-targets --all-features
+ working-directory: rust
+ run: cargo clippy -p ente_photos_rust --all-targets --all-features
- name: Build (ente_photos_rust)
if: steps.rust_changes.outputs.ente_photos_rust == 'true'
- working-directory: mobile/apps/photos/rust
- run: cargo build
+ working-directory: rust
+ run: cargo build -p ente_photos_rust
- name: Test (ente_photos_rust)
if: steps.rust_changes.outputs.ente_photos_rust == 'true'
- working-directory: mobile/apps/photos/rust
- run: cargo test
+ working-directory: rust
+ run: cargo test -p ente_photos_rust
diff --git a/.github/workflows/mobile-packages-lint.yml b/.github/workflows/mobile-packages-lint.yml
index c66861c508..3e5931f5e3 100644
--- a/.github/workflows/mobile-packages-lint.yml
+++ b/.github/workflows/mobile-packages-lint.yml
@@ -8,6 +8,10 @@ on:
- "mobile/**/pubspec*.yaml"
- "mobile/**/pubspec.lock"
- "rust/photos/**"
+ - "rust/bindings/frb/**"
+ - "rust/apps/codegen/**"
+ - "rust/Cargo.lock"
+ - "rust/Cargo.toml"
- ".github/workflows/mobile-packages-lint.yml"
- "mobile/scripts/check_frozen_pubspecs.rb"
- "mobile/scripts/check_source_arb_plurals.rb"
@@ -45,11 +49,11 @@ jobs:
with:
filters: |
rust:
- - 'mobile/packages/rust/**/*.rs'
- - 'mobile/packages/rust/**/Cargo.toml'
- - 'mobile/packages/rust/**/Cargo.lock'
- - 'mobile/apps/photos/rust/**/*.rs'
- - 'mobile/apps/photos/rust/**/Cargo.toml'
+ - 'rust/bindings/frb/**/*.rs'
+ - 'rust/bindings/frb/**/Cargo.toml'
+ - 'rust/apps/codegen/**'
+ - 'rust/Cargo.lock'
+ - 'rust/Cargo.toml'
- 'rust/photos/**'
- 'rust/crates/core/**/*.rs'
workflow:
@@ -134,15 +138,11 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
- mobile/packages/rust/rust/target
- key: ${{ runner.os }}-cargo-packages-${{ hashFiles('mobile/packages/**/Cargo.lock') }}
+ rust/target
+ key: ${{ runner.os }}-cargo-packages-${{ hashFiles('rust/Cargo.lock') }}
- - name: Install Flutter Rust Bridge
- run: cargo install flutter_rust_bridge_codegen
-
- - name: Generate Rust bindings (Core)
- run: flutter_rust_bridge_codegen generate
- working-directory: mobile/packages/rust
+ - run: cargo codegen frb
+ working-directory: rust
- name: Generate strings localizations
run: flutter gen-l10n
@@ -276,51 +276,43 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
- mobile/packages/rust/rust/target
- key: ${{ runner.os }}-cargo-packages-${{ hashFiles('mobile/packages/**/Cargo.lock') }}
-
- - name: Install Flutter Rust Bridge
- run: cargo install flutter_rust_bridge_codegen
+ rust/target
+ key: ${{ runner.os }}-cargo-packages-${{ hashFiles('rust/Cargo.lock') }}
- - name: Generate Rust bindings (Core)
- run: flutter_rust_bridge_codegen generate
- working-directory: mobile/packages/rust
+ - run: cargo codegen frb
+ working-directory: rust
- name: Check formatting (ente_rust)
- working-directory: mobile/packages/rust/rust
- run: cargo fmt -- src/frb_generated.rs && cargo fmt --check
+ working-directory: rust
+ run: cargo fmt --check -p ente_rust
- name: Run clippy (ente_rust)
- working-directory: mobile/packages/rust/rust
- run: cargo clippy --all-targets --all-features
+ working-directory: rust
+ run: cargo clippy -p ente_rust --all-targets --all-features
- name: Build (ente_rust)
- working-directory: mobile/packages/rust/rust
- run: cargo build
+ working-directory: rust
+ run: cargo build -p ente_rust
- name: Test (ente_rust)
- working-directory: mobile/packages/rust/rust
- run: cargo test
-
- - name: Generate Rust bindings (photos app)
- run: flutter_rust_bridge_codegen generate
- working-directory: mobile/apps/photos
+ working-directory: rust
+ run: cargo test -p ente_rust
- name: Check formatting (ente_photos_rust)
- working-directory: mobile/apps/photos/rust
- run: cargo fmt -- src/frb_generated.rs && cargo fmt --check
+ working-directory: rust
+ run: cargo fmt --check -p ente_photos_rust
- name: Run clippy (ente_photos_rust)
- working-directory: mobile/apps/photos/rust
- run: cargo clippy --all-targets --all-features
+ working-directory: rust
+ run: cargo clippy -p ente_photos_rust --all-targets --all-features
- name: Build (ente_photos_rust)
- working-directory: mobile/apps/photos/rust
- run: cargo build
+ working-directory: rust
+ run: cargo build -p ente_photos_rust
- name: Test (ente_photos_rust)
- working-directory: mobile/apps/photos/rust
- run: cargo test
+ working-directory: rust
+ run: cargo test -p ente_photos_rust
apps-lint:
needs: detect-changes
@@ -357,22 +349,12 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
- mobile/packages/rust/rust/target
- key: ${{ runner.os }}-cargo-packages-${{ hashFiles('mobile/packages/**/Cargo.lock') }}
-
- - name: Install Flutter Rust Bridge
- if: needs.detect-changes.outputs.lint_photos == 'true' || needs.detect-changes.outputs.lint_locker == 'true'
- run: cargo install flutter_rust_bridge_codegen
-
- - name: Generate Rust bindings (Core package)
- if: needs.detect-changes.outputs.lint_photos == 'true' || needs.detect-changes.outputs.lint_locker == 'true'
- run: flutter_rust_bridge_codegen generate
- working-directory: mobile/packages/rust
+ rust/target
+ key: ${{ runner.os }}-cargo-packages-${{ hashFiles('rust/Cargo.lock') }}
- - name: Generate Rust bindings (photos app)
- if: needs.detect-changes.outputs.lint_photos == 'true'
- run: flutter_rust_bridge_codegen generate
- working-directory: mobile/apps/photos
+ - if: needs.detect-changes.outputs.lint_photos == 'true' || needs.detect-changes.outputs.lint_locker == 'true'
+ run: cargo codegen frb
+ working-directory: rust
- name: Generate strings localizations
run: flutter gen-l10n
diff --git a/.github/workflows/mobile-release.yml b/.github/workflows/mobile-release.yml
index 46be7baa5d..5dd71f6300 100644
--- a/.github/workflows/mobile-release.yml
+++ b/.github/workflows/mobile-release.yml
@@ -79,15 +79,8 @@ jobs:
- name: Resolve dependencies with lockfile enforcement
run: flutter pub get --enforce-lockfile
- - name: Install Flutter Rust Bridge
- run: cargo install flutter_rust_bridge_codegen
-
- - name: Generate Rust bindings (Core)
- run: flutter_rust_bridge_codegen generate
- working-directory: mobile/packages/rust
-
- - name: Generate Rust bindings
- run: flutter_rust_bridge_codegen generate
+ - run: cargo codegen frb
+ working-directory: rust
- name: Add keystore
run: echo "${{ secrets.SIGNING_KEY_PHOTOS }}" | base64 -d > "$RUNNER_TEMP/ente_photos_key.jks"
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index bf6496eddc..f6b7b4b3d6 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -5896,15 +5896,6 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "numkong"
-version = "7.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a75e386ad4a252e96357fd400ed9b5c7afea048447f2fb0906652b47cf2aaa87"
-dependencies = [
- "cc",
-]
-
[[package]]
name = "nutype-enum"
version = "0.1.5"
@@ -9490,13 +9481,12 @@ checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
[[package]]
name = "usearch"
-version = "2.25.2"
+version = "2.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15d31c8be436d55b9ec4300fe21978435bf59c1026e821257e9e74c651f7f05c"
+checksum = "2cc9fc5f872a3a4f9081d5f42624d788231b763e1846c829b9968a3755ac884d"
dependencies = [
"cxx",
"cxx-build",
- "numkong",
]
[[package]]
diff --git a/rust/apps/codegen/src/main.rs b/rust/apps/codegen/src/main.rs
index a71a73d16f..702569fad0 100644
--- a/rust/apps/codegen/src/main.rs
+++ b/rust/apps/codegen/src/main.rs
@@ -162,7 +162,8 @@ fn generate_native_android() -> Result<(), DynError> {
fn generate_frb() -> Result<(), DynError> {
generate_frb_path("mobile/packages/rust")?;
- generate_frb_path("mobile/apps/photos")
+ generate_frb_path("mobile/apps/photos")?;
+ format_frb_bindings()
}
fn generate_frb_path(relative_package_dir: &str) -> Result<(), DynError> {
@@ -212,6 +213,20 @@ fn generate_frb_package(package_dir: &Path) -> Result<(), DynError> {
Ok(())
}
+fn format_frb_bindings() -> Result<(), DynError> {
+ let rust_root = rust_root()?;
+ run_command(
+ Command::new("cargo")
+ .arg("fmt")
+ .arg("-p")
+ .arg("ente_rust")
+ .arg("-p")
+ .arg("ente_photos_rust")
+ .current_dir(rust_root),
+ "failed to format generated FRB Rust bindings".to_owned(),
+ )
+}
+
fn rust_root() -> Result<PathBuf, DynError> {
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
manifest_dir
diff --git a/rust/photos/Cargo.toml b/rust/photos/Cargo.toml
index 4bc55c4c78..2f67e06b36 100644
--- a/rust/photos/Cargo.toml
+++ b/rust/photos/Cargo.toml
@@ -6,7 +6,9 @@ edition = "2024"
[dependencies]
ente_image = { path = "../crates/image" }
quick-xml = "0.37"
-usearch = "2.21.3"
+# The FRB photos bridge calls the SimSIMD symbol exported by usearch 2.21.x.
+# Newer usearch releases switched that implementation to numkong symbols.
+usearch = "=2.21.4"
fast_image_resize = { version = "5.5.0", features = ["image", "rayon"] }
image = { version = "0.25.5", default-features = true }
imageproc = "0.25.0"