Skip to content

Commit c005609

Browse files
cortinicofacebook-github-bot
authored andcommitted
Properly set REACTNATIVE_MERGED_SO for autolinked libraries. (#46606)
Summary: Pull Request resolved: #46606 This fixes this issue reported here: react-native-community/discussions-and-proposals#816 (reply in thread) reported by both SWM and Expo. The problem is that `REACTNATIVE_MERGED_SO` is not properly set for autolinked libraries so they can't access it to understand if the version of ReactNative has merged so libraries or not. This fixes it, I've tested against https://github.com/tomekzaw/repro-reactnative-merged-so reproducer provided by tomekzaw Changelog: [Android] [Fixed] - Properly set `REACTNATIVE_MERGED_SO` for autolinked libraries Reviewed By: rubennorte Differential Revision: D63262687 fbshipit-source-id: c505dce9036bb4cd0366b7ab99412368963273af
1 parent fc82240 commit c005609

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTask.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ abstract class GenerateAutolinkingNewArchitecturesFileTask : DefaultTask() {
166166
cmake_minimum_required(VERSION 3.13)
167167
set(CMAKE_VERBOSE_MAKEFILE on)
168168
169+
# We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so
170+
# or link against a old prefab target (this is needed for React Native 0.76 on).
171+
set(REACTNATIVE_MERGED_SO true)
172+
169173
{{ libraryIncludes }}
170174
171175
set(AUTOLINKED_LIBRARIES

packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTaskTest.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
115115
cmake_minimum_required(VERSION 3.13)
116116
set(CMAKE_VERBOSE_MAKEFILE on)
117117
118+
# We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so
119+
# or link against a old prefab target (this is needed for React Native 0.76 on).
120+
set(REACTNATIVE_MERGED_SO true)
121+
118122
119123
120124
set(AUTOLINKED_LIBRARIES
@@ -137,6 +141,10 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
137141
cmake_minimum_required(VERSION 3.13)
138142
set(CMAKE_VERBOSE_MAKEFILE on)
139143
144+
# We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so
145+
# or link against a old prefab target (this is needed for React Native 0.76 on).
146+
set(REACTNATIVE_MERGED_SO true)
147+
140148
add_subdirectory(./a/directory/ aPackage_autolinked_build)
141149
add_subdirectory(./another/directory/ anotherPackage_autolinked_build)
142150
add_subdirectory(./another/directory/cxx/ anotherPackage_cxxmodule_autolinked_build)

0 commit comments

Comments
 (0)