Description
When a React Native project passes -PreactNativeArchitectures to restrict which ABIs to build for (e.g. arm64-v8a,armeabi-v7a), the app module respects the filter — but the watermelondb-android-jsi native library compiles for all NDK ABIs (including x86, x86_64) anyway.
This wastes significant CPU time during local and EAS builds, especially on developer machines or CI runners where every second counts. The unnecessary .so files are eventually stripped from the AAB packaging, so it is purely wasted work.
Root Cause
The native/android-jsi/build.gradle has no abiFilters in its defaultConfig.ndk{} block, so CMake/ninja builds for every architecture the NDK supports — ignoring the parent project's reactNativeArchitectures property.
Proposed Fix
PR #1970 adds an ndk.abiFilters block in defaultConfig that reads the reactNativeArchitectures (or react.nativeArchitectures) property from rootProject. When unset, the list is empty which is a no-op (all ABIs built, same as before).
Steps to Reproduce
- Set
android.gradleCommand in eas.json to :app:bundleRelease -PreactNativeArchitectures=arm64-v8a
- Run
eas build --platform android --profile production --local
- Observe that ninja spawns
x86 and x86_64 build processes for watermelondb-android-jsi
Environment
- WatermelonDB: current master
- React Native: 0.85.x
- Android: API 26+
Description
When a React Native project passes
-PreactNativeArchitecturesto restrict which ABIs to build for (e.g.arm64-v8a,armeabi-v7a), the app module respects the filter — but thewatermelondb-android-jsinative library compiles for all NDK ABIs (includingx86,x86_64) anyway.This wastes significant CPU time during local and EAS builds, especially on developer machines or CI runners where every second counts. The unnecessary
.sofiles are eventually stripped from the AAB packaging, so it is purely wasted work.Root Cause
The
native/android-jsi/build.gradlehas noabiFiltersin itsdefaultConfig.ndk{}block, so CMake/ninja builds for every architecture the NDK supports — ignoring the parent project'sreactNativeArchitecturesproperty.Proposed Fix
PR #1970 adds an
ndk.abiFiltersblock indefaultConfigthat reads thereactNativeArchitectures(orreact.nativeArchitectures) property fromrootProject. When unset, the list is empty which is a no-op (all ABIs built, same as before).Steps to Reproduce
android.gradleCommandineas.jsonto:app:bundleRelease -PreactNativeArchitectures=arm64-v8aeas build --platform android --profile production --localx86andx86_64build processes forwatermelondb-android-jsiEnvironment