fix(android): respect reactNativeArchitectures to skip unnecessary ABI builds - #1970
Open
SscSPs wants to merge 1 commit into
Open
fix(android): respect reactNativeArchitectures to skip unnecessary ABI builds#1970SscSPs wants to merge 1 commit into
SscSPs wants to merge 1 commit into
Conversation
…I builds When the parent project passes -PreactNativeArchitectures (or -Preact.nativeArchitectures), the android-jsi library currently builds native code for every NDK ABI (arm64-v8a, armeabi-v7a, x86, x86_64, etc.) regardless of the specified filter. This adds an ndk.abiFilters block inside defaultConfig that reads the property from rootProject. When unset the list stays empty, which is a no-op (every ABI is built — same as before). When set, CMake/ninja only compiles for the requested architectures, saving build time and resources. Fixes #___
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the parent project passes
-PreactNativeArchitectures(or-Preact.nativeArchitectures), theandroid-jsilibrary currently compiles native code for every NDK ABI — includingx86,x86_64, etc. — regardless of the specified filter.This adds an
ndk.abiFiltersblock insidedefaultConfigthat reads the property fromrootProject. When the property is set, CMake/ninja only builds for the requested architectures, saving build time and disk space. When unset, the list stays empty which is a no-op (all ABIs are built — same as before).Motivation
In a React Native project configured with e.g.
:app:bundleRelease -PreactNativeArchitectures=arm64-v8a,armeabi-v7a, the app module correctly filters its native builds — but library modules likewatermelondb-android-jsiignore this flag and compile for the full NDK matrix. This is wasted CPU time (and disk space during local/EAS builds) since the AAB packaging strips unneeded architectures anyway.Testing
abiFiltersis an empty list, preserving existing behaviorFixes #___
Fixes #1971