From 4dfa3be87191afeb82b695e7f9e94c7129c51ff3 Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Mon, 19 Oct 2020 09:31:22 -0700 Subject: [PATCH 1/2] Codegen Android: handle nullable getConstants() properties generation. Summary: The GenerateModuleJavaSpec.js mistakenly treated nullable getConstants() properties as required, such that the Java spec will throw an exception when the properties are missing. This fixed it. Note that the JavaPoet-based generator got this correct already. Changelog: [Internal] Differential Revision: D24381941 fbshipit-source-id: c95d2181c66443e2191318f09b6454a5296009e4 --- .../src/generators/modules/GenerateModuleJavaSpec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js index 8a35a0b506184e..2b263a046428a0 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js @@ -203,8 +203,7 @@ function buildGetConstantsMethod( const rawProperties = methodTypeAnnotation.returnTypeAnnotation.properties || []; rawProperties.forEach(p => { - // TODO(T76712813): Should we push to optionalProps if the constant is nullable? - if (p.optional) { + if (p.optional || p.typeAnnotation.type === 'NullableTypeAnnotation') { optionalProps.push(p.name); } else { requiredProps.push(p.name); From 2a3c26e97539569f7c6e783c7262c50fdafad8e2 Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Mon, 19 Oct 2020 09:31:22 -0700 Subject: [PATCH 2/2] Android: add libglog prebuilt .so definition Summary: So that it's easier for C++ targets to depend on libglog.so for debugging purpose. Changelog: [Internal] Differential Revision: D24382033 fbshipit-source-id: 00ad6b2365d571583d6d1aaa40fac2c96974abf1 --- ReactAndroid/Android-prebuilt.mk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/Android-prebuilt.mk b/ReactAndroid/Android-prebuilt.mk index 394032a524ab95..3fd9edb409164b 100644 --- a/ReactAndroid/Android-prebuilt.mk +++ b/ReactAndroid/Android-prebuilt.mk @@ -40,8 +40,7 @@ LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libfolly_json.so LOCAL_EXPORT_C_INCLUDES := \ $(THIRD_PARTY_NDK_DIR)/boost/boost_1_63_0 \ $(THIRD_PARTY_NDK_DIR)/double-conversion \ - $(THIRD_PARTY_NDK_DIR)/folly \ - $(THIRD_PARTY_NDK_DIR)/glog/exported + $(THIRD_PARTY_NDK_DIR)/folly # Note: Sync with folly/Android.mk. FOLLY_FLAGS := \ -DFOLLY_NO_CONFIG=1 \ @@ -61,6 +60,14 @@ LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libfolly_futures.s LOCAL_SHARED_LIBRARIES := liblibfolly_json include $(PREBUILT_SHARED_LIBRARY) +# glog +include $(CLEAR_VARS) +LOCAL_MODULE := glog +LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libglog.so +LOCAL_EXPORT_C_INCLUDES := $(THIRD_PARTY_NDK_DIR)/glog/exported +LOCAL_SHARED_LIBRARIES := libglog +include $(PREBUILT_SHARED_LIBRARY) + # react_nativemodule_core include $(CLEAR_VARS) LOCAL_MODULE := react_nativemodule_core