react-native-reanimated 3.0.0-rc.9 → 3.0.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.
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +30 -12
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +2 -0
- package/Common/cpp/Fabric/FabricUtils.cpp +3 -107
- package/Common/cpp/Fabric/FabricUtils.h +3 -24
- package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +54 -37
- package/Common/cpp/LayoutAnimations/LayoutAnimationType.h +8 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +81 -26
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +20 -3
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +105 -109
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +19 -12
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +15 -7
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +6 -2
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +20 -1
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +9 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +5 -1
- package/Common/cpp/Registries/EventHandlerRegistry.cpp +8 -34
- package/Common/cpp/Registries/EventHandlerRegistry.h +7 -13
- package/Common/cpp/SharedItems/Shareables.cpp +9 -63
- package/Common/cpp/SharedItems/Shareables.h +77 -72
- package/Common/cpp/Tools/CollectionUtils.h +14 -0
- package/Common/cpp/Tools/JsiUtils.cpp +26 -0
- package/Common/cpp/Tools/JsiUtils.h +176 -0
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +5 -5
- package/Common/cpp/Tools/ReanimatedVersion.cpp +17 -0
- package/Common/cpp/Tools/ReanimatedVersion.h +11 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +49 -230
- package/Common/cpp/Tools/RuntimeDecorator.h +0 -2
- package/Common/cpp/Tools/WorkletEventHandler.cpp +3 -2
- package/Common/cpp/Tools/WorkletEventHandler.h +14 -6
- package/RNReanimated.podspec +2 -1
- package/android/CMakeLists.txt +188 -181
- package/android/build.gradle +362 -311
- package/android/proguard-rules.pro +2 -0
- package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +63 -295
- package/android/src/main/cpp/LayoutAnimations.cpp +35 -5
- package/android/src/main/cpp/LayoutAnimations.h +23 -6
- package/android/src/main/cpp/NativeProxy.cpp +143 -98
- package/android/src/main/cpp/NativeProxy.h +22 -28
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
- package/android/src/main/java/com/swmansion/reanimated/Utils.java +7 -1
- package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +10 -3
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +218 -35
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +43 -17
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +6 -2
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedElement.java +19 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +610 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +93 -23
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/AnimationFrameCallback.java +19 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +35 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/KeyboardEventDataUpdater.java +16 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +206 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/SensorSetter.java +17 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +9 -3
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +3 -4
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -7
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +90 -307
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
- package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +76 -20
- package/ios/LayoutReanimation/REAAnimationsManager.h +28 -4
- package/ios/LayoutReanimation/REAAnimationsManager.m +216 -61
- package/ios/LayoutReanimation/REAFrame.h +10 -0
- package/ios/LayoutReanimation/REAFrame.m +15 -0
- package/ios/LayoutReanimation/REAScreensHelper.h +19 -0
- package/ios/LayoutReanimation/REAScreensHelper.m +106 -0
- package/ios/LayoutReanimation/REASharedElement.h +15 -0
- package/ios/LayoutReanimation/REASharedElement.m +16 -0
- package/ios/LayoutReanimation/REASharedTransitionManager.h +17 -0
- package/ios/LayoutReanimation/REASharedTransitionManager.m +632 -0
- package/ios/LayoutReanimation/REASnapshot.h +1 -0
- package/ios/LayoutReanimation/REASnapshot.m +96 -11
- package/ios/LayoutReanimation/REAUIManager.mm +64 -17
- package/ios/REAModule.mm +2 -7
- package/ios/REANodesManager.mm +1 -21
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +72 -36
- package/ios/native/NativeProxy.mm +75 -114
- package/ios/native/REAInitializer.mm +2 -7
- package/ios/native/REAJSIUtils.h +60 -2
- package/ios/sensor/ReanimatedSensor.h +6 -2
- package/ios/sensor/ReanimatedSensor.m +43 -7
- package/ios/sensor/ReanimatedSensorContainer.h +4 -1
- package/ios/sensor/ReanimatedSensorContainer.m +8 -2
- package/lib/commonjs/createAnimatedComponent.js +232 -28
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/reanimated2/Colors.js +43 -22
- package/lib/commonjs/reanimated2/Colors.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +16 -33
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/styleAnimation.js +5 -1
- package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js +17 -15
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +33 -1
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +33 -14
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/index.js +0 -6
- package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +5 -2
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +13 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +89 -16
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +43 -40
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js +13 -1
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +2 -2
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js +18 -65
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/index.js +13 -0
- package/lib/commonjs/reanimated2/index.js.map +1 -1
- package/lib/commonjs/reanimated2/initializers.js +71 -32
- package/lib/commonjs/reanimated2/initializers.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolateColor.js +96 -19
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +103 -13
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +22 -0
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js +2 -0
- package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/global.js +0 -2
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +0 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +11 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +8 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +17 -9
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -14
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -14
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -15
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +13 -0
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +94 -0
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
- package/lib/commonjs/reanimated2/mappers.js +18 -6
- package/lib/commonjs/reanimated2/mappers.js.map +1 -1
- package/lib/commonjs/reanimated2/mock.js +20 -1
- package/lib/commonjs/reanimated2/mock.js.map +1 -1
- package/lib/commonjs/reanimated2/mutables.js +4 -2
- package/lib/commonjs/reanimated2/mutables.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +42 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +15 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
- package/lib/commonjs/reanimated2/pluginUtils.js +11 -0
- package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -0
- package/lib/commonjs/reanimated2/shareables.js +36 -15
- package/lib/commonjs/reanimated2/shareables.js.map +1 -1
- package/lib/commonjs/reanimated2/threads.js +114 -4
- package/lib/commonjs/reanimated2/threads.js.map +1 -1
- package/lib/commonjs/reanimated2/utils.js +7 -0
- package/lib/commonjs/reanimated2/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/valueSetter.js +1 -3
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/createAnimatedComponent.js +229 -29
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/Colors.js +35 -19
- package/lib/module/reanimated2/Colors.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +16 -32
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +5 -1
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +17 -16
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +29 -0
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/core.js +32 -7
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js +1 -1
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +5 -2
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +12 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +2 -2
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +88 -13
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +46 -43
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +12 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +2 -2
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js +17 -60
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js +1 -0
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +72 -33
- package/lib/module/reanimated2/initializers.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +96 -19
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +1 -1
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +103 -13
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/Mapper.js +21 -0
- package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/WebSensor.js +2 -0
- package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/global.js +0 -2
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +0 -1
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +9 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +15 -8
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -21
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -12
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -13
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -21
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js +1 -0
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +82 -0
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
- package/lib/module/reanimated2/mappers.js +16 -6
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mock.js +20 -1
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +4 -2
- package/lib/module/reanimated2/mutables.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.js +35 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js +8 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
- package/lib/module/reanimated2/pluginUtils.js +4 -0
- package/lib/module/reanimated2/pluginUtils.js.map +1 -0
- package/lib/module/reanimated2/shareables.js +36 -12
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/threads.js +105 -4
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/utils.js +5 -0
- package/lib/module/reanimated2/utils.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +1 -2
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/package.json +10 -10
- package/{plugin.js → plugin/index.js} +128 -249
- package/react-native-reanimated.d.ts +57 -10
- package/scripts/reanimated_utils.rb +15 -2
- package/src/createAnimatedComponent.tsx +238 -28
- package/src/reanimated2/Colors.ts +38 -11
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +52 -39
- package/src/reanimated2/animation/styleAnimation.ts +8 -1
- package/src/reanimated2/animation/util.ts +29 -16
- package/src/reanimated2/commonTypes.ts +28 -1
- package/src/reanimated2/core.ts +42 -9
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +2 -2
- package/src/reanimated2/globals.d.ts +12 -15
- package/src/reanimated2/hook/index.ts +1 -1
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +10 -4
- package/src/reanimated2/hook/useAnimatedReaction.ts +12 -5
- package/src/reanimated2/hook/useAnimatedRef.ts +1 -4
- package/src/reanimated2/hook/useAnimatedSensor.ts +88 -11
- package/src/reanimated2/hook/useAnimatedStyle.ts +44 -36
- package/src/reanimated2/hook/useDerivedValue.ts +8 -1
- package/src/reanimated2/hook/useScrollViewOffset.ts +2 -2
- package/src/reanimated2/hook/utils.ts +15 -61
- package/src/reanimated2/index.ts +1 -0
- package/src/reanimated2/initializers.ts +76 -35
- package/src/reanimated2/interpolateColor.ts +104 -20
- package/src/reanimated2/jestUtils.ts +1 -1
- package/src/reanimated2/js-reanimated/JSReanimated.ts +98 -15
- package/src/reanimated2/js-reanimated/Mapper.ts +32 -0
- package/src/reanimated2/js-reanimated/WebSensor.ts +34 -0
- package/src/reanimated2/js-reanimated/commonTypes.ts +0 -1
- package/src/reanimated2/js-reanimated/global.ts +0 -1
- package/src/reanimated2/js-reanimated/index.ts +0 -1
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +13 -1
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
- package/src/reanimated2/layoutReanimation/animationsManager.ts +17 -9
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
- package/src/reanimated2/layoutReanimation/index.ts +1 -0
- package/src/reanimated2/layoutReanimation/sharedTransitions/index.ts +87 -0
- package/src/reanimated2/mappers.ts +17 -6
- package/src/reanimated2/mock.ts +24 -1
- package/src/reanimated2/mutables.ts +2 -0
- package/src/reanimated2/platform-specific/checkVersion.ts +39 -0
- package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
- package/src/reanimated2/pluginUtils.ts +8 -0
- package/src/reanimated2/shareables.ts +45 -16
- package/src/reanimated2/threads.ts +103 -1
- package/src/reanimated2/utils.ts +6 -0
- package/src/reanimated2/valueSetter.ts +1 -2
- package/lib/commonjs/reanimated2/time.js +0 -55
- package/lib/commonjs/reanimated2/time.js.map +0 -1
- package/lib/module/reanimated2/time.js +0 -37
- package/lib/module/reanimated2/time.js.map +0 -1
- package/src/reanimated2/time.ts +0 -30
- /package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -0
package/android/build.gradle
CHANGED
|
@@ -44,10 +44,7 @@ def safeExtGet(prop, fallback) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
def safeAppExtGet(prop, fallback) {
|
|
47
|
-
|
|
48
|
-
return fallback
|
|
49
|
-
}
|
|
50
|
-
def appProject = project(':app')
|
|
47
|
+
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
51
48
|
appProject?.ext?.has(prop) ? appProject.ext.get(prop) : fallback
|
|
52
49
|
}
|
|
53
50
|
|
|
@@ -110,7 +107,7 @@ def resolveReactNativeDirectory() {
|
|
|
110
107
|
return reactNativeFromNodeModulesWithReanimated
|
|
111
108
|
}
|
|
112
109
|
|
|
113
|
-
throw new
|
|
110
|
+
throw new GradleException(
|
|
114
111
|
"[Reanimated] Unable to resolve react-native location in " +
|
|
115
112
|
"node_modules. You should project extension property (in app/build.gradle) " +
|
|
116
113
|
"`REACT_NATIVE_NODE_MODULES_DIR` with path to react-native."
|
|
@@ -172,7 +169,7 @@ def checkNoMultipleInstances() {
|
|
|
172
169
|
"https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/" +
|
|
173
170
|
"troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict " +
|
|
174
171
|
"between: \n" + parsedLocation + "\n";
|
|
175
|
-
throw new
|
|
172
|
+
throw new GradleException(exceptionMessage)
|
|
176
173
|
}
|
|
177
174
|
}
|
|
178
175
|
|
|
@@ -204,16 +201,18 @@ def reactNativeRootDir = resolveReactNativeDirectory()
|
|
|
204
201
|
def reactProperties = new Properties()
|
|
205
202
|
file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
|
|
206
203
|
|
|
204
|
+
def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
|
|
205
|
+
def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
|
|
206
|
+
def REANIMATED_PACKAGE_BUILD = System.getenv("REANIMATED_PACKAGE_BUILD")
|
|
207
|
+
def REANIMATED_VERSION = getReanimatedVersion()
|
|
208
|
+
def REANIMATED_MAJOR_VERSION = getReanimatedMajorVersion()
|
|
209
|
+
|
|
210
|
+
// for React Native <= 0.70
|
|
207
211
|
def BOOST_VERSION = reactProperties.getProperty("BOOST_VERSION")
|
|
208
212
|
def DOUBLE_CONVERSION_VERSION = reactProperties.getProperty("DOUBLE_CONVERSION_VERSION")
|
|
209
213
|
def FOLLY_VERSION = reactProperties.getProperty("FOLLY_VERSION")
|
|
210
214
|
def GLOG_VERSION = reactProperties.getProperty("GLOG_VERSION")
|
|
211
|
-
def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
|
|
212
|
-
def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
|
|
213
215
|
def FBJNI_VERSION = "0.3.0"
|
|
214
|
-
def REANIMATED_PACKAGE_BUILD = System.getenv("REANIMATED_PACKAGE_BUILD")
|
|
215
|
-
def REANIMATED_VERSION = getReanimatedVersion()
|
|
216
|
-
def REANIMATED_MAJOR_VERSION = getReanimatedMajorVersion()
|
|
217
216
|
|
|
218
217
|
// We download various C++ open-source dependencies into downloads.
|
|
219
218
|
// We then copy both the downloaded code and our custom makefiles and headers into third-party-ndk.
|
|
@@ -226,22 +225,26 @@ def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
|
|
|
226
225
|
def reactNativeThirdParty = new File("$reactNativeRootDir/ReactAndroid/src/main/jni/third-party")
|
|
227
226
|
def reactNativeAndroidDownloadDir = new File("$reactNativeRootDir/ReactAndroid/build/downloads")
|
|
228
227
|
|
|
229
|
-
def _stackProtectorFlag = true
|
|
230
|
-
|
|
231
228
|
def JS_RUNTIME = {
|
|
232
|
-
//
|
|
229
|
+
// Override JS runtime with environment variable
|
|
233
230
|
if (System.getenv("JS_RUNTIME")) {
|
|
234
231
|
return System.getenv("JS_RUNTIME")
|
|
235
232
|
}
|
|
236
233
|
|
|
237
|
-
//
|
|
238
|
-
def defaultRuntimeType = "jsc";
|
|
234
|
+
// Enable V8 runtime if react-native-v8 is installed
|
|
239
235
|
def v8Project = rootProject.getSubprojects().find { project -> project.name == "react-native-v8" }
|
|
240
236
|
if (v8Project != null) {
|
|
241
237
|
return "v8"
|
|
242
238
|
}
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
|
|
240
|
+
// Check if Hermes is enabled in app setup
|
|
241
|
+
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
242
|
+
if ((REACT_NATIVE_MINOR_VERSION >= 71 && appProject?.hermesEnabled?.toBoolean()) || appProject?.ext?.react?.enableHermes?.toBoolean()) {
|
|
243
|
+
return "hermes"
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Use JavaScriptCore (JSC) by default
|
|
247
|
+
return "jsc"
|
|
245
248
|
}.call()
|
|
246
249
|
|
|
247
250
|
def jsRuntimeDir = {
|
|
@@ -282,10 +285,10 @@ def detectAAR(Integer rnMinorVersion, String engine) { // Reanimated2 only
|
|
|
282
285
|
println "\n\n\n"
|
|
283
286
|
println "****************************************************************************************"
|
|
284
287
|
println "\n\n\n"
|
|
285
|
-
println "WARNING reanimated - no version-specific reanimated AAR for react-native version $
|
|
288
|
+
println "WARNING reanimated - no version-specific reanimated AAR for react-native version $rnMinorVersion found."
|
|
286
289
|
println "Falling back to AAR for react-native version $rnMinorVersionCopy."
|
|
287
290
|
println "The react-native JSI interface is not ABI-safe yet, this may result in crashes."
|
|
288
|
-
println "Please post a pull request to implement support for react-native version $
|
|
291
|
+
println "Please post a pull request to implement support for react-native version $rnMinorVersion to the reanimated repo."
|
|
289
292
|
println "Thanks!"
|
|
290
293
|
println "\n\n\n"
|
|
291
294
|
println "****************************************************************************************"
|
|
@@ -402,25 +405,6 @@ if (!BUILD_FROM_SOURCE && !isNewArchitectureEnabled()) { // Reanimated2 only
|
|
|
402
405
|
if (!BUILD_FROM_SOURCE) {
|
|
403
406
|
return
|
|
404
407
|
}
|
|
405
|
-
// You need to have following folders in this directory:
|
|
406
|
-
// - boost_1_63_0
|
|
407
|
-
// - double-conversion-1.1.6
|
|
408
|
-
// - folly-deprecate-dynamic-initializer
|
|
409
|
-
// - glog-0.3.5
|
|
410
|
-
def dependenciesPath = System.getenv("REACT_NATIVE_DEPENDENCIES")
|
|
411
|
-
|
|
412
|
-
// The Boost library is a very large download (>100MB).
|
|
413
|
-
// If Boost is already present on your system, define the REACT_NATIVE_BOOST_PATH env variable
|
|
414
|
-
// and the build will use that.
|
|
415
|
-
def boostPath = dependenciesPath ?: System.getenv("REACT_NATIVE_BOOST_PATH")
|
|
416
|
-
|
|
417
|
-
def follyReplaceContent = '''
|
|
418
|
-
ssize_t r;
|
|
419
|
-
do {
|
|
420
|
-
r = open(name, flags, mode);
|
|
421
|
-
} while (r == -1 && errno == EINTR);
|
|
422
|
-
return r;
|
|
423
|
-
'''
|
|
424
408
|
|
|
425
409
|
buildscript {
|
|
426
410
|
repositories {
|
|
@@ -431,7 +415,7 @@ buildscript {
|
|
|
431
415
|
}
|
|
432
416
|
}
|
|
433
417
|
dependencies {
|
|
434
|
-
classpath "com.android.tools.build:gradle:7.3.
|
|
418
|
+
classpath "com.android.tools.build:gradle:7.3.1"
|
|
435
419
|
classpath "de.undercouch:gradle-download-task:5.0.1"
|
|
436
420
|
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.11.0"
|
|
437
421
|
}
|
|
@@ -447,6 +431,11 @@ apply plugin: "de.undercouch.download"
|
|
|
447
431
|
|
|
448
432
|
android {
|
|
449
433
|
compileSdkVersion safeExtGet("compileSdkVersion", 30)
|
|
434
|
+
if (REACT_NATIVE_MINOR_VERSION >= 71) {
|
|
435
|
+
buildFeatures {
|
|
436
|
+
prefab true
|
|
437
|
+
}
|
|
438
|
+
}
|
|
450
439
|
defaultConfig {
|
|
451
440
|
minSdkVersion safeExtGet("minSdkVersion", 16)
|
|
452
441
|
targetSdkVersion safeExtGet("targetSdkVersion", 30)
|
|
@@ -458,7 +447,7 @@ android {
|
|
|
458
447
|
arguments "-DANDROID_STL=c++_shared",
|
|
459
448
|
"-DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION}",
|
|
460
449
|
"-DANDROID_TOOLCHAIN=clang",
|
|
461
|
-
"-DBOOST_VERSION=${BOOST_VERSION}",
|
|
450
|
+
REACT_NATIVE_MINOR_VERSION < 71 ? "-DBOOST_VERSION=${BOOST_VERSION}" : "-DBOOST_VERSION=",
|
|
462
451
|
"-DREACT_NATIVE_DIR=${toPlatformFileString(reactNativeRootDir.path)}",
|
|
463
452
|
"-DJS_RUNTIME=${JS_RUNTIME}",
|
|
464
453
|
"-DJS_RUNTIME_DIR=${jsRuntimeDir}",
|
|
@@ -468,13 +457,14 @@ android {
|
|
|
468
457
|
"-DREANIMATED_PACKAGE_BUILD=${REANIMATED_PACKAGE_BUILD}",
|
|
469
458
|
"-DREANIMATED_VERSION=${REANIMATED_VERSION}"
|
|
470
459
|
abiFilters (*reactNativeArchitectures())
|
|
471
|
-
_stackProtectorFlag ? (cppFlags("-fstack-protector-all")) : null
|
|
472
460
|
}
|
|
473
461
|
}
|
|
474
462
|
|
|
475
463
|
buildConfigField("boolean", "IS_INTERNAL_BUILD", "false")
|
|
476
464
|
buildConfigField("int", "EXOPACKAGE_FLAGS", "0")
|
|
477
465
|
buildConfigField("int", "REACT_NATIVE_MINOR_VERSION", REACT_NATIVE_MINOR_VERSION.toString())
|
|
466
|
+
|
|
467
|
+
consumerProguardFiles 'proguard-rules.pro'
|
|
478
468
|
}
|
|
479
469
|
externalNativeBuild {
|
|
480
470
|
cmake {
|
|
@@ -485,7 +475,7 @@ android {
|
|
|
485
475
|
debug {
|
|
486
476
|
externalNativeBuild {
|
|
487
477
|
cmake {
|
|
488
|
-
if (JS_RUNTIME == "hermes") {
|
|
478
|
+
if (JS_RUNTIME == "hermes" && !REANIMATED_PACKAGE_BUILD) {
|
|
489
479
|
arguments "-DHERMES_ENABLE_DEBUGGER=1"
|
|
490
480
|
} else {
|
|
491
481
|
arguments "-DHERMES_ENABLE_DEBUGGER=0"
|
|
@@ -517,7 +507,10 @@ android {
|
|
|
517
507
|
"**/libglog.so",
|
|
518
508
|
"**/libhermes.so",
|
|
519
509
|
"**/libhermes-executor-debug.so",
|
|
510
|
+
"**/libhermes_executor.so",
|
|
520
511
|
"**/libreactnativejni.so",
|
|
512
|
+
"**/libturbomodulejsijni.so",
|
|
513
|
+
"**/libreact_nativemodule_core.so",
|
|
521
514
|
"**/libjscexecutor.so",
|
|
522
515
|
"**/libv8executor.so",
|
|
523
516
|
]
|
|
@@ -566,6 +559,13 @@ android {
|
|
|
566
559
|
srcDirs += "src/reactNativeVersionPatch/UIImplementation/latest"
|
|
567
560
|
}
|
|
568
561
|
|
|
562
|
+
// ReanimatedUIManager & ReanimatedUIImplementation
|
|
563
|
+
if (REACT_NATIVE_MINOR_VERSION <= 70) {
|
|
564
|
+
srcDirs += "src/reactNativeVersionPatch/ReanimatedUIManager/70"
|
|
565
|
+
} else {
|
|
566
|
+
srcDirs += "src/reactNativeVersionPatch/ReanimatedUIManager/latest"
|
|
567
|
+
}
|
|
568
|
+
|
|
569
569
|
// nativeHierarchyManager
|
|
570
570
|
if (REACT_NATIVE_MINOR_VERSION <= 62) {
|
|
571
571
|
srcDirs += "src/reactNativeVersionPatch/nativeHierarchyManager/62"
|
|
@@ -586,7 +586,7 @@ def assertNoMultipleInstances = task assertNoMultipleInstancesTask {
|
|
|
586
586
|
def assertNoReanimated2WithNewArchitecture = task assertNoReanimated2WithNewArchitectureTask {
|
|
587
587
|
onlyIf { isNewArchitectureEnabled() && REANIMATED_MAJOR_VERSION == 2 }
|
|
588
588
|
doFirst {
|
|
589
|
-
throw new
|
|
589
|
+
throw new GradleException(
|
|
590
590
|
"\n[react-native-reanimated] Reanimated 2.x does not support Fabric. " +
|
|
591
591
|
"Please upgrade to 3.x to use Reanimated with the New Architecture. " +
|
|
592
592
|
"For details, see https://blog.swmansion.com/announcing-reanimated-3-16167428c5f7"
|
|
@@ -594,8 +594,19 @@ def assertNoReanimated2WithNewArchitecture = task assertNoReanimated2WithNewArch
|
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
|
|
597
|
+
def assertLatestReactNativeWithNewArchitecture = task assertLatestReactNativeWithNewArchitectureTask {
|
|
598
|
+
onlyIf { isNewArchitectureEnabled() && REANIMATED_MAJOR_VERSION == 3 && REACT_NATIVE_MINOR_VERSION < 71 }
|
|
599
|
+
doFirst {
|
|
600
|
+
throw new GradleException(
|
|
601
|
+
"\n[react-native-reanimated] Reanimated " + REANIMATED_VERSION + " supports the New Architecture " +
|
|
602
|
+
"only on the latest minor release of React Native. Please upgrade to React Native 0.71.0+ " +
|
|
603
|
+
"or downgrade to an older version of Reanimated v3."
|
|
604
|
+
)
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
597
608
|
tasks.preBuild {
|
|
598
|
-
dependsOn assertNoMultipleInstances, assertNoReanimated2WithNewArchitecture
|
|
609
|
+
dependsOn assertNoMultipleInstances, assertNoReanimated2WithNewArchitecture, assertLatestReactNativeWithNewArchitecture
|
|
599
610
|
}
|
|
600
611
|
|
|
601
612
|
task cleanCmakeCache() {
|
|
@@ -637,153 +648,17 @@ def resolveTaskFactory(String taskName, String artifactLocalName, File reactNati
|
|
|
637
648
|
}
|
|
638
649
|
}
|
|
639
650
|
|
|
640
|
-
Task resolveBoost = resolveTaskFactory("resolveBoost", "boost_${BOOST_VERSION}.tar.gz", reactNativeAndroidDownloadDir, downloadsDir)
|
|
641
|
-
Task resolveDoubleConversion = resolveTaskFactory(
|
|
642
|
-
"resolveDoubleConversion",
|
|
643
|
-
"double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz",
|
|
644
|
-
reactNativeAndroidDownloadDir,
|
|
645
|
-
downloadsDir
|
|
646
|
-
)
|
|
647
|
-
Task resolveFolly = resolveTaskFactory("resolveFolly", "folly-${FOLLY_VERSION}.tar.gz", reactNativeAndroidDownloadDir, downloadsDir)
|
|
648
|
-
Task resolveGlog = resolveTaskFactory("resolveGlog", "glog-${GLOG_VERSION}.tar.gz", reactNativeAndroidDownloadDir, downloadsDir)
|
|
649
|
-
|
|
650
|
-
if (isNewArchitectureEnabled()) {
|
|
651
|
-
def reactNativeAndroidProject = findProject(":ReactAndroid")
|
|
652
|
-
if (reactNativeAndroidProject != null) {
|
|
653
|
-
reactNativeAndroidProject.afterEvaluate {
|
|
654
|
-
def resolveTasks = [resolveBoost, resolveGlog, resolveDoubleConversion, resolveFolly]
|
|
655
|
-
resolveTasks.forEach({ task ->
|
|
656
|
-
String reactAndroidDownloadTaskName = "download" + task.name.replace("resolve", "")
|
|
657
|
-
def reactAndroidDownloadTask = reactNativeAndroidProject.getTasks().findByName(reactAndroidDownloadTaskName)
|
|
658
|
-
if (reactAndroidDownloadTask != null) {
|
|
659
|
-
task.dependsOn(reactAndroidDownloadTask)
|
|
660
|
-
} else {
|
|
661
|
-
logger.warn("[Reanimated] Failed to find task named `$reactAndroidDownloadTaskName` in `:ReactAndroid` project." +
|
|
662
|
-
" Explicit dependency between it and $task.name task can not be set.")
|
|
663
|
-
}
|
|
664
|
-
})
|
|
665
|
-
}
|
|
666
|
-
} else {
|
|
667
|
-
throw new GradleScriptException("[Reanimated] Failed to find `:ReactAndroid` project. Explicit dependency between download tasks can not be set.")
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
task downloadBoost(dependsOn: resolveBoost, type: Download) {
|
|
672
|
-
def transformedVersion = BOOST_VERSION.replace("_", ".")
|
|
673
|
-
def artifactLocalName = "boost_${BOOST_VERSION}.tar.gz"
|
|
674
|
-
def srcUrl = "https://boostorg.jfrog.io/artifactory/main/release/${transformedVersion}/source/boost_${BOOST_VERSION}.tar.gz"
|
|
675
|
-
if (REACT_NATIVE_MINOR_VERSION < 69) {
|
|
676
|
-
srcUrl = "https://github.com/react-native-community/boost-for-react-native/releases/download/v${transformedVersion}-0/boost_${BOOST_VERSION}.tar.gz"
|
|
677
|
-
}
|
|
678
|
-
src(srcUrl)
|
|
679
|
-
onlyIfNewer(true)
|
|
680
|
-
overwrite(false)
|
|
681
|
-
dest(new File(downloadsDir, artifactLocalName))
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
|
|
685
|
-
from(boostPath ?: tarTree(resources.gzip(downloadBoost.dest)))
|
|
686
|
-
from("$reactNativeThirdParty/boost/Android.mk")
|
|
687
|
-
include("Android.mk", "boost_${BOOST_VERSION}/boost/**/*.hpp", "boost/boost/**/*.hpp")
|
|
688
|
-
includeEmptyDirs = false
|
|
689
|
-
into("$thirdPartyNdkDir/boost")
|
|
690
|
-
doLast {
|
|
691
|
-
file("$thirdPartyNdkDir/boost/boost").renameTo("$thirdPartyNdkDir/boost/boost_${BOOST_VERSION}")
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
task downloadDoubleConversion(dependsOn: resolveDoubleConversion, type: Download) {
|
|
696
|
-
src("https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz")
|
|
697
|
-
onlyIfNewer(true)
|
|
698
|
-
overwrite(false)
|
|
699
|
-
dest(new File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz"))
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
task prepareDoubleConversion(dependsOn: dependenciesPath ? [] : [downloadDoubleConversion], type: Copy) {
|
|
703
|
-
from(dependenciesPath ?: tarTree(downloadDoubleConversion.dest))
|
|
704
|
-
from("$reactNativeThirdParty/double-conversion/Android.mk")
|
|
705
|
-
include("double-conversion-${DOUBLE_CONVERSION_VERSION}/src/**/*", "Android.mk")
|
|
706
|
-
filesMatching("*/src/**/*", { fname -> fname.path = "double-conversion/${fname.name}" })
|
|
707
|
-
includeEmptyDirs = false
|
|
708
|
-
into("$thirdPartyNdkDir/double-conversion")
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
task downloadFolly(dependsOn: resolveFolly, type: Download) {
|
|
712
|
-
src("https://github.com/facebook/folly/archive/v${FOLLY_VERSION}.tar.gz")
|
|
713
|
-
onlyIfNewer(true)
|
|
714
|
-
overwrite(false)
|
|
715
|
-
dest(new File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz"))
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy) {
|
|
719
|
-
from(dependenciesPath ?: tarTree(downloadFolly.dest))
|
|
720
|
-
from("$reactNativeThirdParty/folly/Android.mk")
|
|
721
|
-
include("folly-${FOLLY_VERSION}/folly/**/*", "Android.mk")
|
|
722
|
-
eachFile { fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/") }
|
|
723
|
-
// Fixes problem with Folly failing to build on certain systems. See
|
|
724
|
-
// https://github.com/software-mansion/react-native-reanimated/issues/1024
|
|
725
|
-
filter { line -> line.replaceAll("return int\\(wrapNoInt\\(open, name, flags, mode\\)\\);", follyReplaceContent) }
|
|
726
|
-
includeEmptyDirs = false
|
|
727
|
-
into("$thirdPartyNdkDir/folly")
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
task downloadGlog(dependsOn: resolveGlog, type: Download) {
|
|
731
|
-
src("https://github.com/google/glog/archive/v${GLOG_VERSION}.tar.gz")
|
|
732
|
-
onlyIfNewer(true)
|
|
733
|
-
overwrite(false)
|
|
734
|
-
dest(new File(downloadsDir, "glog-${GLOG_VERSION}.tar.gz"))
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
// Prepare glog sources to be compiled, this task will perform steps that normally should've been
|
|
738
|
-
// executed by automake. This way we can avoid dependencies on make/automake
|
|
739
|
-
task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy) {
|
|
740
|
-
duplicatesStrategy = "include"
|
|
741
|
-
from(dependenciesPath ?: tarTree(downloadGlog.dest))
|
|
742
|
-
from("$reactNativeThirdParty/glog/")
|
|
743
|
-
include("glog-${GLOG_VERSION}/src/**/*", "Android.mk", "config.h")
|
|
744
|
-
includeEmptyDirs = false
|
|
745
|
-
filesMatching("**/*.h.in") {
|
|
746
|
-
filter(ReplaceTokens, tokens: [
|
|
747
|
-
ac_cv_have_unistd_h : "1",
|
|
748
|
-
ac_cv_have_stdint_h : "1",
|
|
749
|
-
ac_cv_have_systypes_h : "1",
|
|
750
|
-
ac_cv_have_inttypes_h : "1",
|
|
751
|
-
ac_cv_have_libgflags : "0",
|
|
752
|
-
ac_google_start_namespace : "namespace google {",
|
|
753
|
-
ac_cv_have_uint16_t : "1",
|
|
754
|
-
ac_cv_have_u_int16_t : "1",
|
|
755
|
-
ac_cv_have___uint16 : "0",
|
|
756
|
-
ac_google_end_namespace : "}",
|
|
757
|
-
ac_cv_have___builtin_expect : "1",
|
|
758
|
-
ac_google_namespace : "google",
|
|
759
|
-
ac_cv___attribute___noinline : "__attribute__ ((noinline))",
|
|
760
|
-
ac_cv___attribute___noreturn : "__attribute__ ((noreturn))",
|
|
761
|
-
ac_cv___attribute___printf_4_5: "__attribute__((__format__ (__printf__, 4, 5)))"
|
|
762
|
-
])
|
|
763
|
-
it.path = (it.name - ".in")
|
|
764
|
-
}
|
|
765
|
-
into("$thirdPartyNdkDir/glog")
|
|
766
|
-
|
|
767
|
-
doLast {
|
|
768
|
-
copy {
|
|
769
|
-
from(fileTree(dir: "$thirdPartyNdkDir/glog", includes: ["stl_logging.h", "logging.h", "raw_logging.h", "vlog_is_on.h", "**/src/glog/log_severity.h"]).files)
|
|
770
|
-
includeEmptyDirs = false
|
|
771
|
-
into("$thirdPartyNdkDir/glog/exported/glog")
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
|
|
776
651
|
/*
|
|
777
652
|
Reanimated includes "hermes/hermes.h" header file in `NativeProxy.cpp`.
|
|
778
653
|
Previously, we used header files from `hermes-engine` package in `node_modules`.
|
|
779
|
-
|
|
654
|
+
In React Native 0.69 and 0.70, Hermes is no longer distributed as package on NPM.
|
|
780
655
|
On the new architecture, Hermes is downloaded from GitHub and then compiled from sources.
|
|
781
656
|
However, on the old architecture, we need to download Hermes header files on our own
|
|
782
657
|
as well as unzip Hermes AAR in order to obtain `libhermes.so` shared library.
|
|
783
658
|
For more details, see https://reactnative.dev/architecture/bundled-hermes
|
|
784
659
|
or https://github.com/reactwg/react-native-new-architecture/discussions/4
|
|
785
660
|
*/
|
|
786
|
-
if (REACT_NATIVE_MINOR_VERSION
|
|
661
|
+
if (REACT_NATIVE_MINOR_VERSION in [69, 70] && !isNewArchitectureEnabled()) {
|
|
787
662
|
// copied from `react-native/ReactAndroid/hermes-engine/build.gradle`
|
|
788
663
|
|
|
789
664
|
def downloadDir = customDownloadsDir ? new File(customDownloadsDir) : new File(reactNativeRootDir, "sdks/download")
|
|
@@ -819,110 +694,306 @@ if (REACT_NATIVE_MINOR_VERSION >= 69 && !isNewArchitectureEnabled()) {
|
|
|
819
694
|
}
|
|
820
695
|
}
|
|
821
696
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
697
|
+
if (REACT_NATIVE_MINOR_VERSION < 71) {
|
|
698
|
+
// You need to have following folders in this directory:
|
|
699
|
+
// - boost_1_63_0
|
|
700
|
+
// - double-conversion-1.1.6
|
|
701
|
+
// - folly-deprecate-dynamic-initializer
|
|
702
|
+
// - glog-0.3.5
|
|
703
|
+
def dependenciesPath = System.getenv("REACT_NATIVE_DEPENDENCIES")
|
|
704
|
+
|
|
705
|
+
// The Boost library is a very large download (>100MB).
|
|
706
|
+
// If Boost is already present on your system, define the REACT_NATIVE_BOOST_PATH env variable
|
|
707
|
+
// and the build will use that.
|
|
708
|
+
def boostPath = dependenciesPath ?: System.getenv("REACT_NATIVE_BOOST_PATH")
|
|
709
|
+
|
|
710
|
+
def follyReplaceContent = '''
|
|
711
|
+
ssize_t r;
|
|
712
|
+
do {
|
|
713
|
+
r = open(name, flags, mode);
|
|
714
|
+
} while (r == -1 && errno == EINTR);
|
|
715
|
+
return r;
|
|
716
|
+
'''
|
|
717
|
+
|
|
718
|
+
Task resolveBoost = resolveTaskFactory("resolveBoost", "boost_${BOOST_VERSION}.tar.gz", reactNativeAndroidDownloadDir, downloadsDir)
|
|
719
|
+
Task resolveDoubleConversion = resolveTaskFactory(
|
|
720
|
+
"resolveDoubleConversion",
|
|
721
|
+
"double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz",
|
|
722
|
+
reactNativeAndroidDownloadDir,
|
|
723
|
+
downloadsDir
|
|
724
|
+
)
|
|
725
|
+
Task resolveFolly = resolveTaskFactory("resolveFolly", "folly-${FOLLY_VERSION}.tar.gz", reactNativeAndroidDownloadDir, downloadsDir)
|
|
726
|
+
Task resolveGlog = resolveTaskFactory("resolveGlog", "glog-${GLOG_VERSION}.tar.gz", reactNativeAndroidDownloadDir, downloadsDir)
|
|
727
|
+
|
|
728
|
+
if (isNewArchitectureEnabled()) {
|
|
729
|
+
def reactNativeAndroidProject = findProject(":ReactAndroid")
|
|
730
|
+
if (reactNativeAndroidProject != null) {
|
|
731
|
+
reactNativeAndroidProject.afterEvaluate {
|
|
732
|
+
def resolveTasks = [resolveBoost, resolveGlog, resolveDoubleConversion, resolveFolly]
|
|
733
|
+
resolveTasks.forEach({ task ->
|
|
734
|
+
String reactAndroidDownloadTaskName = "download" + task.name.replace("resolve", "")
|
|
735
|
+
def reactAndroidDownloadTask = reactNativeAndroidProject.getTasks().findByName(reactAndroidDownloadTaskName)
|
|
736
|
+
if (reactAndroidDownloadTask != null) {
|
|
737
|
+
task.dependsOn(reactAndroidDownloadTask)
|
|
738
|
+
} else {
|
|
739
|
+
logger.warn("[Reanimated] Failed to find task named `$reactAndroidDownloadTaskName` in `:ReactAndroid` project." +
|
|
740
|
+
" Explicit dependency between it and $task.name task can not be set.")
|
|
741
|
+
}
|
|
742
|
+
})
|
|
743
|
+
}
|
|
744
|
+
} else {
|
|
745
|
+
throw new GradleException("[Reanimated] Failed to find `:ReactAndroid` project. Explicit dependency between download tasks can not be set.")
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
task downloadBoost(dependsOn: resolveBoost, type: Download) {
|
|
750
|
+
def transformedVersion = BOOST_VERSION.replace("_", ".")
|
|
751
|
+
def artifactLocalName = "boost_${BOOST_VERSION}.tar.gz"
|
|
752
|
+
def srcUrl = "https://boostorg.jfrog.io/artifactory/main/release/${transformedVersion}/source/boost_${BOOST_VERSION}.tar.gz"
|
|
753
|
+
if (REACT_NATIVE_MINOR_VERSION < 69) {
|
|
754
|
+
srcUrl = "https://github.com/react-native-community/boost-for-react-native/releases/download/v${transformedVersion}-0/boost_${BOOST_VERSION}.tar.gz"
|
|
826
755
|
}
|
|
756
|
+
src(srcUrl)
|
|
757
|
+
onlyIfNewer(true)
|
|
758
|
+
overwrite(false)
|
|
759
|
+
dest(new File(downloadsDir, artifactLocalName))
|
|
760
|
+
}
|
|
827
761
|
|
|
762
|
+
task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
|
|
763
|
+
from(boostPath ?: tarTree(resources.gzip(downloadBoost.dest)))
|
|
764
|
+
from("$reactNativeThirdParty/boost/Android.mk")
|
|
765
|
+
include("Android.mk", "boost_${BOOST_VERSION}/boost/**/*.hpp", "boost/boost/**/*.hpp")
|
|
766
|
+
includeEmptyDirs = false
|
|
767
|
+
into("$thirdPartyNdkDir/boost")
|
|
828
768
|
doLast {
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
769
|
+
file("$thirdPartyNdkDir/boost/boost").renameTo("$thirdPartyNdkDir/boost/boost_${BOOST_VERSION}")
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
task downloadDoubleConversion(dependsOn: resolveDoubleConversion, type: Download) {
|
|
774
|
+
src("https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz")
|
|
775
|
+
onlyIfNewer(true)
|
|
776
|
+
overwrite(false)
|
|
777
|
+
dest(new File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz"))
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
task prepareDoubleConversion(dependsOn: dependenciesPath ? [] : [downloadDoubleConversion], type: Copy) {
|
|
781
|
+
from(dependenciesPath ?: tarTree(downloadDoubleConversion.dest))
|
|
782
|
+
from("$reactNativeThirdParty/double-conversion/Android.mk")
|
|
783
|
+
include("double-conversion-${DOUBLE_CONVERSION_VERSION}/src/**/*", "Android.mk")
|
|
784
|
+
filesMatching("*/src/**/*", { fname -> fname.path = "double-conversion/${fname.name}" })
|
|
785
|
+
includeEmptyDirs = false
|
|
786
|
+
into("$thirdPartyNdkDir/double-conversion")
|
|
787
|
+
}
|
|
838
788
|
|
|
839
|
-
|
|
789
|
+
task downloadFolly(dependsOn: resolveFolly, type: Download) {
|
|
790
|
+
src("https://github.com/facebook/folly/archive/v${FOLLY_VERSION}.tar.gz")
|
|
791
|
+
onlyIfNewer(true)
|
|
792
|
+
overwrite(false)
|
|
793
|
+
dest(new File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz"))
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy) {
|
|
797
|
+
from(dependenciesPath ?: tarTree(downloadFolly.dest))
|
|
798
|
+
from("$reactNativeThirdParty/folly/Android.mk")
|
|
799
|
+
include("folly-${FOLLY_VERSION}/folly/**/*", "Android.mk")
|
|
800
|
+
eachFile { fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/") }
|
|
801
|
+
// Fixes problem with Folly failing to build on certain systems. See
|
|
802
|
+
// https://github.com/software-mansion/react-native-reanimated/issues/1024
|
|
803
|
+
filter { line -> line.replaceAll("return int\\(wrapNoInt\\(open, name, flags, mode\\)\\);", follyReplaceContent) }
|
|
804
|
+
includeEmptyDirs = false
|
|
805
|
+
into("$thirdPartyNdkDir/folly")
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
task downloadGlog(dependsOn: resolveGlog, type: Download) {
|
|
809
|
+
src("https://github.com/google/glog/archive/v${GLOG_VERSION}.tar.gz")
|
|
810
|
+
onlyIfNewer(true)
|
|
811
|
+
overwrite(false)
|
|
812
|
+
dest(new File(downloadsDir, "glog-${GLOG_VERSION}.tar.gz"))
|
|
813
|
+
}
|
|
840
814
|
|
|
815
|
+
// Prepare glog sources to be compiled, this task will perform steps that normally should've been
|
|
816
|
+
// executed by automake. This way we can avoid dependencies on make/automake
|
|
817
|
+
task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy) {
|
|
818
|
+
duplicatesStrategy = "include"
|
|
819
|
+
from(dependenciesPath ?: tarTree(downloadGlog.dest))
|
|
820
|
+
from("$reactNativeThirdParty/glog/")
|
|
821
|
+
include("glog-${GLOG_VERSION}/src/**/*", "Android.mk", "config.h")
|
|
822
|
+
includeEmptyDirs = false
|
|
823
|
+
filesMatching("**/*.h.in") {
|
|
824
|
+
filter(ReplaceTokens, tokens: [
|
|
825
|
+
ac_cv_have_unistd_h : "1",
|
|
826
|
+
ac_cv_have_stdint_h : "1",
|
|
827
|
+
ac_cv_have_systypes_h : "1",
|
|
828
|
+
ac_cv_have_inttypes_h : "1",
|
|
829
|
+
ac_cv_have_libgflags : "0",
|
|
830
|
+
ac_google_start_namespace : "namespace google {",
|
|
831
|
+
ac_cv_have_uint16_t : "1",
|
|
832
|
+
ac_cv_have_u_int16_t : "1",
|
|
833
|
+
ac_cv_have___uint16 : "0",
|
|
834
|
+
ac_google_end_namespace : "}",
|
|
835
|
+
ac_cv_have___builtin_expect : "1",
|
|
836
|
+
ac_google_namespace : "google",
|
|
837
|
+
ac_cv___attribute___noinline : "__attribute__ ((noinline))",
|
|
838
|
+
ac_cv___attribute___noreturn : "__attribute__ ((noreturn))",
|
|
839
|
+
ac_cv___attribute___printf_4_5: "__attribute__((__format__ (__printf__, 4, 5)))"
|
|
840
|
+
])
|
|
841
|
+
it.path = (it.name - ".in")
|
|
842
|
+
}
|
|
843
|
+
into("$thirdPartyNdkDir/glog")
|
|
844
|
+
|
|
845
|
+
doLast {
|
|
841
846
|
copy {
|
|
842
|
-
from
|
|
843
|
-
|
|
844
|
-
into
|
|
847
|
+
from(fileTree(dir: "$thirdPartyNdkDir/glog", includes: ["stl_logging.h", "logging.h", "raw_logging.h", "vlog_is_on.h", "**/src/glog/log_severity.h"]).files)
|
|
848
|
+
includeEmptyDirs = false
|
|
849
|
+
into("$thirdPartyNdkDir/glog/exported/glog")
|
|
845
850
|
}
|
|
846
851
|
}
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
task prepareHermes {
|
|
855
|
+
if (REACT_NATIVE_MINOR_VERSION >= 69) {
|
|
856
|
+
if (!isNewArchitectureEnabled()) {
|
|
857
|
+
dependsOn(unzipHermes)
|
|
852
858
|
}
|
|
853
859
|
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
860
|
+
doLast {
|
|
861
|
+
// e.g. hermes-engine-0.70.0-rc.1-debug.aar
|
|
862
|
+
def hermesAAR = file(
|
|
863
|
+
"$reactNativeRootDir/android/com/facebook/react/hermes-engine/" +
|
|
864
|
+
"${REACT_NATIVE_VERSION}/hermes-engine-${REACT_NATIVE_VERSION}-" +
|
|
865
|
+
"${resolveBuildType()}.aar"
|
|
866
|
+
)
|
|
867
|
+
if (!hermesAAR.exists()) {
|
|
868
|
+
throw new GradleException("Could not find hermes-engine AAR", null)
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
def soFiles = zipTree(hermesAAR).matching({ it.include "**/*.so" })
|
|
872
|
+
|
|
873
|
+
copy {
|
|
874
|
+
from soFiles
|
|
875
|
+
from "$reactNativeRootDir/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
|
|
876
|
+
into "$thirdPartyNdkDir/hermes"
|
|
877
|
+
}
|
|
857
878
|
}
|
|
879
|
+
} else {
|
|
880
|
+
doLast {
|
|
881
|
+
def hermesPackagePath = findNodeModulePath(projectDir, "hermes-engine")
|
|
882
|
+
if (!hermesPackagePath) {
|
|
883
|
+
throw new GradleException("Could not find the hermes-engine npm package", null)
|
|
884
|
+
}
|
|
858
885
|
|
|
859
|
-
|
|
886
|
+
def hermesAAR = file("$hermesPackagePath/android/hermes-${resolveBuildType()}.aar") // e.g. hermes-debug.aar
|
|
887
|
+
if (!hermesAAR.exists()) {
|
|
888
|
+
throw new GradleException("The hermes-engine npm package is missing \"android/hermes-${resolveBuildType()}.aar\"", null)
|
|
889
|
+
}
|
|
860
890
|
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
891
|
+
def soFiles = zipTree(hermesAAR).matching({ it.include "**/*.so" })
|
|
892
|
+
|
|
893
|
+
copy {
|
|
894
|
+
from soFiles
|
|
895
|
+
from "$reactNativeRootDir/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
|
|
896
|
+
into "$thirdPartyNdkDir/hermes"
|
|
897
|
+
}
|
|
865
898
|
}
|
|
866
899
|
}
|
|
867
900
|
}
|
|
868
|
-
}
|
|
869
901
|
|
|
870
|
-
task prepareJSC {
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
902
|
+
task prepareJSC {
|
|
903
|
+
if (REACT_NATIVE_MINOR_VERSION >= 71) {
|
|
904
|
+
// do nothing
|
|
905
|
+
} else {
|
|
906
|
+
doLast {
|
|
907
|
+
def jscPackagePath = findNodeModulePath(projectDir, "jsc-android")
|
|
908
|
+
if (!jscPackagePath) {
|
|
909
|
+
throw new GradleException("Could not find the jsc-android npm package", null)
|
|
910
|
+
}
|
|
876
911
|
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
912
|
+
def jscDist = file("$jscPackagePath/dist")
|
|
913
|
+
if (!jscDist.exists()) {
|
|
914
|
+
throw new GradleException("The jsc-android npm package is missing its \"dist\" directory", null)
|
|
915
|
+
}
|
|
881
916
|
|
|
882
|
-
|
|
883
|
-
|
|
917
|
+
def jscAAR = fileTree(jscDist).matching({ it.include "**/android-jsc/**/*.aar" }).singleFile
|
|
918
|
+
def soFiles = zipTree(jscAAR).matching({ it.include "**/*.so" })
|
|
884
919
|
|
|
885
|
-
|
|
920
|
+
def headerFiles = fileTree(jscDist).matching({ it.include "**/include/*.h" })
|
|
886
921
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
922
|
+
copy {
|
|
923
|
+
from(soFiles)
|
|
924
|
+
from(headerFiles)
|
|
925
|
+
from("$reactNativeRootDir/ReactAndroid/src/main/jni/third-party/jsc/Android.mk")
|
|
891
926
|
|
|
892
|
-
|
|
927
|
+
filesMatching("**/*.h", { it.path = "JavaScriptCore/${it.name}" })
|
|
893
928
|
|
|
894
|
-
|
|
895
|
-
|
|
929
|
+
includeEmptyDirs(false)
|
|
930
|
+
into("$thirdPartyNdkDir/jsc")
|
|
931
|
+
}
|
|
932
|
+
}
|
|
896
933
|
}
|
|
897
934
|
}
|
|
898
|
-
}
|
|
899
935
|
|
|
900
|
-
task extractAARHeaders {
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
936
|
+
task extractAARHeaders {
|
|
937
|
+
doLast {
|
|
938
|
+
configurations.extractHeaders.files.each {
|
|
939
|
+
def file = it.absoluteFile
|
|
940
|
+
def packageName = file.name.tokenize('-')[0]
|
|
941
|
+
copy {
|
|
942
|
+
from zipTree(file)
|
|
943
|
+
into "$reactNativeRootDir/ReactAndroid/src/main/jni/first-party/$packageName/headers"
|
|
944
|
+
include "**/*.h"
|
|
945
|
+
}
|
|
909
946
|
}
|
|
910
947
|
}
|
|
911
948
|
}
|
|
912
|
-
}
|
|
913
949
|
|
|
914
|
-
task extractSOFiles {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
950
|
+
task extractSOFiles {
|
|
951
|
+
doLast {
|
|
952
|
+
configurations.extractSO.files.each {
|
|
953
|
+
def file = it.absoluteFile
|
|
954
|
+
def packageName = file.name.tokenize('-')[0]
|
|
955
|
+
copy {
|
|
956
|
+
from zipTree(file)
|
|
957
|
+
into "$reactNativeRootDir/ReactAndroid/src/main/jni/first-party/$packageName/"
|
|
958
|
+
include "jni/**/*.so"
|
|
959
|
+
}
|
|
923
960
|
}
|
|
924
961
|
}
|
|
925
962
|
}
|
|
963
|
+
|
|
964
|
+
task unpackReactNativeAAR {
|
|
965
|
+
def buildType = resolveBuildType()
|
|
966
|
+
def rnAarMatcher = "**/react-native/**/*${buildType}.aar"
|
|
967
|
+
if (REACT_NATIVE_MINOR_VERSION < 69) {
|
|
968
|
+
rnAarMatcher = "**/**/*.aar"
|
|
969
|
+
}
|
|
970
|
+
def rnAAR = fileTree("$reactNativeRootDir/android").matching({ it.include rnAarMatcher }).singleFile
|
|
971
|
+
def file = rnAAR.absoluteFile
|
|
972
|
+
def packageName = file.name.tokenize('-')[0]
|
|
973
|
+
copy {
|
|
974
|
+
from zipTree(file)
|
|
975
|
+
into "$reactNativeRootDir/ReactAndroid/src/main/jni/first-party/$packageName/"
|
|
976
|
+
include "jni/**/*.so"
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
task downloadNdkBuildDependencies {
|
|
981
|
+
if (!boostPath) {
|
|
982
|
+
dependsOn(downloadBoost)
|
|
983
|
+
}
|
|
984
|
+
dependsOn(downloadDoubleConversion)
|
|
985
|
+
dependsOn(downloadFolly)
|
|
986
|
+
dependsOn(downloadGlog)
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
task prepareThirdPartyNdkHeaders(dependsOn:[
|
|
990
|
+
downloadNdkBuildDependencies,
|
|
991
|
+
prepareBoost,
|
|
992
|
+
prepareDoubleConversion,
|
|
993
|
+
prepareFolly,
|
|
994
|
+
prepareGlog,
|
|
995
|
+
unpackReactNativeAAR]
|
|
996
|
+
) {}
|
|
926
997
|
}
|
|
927
998
|
|
|
928
999
|
task packageNdkLibs(type: Copy) {
|
|
@@ -951,57 +1022,31 @@ repositories {
|
|
|
951
1022
|
dependencies {
|
|
952
1023
|
// noinspection GradleDynamicVersion
|
|
953
1024
|
implementation "com.facebook.yoga:proguard-annotations:1.19.0"
|
|
954
|
-
if (isDeveloperMode() && !isNewArchitectureEnabled()) {
|
|
955
|
-
implementation "com.facebook.fbjni:fbjni:" + FBJNI_VERSION
|
|
956
|
-
}
|
|
957
|
-
else {
|
|
958
|
-
implementation "com.facebook.fbjni:fbjni-java-only:" + FBJNI_VERSION
|
|
959
|
-
}
|
|
960
|
-
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
961
1025
|
implementation "androidx.transition:transition:1.1.0"
|
|
962
1026
|
implementation "androidx.core:core:1.6.0"
|
|
963
|
-
|
|
964
|
-
extractHeaders("com.facebook.fbjni:fbjni:" + FBJNI_VERSION + ":headers")
|
|
965
|
-
extractSO("com.facebook.fbjni:fbjni:" + FBJNI_VERSION)
|
|
966
1027
|
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1028
|
+
if (REACT_NATIVE_MINOR_VERSION >= 71) {
|
|
1029
|
+
implementation "com.facebook.react:react-android" // version substituted by RNGP
|
|
1030
|
+
if (JS_RUNTIME == "hermes") {
|
|
1031
|
+
implementation "com.facebook.react:hermes-android" // version substituted by RNGP
|
|
1032
|
+
}
|
|
1033
|
+
} else {
|
|
1034
|
+
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
1035
|
+
if (isDeveloperMode() && !isNewArchitectureEnabled()) {
|
|
1036
|
+
implementation "com.facebook.fbjni:fbjni:" + FBJNI_VERSION
|
|
1037
|
+
}
|
|
1038
|
+
else {
|
|
1039
|
+
implementation "com.facebook.fbjni:fbjni-java-only:" + FBJNI_VERSION
|
|
1040
|
+
}
|
|
970
1041
|
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
def rnAarMatcher = "**/react-native/**/*${buildType}.aar"
|
|
974
|
-
if (REACT_NATIVE_MINOR_VERSION < 69) {
|
|
975
|
-
rnAarMatcher = "**/**/*.aar"
|
|
976
|
-
}
|
|
977
|
-
def rnAAR = fileTree("$reactNativeRootDir/android").matching({ it.include rnAarMatcher }).singleFile
|
|
978
|
-
def file = rnAAR.absoluteFile
|
|
979
|
-
def packageName = file.name.tokenize('-')[0]
|
|
980
|
-
copy {
|
|
981
|
-
from zipTree(file)
|
|
982
|
-
into "$reactNativeRootDir/ReactAndroid/src/main/jni/first-party/$packageName/"
|
|
983
|
-
include "jni/**/*.so"
|
|
984
|
-
}
|
|
985
|
-
}
|
|
1042
|
+
extractHeaders("com.facebook.fbjni:fbjni:" + FBJNI_VERSION + ":headers")
|
|
1043
|
+
extractSO("com.facebook.fbjni:fbjni:" + FBJNI_VERSION)
|
|
986
1044
|
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
dependsOn(downloadBoost)
|
|
1045
|
+
def jscAAR = fileTree("$reactNativeRootDir/../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*.aar" }).singleFile
|
|
1046
|
+
extractSO(files(jscAAR))
|
|
990
1047
|
}
|
|
991
|
-
dependsOn(downloadDoubleConversion)
|
|
992
|
-
dependsOn(downloadFolly)
|
|
993
|
-
dependsOn(downloadGlog)
|
|
994
1048
|
}
|
|
995
1049
|
|
|
996
|
-
task prepareThirdPartyNdkHeaders(dependsOn:[
|
|
997
|
-
downloadNdkBuildDependencies,
|
|
998
|
-
prepareBoost,
|
|
999
|
-
prepareDoubleConversion,
|
|
1000
|
-
prepareFolly,
|
|
1001
|
-
prepareGlog,
|
|
1002
|
-
unpackReactNativeAAR]
|
|
1003
|
-
) {}
|
|
1004
|
-
|
|
1005
1050
|
def nativeBuildDependsOn(dependsOnTask) {
|
|
1006
1051
|
def buildTasks = tasks.findAll({ task -> (
|
|
1007
1052
|
!task.name.contains("Clean")
|
|
@@ -1014,22 +1059,26 @@ def nativeBuildDependsOn(dependsOnTask) {
|
|
|
1014
1059
|
}
|
|
1015
1060
|
|
|
1016
1061
|
afterEvaluate {
|
|
1017
|
-
|
|
1018
|
-
|
|
1062
|
+
if (REACT_NATIVE_MINOR_VERSION < 71) {
|
|
1063
|
+
extractAARHeaders.dependsOn(prepareThirdPartyNdkHeaders)
|
|
1064
|
+
extractSOFiles.dependsOn(prepareThirdPartyNdkHeaders)
|
|
1019
1065
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1066
|
+
nativeBuildDependsOn(prepareThirdPartyNdkHeaders)
|
|
1067
|
+
nativeBuildDependsOn(extractAARHeaders)
|
|
1068
|
+
nativeBuildDependsOn(extractSOFiles)
|
|
1023
1069
|
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1070
|
+
tasks.forEach({ task ->
|
|
1071
|
+
if (task.name.contains("JniLibFolders")) {
|
|
1072
|
+
task.dependsOn(packageNdkLibs)
|
|
1073
|
+
}
|
|
1074
|
+
})
|
|
1075
|
+
}
|
|
1029
1076
|
|
|
1030
1077
|
if (JS_RUNTIME == "hermes") {
|
|
1031
|
-
|
|
1032
|
-
|
|
1078
|
+
if (REACT_NATIVE_MINOR_VERSION < 71) {
|
|
1079
|
+
extractAARHeaders.dependsOn(prepareHermes)
|
|
1080
|
+
extractSOFiles.dependsOn(prepareHermes)
|
|
1081
|
+
}
|
|
1033
1082
|
} else if (JS_RUNTIME == "v8") {
|
|
1034
1083
|
def buildTasks = tasks.findAll({ task ->
|
|
1035
1084
|
!task.name.contains("Clean") && (task.name.contains("externalNative") || task.name.contains("CMake") || task.name.startsWith("generateJsonModel")) })
|
|
@@ -1038,8 +1087,10 @@ afterEvaluate {
|
|
|
1038
1087
|
task.dependsOn(":react-native-v8:copy${buildType}JniLibsProjectOnly")
|
|
1039
1088
|
}
|
|
1040
1089
|
} else if (JS_RUNTIME == "jsc") {
|
|
1041
|
-
|
|
1042
|
-
|
|
1090
|
+
if (REACT_NATIVE_MINOR_VERSION < 71) {
|
|
1091
|
+
extractAARHeaders.dependsOn(prepareJSC)
|
|
1092
|
+
extractSOFiles.dependsOn(prepareJSC)
|
|
1093
|
+
}
|
|
1043
1094
|
} else {
|
|
1044
1095
|
throw GradleScriptException("Unknown JS runtime ${JS_RUNTIME}.")
|
|
1045
1096
|
}
|