Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / avatar / build.gradle.kts
build.gradle.kts60 lines · 2.3 KiBRaw
| 1 | plugins { |
| 2 | id("common-conventions-library") |
| 3 | } |
| 4 | |
| 5 | android { |
| 6 | // Detached-fd asset handoff (YuuAvatarAssets): the .glb must stay stored |
| 7 | // uncompressed so openFd() maps it. Same arrangement as :library:ml. |
| 8 | aaptOptions { |
| 9 | noCompress += ".glb" |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | androidComponents { |
| 14 | onVariants { variant -> |
| 15 | variant.sources.jniLibs?.addStaticSourceDirectory( |
| 16 | layout.buildDirectory.dir("rustJniLibs").get().asFile.absolutePath |
| 17 | ) |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | dependencies { |
| 22 | implementation(project(":library:ui")) |
| 23 | implementation(libs.androidx.lifecycle.runtime.compose) |
| 24 | } |
| 25 | |
| 26 | // Yuu 3D avatar engine: `library/avatar/src/main/rust`, glTF upper-body base |
| 27 | // mesh, skeletal skinning, preset poses, Vulkan-first + GLES fallback. |
| 28 | // |
| 29 | // Same arrangement as :library:map: the crate builds into rustJniLibs and |
| 30 | // YuuAvatarNative.isAvailable gates every call, so devices without the .so |
| 31 | // keep the 2D YuuFace preview. arm64 only (map precedent). |
| 32 | rustNativeLib( |
| 33 | "yuu_avatar", |
| 34 | "avatar", |
| 35 | // yuu_avatar_gles.* are GLSL ES, compiled at run time by the GLES path. |
| 36 | shaders = listOf("yuu_avatar.vert", "yuu_avatar.frag"), |
| 37 | ) |
| 38 | |
| 39 | // Only YuuPoseTest never loads a native library (the pure pose gallery). |
| 40 | // Every other class reaches YuuAvatarNative: YuuAvatarNativeTest drives |
| 41 | // the JNI bridge directly against the host libyuu_avatar, YuuAvatarAssetsTest |
| 42 | // goes through adoptBundledMesh/handOff (both gated on |
| 43 | // YuuAvatarNative.isAvailable, and handOff forwards the fd natively), and |
| 44 | // the components tests compose YuuAvatar3D / drive YuuAvatarSurfaceView, |
| 45 | // whose first check is YuuAvatarNative.isAvailable. Quarantine those |
| 46 | // loaders into testDebugUnitTestNative (forkEvery = 1); YuuPoseTest |
| 47 | // batches 20-per-JVM in testDebugUnitTest, which depends on the |
| 48 | // quarantine task so the usual invocation still runs everything. No |
| 49 | // isolatedClasses: no DataStore/ViewModel or process-wide singleton here. |
| 50 | rustNativeTests { |
| 51 | nativeClasses.addAll( |
| 52 | listOf( |
| 53 | "com.vayunmathur.library.avatar.YuuAvatarAssetsTest", |
| 54 | "com.vayunmathur.library.avatar.YuuAvatarNativeTest", |
| 55 | "com.vayunmathur.library.avatar.components.YuuAvatar3DLifecycleTest", |
| 56 | "com.vayunmathur.library.avatar.components.YuuAvatar3DTest", |
| 57 | "com.vayunmathur.library.avatar.components.YuuAvatarSurfaceViewTest", |
| 58 | ) |
| 59 | ) |
| 60 | } |