react-native-reanimated 2.9.1 → 2.10.0

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 (195) hide show
  1. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +4 -4
  2. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +38 -0
  3. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +23 -0
  4. package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +8 -0
  5. package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +8 -0
  6. package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +5 -0
  7. package/RNReanimated.podspec +22 -3
  8. package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  9. package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
  10. package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
  11. package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
  12. package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
  13. package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
  14. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  15. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  16. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  17. package/android/.gradle/checksums/checksums.lock +0 -0
  18. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  19. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  20. package/android/CMakeLists.txt +214 -95
  21. package/android/build.gradle +247 -236
  22. package/android/react-native-reanimated-66-hermes.aar +0 -0
  23. package/android/react-native-reanimated-66-jsc.aar +0 -0
  24. package/android/react-native-reanimated-67-hermes.aar +0 -0
  25. package/android/react-native-reanimated-67-jsc.aar +0 -0
  26. package/android/react-native-reanimated-68-hermes.aar +0 -0
  27. package/android/react-native-reanimated-68-jsc.aar +0 -0
  28. package/android/react-native-reanimated-69-hermes.aar +0 -0
  29. package/android/react-native-reanimated-69-jsc.aar +0 -0
  30. package/android/react-native-reanimated-70-hermes.aar +0 -0
  31. package/android/react-native-reanimated-70-jsc.aar +0 -0
  32. package/{lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts → android/rnVersionPatch/70/.gitkeep} +0 -0
  33. package/android/src/main/cpp/NativeProxy.cpp +54 -20
  34. package/android/src/main/cpp/OnLoad.cpp +1 -0
  35. package/android/src/main/cpp/headers/NativeProxy.h +29 -0
  36. package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +25 -0
  37. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +3 -1
  38. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +165 -0
  39. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +19 -16
  40. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +5 -1
  41. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +1 -1
  42. package/ios/REANodesManager.m +31 -8
  43. package/ios/keyboardObserver/REAKeyboardEventObserver.h +17 -0
  44. package/ios/keyboardObserver/REAKeyboardEventObserver.m +198 -0
  45. package/ios/native/NativeProxy.mm +20 -1
  46. package/ios/native/REAInitializer.mm +8 -12
  47. package/ios/sensor/ReanimatedSensor.m +26 -17
  48. package/lib/index.js +11 -3
  49. package/lib/index.web.js +4 -0
  50. package/lib/reanimated2/Colors.js +1 -1
  51. package/lib/reanimated2/NativeMethods.js +3 -0
  52. package/lib/reanimated2/NativeReanimated/NativeReanimated.js +6 -0
  53. package/lib/reanimated2/animation/util.js +4 -1
  54. package/lib/reanimated2/commonTypes.js +8 -1
  55. package/lib/reanimated2/component/FlatList.js +5 -5
  56. package/lib/reanimated2/core.js +5 -4
  57. package/lib/reanimated2/frameCallback/FrameCallbackRegistryJS.js +32 -0
  58. package/lib/reanimated2/frameCallback/FrameCallbackRegistryUI.js +47 -0
  59. package/lib/reanimated2/globals.d.ts +3 -0
  60. package/lib/reanimated2/hook/index.js +2 -0
  61. package/lib/reanimated2/hook/useAnimatedKeyboard.js +31 -0
  62. package/lib/reanimated2/hook/useAnimatedSensor.js +3 -3
  63. package/lib/reanimated2/hook/useFrameCallback.js +23 -0
  64. package/lib/reanimated2/jestUtils.js +11 -3
  65. package/lib/reanimated2/js-reanimated/JSReanimated.js +7 -0
  66. package/lib/reanimated2/js-reanimated/global.js +33 -22
  67. package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +1 -1
  68. package/lib/types/{lib/Animated.d.ts → Animated.d.ts} +0 -0
  69. package/lib/types/{lib/ConfigHelper.d.ts → ConfigHelper.d.ts} +0 -0
  70. package/lib/types/{lib/ReanimatedEventEmitter.d.ts → ReanimatedEventEmitter.d.ts} +0 -0
  71. package/lib/types/{lib/ReanimatedModule.d.ts → ReanimatedModule.d.ts} +0 -0
  72. package/lib/types/{lib/ReanimatedModule.macos.d.ts → ReanimatedModule.macos.d.ts} +0 -0
  73. package/lib/types/{lib/ReanimatedModule.native.d.ts → ReanimatedModule.native.d.ts} +0 -0
  74. package/lib/types/{lib/ReanimatedModule.windows.d.ts → ReanimatedModule.windows.d.ts} +0 -0
  75. package/lib/types/{lib/ReanimatedModuleCompat.d.ts → ReanimatedModuleCompat.d.ts} +0 -0
  76. package/lib/types/{lib/createAnimatedComponent.d.ts → createAnimatedComponent.d.ts} +0 -0
  77. package/lib/types/index.d.ts +4 -0
  78. package/lib/types/{lib/index.d.ts → index.web.d.ts} +0 -1
  79. package/lib/types/{lib/reanimated2 → reanimated2}/Bezier.d.ts +0 -0
  80. package/lib/types/{lib/reanimated2 → reanimated2}/Colors.d.ts +0 -0
  81. package/lib/types/{lib/reanimated2 → reanimated2}/Easing.d.ts +0 -0
  82. package/lib/types/{lib/reanimated2 → reanimated2}/NativeMethods.d.ts +0 -0
  83. package/lib/types/{lib/reanimated2 → reanimated2}/NativeReanimated/NativeReanimated.d.ts +3 -1
  84. package/lib/types/{lib/reanimated2 → reanimated2}/NativeReanimated/index.d.ts +0 -0
  85. package/lib/types/{lib/reanimated2 → reanimated2}/PlatformChecker.d.ts +0 -0
  86. package/lib/types/{lib/reanimated2 → reanimated2}/PropAdapters.d.ts +0 -0
  87. package/lib/types/{lib/reanimated2 → reanimated2}/UpdateProps.d.ts +0 -0
  88. package/lib/types/{lib/reanimated2 → reanimated2}/ViewDescriptorsSet.d.ts +0 -0
  89. package/lib/types/{lib/reanimated2 → reanimated2}/WorkletEventHandler.d.ts +0 -0
  90. package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/MutableValue.d.ts +0 -0
  91. package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/NativeReanimated.d.ts +0 -0
  92. package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/NativeReanimated.native.d.ts +0 -0
  93. package/lib/types/{lib/reanimated2 → reanimated2}/animation/commonTypes.d.ts +0 -0
  94. package/lib/types/{lib/reanimated2 → reanimated2}/animation/decay.d.ts +0 -0
  95. package/lib/types/{lib/reanimated2 → reanimated2}/animation/delay.d.ts +0 -0
  96. package/lib/types/{lib/reanimated2 → reanimated2}/animation/index.d.ts +0 -0
  97. package/lib/types/{lib/reanimated2 → reanimated2}/animation/repeat.d.ts +0 -0
  98. package/lib/types/{lib/reanimated2 → reanimated2}/animation/sequence.d.ts +0 -0
  99. package/lib/types/{lib/reanimated2 → reanimated2}/animation/spring.d.ts +0 -0
  100. package/lib/types/{lib/reanimated2 → reanimated2}/animation/styleAnimation.d.ts +0 -0
  101. package/lib/types/{lib/reanimated2 → reanimated2}/animation/timing.d.ts +0 -0
  102. package/lib/types/{lib/reanimated2 → reanimated2}/animation/util.d.ts +0 -0
  103. package/lib/types/{lib/reanimated2 → reanimated2}/commonTypes.d.ts +12 -0
  104. package/lib/types/{lib/reanimated2 → reanimated2}/component/FlatList.d.ts +2 -2
  105. package/lib/types/{lib/reanimated2 → reanimated2}/component/Image.d.ts +0 -0
  106. package/lib/types/{lib/reanimated2 → reanimated2}/component/ScrollView.d.ts +0 -0
  107. package/lib/types/{lib/reanimated2 → reanimated2}/component/Text.d.ts +0 -0
  108. package/lib/types/{lib/reanimated2 → reanimated2}/component/View.d.ts +0 -0
  109. package/lib/types/{lib/reanimated2 → reanimated2}/core.d.ts +0 -0
  110. package/lib/types/reanimated2/frameCallback/FrameCallbackRegistryJS.d.ts +7 -0
  111. package/lib/types/reanimated2/frameCallback/FrameCallbackRegistryUI.d.ts +10 -0
  112. package/lib/types/{lib/reanimated2 → reanimated2}/hook/Hooks.d.ts +0 -0
  113. package/lib/types/{lib/reanimated2 → reanimated2}/hook/commonTypes.d.ts +0 -0
  114. package/lib/types/{lib/reanimated2 → reanimated2}/hook/index.d.ts +3 -0
  115. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedGestureHandler.d.ts +0 -0
  116. package/lib/types/reanimated2/hook/useAnimatedKeyboard.d.ts +2 -0
  117. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedReaction.d.ts +0 -0
  118. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedRef.d.ts +0 -0
  119. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedScrollHandler.d.ts +0 -0
  120. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedSensor.d.ts +1 -1
  121. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedStyle.d.ts +0 -0
  122. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useDerivedValue.d.ts +0 -0
  123. package/lib/types/reanimated2/hook/useFrameCallback.d.ts +6 -0
  124. package/lib/types/{lib/reanimated2 → reanimated2}/hook/useSharedValue.d.ts +0 -0
  125. package/lib/types/{lib/reanimated2 → reanimated2}/hook/utils.d.ts +0 -0
  126. package/lib/types/{lib/reanimated2 → reanimated2}/index.d.ts +0 -0
  127. package/lib/types/{lib/reanimated2 → reanimated2}/interpolateColor.d.ts +0 -0
  128. package/lib/types/{lib/reanimated2 → reanimated2}/interpolation.d.ts +0 -0
  129. package/lib/types/{lib/reanimated2 → reanimated2}/jestUtils.d.ts +1 -1
  130. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/JSReanimated.d.ts +3 -1
  131. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/Mapper.d.ts +0 -0
  132. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/MapperRegistry.d.ts +0 -0
  133. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/MutableValue.d.ts +0 -0
  134. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/commonTypes.d.ts +0 -0
  135. package/lib/types/reanimated2/js-reanimated/global.d.ts +2 -0
  136. package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/index.d.ts +0 -0
  137. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/LayoutAnimationRepository.d.ts +0 -0
  138. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -0
  139. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -0
  140. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -0
  141. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/commonTypes.d.ts +0 -0
  142. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/index.d.ts +0 -0
  143. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -0
  144. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Default.d.ts +0 -0
  145. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Fade.d.ts +0 -0
  146. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Flip.d.ts +0 -0
  147. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -0
  148. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -0
  149. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Roll.d.ts +0 -0
  150. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -0
  151. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Slide.d.ts +0 -0
  152. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -0
  153. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -0
  154. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/index.d.ts +0 -0
  155. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -0
  156. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -0
  157. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -0
  158. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -0
  159. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -0
  160. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -0
  161. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/index.d.ts +0 -0
  162. package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/index.d.ts +0 -0
  163. package/lib/types/{lib/reanimated2 → reanimated2}/mock.d.ts +0 -0
  164. package/lib/types/{lib/reanimated2 → reanimated2}/platform-specific/RNRenderer.d.ts +0 -0
  165. package/lib/types/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
  166. package/lib/types/{lib/reanimated2 → reanimated2}/utils.d.ts +0 -0
  167. package/lib/types/{lib/setAndForwardRef.d.ts → setAndForwardRef.d.ts} +0 -0
  168. package/mock.js +1 -0
  169. package/package.json +5 -6
  170. package/plugin.js +7 -16
  171. package/react-native-reanimated.d.ts +55 -4
  172. package/src/index.ts +11 -3
  173. package/src/index.web.ts +5 -0
  174. package/src/reanimated2/Colors.ts +1 -1
  175. package/src/reanimated2/NativeMethods.ts +5 -0
  176. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +9 -0
  177. package/src/reanimated2/animation/util.ts +8 -1
  178. package/src/reanimated2/commonTypes.ts +15 -0
  179. package/src/reanimated2/component/FlatList.tsx +29 -19
  180. package/src/reanimated2/core.ts +8 -8
  181. package/src/reanimated2/frameCallback/FrameCallbackRegistryJS.ts +43 -0
  182. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +64 -0
  183. package/src/reanimated2/globals.d.ts +3 -0
  184. package/src/reanimated2/hook/index.ts +3 -0
  185. package/src/reanimated2/hook/useAnimatedKeyboard.ts +35 -0
  186. package/src/reanimated2/hook/useAnimatedSensor.ts +5 -5
  187. package/src/reanimated2/hook/useFrameCallback.ts +39 -0
  188. package/src/reanimated2/jestUtils.ts +11 -3
  189. package/src/reanimated2/js-reanimated/JSReanimated.ts +16 -1
  190. package/src/reanimated2/js-reanimated/global.ts +41 -29
  191. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +1 -1
  192. package/android/react-native-reanimated-65-hermes.aar +0 -0
  193. package/android/react-native-reanimated-65-jsc.aar +0 -0
  194. package/lib/types/lib/reanimated2/js-reanimated/global.d.ts +0 -1
  195. package/lib/types/react-native-reanimated-tests.d.ts +0 -1
