fix(android): compile native code into merged SO#3871
fix(android): compile native code into merged SO#3871alpha0010 wants to merge 1 commit intosoftware-mansion:mainfrom
Conversation
kkafar
left a comment
There was a problem hiding this comment.
Hey, thanks for the contribution!
I get the change & why it uses a bit less memory, but I'm not confident about its consequences. I don't recall exactly why it has been a shared lib in the first place.
You mention that you want to align a bit more with the autogenerated CMakeLists (including only the codegened srcs, w/o our custom code) - do you happen to have context how that generated CMakeLists changed? Is it something RN Codegen introduced recently or has it been like that for a long time now?
Also, do you happen to open similar PRs to other libraries?
I suspect the origin of this for many libraries is https://swmansion.com/blog/react-natives-new-architecture-the-tricky-parts-1-2-bb0c16950f2d/ , which is the most complete description I have been able to find, regarding new architecture shadow nodes. It mentions copying and modifying the generated
To my knowledge, this changed in RN 0.76 react-native-community/discussions-and-proposals#816 , with the introduction
I did open one other currently: AppAndFlow/react-native-safe-area-context#715 (and probably will open more with other libraries in the near future). |
Description
Take advantage of the merged library structure introduced in RN 0.76 to reduce footprint on Android.
Changes
Modifies the custom
CMakeLists.txtto more closely match the autogeneratedandroid/build/generated/source/codegen/jni/CMakeLists.txtit is replacing.Before & after - visual documentation
Note that
libreact_codegen_rnscreens.sois now merged intolibappmodules.so.(
librnscreens.sois untouched, as I am not familiar enough with the structure to know if that is possible to merge as well.)Test plan
Build and run Android. Analyze the APK to confirm library merging. There should be no functional change.
Checklist