mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove core modules from the default tmmdelegate (#43939)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43939 ## Problem If we link the default tmmdelegate with our vr apps, we get this issue: ``` ld.lld: error: duplicate symbol: facebook::react::NativeDevLoadingViewSpecJSI::NativeDevLoadingViewSpecJSI(facebook::react::JavaTurboModule::InitParams const&) >>> defined at firsttimenux_v2AppModulesCodegen-generated.cpp:1367 (buck-out/v2/gen/fbsource/bcbe7a50bd5ff29a/arvr/libraries/react-panellib/FirstTimeNux/__firsttimenux_v2AppModulesCodegen-codegen-modules-jni_cpp__/out/firsttimenux_v2AppModulesCodegen-generated.cpp:1367) >>> firsttimenux_v2AppModulesCodegen-generated.cpp.pic.o:(facebook::react::NativeDevLoadingViewSpecJSI::NativeDevLoadingViewSpecJSI(facebook::react::JavaTurboModule::InitParams const&)) in archive buck-out/v2/gen/fbsource/bcbe7a50bd5ff29a/arvr/libraries/react-panellib/FirstTimeNux/__firsttimenux_v2AppModulesCodegen-jni__/libfirsttimenux_v2AppModulesCodegen-jni.pic.a >>> defined at rncore-generated.cpp:606 (buck-out/v2/gen/fbsource/bcbe7a50bd5ff29a/xplat/js/react-native-github/__rncore-codegen-modules-jni_cpp__/out/rncore-generated.cpp:606) >>> rncore-generated.cpp.pic.o:(.text._ZN8facebook5react27NativeDevLoadingViewSpecJSIC2ERKNS0_15JavaTurboModule10InitParamsE+0x0) in archive buck-out/v2/gen/fbsource/bcbe7a50bd5ff29a/xplat/js/react-native-github/__rncore-jniAndroid__/librncore-jniAndroid.pic.a ``` ## Cause My best understanding of the problem: - Default tmmdelegate links against rncore, which contains codegen for react native's standard library of modules. - But, the default delegate also pulls in this appmodules.so library. That library also contains codegen for react native's standard library of modules + the app's modules. So, two so libraries define the same symbols. Hence the build fails. ## Solution Remove the codegen for react native's standard library of modules from the default tmmdelegate. Prereq: In open source, also make appmodules.so include the codegen for react native's standard library of modules. Changelog: [Android][Breaking] - Make the app responsible for returning core turbomodule jsi hostobjects Reviewed By: cortinico Differential Revision: D55613024 fbshipit-source-id: 6406a9f388ff9de01288de0e263a78a079e7a0da
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a0d809cdd3
commit
7facb32f30
@@ -32,6 +32,7 @@
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||
#include <rncli.h>
|
||||
#include <rncore.h>
|
||||
|
||||
#ifdef REACT_NATIVE_APP_CODEGEN_HEADER
|
||||
#include REACT_NATIVE_APP_CODEGEN_HEADER
|
||||
@@ -95,8 +96,17 @@ std::shared_ptr<TurboModule> javaModuleProvider(
|
||||
}
|
||||
#endif
|
||||
|
||||
// We first try to look up core modules
|
||||
if (auto module = rncore_ModuleProvider(name, params)) {
|
||||
return module;
|
||||
}
|
||||
|
||||
// And we fallback to the module providers autolinked by RN CLI
|
||||
return rncli_ModuleProvider(name, params);
|
||||
if (auto module = rncli_ModuleProvider(name, params)) {
|
||||
return module;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
+2
-2
@@ -12,7 +12,6 @@
|
||||
#include <react/nativemodule/dom/NativeDOM.h>
|
||||
#include <react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h>
|
||||
#include <react/nativemodule/microtasks/NativeMicrotasks.h>
|
||||
#include <rncore.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
@@ -100,7 +99,8 @@ std::shared_ptr<TurboModule> DefaultTurboModuleManagerDelegate::getTurboModule(
|
||||
return resolvedModule;
|
||||
}
|
||||
}
|
||||
return rncore_ModuleProvider(name, params);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <ReactCommon/SampleTurboModuleSpec.h>
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||
#include <rncore.h>
|
||||
|
||||
#ifdef REACT_NATIVE_APP_CODEGEN_HEADER
|
||||
#include REACT_NATIVE_APP_CODEGEN_HEADER
|
||||
@@ -51,6 +52,12 @@ std::shared_ptr<TurboModule> javaModuleProvider(
|
||||
return module;
|
||||
}
|
||||
#endif
|
||||
|
||||
// We first try to look up core modules
|
||||
if (auto module = rncore_ModuleProvider(name, params)) {
|
||||
return module;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user