expo-modules-core 0.9.2 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/CHANGELOG.md +33 -3
  2. package/README.md +3 -3
  3. package/android/CMakeLists.txt +163 -0
  4. package/android/build.gradle +343 -5
  5. package/android/src/main/cpp/CachedReferencesRegistry.cpp +65 -0
  6. package/android/src/main/cpp/CachedReferencesRegistry.h +80 -0
  7. package/android/src/main/cpp/Exceptions.cpp +22 -0
  8. package/android/src/main/cpp/Exceptions.h +38 -0
  9. package/android/src/main/cpp/ExpoModulesHostObject.cpp +47 -0
  10. package/android/src/main/cpp/ExpoModulesHostObject.h +32 -0
  11. package/android/src/main/cpp/JNIFunctionBody.cpp +44 -0
  12. package/android/src/main/cpp/JNIFunctionBody.h +50 -0
  13. package/android/src/main/cpp/JNIInjector.cpp +23 -0
  14. package/android/src/main/cpp/JSIInteropModuleRegistry.cpp +122 -0
  15. package/android/src/main/cpp/JSIInteropModuleRegistry.h +96 -0
  16. package/android/src/main/cpp/JSIObjectWrapper.h +33 -0
  17. package/android/src/main/cpp/JSITypeConverter.h +84 -0
  18. package/android/src/main/cpp/JavaScriptModuleObject.cpp +219 -0
  19. package/android/src/main/cpp/JavaScriptModuleObject.h +144 -0
  20. package/android/src/main/cpp/JavaScriptObject.cpp +125 -0
  21. package/android/src/main/cpp/JavaScriptObject.h +131 -0
  22. package/android/src/main/cpp/JavaScriptRuntime.cpp +127 -0
  23. package/android/src/main/cpp/JavaScriptRuntime.h +87 -0
  24. package/android/src/main/cpp/JavaScriptValue.cpp +172 -0
  25. package/android/src/main/cpp/JavaScriptValue.h +78 -0
  26. package/android/src/main/cpp/MethodMetadata.cpp +340 -0
  27. package/android/src/main/cpp/MethodMetadata.h +131 -0
  28. package/android/src/main/java/expo/modules/adapters/react/NativeModulesProxy.java +2 -0
  29. package/android/src/main/java/expo/modules/core/errors/ContextDestroyedException.kt +7 -0
  30. package/android/src/main/java/expo/modules/interfaces/permissions/Permissions.java +30 -0
  31. package/android/src/main/java/expo/modules/kotlin/AppContext.kt +98 -3
  32. package/android/src/main/java/expo/modules/kotlin/ConcatIterator.kt +18 -0
  33. package/android/src/main/java/expo/modules/kotlin/KotlinInteropModuleRegistry.kt +15 -12
  34. package/android/src/main/java/expo/modules/kotlin/ModuleHolder.kt +45 -3
  35. package/android/src/main/java/expo/modules/kotlin/activityaware/AppCompatActivityAware.kt +49 -0
  36. package/android/src/main/java/expo/modules/kotlin/activityaware/AppCompatActivityAwareHelper.kt +43 -0
  37. package/android/src/main/java/expo/modules/kotlin/activityaware/OnActivityAvailableListener.kt +18 -0
  38. package/android/src/main/java/expo/modules/kotlin/activityresult/ActivityResultsManager.kt +99 -0
  39. package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultCaller.kt +25 -0
  40. package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultContract.kt +27 -0
  41. package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultFallbackCallback.kt +17 -0
  42. package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultLauncher.kt +30 -0
  43. package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultRegistry.kt +358 -0
  44. package/android/src/main/java/expo/modules/kotlin/activityresult/DataPersistor.kt +135 -0
  45. package/android/src/main/java/expo/modules/kotlin/defaultmodules/ErrorManagerModule.kt +2 -2
  46. package/android/src/main/java/expo/modules/kotlin/exception/CodedException.kt +13 -0
  47. package/android/src/main/java/expo/modules/kotlin/exception/ExceptionDecorator.kt +2 -0
  48. package/android/src/main/java/expo/modules/kotlin/functions/AnyFunction.kt +53 -15
  49. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunction.kt +35 -7
  50. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionBuilder.kt +13 -121
  51. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionComponent.kt +21 -0
  52. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionWithPromiseComponent.kt +21 -0
  53. package/android/src/main/java/expo/modules/kotlin/functions/SuspendFunctionComponent.kt +63 -0
  54. package/android/src/main/java/expo/modules/kotlin/functions/SyncFunctionComponent.kt +36 -0
  55. package/android/src/main/java/expo/modules/kotlin/jni/CppType.kt +19 -0
  56. package/android/src/main/java/expo/modules/kotlin/jni/JNIFunctionBody.kt +39 -0
  57. package/android/src/main/java/expo/modules/kotlin/jni/JSIInteropModuleRegistry.kt +89 -0
  58. package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptModuleObject.kt +46 -0
  59. package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptObject.kt +113 -0
  60. package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptValue.kt +35 -0
  61. package/android/src/main/java/expo/modules/kotlin/modules/Module.kt +16 -6
  62. package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionBuilder.kt +5 -500
  63. package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionData.kt +30 -5
  64. package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +271 -0
  65. package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionData.kt +21 -0
  66. package/android/src/main/java/expo/modules/kotlin/objects/PropertyComponent.kt +54 -0
  67. package/android/src/main/java/expo/modules/kotlin/objects/PropertyComponentBuilder.kt +32 -0
  68. package/android/src/main/java/expo/modules/kotlin/providers/AppContextProvider.kt +14 -0
  69. package/android/src/main/java/expo/modules/kotlin/providers/CurrentActivityProvider.kt +22 -0
  70. package/android/src/main/java/expo/modules/kotlin/records/RecordTypeConverter.kt +19 -2
  71. package/android/src/main/java/expo/modules/kotlin/types/AnyType.kt +3 -2
  72. package/android/src/main/java/expo/modules/kotlin/types/AnyTypeConverter.kt +36 -0
  73. package/android/src/main/java/expo/modules/kotlin/types/ArrayTypeConverter.kt +7 -2
  74. package/android/src/main/java/expo/modules/kotlin/types/BasicTypeConverters.kt +68 -20
  75. package/android/src/main/java/expo/modules/kotlin/types/EnumTypeConverter.kt +50 -22
  76. package/android/src/main/java/expo/modules/kotlin/types/ListTypeConverter.kt +18 -2
  77. package/android/src/main/java/expo/modules/kotlin/types/MapTypeConverter.kt +18 -2
  78. package/android/src/main/java/expo/modules/kotlin/types/PairTypeConverter.kt +17 -2
  79. package/android/src/main/java/expo/modules/kotlin/types/TypeConverter.kt +43 -3
  80. package/android/src/main/java/expo/modules/kotlin/types/TypeConverterProvider.kt +12 -0
  81. package/android/src/main/java/expo/modules/kotlin/views/ViewGroupDefinitionBuilder.kt +0 -41
  82. package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinitionBuilder.kt +0 -33
  83. package/build/NativeModulesProxy.native.d.ts.map +1 -1
  84. package/build/NativeModulesProxy.native.js +9 -3
  85. package/build/NativeModulesProxy.native.js.map +1 -1
  86. package/build/PermissionsInterface.d.ts +29 -0
  87. package/build/PermissionsInterface.d.ts.map +1 -1
  88. package/build/PermissionsInterface.js +9 -0
  89. package/build/PermissionsInterface.js.map +1 -1
  90. package/ios/AppDelegates/EXAppDelegatesLoader.m +1 -2
  91. package/ios/ExpoModulesCore.podspec +3 -2
  92. package/ios/JSI/EXJSIConversions.mm +6 -0
  93. package/ios/JSI/EXJSIInstaller.h +15 -21
  94. package/ios/JSI/EXJSIInstaller.mm +39 -3
  95. package/ios/JSI/EXJSIUtils.h +48 -3
  96. package/ios/JSI/EXJSIUtils.mm +88 -4
  97. package/ios/JSI/EXJavaScriptObject.h +11 -18
  98. package/ios/JSI/EXJavaScriptObject.mm +37 -18
  99. package/ios/JSI/EXJavaScriptRuntime.h +43 -9
  100. package/ios/JSI/EXJavaScriptRuntime.mm +70 -27
  101. package/ios/JSI/EXJavaScriptTypedArray.h +30 -0
  102. package/ios/JSI/EXJavaScriptTypedArray.mm +29 -0
  103. package/ios/JSI/EXJavaScriptValue.h +3 -2
  104. package/ios/JSI/EXJavaScriptValue.mm +17 -20
  105. package/ios/JSI/EXJavaScriptWeakObject.h +23 -0
  106. package/ios/JSI/EXJavaScriptWeakObject.mm +53 -0
  107. package/ios/JSI/EXObjectDeallocator.h +27 -0
  108. package/ios/JSI/ExpoModulesHostObject.h +3 -3
  109. package/ios/JSI/ExpoModulesHostObject.mm +4 -4
  110. package/ios/JSI/JavaScriptRuntime.swift +38 -1
  111. package/ios/JSI/JavaScriptValue.swift +7 -0
  112. package/ios/JSI/TypedArray.cpp +67 -0
  113. package/ios/JSI/TypedArray.h +46 -0
  114. package/ios/ModuleRegistryAdapter/EXModuleRegistryAdapter.m +0 -11
  115. package/ios/NativeModulesProxy/EXNativeModulesProxy.h +17 -10
  116. package/ios/NativeModulesProxy/EXNativeModulesProxy.mm +86 -77
  117. package/ios/NativeModulesProxy/NativeModulesProxyModule.swift +17 -0
  118. package/ios/Services/EXReactNativeEventEmitter.h +2 -2
  119. package/ios/Services/EXReactNativeEventEmitter.m +11 -6
  120. package/ios/Swift/AppContext.swift +206 -28
  121. package/ios/Swift/Arguments/AnyArgument.swift +18 -0
  122. package/ios/Swift/Arguments/{Types/EnumArgumentType.swift → EnumArgument.swift} +2 -17
  123. package/ios/Swift/Classes/ClassComponent.swift +95 -0
  124. package/ios/Swift/Classes/ClassComponentElement.swift +33 -0
  125. package/ios/Swift/Classes/ClassComponentElementsBuilder.swift +34 -0
  126. package/ios/Swift/Classes/ClassComponentFactories.swift +96 -0
  127. package/ios/Swift/DynamicTypes/AnyDynamicType.swift +44 -0
  128. package/ios/Swift/DynamicTypes/DynamicArrayType.swift +56 -0
  129. package/ios/Swift/DynamicTypes/DynamicConvertibleType.swift +27 -0
  130. package/ios/Swift/DynamicTypes/DynamicEnumType.swift +27 -0
  131. package/ios/Swift/DynamicTypes/DynamicOptionalType.swift +63 -0
  132. package/ios/Swift/DynamicTypes/DynamicRawType.swift +33 -0
  133. package/ios/Swift/DynamicTypes/DynamicSharedObjectType.swift +37 -0
  134. package/ios/Swift/DynamicTypes/DynamicType.swift +39 -0
  135. package/ios/Swift/DynamicTypes/DynamicTypedArrayType.swift +46 -0
  136. package/ios/Swift/Exceptions/ChainableException.swift +3 -3
  137. package/ios/Swift/Exceptions/CodedError.swift +1 -1
  138. package/ios/Swift/Exceptions/Exception.swift +8 -6
  139. package/ios/Swift/Exceptions/UnexpectedException.swift +2 -1
  140. package/ios/Swift/ExpoBridgeModule.m +5 -0
  141. package/ios/Swift/ExpoBridgeModule.swift +79 -0
  142. package/ios/Swift/Functions/AnyFunction.swift +33 -31
  143. package/ios/Swift/Functions/AsyncFunctionComponent.swift +196 -59
  144. package/ios/Swift/Functions/SyncFunctionComponent.swift +142 -58
  145. package/ios/Swift/JavaScriptUtils.swift +32 -57
  146. package/ios/Swift/Logging/LogHandlers.swift +39 -0
  147. package/ios/Swift/Logging/LogType.swift +62 -0
  148. package/ios/Swift/Logging/Logger.swift +201 -0
  149. package/ios/Swift/ModuleHolder.swift +19 -54
  150. package/ios/Swift/ModuleRegistry.swift +7 -1
  151. package/ios/Swift/Modules/AnyModule.swift +3 -3
  152. package/ios/Swift/ModulesProvider.swift +2 -0
  153. package/ios/Swift/Objects/JavaScriptObjectBuilder.swift +37 -0
  154. package/ios/Swift/Objects/ObjectDefinition.swift +74 -1
  155. package/ios/Swift/Objects/ObjectDefinitionComponents.swift +77 -68
  156. package/ios/Swift/Objects/PropertyComponent.swift +147 -0
  157. package/ios/Swift/Promise.swift +17 -4
  158. package/ios/Swift/Records/Field.swift +2 -2
  159. package/ios/Swift/SharedObjects/SharedObject.swift +20 -0
  160. package/ios/Swift/SharedObjects/SharedObjectRegistry.swift +129 -0
  161. package/ios/Swift/TypedArrays/AnyTypedArray.swift +11 -0
  162. package/ios/Swift/TypedArrays/ConcreteTypedArrays.swift +56 -0
  163. package/ios/Swift/TypedArrays/GenericTypedArray.swift +49 -0
  164. package/ios/Swift/TypedArrays/TypedArray.swift +80 -0
  165. package/ios/Swift/Utilities.swift +28 -0
  166. package/ios/Swift/Views/ConcreteViewProp.swift +3 -3
  167. package/ios/Swift/Views/ViewManagerDefinitionComponents.swift +2 -2
  168. package/ios/Tests/ClassComponentSpec.swift +210 -0
  169. package/ios/Tests/DynamicTypeSpec.swift +336 -0
  170. package/ios/Tests/EnumArgumentSpec.swift +48 -0
  171. package/ios/Tests/ExpoModulesSpec.swift +17 -3
  172. package/ios/Tests/FunctionSpec.swift +167 -118
  173. package/ios/Tests/Mocks/ModuleMocks.swift +1 -1
  174. package/ios/Tests/PropertyComponentSpec.swift +95 -0
  175. package/ios/Tests/SharedObjectRegistrySpec.swift +109 -0
  176. package/ios/Tests/TypedArraysSpec.swift +136 -0
  177. package/package.json +2 -2
  178. package/src/NativeModulesProxy.native.ts +13 -3
  179. package/src/PermissionsInterface.ts +29 -0
  180. package/src/ts-declarations/ExpoModules.d.ts +7 -0
  181. package/tsconfig.json +1 -1
  182. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionWithPromise.kt +0 -15
  183. package/android/src/main/java/expo/modules/kotlin/functions/AsyncSuspendFunction.kt +0 -36
  184. package/ios/Swift/Arguments/AnyArgumentType.swift +0 -13
  185. package/ios/Swift/Arguments/ArgumentType.swift +0 -28
  186. package/ios/Swift/Arguments/Types/ArrayArgumentType.swift +0 -42
  187. package/ios/Swift/Arguments/Types/ConvertibleArgumentType.swift +0 -16
  188. package/ios/Swift/Arguments/Types/OptionalArgumentType.swift +0 -49
  189. package/ios/Swift/Arguments/Types/PromiseArgumentType.swift +0 -15
  190. package/ios/Swift/Arguments/Types/RawArgumentType.swift +0 -25
  191. package/ios/Swift/Functions/ConcreteFunction.swift +0 -103
  192. package/ios/Swift/SwiftInteropBridge.swift +0 -155
  193. package/ios/Tests/ArgumentTypeSpec.swift +0 -143
