Skip to content

High performance self-hosted photo and video management solution.

chore(mobile): rename the native core crates and package (#31986)

Santo Shakil0e6371539450
diff --git a/.github/workflows/build-mobile.yml b/.github/workflows/build-mobile.yml
index f702b7b02e..77d366ecab 100644
--- a/.github/workflows/build-mobile.yml
+++ b/.github/workflows/build-mobile.yml
@@ -113,7 +113,7 @@ jobs:
~/.cargo/bin
~/.cargo/registry
~/.cargo/git
- key: build-mobile-rust-${{ runner.os }}-${{ hashFiles('native/crates/immich_core_ffi/rust-toolchain.toml', 'native/Cargo.lock') }}
+ key: build-mobile-rust-${{ runner.os }}-${{ hashFiles('native/crates/native_core_ffi/rust-toolchain.toml', 'native/Cargo.lock') }}
restore-keys: |
build-mobile-rust-${{ runner.os }}-
@@ -261,7 +261,7 @@ jobs:
~/.cargo/bin
~/.cargo/registry
~/.cargo/git
- key: build-mobile-rust-${{ runner.os }}-${{ hashFiles('native/crates/immich_core_ffi/rust-toolchain.toml', 'native/Cargo.lock') }}
+ key: build-mobile-rust-${{ runner.os }}-${{ hashFiles('native/crates/native_core_ffi/rust-toolchain.toml', 'native/Cargo.lock') }}
restore-keys: |
build-mobile-rust-${{ runner.os }}-
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 5a7f73b9d7..a6f3a7e327 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -107,7 +107,7 @@ jobs:
~/.cargo/registry
~/.cargo/git
native/target
- key: native-rust-${{ runner.os }}-${{ hashFiles('native/crates/immich_core_ffi/rust-toolchain.toml', 'native/mise.lock', 'native/Cargo.lock') }}
+ key: native-rust-${{ runner.os }}-${{ hashFiles('native/crates/native_core_ffi/rust-toolchain.toml', 'native/mise.lock', 'native/Cargo.lock') }}
restore-keys: |
native-rust-${{ runner.os }}-
@@ -686,7 +686,7 @@ jobs:
~/.cargo/bin
~/.cargo/registry
~/.cargo/git
- key: mobile-rust-${{ runner.os }}-${{ hashFiles('native/crates/immich_core_ffi/rust-toolchain.toml', 'mobile/mise.lock', 'native/Cargo.lock') }}
+ key: mobile-rust-${{ runner.os }}-${{ hashFiles('native/crates/native_core_ffi/rust-toolchain.toml', 'mobile/mise.lock', 'native/Cargo.lock') }}
restore-keys: |
mobile-rust-${{ runner.os }}-
diff --git a/mobile/android/app/src/main/kotlin/app/alextran/immich/NativeBuffer.kt b/mobile/android/app/src/main/kotlin/app/alextran/immich/NativeBuffer.kt
index e80bb0a463..4737c78b75 100644
--- a/mobile/android/app/src/main/kotlin/app/alextran/immich/NativeBuffer.kt
+++ b/mobile/android/app/src/main/kotlin/app/alextran/immich/NativeBuffer.kt
@@ -6,7 +6,7 @@ const val INITIAL_BUFFER_SIZE = 32 * 1024
object NativeBuffer {
init {
- System.loadLibrary("immich_core_ffi")
+ System.loadLibrary("native_core_ffi")
}
@JvmStatic
diff --git a/mobile/android/app/src/main/kotlin/app/alextran/immich/NativeImage.kt b/mobile/android/app/src/main/kotlin/app/alextran/immich/NativeImage.kt
index 44812e3911..30453985cd 100644
--- a/mobile/android/app/src/main/kotlin/app/alextran/immich/NativeImage.kt
+++ b/mobile/android/app/src/main/kotlin/app/alextran/immich/NativeImage.kt
@@ -4,7 +4,7 @@ import android.graphics.Bitmap
object NativeImage {
init {
- System.loadLibrary("immich_core_ffi")
+ System.loadLibrary("native_core_ffi")
}
/**
diff --git a/mobile/android/app/src/main/kotlin/app/alextran/immich/images/ThumbHash.kt b/mobile/android/app/src/main/kotlin/app/alextran/immich/images/ThumbHash.kt
index 81eefb9670..122d368003 100644
--- a/mobile/android/app/src/main/kotlin/app/alextran/immich/images/ThumbHash.kt
+++ b/mobile/android/app/src/main/kotlin/app/alextran/immich/images/ThumbHash.kt
@@ -2,7 +2,7 @@ package app.alextran.immich.images
object ThumbHash {
init {
- System.loadLibrary("immich_core_ffi")
+ System.loadLibrary("native_core_ffi")
}
@JvmStatic
diff --git a/mobile/integration_test/native_core_test.dart b/mobile/integration_test/native_core_test.dart
index 24acca9f3a..bd34e38a6d 100644
--- a/mobile/integration_test/native_core_test.dart
+++ b/mobile/integration_test/native_core_test.dart
@@ -1,6 +1,6 @@
import 'package:flutter_test/flutter_test.dart';
-import 'package:immich_native_core/immich_native_core.dart';
import 'package:integration_test/integration_test.dart';
+import 'package:native_core/native_core.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
diff --git a/mobile/ios/Runner/Core/NativeCore.swift b/mobile/ios/Runner/Core/NativeCore.swift
index 044ee462b7..1d72557f76 100644
--- a/mobile/ios/Runner/Core/NativeCore.swift
+++ b/mobile/ios/Runner/Core/NativeCore.swift
@@ -1,14 +1,14 @@
import Foundation
enum NativeCore {
- private static let library = dlopen("@rpath/immich_core_ffi.framework/immich_core_ffi", RTLD_NOW)
+ private static let library = dlopen("@rpath/native_core_ffi.framework/native_core_ffi", RTLD_NOW)
private static func symbol<T>(_ name: String, as type: T.Type) -> T? {
guard let library, let symbol = dlsym(library, name) else { return nil }
return unsafeBitCast(symbol, to: type)
}
- private static let coreThumbhash = symbol("immich_core_thumbhash", as: ImmichCoreThumbhashFn.self)
+ private static let coreThumbhash = symbol("native_core_thumbhash", as: NativeCoreThumbhashFn.self)
static func thumbhash(_ hash: Data) -> (width: Int, height: Int, pointer: UnsafeMutableRawPointer)? {
guard let coreThumbhash else { return nil }
diff --git a/mobile/ios/Runner/Runner-Bridging-Header.h b/mobile/ios/Runner/Runner-Bridging-Header.h
index 19717c3c7e..f7fb444153 100644
--- a/mobile/ios/Runner/Runner-Bridging-Header.h
+++ b/mobile/ios/Runner/Runner-Bridging-Header.h
@@ -1,5 +1,5 @@
#import "GeneratedPluginRegistrant.h"
-#include "../../../native/crates/immich_core_ffi/include/immich_core.h"
+#include "../../../native/crates/native_core_ffi/include/native_core.h"
// The function pointer type comes from the declaration, so nothing is retyped here.
-typedef __typeof__(&immich_core_thumbhash) ImmichCoreThumbhashFn;
+typedef __typeof__(&native_core_thumbhash) NativeCoreThumbhashFn;
diff --git a/mobile/mise.toml b/mobile/mise.toml
index ceb5666f41..d8c97aac25 100644
--- a/mobile/mise.toml
+++ b/mobile/mise.toml
@@ -85,9 +85,9 @@ run = "dart run build_runner watch"
[tasks."codegen:native"]
description = "Generate the C header and the ffigen bindings for the native core"
-dir = "../native/immich_native_core"
+dir = "../native/native_core"
run = [
- "cargo build -p immich_core_ffi",
+ "cargo build -p native_core_ffi",
"flutter pub get",
"dart run ffigen --config ffigen.yaml",
]
diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock
index 0215ccde5a..0b20d8bd4f 100644
--- a/mobile/pubspec.lock
+++ b/mobile/pubspec.lock
@@ -928,13 +928,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.2.2"
- immich_native_core:
- dependency: "direct main"
- description:
- path: "../native/immich_native_core"
- relative: true
- source: path
- version: "0.0.0"
immich_ui:
dependency: "direct main"
description:
@@ -1139,6 +1132,13 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.5"
+ native_core:
+ dependency: "direct main"
+ description:
+ path: "../native/native_core"
+ relative: true
+ source: path
+ version: "0.0.0"
native_toolchain_c:
dependency: transitive
description:
diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml
index a73054a303..5d9956767e 100644
--- a/mobile/pubspec.yaml
+++ b/mobile/pubspec.yaml
@@ -39,8 +39,8 @@ dependencies:
hooks_riverpod: ^2.6.1
http: ^1.6.0
image_picker: ^1.2.3
- immich_native_core:
- path: ../native/immich_native_core
+ native_core:
+ path: ../native/native_core
immich_ui:
path: './packages/ui'
intl: ^0.20.2
diff --git a/native/.gitignore b/native/.gitignore
index a6778de659..dd13b7e3ff 100644
--- a/native/.gitignore
+++ b/native/.gitignore
@@ -1,3 +1,3 @@
/target
-/crates/immich_core_ffi/include/immich_core.h
-/immich_native_core/lib/src/bindings.g.dart
+/crates/native_core_ffi/include/native_core.h
+/native_core/lib/src/bindings.g.dart
diff --git a/native/Cargo.lock b/native/Cargo.lock
index b727b345a5..7d3032f73b 100644
--- a/native/Cargo.lock
+++ b/native/Cargo.lock
@@ -93,20 +93,6 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
-[[package]]
-name = "immich_core"
-version = "0.1.0"
-
-[[package]]
-name = "immich_core_ffi"
-version = "0.1.0"
-dependencies = [
- "cbindgen",
- "immich_core",
- "jni",
- "libc",
-]
-
[[package]]
name = "indexmap"
version = "2.14.1"
@@ -196,6 +182,20 @@ version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
+[[package]]
+name = "native_core"
+version = "0.1.0"
+
+[[package]]
+name = "native_core_ffi"
+version = "0.1.0"
+dependencies = [
+ "cbindgen",
+ "jni",
+ "libc",
+ "native_core",
+]
+
[[package]]
name = "once_cell"
version = "1.21.4"
diff --git a/native/Cargo.toml b/native/Cargo.toml
index 87591be4dc..2a9a7da070 100644
--- a/native/Cargo.toml
+++ b/native/Cargo.toml
@@ -1,6 +1,6 @@
[workspace]
resolver = "3"
-members = ["crates/immich_core", "crates/immich_core_ffi"]
+members = ["crates/native_core", "crates/native_core_ffi"]
[workspace.package]
version = "0.1.0"
diff --git a/native/README.md b/native/README.md
index 253eb10e4a..1d89d73897 100644
--- a/native/README.md
+++ b/native/README.md
@@ -1,13 +1,13 @@
# Native core
Rust code that ships inside the mobile app. Flutter compiles it from source through the
-`immich_native_core` build hook, so building the app needs a Rust toolchain: `mise install`
+`native_core` build hook, so building the app needs a Rust toolchain: `mise install`
in `mobile/` sets one up, otherwise install [rustup](https://rustup.rs) once and the build
fetches the pinned toolchain itself.
-- `crates/immich_core`: the shared logic
-- `crates/immich_core_ffi`: the C ABI, cbindgen writes `include/immich_core.h`
-- `immich_native_core`: Flutter package with the build hook and the ffigen bindings
+- `crates/native_core`: the shared logic
+- `crates/native_core_ffi`: the C ABI, cbindgen writes `include/native_core.h`
+- `native_core`: Flutter package with the build hook and the ffigen bindings
(`NOTICES` carries the licenses of the crates compiled into the core, update it with the dependencies)
`mise run build`, `test`, `lint`, and `fmt`. The header and the Dart bindings come from `mise run //mobile:codegen:native`.
diff --git a/native/crates/immich_core/Cargo.toml b/native/crates/native_core/Cargo.toml
similarity index 84%
rename from native/crates/immich_core/Cargo.toml
rename to native/crates/native_core/Cargo.toml
index f7946f6b67..eff59c46f5 100644
--- a/native/crates/immich_core/Cargo.toml
+++ b/native/crates/native_core/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "immich_core"
+name = "native_core"
version.workspace = true
edition.workspace = true
license.workspace = true
diff --git a/native/crates/immich_core/src/convert.rs b/native/crates/native_core/src/convert.rs
similarity index 100%
rename from native/crates/immich_core/src/convert.rs
rename to native/crates/native_core/src/convert.rs
diff --git a/native/crates/immich_core/src/lib.rs b/native/crates/native_core/src/lib.rs
similarity index 68%
rename from native/crates/immich_core/src/lib.rs
rename to native/crates/native_core/src/lib.rs
index 199bc6184c..258913d03b 100644
--- a/native/crates/immich_core/src/lib.rs
+++ b/native/crates/native_core/src/lib.rs
@@ -2,6 +2,6 @@ pub mod convert;
pub mod rotate;
pub mod thumbhash;
-pub fn core_version() -> &'static str {
+pub fn version() -> &'static str {
env!("CARGO_PKG_VERSION")
}
diff --git a/native/crates/immich_core/src/rotate.rs b/native/crates/native_core/src/rotate.rs
similarity index 100%
rename from native/crates/immich_core/src/rotate.rs
rename to native/crates/native_core/src/rotate.rs
diff --git a/native/crates/immich_core/src/thumbhash.rs b/native/crates/native_core/src/thumbhash.rs
similarity index 100%
rename from native/crates/immich_core/src/thumbhash.rs
rename to native/crates/native_core/src/thumbhash.rs
diff --git a/native/crates/immich_core/tests/convert.rs b/native/crates/native_core/tests/convert.rs
similarity index 95%
rename from native/crates/immich_core/tests/convert.rs
rename to native/crates/native_core/tests/convert.rs
index e6d614613e..d7a370ca94 100644
--- a/native/crates/immich_core/tests/convert.rs
+++ b/native/crates/native_core/tests/convert.rs
@@ -1,4 +1,4 @@
-use immich_core::convert::convert_1010102;
+use native_core::convert::convert_1010102;
#[test]
fn channels_and_alpha() {
diff --git a/native/crates/immich_core/tests/rotate.rs b/native/crates/native_core/tests/rotate.rs
similarity index 95%
rename from native/crates/immich_core/tests/rotate.rs
rename to native/crates/native_core/tests/rotate.rs
index 1bcb765ce1..4473fef72b 100644
--- a/native/crates/immich_core/tests/rotate.rs
+++ b/native/crates/native_core/tests/rotate.rs
@@ -1,4 +1,4 @@
-use immich_core::rotate::{Orientation, rotate};
+use native_core::rotate::{Orientation, rotate};
#[test]
fn exif_orientations() {
diff --git a/native/crates/immich_core/tests/thumbhash.rs b/native/crates/native_core/tests/thumbhash.rs
similarity index 98%
rename from native/crates/immich_core/tests/thumbhash.rs
rename to native/crates/native_core/tests/thumbhash.rs
index 9d29527713..1382c8cf64 100644
--- a/native/crates/immich_core/tests/thumbhash.rs
+++ b/native/crates/native_core/tests/thumbhash.rs
@@ -1,4 +1,4 @@
-use immich_core::thumbhash::decode;
+use native_core::thumbhash::decode;
// Expected pixels come from the old Swift decoder patched to round like the Java did (it truncated),
// taken at pixels whose values sit well away from a rounding boundary, so the check is exact on any libm.
diff --git a/native/crates/immich_core_ffi/Cargo.toml b/native/crates/native_core_ffi/Cargo.toml
similarity index 81%
rename from native/crates/immich_core_ffi/Cargo.toml
rename to native/crates/native_core_ffi/Cargo.toml
index be37d949bd..97f2a21d55 100644
--- a/native/crates/immich_core_ffi/Cargo.toml
+++ b/native/crates/native_core_ffi/Cargo.toml
@@ -1,16 +1,16 @@
[package]
-name = "immich_core_ffi"
+name = "native_core_ffi"
version.workspace = true
edition.workspace = true
license.workspace = true
# native_toolchain_rust wants the explicit name and both crate types.
[lib]
-name = "immich_core_ffi"
+name = "native_core_ffi"
crate-type = ["cdylib", "staticlib"]
[dependencies]
-immich_core = { path = "../immich_core" }
+native_core = { path = "../native_core" }
libc = { workspace = true }
[target.'cfg(target_os = "android")'.dependencies]
diff --git a/native/crates/immich_core_ffi/build.rs b/native/crates/native_core_ffi/build.rs
similarity index 85%
rename from native/crates/immich_core_ffi/build.rs
rename to native/crates/native_core_ffi/build.rs
index 34edfa9520..e829519f9d 100644
--- a/native/crates/immich_core_ffi/build.rs
+++ b/native/crates/native_core_ffi/build.rs
@@ -8,5 +8,5 @@ fn main() {
let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
cbindgen::generate(&crate_dir)
.unwrap_or_else(|e| panic!("cbindgen failed: {e}"))
- .write_to_file(Path::new(&crate_dir).join("include/immich_core.h"));
+ .write_to_file(Path::new(&crate_dir).join("include/native_core.h"));
}
diff --git a/native/crates/immich_core_ffi/cbindgen.toml b/native/crates/native_core_ffi/cbindgen.toml
similarity index 100%
rename from native/crates/immich_core_ffi/cbindgen.toml
rename to native/crates/native_core_ffi/cbindgen.toml
diff --git a/native/crates/immich_core_ffi/rust-toolchain.toml b/native/crates/native_core_ffi/rust-toolchain.toml
similarity index 100%
rename from native/crates/immich_core_ffi/rust-toolchain.toml
rename to native/crates/native_core_ffi/rust-toolchain.toml
diff --git a/native/crates/immich_core_ffi/src/android.rs b/native/crates/native_core_ffi/src/android.rs
similarity index 100%
rename from native/crates/immich_core_ffi/src/android.rs
rename to native/crates/native_core_ffi/src/android.rs
diff --git a/native/crates/immich_core_ffi/src/bitmap.rs b/native/crates/native_core_ffi/src/bitmap.rs
similarity index 100%
rename from native/crates/immich_core_ffi/src/bitmap.rs
rename to native/crates/native_core_ffi/src/bitmap.rs
diff --git a/native/crates/immich_core_ffi/src/convert.rs b/native/crates/native_core_ffi/src/convert.rs
similarity index 92%
rename from native/crates/immich_core_ffi/src/convert.rs
rename to native/crates/native_core_ffi/src/convert.rs
index f25ce3d621..57a1a72e61 100644
--- a/native/crates/immich_core_ffi/src/convert.rs
+++ b/native/crates/native_core_ffi/src/convert.rs
@@ -1,7 +1,7 @@
-use immich_core::convert::convert_1010102;
use jni::EnvUnowned;
use jni::objects::{JClass, JIntArray, JObject};
use jni::sys::jlong;
+use native_core::convert::convert_1010102;
use super::bitmap::{self, FORMAT_RGBA_1010102};
diff --git a/native/crates/immich_core_ffi/src/lib.rs b/native/crates/native_core_ffi/src/lib.rs
similarity index 75%
rename from native/crates/immich_core_ffi/src/lib.rs
rename to native/crates/native_core_ffi/src/lib.rs
index 02e8f8d0cd..ccb80985aa 100644
--- a/native/crates/immich_core_ffi/src/lib.rs
+++ b/native/crates/native_core_ffi/src/lib.rs
@@ -13,11 +13,11 @@ mod convert;
mod rotate;
mod thumbhash;
-/// Returns the core version as a C string. Free it with `immich_core_free_string`.
+/// Returns the core version as a C string. Free it with `native_core_free_string`.
#[unsafe(no_mangle)]
-pub extern "C" fn immich_core_version() -> *mut c_char {
+pub extern "C" fn native_core_version() -> *mut c_char {
guard(ptr::null_mut(), || {
- match CString::new(immich_core::core_version()) {
+ match CString::new(native_core::version()) {
Ok(s) => s.into_raw(),
Err(_) => ptr::null_mut(),
}
@@ -29,7 +29,7 @@ pub extern "C" fn immich_core_version() -> *mut c_char {
/// # Safety
/// `ptr` must come from this library and must not be freed twice.
#[unsafe(no_mangle)]
-pub unsafe extern "C" fn immich_core_free_string(ptr: *mut c_char) {
+pub unsafe extern "C" fn native_core_free_string(ptr: *mut c_char) {
if ptr.is_null() {
return;
}
@@ -50,18 +50,18 @@ mod tests {
#[test]
fn version_roundtrips() {
- let p = immich_core_version();
+ let p = native_core_version();
assert!(!p.is_null());
// SAFETY: `p` is a C string from this library.
let s = unsafe { CStr::from_ptr(p) }.to_str().unwrap();
- assert_eq!(s, immich_core::core_version());
+ assert_eq!(s, native_core::version());
// SAFETY: `p` is freed exactly once.
- unsafe { immich_core_free_string(p) };
+ unsafe { native_core_free_string(p) };
}
#[test]
fn free_null_is_noop() {
// SAFETY: null is allowed by the contract.
- unsafe { immich_core_free_string(ptr::null_mut()) };
+ unsafe { native_core_free_string(ptr::null_mut()) };
}
}
diff --git a/native/crates/immich_core_ffi/src/rotate.rs b/native/crates/native_core_ffi/src/rotate.rs
similarity index 93%
rename from native/crates/immich_core_ffi/src/rotate.rs
rename to native/crates/native_core_ffi/src/rotate.rs
index 9627668622..978cf26a68 100644
--- a/native/crates/immich_core_ffi/src/rotate.rs
+++ b/native/crates/native_core_ffi/src/rotate.rs
@@ -1,7 +1,7 @@
-use immich_core::rotate::{Orientation, rotate};
use jni::EnvUnowned;
use jni::objects::{JClass, JIntArray, JObject};
use jni::sys::{jint, jlong};
+use native_core::rotate::{Orientation, rotate};
use super::bitmap::{self, FORMAT_RGBA_8888};
diff --git a/native/crates/immich_core_ffi/src/thumbhash.rs b/native/crates/native_core_ffi/src/thumbhash.rs
similarity index 94%
rename from native/crates/immich_core_ffi/src/thumbhash.rs
rename to native/crates/native_core_ffi/src/thumbhash.rs
index 2a2eb918bd..57b2cc962e 100644
--- a/native/crates/immich_core_ffi/src/thumbhash.rs
+++ b/native/crates/native_core_ffi/src/thumbhash.rs
@@ -2,7 +2,6 @@ use std::{ptr, slice};
use libc::size_t;
-use immich_core::thumbhash;
#[cfg(target_os = "android")]
use jni::{
EnvUnowned,
@@ -10,6 +9,7 @@ use jni::{
objects::{JByteArray, JClass, JIntArray},
sys::jlong,
};
+use native_core::thumbhash;
use super::guard;
@@ -20,7 +20,7 @@ use super::guard;
/// `hash` must be null or readable for `len` bytes, at most `isize::MAX`.
/// `width` and `height` must be null or valid writable pointers, outside `hash`.
#[unsafe(no_mangle)]
-pub unsafe extern "C" fn immich_core_thumbhash(
+pub unsafe extern "C" fn native_core_thumbhash(
hash: *const u8,
len: size_t,
width: *mut i32,
@@ -65,7 +65,7 @@ pub extern "system" fn Java_app_alextran_immich_images_ThumbHash_decode<'caller>
let (mut width, mut height) = (0, 0);
// SAFETY: the hash bytes and both output pointers are valid for this call.
let rgba =
- unsafe { immich_core_thumbhash(hash.as_ptr(), hash.len(), &mut width, &mut height) };
+ unsafe { native_core_thumbhash(hash.as_ptr(), hash.len(), &mut width, &mut height) };
if !rgba.is_null()
&& let Err(err) = info.set_region(env, 0, &[width, height, width * 4])
{
diff --git a/native/mise.toml b/native/mise.toml
index d75420420c..ba3da4fbaf 100644
--- a/native/mise.toml
+++ b/native/mise.toml
@@ -1,5 +1,5 @@
[tools]
-rust = { version = "1.98.0", components = "rustfmt,clippy" } # keep in sync with crates/immich_core_ffi/rust-toolchain.toml
+rust = { version = "1.98.0", components = "rustfmt,clippy" } # keep in sync with crates/native_core_ffi/rust-toolchain.toml
[tasks.build]
description = "Build the native crates for the host"
diff --git a/native/immich_native_core/.gitignore b/native/native_core/.gitignore
similarity index 100%
rename from native/immich_native_core/.gitignore
rename to native/native_core/.gitignore
diff --git a/native/immich_native_core/NOTICES b/native/native_core/NOTICES
similarity index 100%
rename from native/immich_native_core/NOTICES
rename to native/native_core/NOTICES
diff --git a/native/immich_native_core/analysis_options.yaml b/native/native_core/analysis_options.yaml
similarity index 100%
rename from native/immich_native_core/analysis_options.yaml
rename to native/native_core/analysis_options.yaml
diff --git a/native/immich_native_core/ffigen.yaml b/native/native_core/ffigen.yaml
similarity index 51%
rename from native/immich_native_core/ffigen.yaml
rename to native/native_core/ffigen.yaml
index ef0aa83119..c55389e278 100644
--- a/native/immich_native_core/ffigen.yaml
+++ b/native/native_core/ffigen.yaml
@@ -1,9 +1,9 @@
# The asset id must match assetName in hook/build.dart.
ffi-native:
- asset-id: 'package:immich_native_core/src/bindings.g.dart'
+ asset-id: 'package:native_core/src/bindings.g.dart'
output: 'lib/src/bindings.g.dart'
headers:
entry-points:
- - '../crates/immich_core_ffi/include/immich_core.h'
+ - '../crates/native_core_ffi/include/native_core.h'
include-directives:
- - '**/immich_core.h'
+ - '**/native_core.h'
diff --git a/native/immich_native_core/hook/build.dart b/native/native_core/hook/build.dart
similarity index 96%
rename from native/immich_native_core/hook/build.dart
rename to native/native_core/hook/build.dart
index d60c72a2c4..476a9ad510 100644
--- a/native/immich_native_core/hook/build.dart
+++ b/native/native_core/hook/build.dart
@@ -4,14 +4,14 @@ import 'package:code_assets/code_assets.dart';
import 'package:hooks/hooks.dart';
import 'package:native_toolchain_rust/native_toolchain_rust.dart';
-const _crate = '../crates/immich_core_ffi';
+const _crate = '../crates/native_core_ffi';
// Cargo's dep-info only lists source files, so these have to rerun the hook too.
const _manifests = [
'../.cargo/config.toml',
'../Cargo.toml',
'../Cargo.lock',
- '../crates/immich_core/Cargo.toml',
+ '../crates/native_core/Cargo.toml',
'$_crate/Cargo.toml',
'$_crate/rust-toolchain.toml',
];
diff --git a/native/immich_native_core/lib/immich_native_core.dart b/native/native_core/lib/native_core.dart
similarity index 68%
rename from native/immich_native_core/lib/immich_native_core.dart
rename to native/native_core/lib/native_core.dart
index 99db379da2..5dd8fb5ea1 100644
--- a/native/immich_native_core/lib/immich_native_core.dart
+++ b/native/native_core/lib/native_core.dart
@@ -3,10 +3,10 @@ import 'package:ffi/ffi.dart';
import 'src/bindings.g.dart';
String version() {
- final ptr = immich_core_version();
+ final ptr = native_core_version();
try {
return ptr.cast<Utf8>().toDartString();
} finally {
- immich_core_free_string(ptr);
+ native_core_free_string(ptr);
}
}
diff --git a/native/immich_native_core/pubspec.yaml b/native/native_core/pubspec.yaml
similarity index 91%
rename from native/immich_native_core/pubspec.yaml
rename to native/native_core/pubspec.yaml
index fbf3818872..edfad839eb 100644
--- a/native/immich_native_core/pubspec.yaml
+++ b/native/native_core/pubspec.yaml
@@ -1,4 +1,4 @@
-name: immich_native_core
+name: native_core
publish_to: none
environment:
diff --git a/native/immich_native_core/test/native_core_test.dart b/native/native_core/test/native_core_test.dart
similarity index 72%
rename from native/immich_native_core/test/native_core_test.dart
rename to native/native_core/test/native_core_test.dart
index afbb25d4d5..5d59c31949 100644
--- a/native/immich_native_core/test/native_core_test.dart
+++ b/native/native_core/test/native_core_test.dart
@@ -1,5 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
-import 'package:immich_native_core/immich_native_core.dart';
+import 'package:native_core/native_core.dart';
void main() {
test('loads the core and returns its version', () {