diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK index f6c2f002b..6d2c4fe51 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK @@ -16,10 +16,10 @@ android_library( react_native_target('java/com/facebook/react/bridge:bridge'), react_native_target('java/com/facebook/react/common:common'), react_native_target('java/com/facebook/react/cxxbridge:bridge'), - react_native_target('java/com/facebook/react/devsupport:devsupport'), + react_native_target('java/com/facebook/react/devsupport:interfaces'), react_native_target('java/com/facebook/react/module/model:model'), react_native_target('java/com/facebook/react/modules/core:core'), - react_native_target('java/com/facebook/react/modules/debug:debug'), + react_native_target('java/com/facebook/react/modules/debug:interfaces'), react_native_target('java/com/facebook/react/shell:shell'), react_native_target('java/com/facebook/react/uimanager:uimanager'), ], diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java index 5e703104e..752c89ea6 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java @@ -30,7 +30,7 @@ import com.facebook.react.bridge.SoftAssertions; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.common.ApplicationHolder; import com.facebook.react.common.futures.SimpleSettableFuture; -import com.facebook.react.devsupport.DevSupportManager; +import com.facebook.react.devsupport.interfaces.DevSupportManager; import com.facebook.react.modules.core.Timing; import com.facebook.soloader.SoLoader; diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactSettingsForTests.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactSettingsForTests.java index 569f1c7bd..a605b2686 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactSettingsForTests.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactSettingsForTests.java @@ -8,7 +8,7 @@ package com.facebook.react.testing; -import com.facebook.react.modules.debug.DeveloperSettings; +import com.facebook.react.modules.debug.interfaces.DeveloperSettings; public class ReactSettingsForTests implements DeveloperSettings { diff --git a/ReactAndroid/src/main/java/com/facebook/react/BUCK b/ReactAndroid/src/main/java/com/facebook/react/BUCK index 2839101f3..3538ec7fb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/BUCK @@ -11,11 +11,14 @@ DEPS = [ react_native_target('java/com/facebook/react/common:common'), react_native_target('java/com/facebook/react/cxxbridge:bridge'), react_native_target('java/com/facebook/react/devsupport:devsupport'), + react_native_target('java/com/facebook/react/devsupport:interfaces'), react_native_target('java/com/facebook/react/jstasks:jstasks'), react_native_target('java/com/facebook/react/module/annotations:annotations'), react_native_target('java/com/facebook/react/module/model:model'), + react_native_target('java/com/facebook/react/modules/appregistry:appregistry'), react_native_target('java/com/facebook/react/modules/core:core'), react_native_target('java/com/facebook/react/modules/debug:debug'), + react_native_target('java/com/facebook/react/modules/debug:interfaces'), react_native_target('java/com/facebook/react/modules/systeminfo:systeminfo'), react_native_target('java/com/facebook/react/modules/toast:toast'), react_native_target('java/com/facebook/react/uimanager:uimanager'), diff --git a/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java b/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java index d31d05b7e..d9ff55e0d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java @@ -37,7 +37,7 @@ 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.systeminfo.AndroidInfoModule; -import com.facebook.react.uimanager.AppRegistry; +import com.facebook.react.modules.appregistry.AppRegistry; import com.facebook.react.uimanager.UIImplementationProvider; import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.uimanager.ViewManager; diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java index 0d0d09486..c44678cee 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java @@ -53,15 +53,15 @@ import com.facebook.react.cxxbridge.JavaScriptExecutor; import com.facebook.react.cxxbridge.NativeModuleRegistry; import com.facebook.react.cxxbridge.ProxyJavaScriptExecutor; import com.facebook.react.cxxbridge.UiThreadUtil; -import com.facebook.react.devsupport.DevServerHelper; -import com.facebook.react.devsupport.DevSupportManager; +import com.facebook.react.devsupport.interfaces.DevSupportManager; +import com.facebook.react.devsupport.interfaces.PackagerStatusCallback; import com.facebook.react.devsupport.DevSupportManagerFactory; import com.facebook.react.devsupport.ReactInstanceDevCommandsHandler; import com.facebook.react.devsupport.RedBoxHandler; import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; import com.facebook.react.modules.core.DeviceEventManagerModule; -import com.facebook.react.modules.debug.DeveloperSettings; -import com.facebook.react.uimanager.AppRegistry; +import com.facebook.react.modules.debug.interfaces.DeveloperSettings; +import com.facebook.react.modules.appregistry.AppRegistry; import com.facebook.react.uimanager.DisplayMetricsHolder; import com.facebook.react.uimanager.UIImplementationProvider; import com.facebook.react.uimanager.UIManagerModule; @@ -409,7 +409,7 @@ public class ReactInstanceManager { mDevSupportManager.handleReloadJS(); } else { mDevSupportManager.isPackagerRunning( - new DevServerHelper.PackagerStatusCallback() { + new PackagerStatusCallback() { @Override public void onPackagerStatusFetched(final boolean packagerIsRunning) { UiThreadUtil.runOnUiThread( diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java index 5de63f489..d77020bb4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java @@ -15,7 +15,7 @@ import com.facebook.react.bridge.NativeModuleCallExceptionHandler; import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener; import com.facebook.react.common.LifecycleState; import com.facebook.react.cxxbridge.JSBundleLoader; -import com.facebook.react.devsupport.DevSupportManager; +import com.facebook.react.devsupport.interfaces.DevSupportManager; import com.facebook.react.devsupport.RedBoxHandler; import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; import com.facebook.react.uimanager.UIImplementationProvider; diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java index 4424d2e28..8d61ae560 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java @@ -24,7 +24,7 @@ import com.facebook.react.bridge.WritableMap; import com.facebook.react.module.annotations.ReactModule; import com.facebook.react.modules.core.DeviceEventManagerModule; import com.facebook.react.uimanager.GuardedChoreographerFrameCallback; -import com.facebook.react.uimanager.ReactChoreographer; +import com.facebook.react.modules.core.ReactChoreographer; import com.facebook.react.uimanager.UIManagerModule; import java.util.ArrayList; diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BUCK b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BUCK index bf30781eb..603d1fa2e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BUCK @@ -3,7 +3,7 @@ include_defs('//ReactAndroid/DEFS') android_library( name = 'devsupport', manifest = 'AndroidManifest.xml', - srcs = glob(['**/*.java']), + srcs = glob(['*.java']), deps = [ react_native_dep('libraries/fbcore/src/main/java/com/facebook/common/logging:logging'), react_native_dep('third-party/java/infer-annotations:infer-annotations'), @@ -14,8 +14,10 @@ android_library( react_native_target('java/com/facebook/react/bridge:bridge'), react_native_target('java/com/facebook/react/common:common'), react_native_target('java/com/facebook/react/common/network:network'), + react_native_target('java/com/facebook/react/devsupport:interfaces'), react_native_target('java/com/facebook/react/module/annotations:annotations'), react_native_target('java/com/facebook/react/modules/debug:debug'), + react_native_target('java/com/facebook/react/modules/debug:interfaces'), react_native_target('java/com/facebook/react/modules/systeminfo:systeminfo'), react_native_target('java/com/facebook/react/packagerconnection:packagerconnection'), react_native_target('res:devsupport'), @@ -24,3 +26,16 @@ android_library( 'PUBLIC', ], ) + +android_library( + name = 'interfaces', + srcs = glob(['interfaces/*.java']), + deps = [ + react_native_dep('third-party/java/jsr-305:jsr-305'), + react_native_target('java/com/facebook/react/bridge:bridge'), + react_native_target('java/com/facebook/react/modules/debug:interfaces'), + ], + visibility = [ + 'PUBLIC', + ], +) diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java index 2a1a4b68e..ce9ea690e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java @@ -16,7 +16,7 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; import com.facebook.react.common.annotations.VisibleForTesting; -import com.facebook.react.modules.debug.DeveloperSettings; +import com.facebook.react.modules.debug.interfaces.DeveloperSettings; /** * Helper class for accessing developers settings that should not be accessed outside of the package diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java index b273a4a67..373ee8ecb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java @@ -26,6 +26,7 @@ import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.common.ReactConstants; import com.facebook.react.common.network.OkHttpCallUtil; +import com.facebook.react.devsupport.interfaces.PackagerStatusCallback; import com.facebook.react.modules.systeminfo.AndroidInfoHelpers; import com.facebook.react.packagerconnection.JSPackagerWebSocketClient; @@ -88,10 +89,6 @@ public class DevServerHelper { void onPokeSamplingProfilerCommand(@Nullable final JSPackagerWebSocketClient.WebSocketSender webSocket); } - public interface PackagerStatusCallback { - void onPackagerStatusFetched(boolean packagerIsRunning); - } - private final DevInternalSettings mSettings; private final OkHttpClient mClient; private final Handler mRestartOnChangePollingHandler; diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.java index d41db6f5c..e3ba2e6b4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.java @@ -15,6 +15,8 @@ import java.lang.reflect.Constructor; import android.content.Context; +import com.facebook.react.devsupport.interfaces.DevSupportManager; + /** * A simple factory that creates instances of {@link DevSupportManager} implementations. Uses * reflection to create DevSupportManagerImpl if it exists. This allows ProGuard to strip that class diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java index d71f56261..95e3d9a70 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java @@ -51,8 +51,11 @@ import com.facebook.react.common.ReactConstants; import com.facebook.react.common.ShakeDetector; import com.facebook.react.common.futures.SimpleSettableFuture; import com.facebook.react.devsupport.DevServerHelper.PackagerCommandListener; -import com.facebook.react.devsupport.StackTraceHelper.StackFrame; -import com.facebook.react.modules.debug.DeveloperSettings; +import com.facebook.react.devsupport.interfaces.DevOptionHandler; +import com.facebook.react.devsupport.interfaces.DevSupportManager; +import com.facebook.react.devsupport.interfaces.PackagerStatusCallback; +import com.facebook.react.devsupport.interfaces.StackFrame; +import com.facebook.react.modules.debug.interfaces.DeveloperSettings; import com.facebook.react.packagerconnection.JSPackagerWebSocketClient; import okhttp3.MediaType; @@ -648,7 +651,7 @@ public class DevSupportManagerImpl implements } @Override - public void isPackagerRunning(DevServerHelper.PackagerStatusCallback callback) { + public void isPackagerRunning(PackagerStatusCallback callback) { mDevServerHelper.isPackagerRunning(callback); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java index f5592d0f1..23455e027 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java @@ -16,8 +16,11 @@ import java.io.File; import com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler; import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.devsupport.StackTraceHelper.StackFrame; -import com.facebook.react.modules.debug.DeveloperSettings; +import com.facebook.react.devsupport.interfaces.DevOptionHandler; +import com.facebook.react.devsupport.interfaces.DevSupportManager; +import com.facebook.react.devsupport.interfaces.PackagerStatusCallback; +import com.facebook.react.devsupport.interfaces.StackFrame; +import com.facebook.react.modules.debug.interfaces.DeveloperSettings; /** * A dummy implementation of {@link DevSupportManager} to be used in production mode where @@ -132,7 +135,7 @@ public class DisabledDevSupportManager implements DevSupportManager { } @Override - public void isPackagerRunning(DevServerHelper.PackagerStatusCallback callback) { + public void isPackagerRunning(PackagerStatusCallback callback) { } diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialog.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialog.java index 01c4f8032..f2611763c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialog.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialog.java @@ -35,7 +35,8 @@ import com.facebook.infer.annotation.Assertions; import com.facebook.react.R; import com.facebook.react.common.MapBuilder; import com.facebook.react.common.ReactConstants; -import com.facebook.react.devsupport.StackTraceHelper.StackFrame; +import com.facebook.react.devsupport.interfaces.DevSupportManager; +import com.facebook.react.devsupport.interfaces.StackFrame; import com.facebook.react.devsupport.RedBoxHandler.ReportCompletedListener; import okhttp3.MediaType; diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxHandler.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxHandler.java index 2ec51cb7f..33b8eb6b1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxHandler.java @@ -11,7 +11,7 @@ package com.facebook.react.devsupport; import android.text.SpannedString; -import com.facebook.react.devsupport.StackTraceHelper.StackFrame; +import com.facebook.react.devsupport.interfaces.StackFrame; /** * Interface used by {@link DevSupportManagerImpl} to allow interception on any redboxes diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.java index a2b1bb2a8..ef4c6c0cd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.java @@ -15,6 +15,7 @@ import java.io.File; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.devsupport.interfaces.StackFrame; /** * Helper class converting JS and Java stack traces into arrays of {@link StackFrame} objects. @@ -24,14 +25,14 @@ public class StackTraceHelper { /** * Represents a generic entry in a stack trace, be it originally from JS or Java. */ - public static class StackFrame { + public static class StackFrameImpl implements StackFrame { private final String mFile; private final String mMethod; private final int mLine; private final int mColumn; private final String mFileName; - private StackFrame(String file, String method, int line, int column) { + private StackFrameImpl(String file, String method, int line, int column) { mFile = file; mMethod = method; mLine = line; @@ -39,7 +40,7 @@ public class StackTraceHelper { mFileName = new File(file).getName(); } - private StackFrame(String file, String fileName, String method, int line, int column) { + private StackFrameImpl(String file, String fileName, String method, int line, int column) { mFile = file; mFileName = fileName; mMethod = method; @@ -105,7 +106,7 @@ public class StackTraceHelper { if (frame.hasKey("column") && !frame.isNull("column")) { columnNumber = frame.getInt("column"); } - result[i] = new StackFrame(fileName, methodName, lineNumber, columnNumber); + result[i] = new StackFrameImpl(fileName, methodName, lineNumber, columnNumber); } return result; } @@ -117,7 +118,7 @@ public class StackTraceHelper { StackTraceElement[] stackTrace = exception.getStackTrace(); StackFrame[] result = new StackFrame[stackTrace.length]; for (int i = 0; i < stackTrace.length; i++) { - result[i] = new StackFrame( + result[i] = new StackFrameImpl( stackTrace[i].getClassName(), stackTrace[i].getFileName(), stackTrace[i].getMethodName(), diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevOptionHandler.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevOptionHandler.java similarity index 94% rename from ReactAndroid/src/main/java/com/facebook/react/devsupport/DevOptionHandler.java rename to ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevOptionHandler.java index 48deca9b1..c0123cb5f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevOptionHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevOptionHandler.java @@ -7,7 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.react.devsupport; +package com.facebook.react.devsupport.interfaces; /** * Callback class for custom options that may appear in {@link DevSupportManager} developer diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManager.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSupportManager.java similarity index 89% rename from ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManager.java rename to ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSupportManager.java index a0e3f6d06..a8fedc356 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSupportManager.java @@ -7,7 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.react.devsupport; +package com.facebook.react.devsupport.interfaces; import javax.annotation.Nullable; @@ -16,8 +16,7 @@ import java.io.File; import com.facebook.react.bridge.NativeModuleCallExceptionHandler; import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.devsupport.StackTraceHelper.StackFrame; -import com.facebook.react.modules.debug.DeveloperSettings; +import com.facebook.react.modules.debug.interfaces.DeveloperSettings; /** * Interface for accessing and interacting with development features. @@ -46,7 +45,7 @@ public interface DevSupportManager extends NativeModuleCallExceptionHandler { void reloadSettings(); void handleReloadJS(); void reloadJSFromServer(final String bundleURL); - void isPackagerRunning(DevServerHelper.PackagerStatusCallback callback); + void isPackagerRunning(PackagerStatusCallback callback); @Nullable File downloadBundleResourceFromUrlSync( final String resourceURL, final File outputFile); diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/PackagerStatusCallback.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/PackagerStatusCallback.java new file mode 100644 index 000000000..f5abfb9bd --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/PackagerStatusCallback.java @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package com.facebook.react.devsupport.interfaces; + +public interface PackagerStatusCallback { + void onPackagerStatusFetched(boolean packagerIsRunning); +} diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/StackFrame.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/StackFrame.java new file mode 100644 index 000000000..4b02efd1b --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/StackFrame.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package com.facebook.react.devsupport.interfaces; + +/** + * Represents a generic entry in a stack trace, be it originally from JS or Java. + */ +public interface StackFrame { + /** + * Get the file this stack frame points to. + * + * JS traces return the full path to the file here, while Java traces only return the file name + * (the path is not known). + */ + public String getFile(); + + /** + * Get the name of the method this frame points to. + */ + public String getMethod(); + + /** + * Get the line number this frame points to in the file returned by {@link #getFile()}. + */ + public int getLine(); + + /** + * Get the column this frame points to in the file returned by {@link #getFile()}. + */ + public int getColumn(); + + /** + * Get just the name of the file this frame points to. + * + * For JS traces this is different from {@link #getFile()} in that it only returns the file + * name, not the full path. For Java traces there is no difference. + */ + public String getFileName(); +} \ No newline at end of file diff --git a/ReactAndroid/src/main/java/com/facebook/react/jstasks/BUCK b/ReactAndroid/src/main/java/com/facebook/react/jstasks/BUCK index 83624c865..aeff38b07 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jstasks/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/jstasks/BUCK @@ -6,7 +6,7 @@ DEPS = [ react_native_dep('third-party/java/jsr-305:jsr-305'), react_native_target('java/com/facebook/react/bridge:bridge'), react_native_target('java/com/facebook/react/common:common'), - react_native_target('java/com/facebook/react/uimanager:uimanager'), + react_native_target('java/com/facebook/react/modules/appregistry:appregistry'), ] android_library( diff --git a/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.java b/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.java index ff1ffe8f1..ea092e6de 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.java +++ b/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.java @@ -15,7 +15,7 @@ import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.common.LifecycleState; -import com.facebook.react.uimanager.AppRegistry; +import com.facebook.react.modules.appregistry.AppRegistry; /** * Helper class for dealing with JS tasks. Handles per-ReactContext active task tracking, starting / diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/AppRegistry.java b/ReactAndroid/src/main/java/com/facebook/react/modules/appregistry/AppRegistry.java similarity index 94% rename from ReactAndroid/src/main/java/com/facebook/react/uimanager/AppRegistry.java rename to ReactAndroid/src/main/java/com/facebook/react/modules/appregistry/AppRegistry.java index d0f4cbeef..37e07edd3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/AppRegistry.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/appregistry/AppRegistry.java @@ -7,7 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.react.uimanager; +package com.facebook.react.modules.appregistry; import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.WritableMap; diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/appregistry/BUCK b/ReactAndroid/src/main/java/com/facebook/react/modules/appregistry/BUCK new file mode 100644 index 000000000..cf421ea33 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/appregistry/BUCK @@ -0,0 +1,12 @@ +include_defs('//ReactAndroid/DEFS') + +android_library( + name = 'appregistry', + srcs = glob(['**/*.java']), + deps = [ + react_native_target('java/com/facebook/react/bridge:bridge'), + ], + visibility = [ + 'PUBLIC', + ], +) diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/BUCK b/ReactAndroid/src/main/java/com/facebook/react/modules/core/BUCK index f82eaf069..382512273 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/BUCK @@ -9,10 +9,9 @@ android_library( react_native_dep('third-party/java/jsr-305:jsr-305'), react_native_target('java/com/facebook/react/bridge:bridge'), react_native_target('java/com/facebook/react/common:common'), - react_native_target('java/com/facebook/react/devsupport:devsupport'), + react_native_target('java/com/facebook/react/devsupport:interfaces'), react_native_target('java/com/facebook/react/jstasks:jstasks'), react_native_target('java/com/facebook/react/module/annotations:annotations'), - react_native_target('java/com/facebook/react/uimanager:uimanager'), ], visibility = [ 'PUBLIC', diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java index b1a82a482..b92d22ad7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java @@ -18,7 +18,7 @@ import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.ReadableType; -import com.facebook.react.devsupport.DevSupportManager; +import com.facebook.react.devsupport.interfaces.DevSupportManager; import com.facebook.react.common.JavascriptException; import com.facebook.react.common.ReactConstants; import com.facebook.react.module.annotations.ReactModule; diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactChoreographer.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactChoreographer.java similarity index 99% rename from ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactChoreographer.java rename to ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactChoreographer.java index cbd6408cb..c3d94e837 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactChoreographer.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactChoreographer.java @@ -7,7 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.react.uimanager; +package com.facebook.react.modules.core; import java.util.ArrayDeque; diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java index 9ac738dc2..dca177c3a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java @@ -35,11 +35,10 @@ import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.bridge.WritableArray; import com.facebook.react.common.SystemClock; -import com.facebook.react.devsupport.DevSupportManager; +import com.facebook.react.devsupport.interfaces.DevSupportManager; import com.facebook.react.jstasks.HeadlessJsTaskEventListener; import com.facebook.react.jstasks.HeadlessJsTaskContext; import com.facebook.react.module.annotations.ReactModule; -import com.facebook.react.uimanager.ReactChoreographer; /** * Native module for JS timer execution. Timers fire on frame boundaries. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java index bfccb4804..fffc74efd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java @@ -24,6 +24,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import com.facebook.react.common.ReactConstants; import com.facebook.react.module.annotations.ReactModule; +import com.facebook.react.modules.debug.interfaces.DeveloperSettings; /** * Module that records debug information during transitions (animated navigation events such as diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/BUCK b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/BUCK index 45a469234..c709e8620 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/BUCK @@ -2,7 +2,7 @@ include_defs('//ReactAndroid/DEFS') android_library( name = 'debug', - srcs = glob(['**/*.java']), + srcs = glob(['*.java']), deps = [ react_native_dep('libraries/fbcore/src/main/java/com/facebook/common/logging:logging'), react_native_dep('third-party/java/infer-annotations:infer-annotations'), @@ -10,6 +10,7 @@ android_library( react_native_target('java/com/facebook/react/bridge:bridge'), react_native_target('java/com/facebook/react/common:common'), react_native_target('java/com/facebook/react/module/annotations:annotations'), + react_native_target('java/com/facebook/react/modules/debug:interfaces'), react_native_target('java/com/facebook/react/uimanager:uimanager'), ], visibility = [ @@ -17,3 +18,12 @@ android_library( ], ) +android_library( + name = 'interfaces', + srcs = glob(['interfaces/*.java']), + deps = [ + ], + visibility = [ + 'PUBLIC', + ], +) diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DeveloperSettings.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/interfaces/DeveloperSettings.java similarity index 95% rename from ReactAndroid/src/main/java/com/facebook/react/modules/debug/DeveloperSettings.java rename to ReactAndroid/src/main/java/com/facebook/react/modules/debug/interfaces/DeveloperSettings.java index afb72dd87..73cec8d26 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DeveloperSettings.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/interfaces/DeveloperSettings.java @@ -7,7 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package com.facebook.react.modules.debug; +package com.facebook.react.modules.debug.interfaces; /** * Provides access to React Native developers settings. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BUCK b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BUCK index 4680553b2..0ac3aa98a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BUCK @@ -19,6 +19,7 @@ android_library( react_native_target('java/com/facebook/react/bridge:bridge'), react_native_target('java/com/facebook/react/common:common'), react_native_target('java/com/facebook/react/module/annotations:annotations'), + react_native_target('java/com/facebook/react/modules/core:core'), react_native_target('java/com/facebook/react/modules/i18nmanager:i18nmanager'), react_native_target('java/com/facebook/react/touch:touch'), react_native_target('java/com/facebook/react/uimanager/annotations:annotations'), diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java index c7cd96255..92780b042 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java @@ -29,6 +29,7 @@ import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.common.ReactConstants; +import com.facebook.react.modules.core.ReactChoreographer; import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener; import com.facebook.systrace.Systrace; import com.facebook.systrace.SystraceMessage; diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java index 619ed445a..756786f91 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java @@ -24,7 +24,7 @@ import com.facebook.react.bridge.LifecycleEventListener; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.common.MapBuilder; -import com.facebook.react.uimanager.ReactChoreographer; +import com.facebook.react.modules.core.ReactChoreographer; import com.facebook.systrace.Systrace; /** diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/BUCK b/ReactAndroid/src/test/java/com/facebook/react/modules/BUCK index 4f2644b3a..34af119e4 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/BUCK +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/BUCK @@ -20,7 +20,7 @@ rn_robolectric_test( react_native_target('java/com/facebook/react/bridge:bridge'), react_native_target('java/com/facebook/react/common:common'), react_native_target('java/com/facebook/react/common/network:network'), - react_native_target('java/com/facebook/react/devsupport:devsupport'), + react_native_target('java/com/facebook/react/devsupport:interfaces'), react_native_target('java/com/facebook/react/jstasks:jstasks'), react_native_target('java/com/facebook/react/modules/clipboard:clipboard'), react_native_target('java/com/facebook/react/modules/common:common'), diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.java index 7bc9b1d12..b7686b3f0 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.java @@ -16,10 +16,10 @@ import com.facebook.react.bridge.ExecutorToken; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.CatalystInstance; import com.facebook.react.bridge.JavaOnlyArray; -import com.facebook.react.devsupport.DevSupportManager; -import com.facebook.react.uimanager.ReactChoreographer; +import com.facebook.react.devsupport.interfaces.DevSupportManager; import com.facebook.react.common.SystemClock; import com.facebook.react.modules.core.JSTimersExecution; +import com.facebook.react.modules.core.ReactChoreographer; import com.facebook.react.modules.core.Timing; import org.junit.Before;