package/CHANGELOG.md CHANGED
@@ -10,17 +10,47 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 0.9.2 — 2022-05-09
13
+ ## 0.11.1 — 2022-07-11
14
14
 
15
15
  ### 🐛 Bug fixes
16
16
 
17
- - Fix view props weren't recognized in the bare workflow on iOS. ([#17411](https://github.com/expo/expo/pull/17411) by [@lukmccall](https://github.com/lukmccall))
17
+ - Fixed a crash when remote debugging is enabled on Android. ([#18165](https://github.com/expo/expo/pull/18165) by [@kudo](https://github.com/kudo))
18
+
19
+ ## 0.11.0 — 2022-07-07
20
+
21
+ ### 🎉 New features
18
22
 
19
- ## 0.9.1 2022-05-05
23
+ - Create `AppContext.registerForActivityResult` mechanism similar to [`ComponentActivity.registerForActivityResult`](https://developer.android.com/training/basics/intents/result)). ([#17572](https://github.com/expo/expo/pull/17572), ([#17987](https://github.com/expo/expo/pull/17987) by [@bbarthec](https://github.com/bbarthec))
24
+
25
+ ### 🐛 Bug fixes
26
+
27
+ - Added support for React Native 0.69.x ([#18006](https://github.com/expo/expo/pull/18006) by [@kudo](https://github.com/kudo))
28
+
29
+ ## 0.10.0 — 2022-06-23
30
+
31
+ ### 🎉 New features
32
+
33
+ - Add proxy methods for `Permissions` module accepting `expo.modules.kotlin.Promise` on Android. ([#17668](https://github.com/expo/expo/pull/17668) by [@bbarthec](https://github.com/bbarthec))
34
+ - Create `CurrentActivityProvider` on Android. ([#17571](https://github.com/expo/expo/pull/17571) by [@bbarthec](https://github.com/bbarthec))
35
+ - Create `AppContextProvider` on Android. ([#17546](https://github.com/expo/expo/pull/17546) by [@bbarthec](https://github.com/bbarthec))
36
+ - Introduce dynamic properties in the Sweet API on iOS. ([#17318](https://github.com/expo/expo/pull/17318) by [@tsapeta](https://github.com/tsapeta))
37
+ - Implemented classes in the Sweet API on iOS. ([#17514](https://github.com/expo/expo/pull/17514), [#17525](https://github.com/expo/expo/pull/17525) by [@tsapeta](https://github.com/tsapeta))
38
+ - Add basic support for sync functions in the Sweet API on Android. ([#16977](https://github.com/expo/expo/pull/16977) by [@lukmccall](https://github.com/lukmccall))
39
+ - Better error handling in the synchronous functions on iOS. ([#17628](https://github.com/expo/expo/pull/17628) by [@tsapeta](https://github.com/tsapeta))
40
+ - Experimental support for typed arrays on iOS. ([#17667](https://github.com/expo/expo/pull/17667) by [@tsapeta](https://github.com/tsapeta))
20
41
 
21
42
  ### 🐛 Bug fixes
22
43
 
23
44
  - Fix modules have not been deallocated during the application reload on iOS. ([#17285](https://github.com/expo/expo/pull/17285) by [@lukmccall](https://github.com/lukmccall))
45
+ - Fix view props weren't recognized in the bare workflow on iOS. ([#17411](https://github.com/expo/expo/pull/17411) by [@lukmccall](https://github.com/lukmccall))
46
+ - Fix support for optional function arguments on iOS. ([#17950](https://github.com/expo/expo/pull/17950) by [@barthap](https://github.com/barthap))
47
+ - Added support for React Native 0.69.x ([#17629](https://github.com/expo/expo/pull/17629) by [@kudo](https://github.com/kudo))
48
+
49
+ ### 💡 Others
50
+
51
+ - Migrated Expo modules definitions to the new naming convention. ([#17193](https://github.com/expo/expo/pull/17193) by [@tsapeta](https://github.com/tsapeta))
52
+ - Refactored Expo modules registration and the `AppContext` on iOS. ([#17225](https://github.com/expo/expo/pull/17225) by [@tsapeta](https://github.com/tsapeta))
53
+ - Split the implementation of async and sync functions on iOS. ([#17188](https://github.com/expo/expo/pull/17188) by [@tsapeta](https://github.com/tsapeta))
24
54
 
25
55
  ## 0.9.0 — 2022-04-21
26
56
 
package/README.md CHANGED
@@ -36,7 +36,7 @@ Many React Native libraries come with platform-specific (native) code. This nati
36
36
  # Podfile
37
37
 
38
38
  require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
39
- require File.join(File.dirname(`node --print "require.resolve('react-native-unimodules/package.json')"`), "cocoapods.rb")
39
+ require File.join(File.dirname(`node --print "require.resolve('expo-modules-core/package.json')"`), "cocoapods.rb")
40
40
  require File.join(File.dirname(`node --print "require.resolve('expo-modules-core/package.json')"`), "scripts/autolinking")
41
41
 
42
42
  # ...
@@ -55,7 +55,7 @@ end
55
55
  ```groovy
56
56
  // app/build.gradle
57
57
 
58
- apply from: new File(["node", "--print", "require.resolve('react-native-unimodules/package.json')"].execute(null, rootDir).text.trim(), "../gradle.groovy")
58
+ apply from: new File(["node", "--print", "require.resolve('expo-modules-core/package.json')"].execute(null, rootDir).text.trim(), "../gradle.groovy")
59
59
  apply from: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../react.gradle")
60
60
  apply from: new File(["node", "--print", "require.resolve('expo-updates/package.json')"].execute(null, rootDir).text.trim(), "../scripts/create-manifest-android.gradle")
61
61
 
@@ -68,7 +68,7 @@ applyNativeModulesAppBuildGradle(project)
68
68
  ```groovy
69
69
  // settings.gradle
70
70
 
71
- apply from: new File(["node", "--print", "require.resolve('react-native-unimodules/package.json')"].execute(null, rootDir).text.trim(), "../gradle.groovy");
71
+ apply from: new File(["node", "--print", "require.resolve('expo-modules-core/package.json')"].execute(null, rootDir).text.trim(), "../gradle.groovy");
72
72
  includeUnimodulesProjects()
73
73
 
74
74
  apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
@@ -0,0 +1,163 @@
1
+ cmake_minimum_required(VERSION 3.4.1)
2
+
3
+ set(CMAKE_VERBOSE_MAKEFILE ON)
4
+ set(CMAKE_ANDROID_STL_TYPE c++_shared)
5
+ set(CMAKE_CXX_STANDARD 17)
6
+ set(PACKAGE_NAME "expo-modules-core")
7
+ set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
8
+
9
+ if (${NATIVE_DEBUG})
10
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
11
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
12
+ endif ()
13
+
14
+ set(SRC_DIR ${CMAKE_SOURCE_DIR}/src)
15
+ file(GLOB sources_android "${SRC_DIR}/main/cpp/*.cpp")
16
+
17
+ # shared
18
+
19
+ add_library(
20
+ ${PACKAGE_NAME}
21
+ SHARED
22
+ ${sources_android}
23
+ )
24
+
25
+ # Extracted AAR: ${BUILD_DIR}/react-native-0*/jni/${ANDROID_ABI}
26
+ file(GLOB LIBRN_DIR "${REACT_NATIVE_SO_DIR}/${ANDROID_ABI}")
27
+ if (NOT LIBRN_DIR)
28
+ # If /${ANDROID_ABI} dir not found, then ${REACT_NATIVE_SO_DIR} is probably:
29
+ # ReactAndroid/build/react-ndk/exported
30
+ file(GLOB LIBRN_DIR "${REACT_NATIVE_SO_DIR}")
31
+ endif ()
32
+
33
+ file(GLOB libfbjni_include_DIRS "${BUILD_DIR}/fbjni-*-headers.jar/")
34
+ file(GLOB HERMES_SO_DIR "${BUILD_DIR}/third-party-ndk/hermes/jni/${ANDROID_ABI}")
35
+
36
+ # includes
37
+
38
+ target_include_directories(
39
+ ${PACKAGE_NAME}
40
+ PRIVATE
41
+ "${REACT_NATIVE_DIR}/React"
42
+ "${REACT_NATIVE_DIR}/React/Base"
43
+ "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni"
44
+ "${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react"
45
+ "${REACT_NATIVE_DIR}/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni"
46
+ "${REACT_NATIVE_DIR}/ReactCommon"
47
+ "${REACT_NATIVE_DIR}/ReactCommon/react/nativemodule/core"
48
+ "${REACT_NATIVE_DIR}/ReactCommon/callinvoker"
49
+ "${REACT_NATIVE_DIR}/ReactCommon/jsi"
50
+ "${HERMES_DIR}/android/include"
51
+ "${BUILD_DIR}/third-party-ndk/boost/boost_${BOOST_VERSION}"
52
+ "${BUILD_DIR}/third-party-ndk/double-conversion"
53
+ "${BUILD_DIR}/third-party-ndk/folly"
54
+ ${libfbjni_include_DIRS}
55
+ )
56
+
57
+ # find libraries
58
+
59
+ find_library(LOG_LIB log)
60
+
61
+ if(${REACT_NATIVE_TARGET_VERSION} LESS 69)
62
+ find_library(
63
+ FOLLY_LIB
64
+ folly_json
65
+ PATHS ${LIBRN_DIR}
66
+ NO_CMAKE_FIND_ROOT_PATH
67
+ )
68
+ else()
69
+ find_library(
70
+ FOLLY_LIB
71
+ folly_runtime
72
+ PATHS ${LIBRN_DIR}
73
+ NO_CMAKE_FIND_ROOT_PATH
74
+ )
75
+ endif()
76
+
77
+ find_library(
78
+ FBJNI_LIB
79
+ fbjni
80
+ PATHS ${LIBRN_DIR}
81
+ NO_CMAKE_FIND_ROOT_PATH
82
+ )
83
+
84
+ find_library(
85
+ JSI_LIB
86
+ jsi
87
+ PATHS ${LIBRN_DIR}
88
+ NO_CMAKE_FIND_ROOT_PATH
89
+ )
90
+
91
+ find_library(
92
+ REACT_NATIVE_JNI_LIB
93
+ reactnativejni
94
+ PATHS ${LIBRN_DIR}
95
+ NO_CMAKE_FIND_ROOT_PATH
96
+ )
97
+
98
+ find_library(
99
+ REACT_NATIVE_MODULES_CORE
100
+ react_nativemodule_core
101
+ PATHS ${LIBRN_DIR}
102
+ NO_CMAKE_FIND_ROOT_PATH
103
+ )
104
+
105
+ find_library(
106
+ HERMES_LIB
107
+ hermes
108
+ PATHS ${HERMES_SO_DIR}
109
+ NO_CMAKE_FIND_ROOT_PATH
110
+ )
111
+
112
+ find_library(
113
+ JSEXECUTOR_LIB
114
+ jscexecutor
115
+ PATHS ${LIBRN_DIR}
116
+ NO_CMAKE_FIND_ROOT_PATH
117
+ )
118
+
119
+ #reactnativejni
120
+
121
+ # linking
122
+
123
+ target_compile_options(
124
+ ${PACKAGE_NAME}
125
+ PRIVATE -DFOLLY_NO_CONFIG=1
126
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
127
+ -DFOLLY_HAVE_MEMRCHR=1
128
+ -DFOLLY_USE_LIBCPP=1
129
+ -DFOLLY_MOBILE=1
130
+ -DFOR_HERMES=${FOR_HERMES}
131
+ -O2
132
+ -frtti
133
+ -fexceptions
134
+ -Wall
135
+ -fstack-protector-all
136
+ )
137
+
138
+ if (${FOR_HERMES})
139
+ target_link_libraries(
140
+ ${PACKAGE_NAME}
141
+ ${LOG_LIB}
142
+ ${FBJNI_LIB}
143
+ ${JSI_LIB}
144
+ ${HERMES_LIB}
145
+ ${REACT_NATIVE_JNI_LIB}
146
+ ${FOLLY_LIB}
147
+ ${REACT_NATIVE_MODULES_CORE}
148
+ android
149
+ )
150
+ else ()
151
+ target_link_libraries(
152
+ ${PACKAGE_NAME}
153
+ ${LOG_LIB}
154
+ ${FBJNI_LIB}
155
+ ${JSI_LIB}
156
+ ${JSEXECUTOR_LIB}
157
+ ${REACT_NATIVE_JNI_LIB}
158
+ ${FOLLY_LIB}
159
+ ${REACT_NATIVE_MODULES_CORE}
160
+ android
161
+ )
162
+ endif ()
163
+
@@ -1,9 +1,12 @@
1
+ import java.nio.file.Paths
2
+
1
3
  apply plugin: 'com.android.library'
2
4
  apply plugin: 'kotlin-android'
3
5
  apply plugin: 'maven-publish'
6
+ apply plugin: "de.undercouch.download"
4
7
 
5
8
  group = 'host.exp.exponent'
6
- version = '0.9.2'
9
+ version = '0.11.1'
7
10
 
8
11
  buildscript {
9
12
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -32,6 +35,72 @@ buildscript {
32
35
 
33
36
  dependencies {
34
37
  classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
38
+ classpath "de.undercouch:gradle-download-task:4.1.2"
39
+ }
40
+ }
41
+
42
+ def isAndroidTest() {
43
+ Gradle gradle = getGradle()
44
+ String tskReqStr = gradle.getStartParameter().getTaskRequests().toString()
45
+ return tskReqStr.contains("AndroidTest")
46
+ }
47
+
48
+ def downloadsDir = new File("$buildDir/downloads")
49
+ def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
50
+
51
+ def REACT_NATIVE_BUILD_FROM_SOURCE = findProject(":ReactAndroid") != null
52
+ def REACT_NATIVE_DIR = REACT_NATIVE_BUILD_FROM_SOURCE
53
+ ? findProject(":ReactAndroid").getProjectDir().parent
54
+ : new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent
55
+ def REACT_NATIVE_SO_DIR = REACT_NATIVE_BUILD_FROM_SOURCE
56
+ ? Paths.get(findProject(":ReactAndroid").getProjectDir().toString(), "build", "intermediates", "library_*", "*", "jni")
57
+ : "${buildDir}/react-native-0*/jni"
58
+
59
+ def reactProperties = new Properties()
60
+ file("$REACT_NATIVE_DIR/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
61
+
62
+ def FOLLY_VERSION = reactProperties.getProperty("FOLLY_VERSION")
63
+ def BOOST_VERSION = reactProperties.getProperty("BOOST_VERSION")
64
+ def DOUBLE_CONVERSION_VERSION = reactProperties.getProperty("DOUBLE_CONVERSION_VERSION")
65
+ def REACT_NATIVE_TARGET_VERSION = reactProperties.getProperty("VERSION_NAME").split("\\.")[1].toInteger()
66
+
67
+ def reactNativeThirdParty = new File("$REACT_NATIVE_DIR/ReactAndroid/src/main/jni/third-party")
68
+
69
+ def reactNativeArchitectures() {
70
+ def value = project.getProperties().get("reactNativeArchitectures")
71
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
72
+ }
73
+
74
+ def FOR_HERMES = false
75
+ def HERMES_ENGINE_DIR = null
76
+ def HERMES_AAR = null
77
+ if (findProject(":app")) {
78
+ def appProjectExt = project(":app").ext
79
+ if (appProjectExt.has("react")) {
80
+ FOR_HERMES = project(":app").ext.react.enableHermes
81
+ } else {
82
+ FOR_HERMES = (findProperty('expo.jsEngine') ?: "jsc") == "hermes"
83
+ }
84
+ } else {
85
+ FOR_HERMES = (findProperty('expo.jsEngine') ?: "jsc") == "hermes"
86
+ }
87
+
88
+ if (FOR_HERMES) {
89
+ // The `hermes-engine` package doesn't contain the correct version of the Hermes.
90
+ // The AAR we need to import is located in the React Native package.
91
+ // However, the version from RN doesn't include header files.
92
+ // To get those, we must fall back to the `hermes-engine` package.
93
+ HERMES_ENGINE_DIR = new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim()).parent
94
+ if (REACT_NATIVE_BUILD_FROM_SOURCE) {
95
+ // TODO(@lukmccall): Use Hermes from the `ReactAndroid:hermes-engine`
96
+ HERMES_AAR = file("$HERMES_ENGINE_DIR/android/hermes-debug.aar")
97
+ } else {
98
+ def prebuiltAAR = fileTree(REACT_NATIVE_DIR).matching { include "**/hermes-engine/**/hermes-engine-*-debug.aar" }
99
+ if (prebuiltAAR.any()) {
100
+ HERMES_AAR = prebuiltAAR.singleFile
101
+ } else {
102
+ HERMES_AAR = file("$HERMES_ENGINE_DIR/android/hermes-debug.aar")
103
+ }
35
104
  }
36
105
  }
37
106
 
@@ -75,14 +144,76 @@ android {
75
144
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
76
145
  consumerProguardFiles 'proguard-rules.pro'
77
146
  versionCode 1
78
- versionName "0.9.2"
147
+ versionName "0.11.1"
148
+
149
+ testInstrumentationRunner "expo.modules.TestRunner"
150
+
151
+ externalNativeBuild {
152
+ cmake {
153
+ abiFilters (*reactNativeArchitectures())
154
+ arguments "-DREACT_NATIVE_DIR=${REACT_NATIVE_DIR}",
155
+ "-DREACT_NATIVE_SO_DIR=${REACT_NATIVE_SO_DIR}",
156
+ "-DREACT_NATIVE_TARGET_VERSION=${REACT_NATIVE_TARGET_VERSION}",
157
+ "-DBOOST_VERSION=${BOOST_VERSION}",
158
+ "-DFOR_HERMES=${FOR_HERMES}",
159
+ "-DHERMES_DIR=${HERMES_ENGINE_DIR}"
160
+ }
161
+ }
79
162
  }
163
+
164
+ externalNativeBuild {
165
+ cmake {
166
+ path "CMakeLists.txt"
167
+ }
168
+ }
169
+
170
+ buildFeatures {
171
+ prefab true
172
+ }
173
+
174
+ packagingOptions {
175
+ // Gradle will add cmake target dependencies into packaging.
176
+ // Theses files are intermediated linking files to build modules-core and should not be in final package.
177
+ def sharedLibraries = [
178
+ "**/libc++_shared.so",
179
+ "**/libreactnativejni.so",
180
+ "**/libreact_nativemodule_core.so",
181
+ "**/libglog.so",
182
+ "**/libjscexecutor.so",
183
+ "**/libfbjni.so",
184
+ "**/libfolly_json.so",
185
+ "**/libfolly_runtime.so",
186
+ "**/libhermes.so",
187
+ "**/libjsi.so",
188
+ ]
189
+
190
+ // In android (instrumental) tests, we want to package all so files to enable our JSI functionality.
191
+ // Otherwise, those files should be excluded, because will be loaded by the application.
192
+ if (isAndroidTest()) {
193
+ excludes = [
194
+ "META-INF/MANIFEST.MF",
195
+ "META-INF/com.android.tools/proguard/coroutines.pro",
196
+ "META-INF/proguard/coroutines.pro"
197
+ ]
198
+ pickFirsts = sharedLibraries
199
+ } else {
200
+ excludes = sharedLibraries
201
+ }
202
+ }
203
+
204
+ configurations {
205
+ extractHeaders
206
+ extractJNI
207
+ }
208
+
80
209
  lintOptions {
81
210
  abortOnError false
82
211
  }
83
212
 
84
213
  testOptions {
85
- unitTests.all {
214
+ unitTests.includeAndroidResources = true
215
+
216
+ unitTests.all { test ->
86
217
  testLogging {
87
218
  outputs.upToDateWhen { false }
88
219
  events "passed", "failed", "skipped", "standardError"
@@ -94,21 +225,49 @@ android {
94
225
  }
95
226
  }
96
227
 
228
+
97
229
  dependencies {
98
230
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
99
231
  implementation "org.jetbrains.kotlin:kotlin-reflect:${getKotlinVersion()}"
100
- implementation 'androidx.annotation:annotation:1.2.0'
232
+ implementation 'androidx.annotation:annotation:1.3.0'
101
233
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0"
234
+ /**
235
+ * ReactActivity (the base activity for every React Native application) is subclassing AndroidX classes.
236
+ * Unfortunately until https://github.com/facebook/react-native/pull/33072 is released React Native uses "androidx.appcompat:appcompat:1.0.2".
237
+ * Gradle is picking the highest version of the dependency so we enforce higher version here.
238
+ * see https://docs.gradle.org/current/userguide/dependency_resolution.html#sec:version-conflict
239
+ * We're enforcing the most up-to-date versions of the dependencies here that are used in subclassing chain for ReactActivity.
240
+ */
241
+ implementation "androidx.appcompat:appcompat:1.4.1"
242
+ implementation "androidx.activity:activity-ktx:1.4.0" // androidx.appcompat:appcompat:1.4.1 depends on version 1.2.3, so we enforce higher one here
243
+ implementation "androidx.fragment:fragment-ktx:1.4.1" // androidx.appcomapt:appcompat:1.4.1 depends on version 1.3.4, so we enforce higher one here
102
244
 
103
245
  //noinspection GradleDynamicVersion
104
246
  implementation 'com.facebook.react:react-native:+'
105
247
 
248
+ compileOnly 'com.facebook.fbjni:fbjni:0.2.2'
249
+ extractHeaders 'com.facebook.fbjni:fbjni:0.2.2:headers'
250
+ extractJNI 'com.facebook.fbjni:fbjni:0.2.2'
251
+
106
252
  testImplementation 'androidx.test:core:1.4.0'
107
253
  testImplementation 'junit:junit:4.13.1'
108
- testImplementation 'io.mockk:mockk:1.10.6'
254
+ testImplementation 'io.mockk:mockk:1.12.3'
109
255
  testImplementation "com.google.truth:truth:1.1.2"
110
256
  testImplementation "org.robolectric:robolectric:4.5.1"
111
257
  testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0"
258
+
259
+ androidTestImplementation 'androidx.test:runner:1.4.0'
260
+ androidTestImplementation 'androidx.test:core:1.4.0'
261
+ androidTestImplementation 'androidx.test:rules:1.4.0'
262
+ androidTestImplementation "io.mockk:mockk-android:1.12.3"
263
+ androidTestImplementation "com.google.truth:truth:1.1.2"
264
+ androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0"
265
+
266
+ if (FOR_HERMES) {
267
+ androidTestImplementation files(HERMES_AAR)
268
+ } else {
269
+ androidTestImplementation "org.webkit:android-jsc:+"
270
+ }
112
271
  }
113
272
 
114
273
  /**
@@ -120,3 +279,182 @@ dependencies {
120
279
  tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
121
280
  kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
122
281
  }
282
+
283
+ // UTILS
284
+ task createNativeDepsDirectories() {
285
+ downloadsDir.mkdirs()
286
+ thirdPartyNdkDir.mkdirs()
287
+ }
288
+ // END UTILS
289
+
290
+ // JNI
291
+ def extractReactNativeAAR = { buildType ->
292
+ def suffix = buildType == 'Debug' ? '-debug' : '-release'
293
+ def rnAARs = fileTree(REACT_NATIVE_DIR).matching { include "**/react-native/**/*${suffix}.aar" }
294
+ if (rnAARs.isEmpty()) {
295
+ rnAARs = fileTree(REACT_NATIVE_DIR).matching { include "**/react-native/**/*.aar" }
296
+ }
297
+ if (rnAARs.any()) {
298
+ // node_modules/react-native has a .aar, extract headers
299
+ if (rnAARs.size() > 1) {
300
+ logger.error("More than one React Native AAR file has been found:")
301
+ rnAARs.each {println(it) }
302
+ throw new GradleException("Multiple React Native AARs found:\n${rnAARs.join("\n")}" +
303
+ "\nRemove the old ones and try again")
304
+ }
305
+ }
306
+ def rnAAR = rnAARs.singleFile
307
+ def file = rnAAR.absoluteFile
308
+ def packageName = file.name.tokenize('-')[0]
309
+ copy {
310
+ from zipTree(file)
311
+ into "$buildDir/$file.name"
312
+ include "jni/**/*"
313
+ }
314
+ }
315
+
316
+ task extractReactNativeAARRelease {
317
+ doLast {
318
+ extractReactNativeAAR('Release')
319
+ }
320
+ }
321
+
322
+ task extractReactNativeAARDebug {
323
+ doLast {
324
+ extractReactNativeAAR('Debug')
325
+ }
326
+ }
327
+
328
+
329
+ task extractAARHeaders {
330
+ doLast {
331
+ configurations.extractHeaders.files.each {
332
+ def file = it.absoluteFile
333
+ copy {
334
+ from zipTree(file)
335
+ into "$buildDir/$file.name"
336
+ include "**/*.h"
337
+ }
338
+ }
339
+ }
340
+ }
341
+
342
+ task extractJNIFiles {
343
+ doLast {
344
+ configurations.extractJNI.files.each {
345
+ def file = it.absoluteFile
346
+ copy {
347
+ from zipTree(file)
348
+ into "$buildDir/$file.name"
349
+ include "jni/**/*"
350
+ }
351
+ }
352
+ }
353
+ }
354
+ // END JNI
355
+
356
+ // BOOST
357
+ task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
358
+ def srcUrl = REACT_NATIVE_TARGET_VERSION >= 69
359
+ ? "https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION.replace("_", ".")}/source/boost_${BOOST_VERSION}.tar.gz"
360
+ : "https://github.com/react-native-community/boost-for-react-native/releases/download/v${BOOST_VERSION.replace("_", ".")}-0/boost_${BOOST_VERSION}.tar.gz"
361
+ src(srcUrl)
362
+ onlyIfNewer(true)
363
+ overwrite(false)
364
+ dest(new File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz"))
365
+ }
366
+
367
+ task prepareBoost(dependsOn: [downloadBoost], type: Copy) {
368
+ from(tarTree(resources.gzip(downloadBoost.dest)))
369
+ from("$reactNativeThirdParty/boost/Android.mk")
370
+ include("Android.mk", "boost_${BOOST_VERSION}/boost/**/*.hpp", "boost/boost/**/*.hpp")
371
+ includeEmptyDirs = false
372
+ into("$thirdPartyNdkDir/boost")
373
+ doLast {
374
+ file("$thirdPartyNdkDir/boost/boost").renameTo("$thirdPartyNdkDir/boost/boost_${BOOST_VERSION}")
375
+ }
376
+ }
377
+ // END BOOST
378
+
379
+ // DOUBLE CONVERSION
380
+ task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Download) {
381
+ src("https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz")
382
+ onlyIfNewer(true)
383
+ overwrite(false)
384
+ dest(new File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz"))
385
+ }
386
+
387
+ task prepareDoubleConversion(dependsOn: [downloadDoubleConversion], type: Copy) {
388
+ from(tarTree(downloadDoubleConversion.dest))
389
+ from("$reactNativeThirdParty/double-conversion/Android.mk")
390
+ include("double-conversion-${DOUBLE_CONVERSION_VERSION}/src/**/*", "Android.mk")
391
+ filesMatching("*/src/**/*", { fname -> fname.path = "double-conversion/${fname.name}" })
392
+ includeEmptyDirs = false
393
+ into("$thirdPartyNdkDir/double-conversion")
394
+ }
395
+ // END DOUBLE CONVERSION
396
+
397
+ // FOLLY
398
+ task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
399
+ src("https://github.com/facebook/folly/archive/v${FOLLY_VERSION}.tar.gz")
400
+ onlyIfNewer(true)
401
+ overwrite(false)
402
+ dest(new File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz"))
403
+ }
404
+
405
+ task prepareFolly(dependsOn: [downloadFolly], type: Copy) {
406
+ from(tarTree(downloadFolly.dest))
407
+ from("$reactNativeThirdParty/folly/Android.mk")
408
+ include("folly-${FOLLY_VERSION}/folly/**/*", "Android.mk")
409
+ eachFile { fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/") }
410
+ // Fixes problem with Folly failing to build on certain systems. See
411
+ // https://github.com/software-mansion/react-native-reanimated/issues/1024
412
+ def follyReplaceContent = '''
413
+ ssize_t r;
414
+ do {
415
+ r = open(name, flags, mode);
416
+ } while (r == -1 && errno == EINTR);
417
+ return r;
418
+ '''
419
+ filter { line -> line.replaceAll("return int\\(wrapNoInt\\(open, name, flags, mode\\)\\);", follyReplaceContent) }
420
+ includeEmptyDirs = false
421
+ into("$thirdPartyNdkDir/folly")
422
+ }
423
+ // END FOLLy
424
+
425
+ task prepareHermes() {
426
+ if (!FOR_HERMES) {
427
+ return
428
+ }
429
+
430
+ def soFiles = zipTree(HERMES_AAR).matching({ it.include "**/*.so" })
431
+
432
+ copy {
433
+ from soFiles
434
+ from "$REACT_NATIVE_DIR/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
435
+ into "$thirdPartyNdkDir/hermes"
436
+ }
437
+ }
438
+
439
+ task prepareThirdPartyNdkHeaders(dependsOn: [prepareBoost, prepareDoubleConversion, prepareFolly, prepareHermes]) {}
440
+
441
+ afterEvaluate {
442
+ extractAARHeaders.dependsOn(prepareThirdPartyNdkHeaders)
443
+ extractJNIFiles.dependsOn(prepareThirdPartyNdkHeaders)
444
+ }
445
+
446
+ tasks.whenTaskAdded { task ->
447
+ if (!task.name.contains("Clean") && (task.name.contains('externalNativeBuild') || task.name.startsWith('configureCMake'))) {
448
+ def buildType = task.name.endsWith('Debug') ? 'Debug' : 'Release'
449
+ task.dependsOn(extractAARHeaders)
450
+ task.dependsOn(extractJNIFiles)
451
+ if (REACT_NATIVE_BUILD_FROM_SOURCE) {
452
+ task.dependsOn(":ReactAndroid:copy${buildType}JniLibsProjectOnly")
453
+ } else {
454
+ task.dependsOn("extractReactNativeAAR${buildType}")
455
+ }
456
+ } else if (task.name.startsWith('generateJsonModel') && REACT_NATIVE_BUILD_FROM_SOURCE) {
457
+ def buildType = task.name.endsWith('Debug') ? 'Debug' : 'Release'
458
+ task.dependsOn(":ReactAndroid:copy${buildType}JniLibsProjectOnly")
459
+ }
460
+ }