@@ -1,10 +1,11 @@
1
+ import com.android.Version
2
+
3
+ import java.nio.file.Files
1
4
  import java.nio.file.Paths
5
+ import java.nio.file.Path
2
6
  import org.apache.tools.ant.filters.ReplaceTokens
3
-
4
- import java.util.regex.Matcher
5
- import java.util.regex.Pattern
6
7
  import groovy.json.JsonSlurper
7
- import java.util.zip.ZipFile
8
+ import java.util.stream.Stream
8
9
 
9
10
  /**
10
11
  * Finds the path of the installed npm package with the given name using Node's
@@ -45,22 +46,20 @@ def safeExtGet(prop, fallback) {
45
46
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
46
47
  }
47
48
 
48
- def getCurrentFlavor() {
49
- String taskRequestName = getGradle().getStartParameter().getTaskRequests().toString()
50
- Pattern pattern = Pattern.compile("(assemble|bundle|install|generate)(\\w*)(Release|Debug)")
51
- Matcher matcher = pattern.matcher(taskRequestName)
52
-
53
- if (matcher.find()) {
54
- return matcher.group(2)
55
- }
56
-
57
- return "NOT-FOUND"
49
+ def resolveBuildType() {
50
+ def buildType = "debug"
51
+ tasks.all({ task ->
52
+ if (task.name == "buildCMakeRelease") {
53
+ buildType = "release"
54
+ }
55
+ })
56
+ return buildType
58
57
  }
59
58
 
60
- def resolveBuildType() {
61
- def buildType = System.getenv("CLIENT_SIDE_BUILD")
62
- if (buildType != null) {
63
- return buildType == "True"
59
+ def resolveClientSideBuild() {
60
+ def clientSideBuild = System.getenv("CLIENT_SIDE_BUILD")
61
+ if (clientSideBuild != null) {
62
+ return clientSideBuild == "True"
64
63
  }
65
64
 
66
65
  if (hasProperty("clientSideBuild")) {
@@ -79,137 +78,57 @@ def isDeveloperMode() {
79
78
  return file("$projectDir/../node_modules/react-native/package.json").exists()
80
79
  }
81
80
 
81
+ def isNewArchitectureEnabled() {
82
+ // To opt-in for the New Architecture, you can either:
83
+ // - Set `newArchEnabled` to true inside the `gradle.properties` file
84
+ // - Invoke gradle with `-newArchEnabled=true`
85
+ // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
86
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
87
+ }
88
+
82
89
  def resolveReactNativeDirectory() {
83
90
  if (isDeveloperMode()) {
84
- return file("$projectDir/../node_modules/react-native")
91
+ return file("$projectDir/../${getPlaygroundAppName()}/node_modules/react-native")
85
92
  }
86
93
  return file("$projectDir/../../react-native")
87
94
  }
88
95
 
89
- abstract class replaceSoTask extends DefaultTask {
90
- public static String appName = ":app"
91
- public static String buildDir = "../../../android/app/build"
92
- public static String fbjniVersion = "0.3.0"
93
-
94
- @TaskAction
95
- def run() {
96
- def libSoDir = new File("${buildDir}/tmp/libSo")
97
- if (!libSoDir.exists()) {
98
- libSoDir.mkdirs()
99
- def fbjniUrl = "https://repo1.maven.org/maven2/com/facebook/fbjni/fbjni/${fbjniVersion}/fbjni-${fbjniVersion}.aar"
100
- def aarFile = new File("${libSoDir.path}/fbjni-${fbjniVersion}.aar")
101
- aarFile.createNewFile()
102
- aarFile.withOutputStream { out ->
103
- def url = new URL(fbjniUrl).openConnection()
104
- out << url.inputStream
105
- }
106
- if (!aarFile.exists()) {
107
- println("Unable to find ${libSoDir.path}/fbjni-${fbjniVersion}.aar")
108
- return
109
- }
110
- def zipFile = new ZipFile(new File("${libSoDir.path}/fbjni-${fbjniVersion}.aar"))
111
- zipFile.entries().each {
112
- def zipIt = it
113
- if (zipIt.name.contains("libfbjni.so")) {
114
- new File("${libSoDir.path}/" + zipIt.name.replace("/libfbjni.so", "")).mkdirs()
115
- new File("${libSoDir.path}/" + zipIt.name).withOutputStream{
116
- it << zipFile.getInputStream(zipIt)
117
- }
118
- }
96
+ def getPlaygroundAppName() { // only for the development
97
+ String playgroundAppName = ""
98
+ try {
99
+ rootProject.getSubprojects().forEach({project ->
100
+ if (project.plugins.hasPlugin("com.android.application")) {
101
+ var projectCatalogAbsolutePath = project.projectDir.toString().replace("/android/app", "")
102
+ var slashPosition = projectCatalogAbsolutePath.lastIndexOf("/")
103
+ playgroundAppName = projectCatalogAbsolutePath.substring(slashPosition + 1)
119
104
  }
120
- }
121
- for(def abiVersion in ["x86", "x86_64", "armeabi-v7a", "arm64-v8a"]) {
122
- ant.sequential {
123
- copy(
124
- tofile: "${buildDir}/intermediates/merged_native_libs/debug/out/lib/${abiVersion}/libfbjni.so",
125
- file: "${buildDir}/tmp/libSo/jni/${abiVersion}/libfbjni.so",
126
- overwrite: true
127
- )
128
- }
129
- }
105
+ })
106
+ } catch(_) {
107
+ return "NOT_FOUND"
130
108
  }
109
+ return playgroundAppName
131
110
  }
132
111
 
133
- def detectAAR(minor, engine) {
134
- def rnMinorVersionCopy = Integer.parseInt(minor)
135
- def aar = file("react-native-reanimated-${rnMinorVersionCopy}-${engine}.aar")
136
-
137
- if (aar.exists()) {
138
- println "AAR for react-native-reanimated has been found\n$aar"
139
- return aar
140
- } else {
141
- while (!aar.exists() && rnMinorVersionCopy >= 63) {
142
- rnMinorVersionCopy -= 1
143
- aar = file("react-native-reanimated-${rnMinorVersionCopy}-${engine}.aar")
144
- }
145
-
146
- if (rnMinorVersionCopy < 63) {
147
- println "No AAR for react-native-reanimated found. Attempting to build from source."
148
- } else { // aar exists, but was build for lower react-native version
149
- println "\n\n\n"
150
- println "****************************************************************************************"
151
- println "\n\n\n"
152
- println "WARNING reanimated - no version-specific reanimated AAR for react-native version $minor found."
153
- println "Falling back to AAR for react-native version $rnMinorVersionCopy."
154
- println "The react-native JSI interface is not ABI-safe yet, this may result in crashes."
155
- println "Please post a pull request to implement support for react-native version $minor to the reanimated repo."
156
- println "Thanks!"
157
- println "\n\n\n"
158
- println "****************************************************************************************"
159
-
160
- return aar
161
- }
162
- }
163
- return null
164
- }
112
+ boolean CLIENT_SIDE_BUILD = resolveClientSideBuild()
113
+ if (CLIENT_SIDE_BUILD) {
114
+ configurations.maybeCreate("default")
165
115
 
166
- def detectJsRuntime() {
167
- def runtimeType = "jsc"
168
- rootProject.getSubprojects().forEach({project ->
169
- if (project.plugins.hasPlugin("com.android.application")) {
170
- if (project.ext.react.enableHermes) {
171
- runtimeType = "hermes"
172
- }
173
- }
174
- })
175
- return runtimeType
176
- }
177
-
178
- def detectReanimatedConfig() {
179
- def buildFromSourceConf = false
180
- rootProject.getSubprojects().forEach({project ->
181
- if (project.plugins.hasPlugin("com.android.application")) {
182
- if (
183
- project.ext.has("reanimated")
184
- && project.ext.reanimated.buildFromSource
185
- ) {
186
- buildFromSourceConf = true
187
- }
188
- }
189
- })
190
- return buildFromSourceConf
191
- }
116
+ List<Path> paths = Files.find(
117
+ Paths.get(rootDir.parent),
118
+ Integer.MAX_VALUE,
119
+ {path, fileAttributes -> path.toString().endsWith("/react-native-reanimated/package.json") }
120
+ ).toArray()
192
121
 
193
- def shouldBuildFromSource(aar) {
194
- if (isDeveloperMode()) {
195
- // Example app
196
- return true
122
+ String parsedLocation = ""
123
+ def libInstancesCount = 0
124
+ for (def path in paths) {
125
+ parsedLocation += "- " + path.toString().replace("/package.json", "\n")
126
+ libInstancesCount++
197
127
  }
198
- else if (detectReanimatedConfig()) {
199
- // on user demand
200
- return true
128
+ if (libInstancesCount > 1) {
129
+ String exceptionMessage = "\nMultiple versions of Reanimated were detected. Only one instance of react-native-reanimated can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict between: \n" + parsedLocation + "\n";
130
+ throw new Exception(exceptionMessage)
201
131
  }
202
- else if (aar != null) {
203
- // when binary exist
204
- return false
205
- }
206
- // when binary is not found
207
- return true
208
- }
209
-
210
- boolean CLIENT_SIDE_BUILD = resolveBuildType()
211
- if (CLIENT_SIDE_BUILD) {
212
- configurations.maybeCreate("default")
213
132
  }
214
133
  def reactNative = resolveReactNativeDirectory()
215
134
  def reactNativeManifest = file("$reactNative/package.json")
@@ -217,70 +136,6 @@ def reactNativeManifestAsJson = new JsonSlurper().parseText(reactNativeManifest.
217
136
  def reactNativeVersion = reactNativeManifestAsJson.version as String
218
137
  def (major, minor, patch) = reactNativeVersion.tokenize('.')
219
138
  def rnMinorVersion = Integer.parseInt(minor)
220
- def engine = detectJsRuntime()
221
- def aar = detectAAR(minor, engine)
222
- boolean BUILD_FROM_SOURCE = shouldBuildFromSource(aar)
223
-
224
- def getTaskByPath(project, String appName, String secondPart, String flavorString, String lastPart) {
225
- String pathName = "${appName}:${secondPart}${flavorString}${lastPart}"
226
- Task task = project.getTasks().findByPath(pathName)
227
- if (task != null) {
228
- return task
229
- }
230
- pathName = "${appName}:${secondPart}${flavorString.capitalize()}${lastPart}"
231
- return project.getTasks().findByPath(pathName)
232
- }
233
-
234
- if (!BUILD_FROM_SOURCE) {
235
- if (rnMinorVersion < 65) {
236
- tasks.register("replaceSoTaskDebug", replaceSoTask)
237
- tasks.register("replaceSoTaskRelease", replaceSoTask)
238
- Task replaceSoTaskDebug = project.getTasks().findByPath(":react-native-reanimated:replaceSoTaskDebug")
239
- Task replaceSoTaskRelease = project.getTasks().findByPath(":react-native-reanimated:replaceSoTaskRelease")
240
-
241
- if (replaceSoTaskDebug != null && replaceSoTaskRelease != null) {
242
- rootProject.getSubprojects().forEach({project ->
243
- if (project.plugins.hasPlugin("com.android.application") && project.getProperties().get("android")) {
244
- def projectProperties = project.getProperties()
245
- def flavorString = getCurrentFlavor()
246
- def reanimatedConf = projectProperties.get("reanimated")
247
-
248
- if (
249
- flavorString != "NOT-FOUND"
250
- && (!reanimatedConf || (reanimatedConf && !reanimatedConf.get("enablePackagingOptions")))
251
- ) {
252
- replaceSoTask.appName = projectProperties.path
253
- replaceSoTask.buildDir = projectProperties.buildDir
254
- def appName = projectProperties.path
255
-
256
- Task debugNativeLibsTask = getTaskByPath(project, appName, "merge", flavorString, "DebugNativeLibs")
257
- Task debugDebugSymbolsTask = getTaskByPath(project, appName, "strip", flavorString, "DebugDebugSymbols")
258
- Task releaseNativeLibsTask = getTaskByPath(project, appName, "merge", flavorString, "ReleaseNativeLibs")
259
- Task releaseDebugSymbolsTask = getTaskByPath(project, appName, "strip", flavorString, "ReleaseDebugSymbols")
260
- Task debugTask = getTaskByPath(project, appName, "package", flavorString, "Debug")
261
- Task releaseTask = getTaskByPath(project, appName, "package", flavorString, "Release")
262
-
263
- if (
264
- debugNativeLibsTask != null && debugDebugSymbolsTask != null
265
- && releaseNativeLibsTask != null && releaseDebugSymbolsTask != null
266
- && debugTask != null && releaseTask != null
267
- ) {
268
- replaceSoTaskDebug.dependsOn(debugNativeLibsTask, debugDebugSymbolsTask)
269
- debugTask.dependsOn(replaceSoTaskDebug)
270
- replaceSoTaskRelease.dependsOn(releaseNativeLibsTask, releaseDebugSymbolsTask)
271
- releaseTask.dependsOn(replaceSoTaskRelease)
272
- }
273
- }
274
- }
275
- })
276
- }
277
- }
278
-
279
- artifacts.add("default", aar)
280
- }
281
-
282
- // end if already loaded aar
283
- if (!BUILD_FROM_SOURCE) return
284
139
 
285
140
  def localProps = new Properties()
286
141
  def localPropertiesFile = file("local.properties")
@@ -309,13 +164,40 @@ def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
309
164
  def reactNativeThirdParty = new File("$reactNative/ReactAndroid/src/main/jni/third-party")
310
165
 
311
166
  def _stackProtectorFlag = true
312
- def FOR_HERMES = ""
313
167
 
314
- if (findProject(":app")) {
315
- FOR_HERMES = project(":app").ext.react.enableHermes;
316
- } else {
317
- FOR_HERMES = System.getenv("FOR_HERMES") == "True";
318
- }
168
+ def CMAKE_NODE_MODULES_DIR = CLIENT_SIDE_BUILD
169
+ ? project.getProjectDir().getParentFile().getParent()
170
+ : Paths.get(project.getProjectDir().getParent(), getPlaygroundAppName(), "node_modules").toString()
171
+
172
+ def JS_RUNTIME = {
173
+ // Returns the js runtime explicitly requested in the environment variable
174
+ if (System.getenv("JS_RUNTIME")) {
175
+ return System.getenv("JS_RUNTIME")
176
+ }
177
+
178
+ // Detect js runtime from project setup
179
+ def defaultRuntimeType = "jsc";
180
+ def v8Project = rootProject.getSubprojects().find { project -> project.name == "react-native-v8" }
181
+ if (v8Project != null) {
182
+ return "v8"
183
+ }
184
+ def appProject = findProject(":app") ? project(":app") : null
185
+ return appProject?.ext?.react?.enableHermes ? "hermes" : defaultRuntimeType
186
+ }.call()
187
+
188
+ def jsRuntimeDir = {
189
+ if (JS_RUNTIME == "hermes") {
190
+ if (rnMinorVersion >= 69) {
191
+ return Paths.get(CMAKE_NODE_MODULES_DIR, "react-native", "sdks", "hermes")
192
+ } else {
193
+ return Paths.get(CMAKE_NODE_MODULES_DIR, "hermes-engine")
194
+ }
195
+ } else if (JS_RUNTIME == "v8") {
196
+ return findProject(":react-native-v8").getProjectDir().getParent()
197
+ } else {
198
+ return Paths.get(CMAKE_NODE_MODULES_DIR, "react-native", "ReactCommon", "jsi")
199
+ }
200
+ }.call()
319
201
 
320
202
  def reactNativeArchitectures() {
321
203
  def value = project.getProperties().get("reactNativeArchitectures")
@@ -351,8 +233,8 @@ buildscript {
351
233
  }
352
234
  }
353
235
  dependencies {
354
- classpath "com.android.tools.build:gradle:7.1.1"
355
- classpath "de.undercouch:gradle-download-task:5.0.1"
236
+ classpath "com.android.tools.build:gradle:4.2.2"
237
+ classpath "de.undercouch:gradle-download-task:4.1.2"
356
238
  classpath "com.diffplug.spotless:spotless-plugin-gradle:5.15.0"
357
239
  }
358
240
  }
@@ -372,6 +254,7 @@ android {
372
254
  targetSdkVersion safeExtGet("targetSdkVersion", 30)
373
255
  versionCode 1
374
256
  versionName "1.0"
257
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
375
258
  externalNativeBuild {
376
259
  cmake {
377
260
  arguments "-DANDROID_STL=c++_shared",
@@ -379,9 +262,13 @@ android {
379
262
  "-DREACT_NATIVE_TARGET_VERSION=${REACT_VERSION}",
380
263
  "-DANDROID_TOOLCHAIN=clang",
381
264
  "-DBOOST_VERSION=${BOOST_VERSION}",
382
- "-DBUILD_DIR=${buildDir}",
383
- "-DFOR_HERMES=${FOR_HERMES}",
384
- "-DCLIENT_SIDE_BUILD=${CLIENT_SIDE_BUILD}"
265
+ "-DNODE_MODULES_DIR=${CMAKE_NODE_MODULES_DIR}",
266
+ "-DJS_RUNTIME=${JS_RUNTIME}",
267
+ "-DJS_RUNTIME_DIR=${jsRuntimeDir}",
268
+ "-DCLIENT_SIDE_BUILD=${CLIENT_SIDE_BUILD}",
269
+ "-DIS_NEW_ARCHITECTURE_ENABLED=${isNewArchitectureEnabled()}",
270
+ "-DPLAYGROUND_APP_NAME=${getPlaygroundAppName()}",
271
+ "-DRNVERSION=${rnMinorVersion}"
385
272
  abiFilters (*reactNativeArchitectures())
386
273
  _stackProtectorFlag ? (cppFlags("-fstack-protector-all")) : null
387
274
  }
@@ -389,10 +276,12 @@ android {
389
276
 
390
277
  buildConfigField("boolean", "IS_INTERNAL_BUILD", "false")
391
278
  buildConfigField("int", "EXOPACKAGE_FLAGS", "0")
279
+ buildConfigField("int", "REACT_NATIVE_VERSION", rnMinorVersion.toString())
392
280
  }
393
281
  externalNativeBuild {
394
282
  cmake {
395
283
  path "CMakeLists.txt"
284
+ version "3.18.1"
396
285
  }
397
286
  }
398
287
  lintOptions {
@@ -411,6 +300,7 @@ android {
411
300
  "**/libhermes.so",
