From 4d9e5f8481531000380cf4d3d485fcde1321a37b Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Tue, 3 Dec 2019 06:27:58 -0800 Subject: [PATCH] Delete com.facebook.react.modules.debug.NativeSourceCodeSpec Summary: When SourceCode was converted to a TurboModule in D17586276, we had to check in `NativeSourceCodeSpec` into the codebase. Since all the OSS NativeModule base classes are now checked into `react-native-github`, it's no longer necessary to keep `NativeSourceCodeSpec`. So, I'm deleting it. Changelog: [Android][Removed] - Delete com.facebook.react.modules.debug.NativeSourceCodeSpec Reviewed By: PeteTheHeat, mdvacca Differential Revision: D18732997 fbshipit-source-id: 6026b4bcb9ebb9c4d7ba556bc644698eb550a9de --- .../com/facebook/react/modules/debug/BUCK | 3 ++ .../modules/debug/NativeSourceCodeSpec.java | 51 ------------------- .../react/modules/debug/SourceCodeModule.java | 1 + 3 files changed, 4 insertions(+), 51 deletions(-) delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/modules/debug/NativeSourceCodeSpec.java 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 5cb908d98c196c..61950b38fbe2ba 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/BUCK @@ -21,6 +21,9 @@ rn_android_library( react_native_target("java/com/facebook/react/turbomodule/core/interfaces:interfaces"), react_native_target("java/com/facebook/react/uimanager:uimanager"), ], + exported_deps = [ + react_native_target("java/com/facebook/fbreact/specs:FBReactNativeSpec"), + ], ) rn_android_library( diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/NativeSourceCodeSpec.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/NativeSourceCodeSpec.java deleted file mode 100644 index f703cc7f82d1a2..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/NativeSourceCodeSpec.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.modules.debug; - -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactModuleWithSpec; -import com.facebook.react.common.build.ReactBuildConfig; -import com.facebook.react.turbomodule.core.interfaces.TurboModule; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import javax.annotation.Nullable; - -public abstract class NativeSourceCodeSpec extends ReactContextBaseJavaModule - implements ReactModuleWithSpec, TurboModule { - public NativeSourceCodeSpec(ReactApplicationContext reactContext) { - super(reactContext); - } - - protected abstract Map getTypedExportedConstants(); - - @Override - public final @Nullable Map getConstants() { - Map constants = getTypedExportedConstants(); - if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) { - Set obligatoryFlowConstants = new HashSet<>(Arrays.asList("scriptURL")); - Set optionalFlowConstants = new HashSet<>(); - Set undeclaredConstants = new HashSet<>(constants.keySet()); - undeclaredConstants.removeAll(obligatoryFlowConstants); - undeclaredConstants.removeAll(optionalFlowConstants); - if (!undeclaredConstants.isEmpty()) { - throw new IllegalStateException( - String.format("Native Module Flow doesn't declare constants: %s", undeclaredConstants)); - } - undeclaredConstants = obligatoryFlowConstants; - undeclaredConstants.removeAll(constants.keySet()); - if (!undeclaredConstants.isEmpty()) { - throw new IllegalStateException( - String.format("Native Module doesn't fill in constants: %s", undeclaredConstants)); - } - } - return constants; - } -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java index 29a40f63770923..315189544d8856 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java @@ -7,6 +7,7 @@ package com.facebook.react.modules.debug; +import com.facebook.fbreact.specs.NativeSourceCodeSpec; import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.module.annotations.ReactModule;