Skip to content

armgit / ente

Public Imported from GitHub
0

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

Rename native codegen command

Manav Rathice326f818e61
diff --git a/.github/workflows/ensu-android-build.yml b/.github/workflows/ensu-android-build.yml
index e34c300535..5cda3778ee 100644
--- a/.github/workflows/ensu-android-build.yml
+++ b/.github/workflows/ensu-android-build.yml
@@ -29,9 +29,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v6
- - name: Generate UniFFI Kotlin bindings
+ - run: cargo codegen native
working-directory: rust
- run: cargo codegen ensu-android
- name: Build Ensu
working-directory: mobile/native/android/apps/ensu
diff --git a/.github/workflows/ensu-build.yml b/.github/workflows/ensu-build.yml
index 631e8b2abf..ee5ebffc42 100644
--- a/.github/workflows/ensu-build.yml
+++ b/.github/workflows/ensu-build.yml
@@ -262,10 +262,8 @@ jobs:
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- - name: Generate Android bindings
- run: |
- cd ../../../../../rust
- cargo codegen ensu-android
+ - run: cargo codegen native
+ working-directory: rust
- name: Setup signing keys
run: |
@@ -332,9 +330,8 @@ jobs:
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- - name: Generate iOS bindings
+ - run: cargo codegen native
working-directory: rust
- run: cargo codegen ensu-ios
- name: Import Apple Distribution certificate
uses: Apple-Actions/import-codesign-certs@5142e029c445c10ffc7149d172e540235a065466 # v7.0.0
diff --git a/.github/workflows/ensu-ios-build.yml b/.github/workflows/ensu-ios-build.yml
index a30e522abb..1c77c1463c 100644
--- a/.github/workflows/ensu-ios-build.yml
+++ b/.github/workflows/ensu-ios-build.yml
@@ -29,9 +29,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v6
- - name: Generate UniFFI Swift bindings
+ - run: cargo codegen native
working-directory: rust
- run: cargo codegen ensu-ios
# This pull_request workflow does not provide the inference fixtures,
# so this step is only a build + startup smoke test.
diff --git a/mobile/native/android/apps/ensu/README.md b/mobile/native/android/apps/ensu/README.md
index ce5892ce04..274d6118c2 100644
--- a/mobile/native/android/apps/ensu/README.md
+++ b/mobile/native/android/apps/ensu/README.md
@@ -12,7 +12,7 @@ To know more about Ente, see [our main README](../../../../../README.md) or visi
```sh
cd rust
- cargo codegen ensu-android
+ cargo codegen native
```
3. Open the project in Android Studio and run the `app-ui` module. If the Android NDK is missing, Android Studio will prompt to install it.
@@ -21,7 +21,7 @@ That's it. Apart from the `cargo codegen`, this is a normal Android project.
> [!NOTE]
>
-> Re-run `cargo codegen ensu-android` whenever the UniFFI interface under `rust/bindings/uniffi` changes.
+> Re-run `cargo codegen native` whenever the UniFFI interface under `rust/bindings/uniffi` changes.
>
> Gradle cross-compiles the Rust libraries to JNI `.so` files automatically when building the app.
diff --git a/mobile/native/darwin/Apps/Ensu/README.md b/mobile/native/darwin/Apps/Ensu/README.md
index 6618a42965..62bf60eef3 100644
--- a/mobile/native/darwin/Apps/Ensu/README.md
+++ b/mobile/native/darwin/Apps/Ensu/README.md
@@ -10,7 +10,7 @@ Source code for the Ensu iOS app.
```sh
cd rust
- cargo codegen ensu-ios
+ cargo codegen native
```
3. Open `Ensu.xcodeproj` in Xcode and run the `Ensu` scheme.
@@ -19,7 +19,7 @@ That's it. Apart from the `cargo codegen`, this is a normal iOS project.
> [!NOTE]
>
-> Re-run `cargo codegen ensu-ios` whenever the UniFFI interface under `rust/bindings/uniffi` changes.
+> Re-run `cargo codegen native` whenever the UniFFI interface under `rust/bindings/uniffi` changes.
>
> Xcode compiles and statically links the Rust libraries automatically when building the app.
diff --git a/mobile/native/darwin/Apps/Ensu/scripts/build-rust.sh b/mobile/native/darwin/Apps/Ensu/scripts/build-rust.sh
index 728bfabb8f..a0508c8cdf 100755
--- a/mobile/native/darwin/Apps/Ensu/scripts/build-rust.sh
+++ b/mobile/native/darwin/Apps/Ensu/scripts/build-rust.sh
@@ -24,7 +24,7 @@ for name in core db sync inference transcription; do
for ext in .swift FFI.h FFI.modulemap; do
[[ -f "$GENERATED_DIR/$name$ext" ]] || {
echo "error: missing $GENERATED_DIR/$name$ext" >&2
- echo " run: (cd $REPO_ROOT/rust && cargo codegen ensu-ios)" >&2
+ echo " run: (cd $REPO_ROOT/rust && cargo codegen native)" >&2
exit 1
}
done
diff --git a/rust/README.md b/rust/README.md
index 45b6c8bed4..5a32b80d0b 100644
--- a/rust/README.md
+++ b/rust/README.md
@@ -209,11 +209,13 @@ yarn build:wasm # builds the WASM package
> cargo watch -w ../rust/crates/core -w ../rust/bindings/wasm/ente-wasm/src -s "yarn build:wasm"
> ```
-**Flutter Rust Bridge:**
+**Generated bindings:**
```sh
cd rust
+cargo codegen native
cargo codegen frb
```
-This regenerates both `ente_rust` and `ente_photos_rust`.
+`native` regenerates the UniFFI bindings used by native mobile apps.
+`frb` regenerates both `ente_rust` and `ente_photos_rust`.
diff --git a/rust/apps/codegen/src/main.rs b/rust/apps/codegen/src/main.rs
index 04bd5e67a2..a71a73d16f 100644
--- a/rust/apps/codegen/src/main.rs
+++ b/rust/apps/codegen/src/main.rs
@@ -34,20 +34,18 @@ fn main() {
fn run() -> Result<(), DynError> {
let mut args = env::args().skip(1);
match (args.next().as_deref(), args.next()) {
- (Some("ensu"), None) => generate_ensu(),
- (Some("ensu-ios"), None) => generate_ensu_ios(),
- (Some("ensu-android"), None) => generate_ensu_android(),
+ (Some("native"), None) => generate_native(),
(Some("frb"), None) => generate_frb(),
- _ => Err("usage: cargo codegen <ensu|ensu-ios|ensu-android|frb>".into()),
+ _ => Err("usage: cargo codegen <native|frb>".into()),
}
}
-fn generate_ensu() -> Result<(), DynError> {
- generate_ensu_ios()?;
- generate_ensu_android()
+fn generate_native() -> Result<(), DynError> {
+ generate_native_ios()?;
+ generate_native_android()
}
-fn generate_ensu_ios() -> Result<(), DynError> {
+fn generate_native_ios() -> Result<(), DynError> {
let rust_root = rust_root()?;
let repo_root = rust_root
.parent()
@@ -94,7 +92,7 @@ fn generate_ensu_ios() -> Result<(), DynError> {
Ok(())
}
-fn generate_ensu_android() -> Result<(), DynError> {
+fn generate_native_android() -> Result<(), DynError> {
let rust_root = rust_root()?;
let repo_root = rust_root
.parent()