412
301
  "**/libreactnativejni.so",
413
302
  "**/libjscexecutor.so",
303
+ "**/libv8executor.so",
414
304
  ]
415
305
  }
416
306
  tasks.withType(JavaCompile) {
@@ -425,6 +315,27 @@ android {
425
315
  sourceCompatibility JavaVersion.VERSION_1_8
426
316
  targetCompatibility JavaVersion.VERSION_1_8
427
317
  }
318
+ packagingOptions {
319
+ // For some reason gradle only complains about the duplicated version of librrc_root and libreact_render libraries
320
+ // while there are more libraries copied in intermediates folder of the lib build directory, we exclude
321
+ // only the ones that make the build fail (ideally we should only include libreanimated but we
322
+ // are only allowed to specify exlude patterns)
323
+ exclude "**/libreact_render*.so"
324
+ exclude "**/librrc_root.so"
325
+ }
326
+ sourceSets.main {
327
+ java {
328
+ if (isNewArchitectureEnabled()) {
329
+ srcDirs += [
330
+ "src/fabric/java",
331
+ ]
332
+ } else {
333
+ srcDirs += [
334
+ "src/paper/java",
335
+ ]
336
+ }
337
+ }
338
+ }
428
339
  }
429
340
 
430
341
  task cleanCmakeCache() {
@@ -435,7 +346,7 @@ task cleanCmakeCache() {
435
346
  }
436
347
 
437
348
  task printVersions {
438
- println "Android gradle plugin: ${com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION}"
349
+ println "Android gradle plugin: ${Version.ANDROID_GRADLE_PLUGIN_VERSION}"
439
350
  println "Gradle: ${project.gradle.gradleVersion}"
440
351
  }
441
352
 
@@ -562,23 +473,94 @@ task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy)
562
473
  }
