Skip to content

Commit

Permalink
Remove splitting to BridgeCorePackage and ReactNativePackage.
Browse files Browse the repository at this point in the history
Reviewed By: kathryngray

Differential Revision: D6286129

fbshipit-source-id: 8d75e610291402ccbffb137ce46e64d11826b950
  • Loading branch information
Dmitry Zakharov authored and facebook-github-bot committed Nov 14, 2017
1 parent 28d5d6b commit 4894ac4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 320 deletions.
132 changes: 0 additions & 132 deletions ReactAndroid/src/main/java/com/facebook/react/BridgeCorePackage.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,38 @@
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.common.build.ReactBuildConfig;
import com.facebook.react.devsupport.JSCHeapCapture;
import com.facebook.react.devsupport.JSCSamplingProfiler;
import com.facebook.react.module.annotations.ReactModuleList;
import com.facebook.react.module.model.ReactModuleInfoProvider;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.modules.core.ExceptionsManagerModule;
import com.facebook.react.modules.core.HeadlessJsTaskSupportModule;
import com.facebook.react.modules.core.Timing;
import com.facebook.react.modules.debug.AnimationsDebugModule;
import com.facebook.react.modules.debug.SourceCodeModule;
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
import com.facebook.react.modules.systeminfo.AndroidInfoModule;
import com.facebook.react.uimanager.UIImplementationProvider;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.systrace.Systrace;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
import javax.inject.Provider;

/**
* This module should be removed following the completion of an experiment into splitting this into
* three modules to allow for more light-weight instantiations of the bridge without UIManager
* The core modules are now in BridgeCorePackage
* The debug modules are now in DebugCorePackage
* The UI manager is in ReactNativeCorePackage
*
* Package defining core framework modules (e.g. UIManager). It should be used for modules that
* require special integration with other framework parts (e.g. with the list of packages to load
* view managers from).
* This is the basic module to support React Native. The debug modules are now in DebugCorePackage.
*/
@ReactModuleList(
nativeModules = {
AndroidInfoModule.class,
AnimationsDebugModule.class,
DeviceEventManagerModule.class,
DeviceInfoModule.class,
ExceptionsManagerModule.class,
HeadlessJsTaskSupportModule.class,
SourceCodeModule.class,
Timing.class,
UIManagerModule.class,
DeviceInfoModule.class,
// Debug only
JSCHeapCapture.class,
JSCSamplingProfiler.class,
}
)
/* package */ class CoreModulesPackage extends LazyReactPackage implements ReactPackageLogger {
Expand All @@ -90,82 +75,63 @@

@Override
public List<ModuleSpec> getNativeModules(final ReactApplicationContext reactContext) {
List<ModuleSpec> moduleSpecList = new ArrayList<>();

moduleSpecList.add(
return Arrays.asList(
ModuleSpec.nativeModuleSpec(
AndroidInfoModule.class,
new Provider<NativeModule>() {
@Override
public NativeModule get() {
return new AndroidInfoModule();
}
}));
moduleSpecList.add(
ModuleSpec.nativeModuleSpec(
AnimationsDebugModule.class,
new Provider<NativeModule>() {
@Override
public NativeModule get() {
return new AnimationsDebugModule(
reactContext, mReactInstanceManager.getDevSupportManager().getDevSettings());
}
}));
moduleSpecList.add(
}),
ModuleSpec.nativeModuleSpec(
DeviceEventManagerModule.class,
new Provider<NativeModule>() {
@Override
public NativeModule get() {
return new DeviceEventManagerModule(reactContext, mHardwareBackBtnHandler);
}
}));
moduleSpecList.add(
}),
ModuleSpec.nativeModuleSpec(
ExceptionsManagerModule.class,
new Provider<NativeModule>() {
@Override
public NativeModule get() {
return new ExceptionsManagerModule(mReactInstanceManager.getDevSupportManager());
}
}));
moduleSpecList.add(
}),
ModuleSpec.nativeModuleSpec(
HeadlessJsTaskSupportModule.class,
new Provider<NativeModule>() {
@Override
public NativeModule get() {
return new HeadlessJsTaskSupportModule(reactContext);
}
}));
moduleSpecList.add(
}),
ModuleSpec.nativeModuleSpec(
SourceCodeModule.class,
new Provider<NativeModule>() {
@Override
public NativeModule get() {
return new SourceCodeModule(reactContext);
}
}));
moduleSpecList.add(
}),
ModuleSpec.nativeModuleSpec(
Timing.class,
new Provider<NativeModule>() {
@Override
public NativeModule get() {
return new Timing(reactContext, mReactInstanceManager.getDevSupportManager());
}
}));
moduleSpecList.add(
}),
ModuleSpec.nativeModuleSpec(
UIManagerModule.class,
new Provider<NativeModule>() {
@Override
public NativeModule get() {
return createUIManager(reactContext);
}
}));
moduleSpecList.add(
}),
ModuleSpec.nativeModuleSpec(
DeviceInfoModule.class,
new Provider<NativeModule>() {
Expand All @@ -174,29 +140,6 @@ public NativeModule get() {
return new DeviceInfoModule(reactContext);
}
}));

if (ReactBuildConfig.DEBUG) {
moduleSpecList.add(
ModuleSpec.nativeModuleSpec(
JSCHeapCapture.class,
new Provider<NativeModule>() {
@Override
public NativeModule get() {
return new JSCHeapCapture(reactContext);
}
}));
moduleSpecList.add(
ModuleSpec.nativeModuleSpec(
JSCSamplingProfiler.class,
new Provider<NativeModule>() {
@Override
public NativeModule get() {
return new JSCSamplingProfiler(reactContext);
}
}));
}

return moduleSpecList;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,16 +272,16 @@ public static ReactInstanceManagerBuilder builder() {
mMinNumShakes = minNumShakes;
synchronized (mPackages) {
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: Use Split Packages");
mPackages.add(new BridgeCorePackage(this, mBackBtnHandler));
if (mUseDeveloperSupport) {
mPackages.add(new DebugCorePackage());
}
mPackages.add(
new ReactNativeCorePackage(
new CoreModulesPackage(
this,
mBackBtnHandler,
mUIImplementationProvider,
mLazyViewManagersEnabled,
mMinTimeLeftInFrameForNonBatchedOperationMs));
if (mUseDeveloperSupport) {
mPackages.add(new DebugCorePackage());
}
mPackages.addAll(packages);
}

Expand Down
Loading

0 comments on commit 4894ac4

Please sign in to comment.