mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-03 22:48:25 +08:00
Fix LazyReactPackage in OSS
Summary: In OSS, during gradle build, the ReactModuleSpecProcess annotation-processor does not run. As a result, the `ReactModuleInfo` that we need for CoreReactPackage is not generated, resulting in a runtime error. The fix is to make LazyReactPackage revert to what it was doing earlier. In `NativeModuleRegistryBuilder`, if we dont find `ReactModuleInfo` for any `ModuleSpec`, we eagerly instantiate the module and get all the `ReactModuleInfo` from it. By returning an emoy collection if the class is not available, we force the modules in `CoreReactPackage` to use this codepath instead. The alternate fix would be to ensure that the annotation processor runs in gradle/OSS. However, the annotation processor will be removed eventually in the future, and we will also be move to generating them for JS, so that work will soon be irrelevant. Reviewed By: fkgozali, achen1 Differential Revision: D9130517 fbshipit-source-id: 469cf0e32a2f3650f098547667b3cd09a63eb1a0
This commit is contained in:
committed by
Facebook Github Bot
parent
3f89dd2db6
commit
42146a7a4a
@@ -60,7 +60,7 @@ public class NativeModuleRegistryBuilder {
|
||||
NativeModule module;
|
||||
ReactMarker.logMarker(
|
||||
ReactMarkerConstants.CREATE_MODULE_START,
|
||||
moduleSpec.getType().getName());
|
||||
moduleSpec.getClassName());
|
||||
try {
|
||||
module = moduleSpec.getProvider().get();
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user