563
474
  }
564
475
 
565
- task prepareHermes() {
566
- def hermesPackagePath = findNodeModulePath(projectDir, "hermes-engine")
567
- if (!hermesPackagePath) {
568
- throw new GradleScriptException("Could not find the hermes-engine npm package", null)
476
+ /*
477
+ Reanimated includes "hermes/hermes.h" header file in `NativeProxy.cpp`.
478
+ Previously, we used header files from `hermes-engine` package in `node_modules`.
479
+ Starting from React Native 0.69, Hermes is no longer distributed as package on NPM.
480
+ On the new architecture, Hermes is downloaded from GitHub and then compiled from sources.
481
+ However, on the old architecture, we need to download Hermes header files on our own
482
+ as well as unzip Hermes AAR in order to obtain `libhermes.so` shared library.
483
+ For more details, see https://reactnative.dev/architecture/bundled-hermes
484
+ or https://github.com/reactwg/react-native-new-architecture/discussions/4
485
+ */
486
+ if (rnMinorVersion >= 69 && !isNewArchitectureEnabled()) {
487
+ // copied from `react-native/ReactAndroid/hermes-engine/build.gradle`
488
+
489
+ def reactNativeRootDir = resolveReactNativeDirectory()
490
+ def customDownloadDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR")
491
+ def downloadDir = customDownloadDir ? new File(customDownloadDir) : new File(reactNativeRootDir, "sdks/download")
492
+
493
+ // By default we are going to download and unzip hermes inside the /sdks/hermes folder
494
+ // but you can provide an override for where the hermes source code is located.
495
+ def hermesDir = System.getenv("REACT_NATIVE_OVERRIDE_HERMES_DIR") ?: new File(reactNativeRootDir, "sdks/hermes")
496
+
497
+ def hermesVersion = "main"
498
+ def hermesVersionFile = new File(reactNativeRootDir, "sdks/.hermesversion")
499
+ if (hermesVersionFile.exists()) {
500
+ hermesVersion = hermesVersionFile.text
501
+ }
502
+
503
+ task downloadHermes(type: Download) {
504
+ src("https://github.com/facebook/hermes/tarball/${hermesVersion}")
505
+ onlyIfNewer(true)
506
+ overwrite(false)
507
+ dest(new File(downloadDir, "hermes.tar.gz"))
508
+ }
509
+
510
+ task unzipHermes(dependsOn: downloadHermes, type: Copy) {
511
+ from(tarTree(downloadHermes.dest)) {
512
+ eachFile { file ->
513
+ // We flatten the unzip as the tarball contains a `facebook-hermes-<SHA>`
514
+ // folder at the top level.
515
+ if (file.relativePath.segments.size() > 1) {
516
+ file.relativePath = new org.gradle.api.file.RelativePath(!file.isDirectory(), file.relativePath.segments.drop(1))
517
+ }
518
+ }
519
+ }
520
+ into(hermesDir)
569
521
  }
522
+ }
570
523
 
571
- def hermesAAR = file("$hermesPackagePath/android/hermes-debug.aar")
572
- if (!hermesAAR.exists()) {
573
- throw new GradleScriptException("The hermes-engine npm package is missing \"android/hermes-debug.aar\"", null)
574
- }
524
+ task prepareHermes() {
525
+ if (rnMinorVersion >= 69) {
526
+ if (!isNewArchitectureEnabled()) {
527
+ dependsOn(unzipHermes)
528
+ }
575
529
 
576
- def soFiles = zipTree(hermesAAR).matching({ it.include "**/*.so" })
530
+ doLast {
531
+ def hermesAAR = file("$reactNative/android/com/facebook/react/hermes-engine/$reactNativeVersion/hermes-engine-$reactNativeVersion-${resolveBuildType()}.aar") // e.g. hermes-engine-0.70.0-rc.1-debug.aar
532
+ if (!hermesAAR.exists()) {
533
+ throw new GradleScriptException("Could not find hermes-engine AAR", null)
534
+ }
577
535
 
578
- copy {
579
- from soFiles
580
- from "$reactNative/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
581
- into "$thirdPartyNdkDir/hermes"
536
+ def soFiles = zipTree(hermesAAR).matching({ it.include "**/*.so" })
537
+
538
+ copy {
539
+ from soFiles
540
+ from "$reactNative/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
541
+ into "$thirdPartyNdkDir/hermes"
542
+ }
543
+ }
544
+ } else {
545
+ doLast {
546
+ def hermesPackagePath = findNodeModulePath(projectDir, "hermes-engine")
547
+ if (!hermesPackagePath) {
548
+ throw new GradleScriptException("Could not find the hermes-engine npm package", null)
549
+ }
550
+
551
+ def hermesAAR = file("$hermesPackagePath/android/hermes-debug.aar")
552
+ if (!hermesAAR.exists()) {
553
+ throw new GradleScriptException("The hermes-engine npm package is missing \"android/hermes-debug.aar\"", null)
554
+ }
555
+
556
+ def soFiles = zipTree(hermesAAR).matching({ it.include "**/*.so" })
557
+
558
+ copy {
559
+ from soFiles
560
+ from "$reactNative/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
561
+ into "$thirdPartyNdkDir/hermes"
562
+ }
563
+ }
582
564
  }
583
565
  }
584
566
 
@@ -666,7 +648,7 @@ repositories {
666
648
  dependencies {
667
649
  // noinspection GradleDynamicVersion
668
650
  implementation "com.facebook.yoga:proguard-annotations:1.19.0"
669
- if (isDeveloperMode()) {
651
+ if (isDeveloperMode() && !isNewArchitectureEnabled()) {
670
652
  implementation "com.facebook.fbjni:fbjni:" + FBJNI_VERSION
671
653
  }
672
654
  else {
@@ -674,22 +656,33 @@ dependencies {
674
656
  }
675
657
  implementation "com.facebook.react:react-native:+" // From node_modules
676
658
  implementation "androidx.transition:transition:1.1.0"
659
+ if (rnMinorVersion > 66) {
660
+ implementation "androidx.core:core:1.7.0"
661
+ }
662
+ else {
663
+ implementation "androidx.core:core:1.6.0"
664
+ }
677
665
  extractHeaders("com.facebook.fbjni:fbjni:" + FBJNI_VERSION + ":headers")
678
666
  extractSO("com.facebook.fbjni:fbjni:" + FBJNI_VERSION)
679
667
 
680
- def buildType = "debug"
681
- tasks.all({ task ->
682
- if (task.name == "buildCMakeRelease") {
683
- buildType = "release"
684
- }
685
- })
668
+ def jscAAR = fileTree("$reactNative/../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*.aar" }).singleFile
669
+ extractSO(files(jscAAR))
670
+ }
671
+
672
+ task unpackReactNativeAAR {
673
+ def buildType = resolveBuildType()
686
674
  def rnAarMatcher = "**/react-native/**/*${buildType}.aar"
687
675
  if (rnMinorVersion < 69) {
688
676
  rnAarMatcher = "**/**/*.aar"
689
677
  }
690
678
  def rnAAR = fileTree("$reactNative/android").matching({ it.include rnAarMatcher }).singleFile
691
- def jscAAR = fileTree("$reactNative/../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*.aar" }).singleFile
692
- extractSO(files(rnAAR, jscAAR))
679
+ def file = rnAAR.absoluteFile
680
+ def packageName = file.name.tokenize('-')[0]
681
+ copy {
682
+ from zipTree(file)
683
+ into "$reactNative/ReactAndroid/src/main/jni/first-party/$packageName/"
684
+ include "jni/**/*.so"
685
+ }
693
686
  }
694
687
 
695
688
  task downloadNdkBuildDependencies {
@@ -701,7 +694,7 @@ task downloadNdkBuildDependencies {
701
694
  dependsOn(downloadGlog)
702
695
  }
703
696
 
704
- task prepareThirdPartyNdkHeaders(dependsOn:[downloadNdkBuildDependencies, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog]) {
697
+ task prepareThirdPartyNdkHeaders(dependsOn:[downloadNdkBuildDependencies, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog, unpackReactNativeAAR]) {
705
698
  }
706
699
 
707
700
  def nativeBuildDependsOn(dependsOnTask) {
@@ -717,13 +710,31 @@ afterEvaluate {
717
710
  nativeBuildDependsOn(prepareThirdPartyNdkHeaders)
718
711
  nativeBuildDependsOn(extractAARHeaders)
719
712
  nativeBuildDependsOn(extractSOFiles)
713
+
714
+ tasks.forEach({ task ->
715
+ if (task.name.contains("JniLibFolders")) {
716
+ task.dependsOn(packageNdkLibs)
717
+ }
718
+ })
719
+
720
+ if (JS_RUNTIME == "hermes") {
721
+ extractAARHeaders.dependsOn(prepareHermes)
722
+ extractSOFiles.dependsOn(prepareHermes)
723
+ } else if (JS_RUNTIME == "v8") {
724
+ def buildTasks = tasks.findAll({ task ->
725
+ !task.name.contains("Clean") && (task.name.contains("externalNative") || task.name.contains("CMake") || task.name.startsWith("generateJsonModel")) })
726
+ buildTasks.forEach { task ->
727
+ def buildType = task.name.endsWith('Debug') ? 'Debug' : 'Release'
728
+ task.dependsOn(":react-native-v8:copy${buildType}JniLibsProjectOnly")
729
+ }
730
+ }
720
731
  }
721
732
 
722
733
  if (CLIENT_SIDE_BUILD) {
723
734
  def aarDir = "${buildDir}/outputs"
724
- aar = file("${aarDir}/android-debug.aar")
735
+ def aar = file("${aarDir}/android-debug.aar")
725
736
  if (aar == null) {
726
737
  throw GradleScriptException("AAR build failed. No AAR found in ${aarDir}.")
727
738
  }
728
739
  artifacts.add("default", aar)
729
- }
740
+ }