react-native-reanimated 2.4.1 → 2.7.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 +72 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +30 -1
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +64 -39
- package/Common/cpp/SharedItems/ShareableValue.cpp +2 -2
- package/Common/cpp/Tools/RuntimeDecorator.cpp +2 -14
- package/Common/cpp/headers/AnimatedSensor/AnimatedSensorModule.h +41 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +14 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +14 -0
- package/Common/cpp/headers/SharedItems/MutableValue.h +4 -1
- package/Common/cpp/headers/SharedItems/ShareableValue.h +3 -0
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +3 -0
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +11 -0
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +2 -0
- package/README.md +2 -2
- package/RNReanimated.podspec +15 -6
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/7.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/CMakeLists.txt +198 -0
- package/android/README.md +15 -0
- package/android/build.gradle +676 -73
- package/android/empty.cpp +1 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +25 -0
- package/android/gradlew +234 -0
- package/android/gradlew.bat +89 -0
- package/android/react-native-reanimated-64-hermes.aar +0 -0
- package/android/react-native-reanimated-64-jsc.aar +0 -0
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/android/react-native-reanimated-68-hermes.aar +0 -0
- package/android/react-native-reanimated-68-jsc.aar +0 -0
- package/android/rnVersionPatch/62/layoutReanimation/ReanimatedNativeHierarchyManager.java +412 -0
- package/android/rnVersionPatch/62/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/rnVersionPatch/63/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/rnVersionPatch/64/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/rnVersionPatch/65/.gitkeep +0 -0
- package/android/rnVersionPatch/66/.gitkeep +0 -0
- package/android/rnVersionPatch/67/.gitkeep +0 -0
- package/android/rnVersionPatch/68/.gitkeep +0 -0
- package/android/rnVersionPatch/backup/.gitkeep +0 -0
- package/android/settings.gradle +1 -0
- package/android/spotless.gradle +9 -0
- package/android/src/{AndroidManifest.xml → main/AndroidManifest.xml} +0 -0
- package/android/src/main/cpp/AndroidErrorHandler.cpp +42 -0
- package/android/src/main/cpp/AndroidLogger.cpp +27 -0
- package/android/src/main/cpp/AndroidScheduler.cpp +59 -0
- package/android/src/main/cpp/JNIHelper.cpp +59 -0
- package/android/src/main/cpp/LayoutAnimations.cpp +103 -0
- package/android/src/main/cpp/NativeProxy.cpp +327 -0
- package/android/src/main/cpp/OnLoad.cpp +17 -0
- package/android/src/main/cpp/TurboModule.cpp +44 -0
- package/android/src/main/cpp/headers/AndroidErrorHandler.h +30 -0
- package/android/src/main/cpp/headers/AndroidLogger.h +16 -0
- package/android/src/main/cpp/headers/AndroidScheduler.h +41 -0
- package/android/src/main/cpp/headers/JNIHelper.h +30 -0
- package/android/src/main/cpp/headers/LayoutAnimations.h +42 -0
- package/android/src/main/cpp/headers/NativeProxy.h +170 -0
- package/android/src/main/cpp/headers/TurboModule.h +70 -0
- package/android/src/main/java/com/facebook/react/uimanager/UIManagerReanimatedHelper.java +15 -0
- package/android/src/main/java/com/swmansion/common/GestureHandlerStateManager.java +5 -0
- package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +8 -0
- package/android/src/main/java/com/swmansion/reanimated/CopiedEvent.java +43 -0
- package/android/src/main/java/com/swmansion/reanimated/MapUtils.java +26 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +117 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +288 -0
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +682 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedJSIModulePackage.java +29 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedModule.java +251 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +96 -0
- package/android/src/main/java/com/swmansion/reanimated/Scheduler.java +51 -0
- package/android/src/main/java/com/swmansion/reanimated/UpdateContext.java +11 -0
- package/android/src/main/java/com/swmansion/reanimated/Utils.java +32 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +524 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +56 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +11 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +410 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +292 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +121 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ViewHierarchyObserver.java +12 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/AlwaysNode.java +29 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/BezierNode.java +87 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/BlockNode.java +24 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/CallFuncNode.java +49 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockNode.java +38 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockOpNode.java +73 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ConcatNode.java +36 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/CondNode.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/DebugNode.java +33 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/EventNode.java +83 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/FinalNode.java +5 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/FunctionNode.java +20 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/JSCallNode.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/Node.java +139 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/NoopNode.java +37 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/OperatorNode.java +377 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ParamNode.java +71 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/PropsNode.java +153 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/SetNode.java +32 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/StyleNode.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/TransformNode.java +84 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ValueNode.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +35 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/ChangeTransition.java +84 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/SaneSidePropagation.java +25 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/Scale.java +86 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionModule.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionUtils.java +161 -0
- package/ios/LayoutReanimation/REAAnimationsManager.h +1 -1
- package/ios/LayoutReanimation/REAAnimationsManager.m +16 -6
- package/ios/LayoutReanimation/REASnapshot.m +1 -1
- package/ios/LayoutReanimation/REAUIManager.h +1 -1
- package/ios/LayoutReanimation/REAUIManager.mm +4 -5
- package/ios/Nodes/REAAlwaysNode.h +1 -1
- package/ios/Nodes/REAAlwaysNode.m +5 -5
- package/ios/Nodes/REABezierNode.h +1 -1
- package/ios/Nodes/REABezierNode.m +4 -5
- package/ios/Nodes/REABlockNode.h +1 -1
- package/ios/Nodes/REABlockNode.m +2 -2
- package/ios/Nodes/REACallFuncNode.h +1 -1
- package/ios/Nodes/REACallFuncNode.m +5 -5
- package/ios/Nodes/REAClockNodes.h +1 -1
- package/ios/Nodes/REAClockNodes.m +4 -4
- package/ios/Nodes/REAConcatNode.h +1 -1
- package/ios/Nodes/REAConcatNode.m +3 -3
- package/ios/Nodes/REACondNode.h +1 -1
- package/ios/Nodes/REACondNode.m +3 -3
- package/ios/Nodes/READebugNode.h +1 -1
- package/ios/Nodes/READebugNode.m +3 -3
- package/ios/Nodes/REAEventNode.h +1 -2
- package/ios/Nodes/REAEventNode.m +3 -3
- package/ios/Nodes/REAFunctionNode.h +1 -1
- package/ios/Nodes/REAFunctionNode.m +3 -3
- package/ios/Nodes/REAJSCallNode.h +1 -1
- package/ios/Nodes/REAJSCallNode.m +3 -3
- package/ios/Nodes/REANode.m +2 -2
- package/ios/Nodes/REAOperatorNode.h +1 -1
- package/ios/Nodes/REAOperatorNode.m +2 -3
- package/ios/Nodes/REAParamNode.h +1 -1
- package/ios/Nodes/REAParamNode.m +4 -4
- package/ios/Nodes/REAPropsNode.h +1 -1
- package/ios/Nodes/REAPropsNode.m +4 -6
- package/ios/Nodes/REASetNode.h +1 -1
- package/ios/Nodes/REASetNode.m +4 -4
- package/ios/Nodes/REAStyleNode.h +1 -1
- package/ios/Nodes/REAStyleNode.m +2 -3
- package/ios/Nodes/REATransformNode.h +1 -1
- package/ios/Nodes/REATransformNode.m +2 -2
- package/ios/Nodes/REAValueNode.h +1 -3
- package/ios/Nodes/REAValueNode.m +1 -1
- package/ios/REAEventDispatcher.m +1 -1
- package/ios/REAModule.h +1 -1
- package/ios/REAModule.m +12 -14
- package/ios/REANodesManager.h +5 -3
- package/ios/REANodesManager.m +97 -27
- package/ios/Transitioning/RCTConvert+REATransition.h +1 -2
- package/ios/Transitioning/RCTConvert+REATransition.m +1 -1
- package/ios/Transitioning/REAAllTransitions.h +1 -1
- package/ios/Transitioning/REAAllTransitions.m +2 -3
- package/ios/Transitioning/REATransition.h +2 -3
- package/ios/Transitioning/REATransition.m +3 -4
- package/ios/Transitioning/REATransitionAnimation.m +1 -2
- package/ios/Transitioning/REATransitionManager.m +2 -4
- package/ios/Transitioning/REATransitionValues.m +2 -3
- package/ios/native/NativeMethods.h +1 -3
- package/ios/native/NativeMethods.mm +1 -1
- package/ios/native/NativeProxy.h +2 -2
- package/ios/native/NativeProxy.mm +86 -15
- package/ios/native/REAIOSErrorHandler.h +2 -4
- package/ios/native/REAIOSErrorHandler.mm +1 -1
- package/ios/native/REAIOSLogger.h +1 -3
- package/ios/native/REAIOSLogger.mm +1 -1
- package/ios/native/REAIOSScheduler.h +1 -3
- package/ios/native/REAIOSScheduler.mm +2 -2
- package/ios/native/REAInitializer.h +0 -7
- package/ios/native/REAInitializer.mm +2 -2
- package/ios/native/UIResponder+Reanimated.mm +3 -3
- package/ios/sensor/ReanimatedSensor.h +25 -0
- package/ios/sensor/ReanimatedSensor.m +217 -0
- package/ios/sensor/ReanimatedSensorContainer.h +12 -0
- package/ios/sensor/ReanimatedSensorContainer.m +40 -0
- package/ios/sensor/ReanimatedSensorType.h +7 -0
- package/lib/ConfigHelper.js +2 -3
- package/lib/createAnimatedComponent.js +3 -4
- package/lib/reanimated1/core/AnimatedFunction.js +1 -1
- package/lib/reanimated1/derived/interpolate.js +2 -4
- package/lib/reanimated2/Colors.js +2 -1
- package/lib/reanimated2/Easing.js +9 -3
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +25 -12
- package/lib/reanimated2/NativeReanimated/index.js +0 -4
- package/lib/reanimated2/ViewDescriptorsSet.js +2 -2
- package/lib/reanimated2/animation/styleAnimation.js +2 -1
- package/lib/reanimated2/core.js +30 -60
- package/lib/reanimated2/globals.d.ts +7 -2
- package/lib/reanimated2/hook/index.js +1 -0
- package/lib/reanimated2/hook/useAnimatedSensor.js +66 -0
- package/lib/reanimated2/interpolateColor.js +11 -11
- package/lib/reanimated2/interpolation.js +1 -1
- package/lib/reanimated2/jestUtils.js +9 -4
- package/lib/reanimated2/js-reanimated/JSReanimated.js +23 -2
- package/lib/reanimated2/js-reanimated/index.js +3 -3
- package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +8 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +2 -1
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +32 -42
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +20 -38
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +32 -44
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -16
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -10
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +20 -36
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +16 -20
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +8 -12
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +32 -48
- package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +22 -18
- package/lib/reanimated2/mock.js +3 -2
- package/lib/types/lib/ConfigHelper.d.ts +12 -0
- package/lib/types/lib/ReanimatedEventEmitter.d.ts +3 -0
- package/lib/types/lib/ReanimatedModule.d.ts +2 -0
- package/lib/types/lib/ReanimatedModule.macos.d.ts +2 -0
- package/lib/types/lib/ReanimatedModule.native.d.ts +2 -0
- package/lib/types/lib/ReanimatedModule.windows.d.ts +2 -0
- package/lib/types/lib/ReanimatedModuleCompat.d.ts +14 -0
- package/lib/types/lib/createAnimatedComponent.d.ts +33 -0
- package/lib/types/lib/reanimated2/Bezier.d.ts +6 -0
- package/lib/types/lib/reanimated2/Colors.d.ts +31 -0
- package/lib/types/lib/reanimated2/Easing.d.ts +172 -0
- package/lib/types/lib/reanimated2/NativeMethods.d.ts +14 -0
- package/lib/types/lib/reanimated2/NativeReanimated/NativeReanimated.d.ts +20 -0
- package/lib/types/lib/reanimated2/NativeReanimated/index.d.ts +3 -0
- package/lib/types/lib/reanimated2/PlatformChecker.d.ts +5 -0
- package/lib/types/lib/reanimated2/PropAdapters.d.ts +4 -0
- package/lib/types/lib/reanimated2/UpdateProps.d.ts +9 -0
- package/lib/types/lib/reanimated2/ViewDescriptorsSet.d.ts +20 -0
- package/lib/types/lib/reanimated2/WorkletEventHandler.d.ts +13 -0
- package/lib/types/lib/reanimated2/__mocks__/MutableValue.d.ts +5 -0
- package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.d.ts +13 -0
- package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.native.d.ts +13 -0
- package/lib/types/lib/reanimated2/animation/commonTypes.d.ts +27 -0
- package/lib/types/lib/reanimated2/animation/decay.d.ts +19 -0
- package/lib/types/lib/reanimated2/animation/delay.d.ts +7 -0
- package/lib/types/lib/reanimated2/animation/index.d.ts +9 -0
- package/lib/types/lib/reanimated2/animation/repeat.d.ts +12 -0
- package/lib/types/lib/reanimated2/animation/sequence.d.ts +7 -0
- package/lib/types/lib/reanimated2/animation/spring.d.ts +22 -0
- package/lib/types/lib/reanimated2/animation/styleAnimation.d.ts +7 -0
- package/lib/types/lib/reanimated2/animation/timing.d.ts +21 -0
- package/lib/types/lib/reanimated2/animation/util.d.ts +9 -0
- package/lib/types/lib/reanimated2/commonTypes.d.ts +79 -0
- package/lib/types/lib/reanimated2/component/FlatList.d.ts +9 -0
- package/lib/types/lib/reanimated2/component/WrappedComponents.d.ts +8 -0
- package/lib/types/lib/reanimated2/component/index.d.ts +9 -0
- package/lib/types/lib/reanimated2/core.d.ts +24 -0
- package/lib/types/lib/reanimated2/hook/Hooks.d.ts +5 -0
- package/lib/types/lib/reanimated2/hook/commonTypes.d.ts +14 -0
- package/lib/types/lib/reanimated2/hook/index.d.ts +10 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedGestureHandler.d.ts +35 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedReaction.d.ts +12 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedRef.d.ts +3 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedScrollHandler.d.ts +21 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedSensor.d.ts +20 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedStyle.d.ts +11 -0
- package/lib/types/lib/reanimated2/hook/useDerivedValue.d.ts +4 -0
- package/lib/types/lib/reanimated2/hook/useSharedValue.d.ts +2 -0
- package/lib/types/lib/reanimated2/hook/utils.d.ts +28 -0
- package/lib/types/lib/reanimated2/index.d.ts +12 -0
- package/lib/types/lib/reanimated2/interpolateColor.d.ts +26 -0
- package/lib/types/lib/reanimated2/interpolation.d.ts +14 -0
- package/lib/types/lib/reanimated2/jestUtils.d.ts +12 -0
- package/lib/types/lib/reanimated2/js-reanimated/JSReanimated.d.ts +30 -0
- package/lib/types/lib/reanimated2/js-reanimated/Mapper.d.ts +14 -0
- package/lib/types/lib/reanimated2/js-reanimated/MapperRegistry.d.ts +14 -0
- package/lib/types/lib/reanimated2/js-reanimated/MutableValue.d.ts +14 -0
- package/lib/types/lib/reanimated2/js-reanimated/commonTypes.d.ts +44 -0
- package/lib/types/lib/reanimated2/js-reanimated/index.d.ts +15 -0
- package/lib/types/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.d.ts +1 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +22 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +38 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +25 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +77 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/index.d.ts +4 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +62 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Default.d.ts +4 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +42 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +50 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +18 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +10 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +18 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +34 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +34 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +18 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +66 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/index.d.ts +10 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +19 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +13 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +6 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +6 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +7 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +9 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/index.d.ts +6 -0
- package/lib/types/lib/reanimated2/layoutReanimation/index.d.ts +4 -0
- package/lib/types/lib/reanimated2/mock.d.ts +55 -0
- package/lib/types/lib/reanimated2/platform-specific/RNRenderer.d.ts +1 -0
- package/lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
- package/lib/types/lib/reanimated2/utils.d.ts +7 -0
- package/lib/types/lib/setAndForwardRef.d.ts +40 -0
- package/lib/types/react-native-reanimated-tests.d.ts +1 -0
- package/mock.js +4 -4
- package/package.json +43 -39
- package/plugin.js +3 -12
- package/react-native-reanimated.d.ts +58 -32
- package/src/ConfigHelper.ts +4 -5
- package/src/createAnimatedComponent.tsx +4 -4
- package/src/reanimated1/core/AnimatedFunction.js +1 -1
- package/src/reanimated1/derived/interpolate.js +2 -4
- package/src/reanimated2/Colors.ts +2 -1
- package/src/reanimated2/Easing.ts +9 -3
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +42 -15
- package/src/reanimated2/NativeReanimated/index.ts +0 -6
- package/src/reanimated2/ViewDescriptorsSet.ts +2 -3
- package/src/reanimated2/animation/index.ts +1 -0
- package/src/reanimated2/animation/styleAnimation.ts +10 -7
- package/src/reanimated2/animation/timing.ts +3 -1
- package/src/reanimated2/animation/util.ts +10 -11
- package/src/reanimated2/commonTypes.ts +20 -1
- package/src/reanimated2/component/FlatList.tsx +3 -2
- package/src/reanimated2/core.ts +34 -73
- package/src/reanimated2/globals.d.ts +7 -2
- package/src/reanimated2/hook/index.ts +1 -0
- package/src/reanimated2/hook/useAnimatedSensor.ts +91 -0
- package/src/reanimated2/hook/utils.ts +2 -1
- package/src/reanimated2/interpolateColor.ts +11 -11
- package/src/reanimated2/interpolation.ts +2 -6
- package/src/reanimated2/jestUtils.ts +20 -4
- package/src/reanimated2/js-reanimated/JSReanimated.ts +25 -2
- package/src/reanimated2/js-reanimated/index.ts +3 -3
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +13 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +2 -3
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +51 -21
- package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +40 -10
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +48 -12
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +8 -2
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +32 -8
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -10
- package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +64 -16
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +26 -19
- package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +2 -1
- package/src/reanimated2/mock.ts +3 -2
- package/android/expo/linking.gradle +0 -46
- package/android/expo/src/main/java/com/swmansion/reanimated/EXReanimatedAdapter.java +0 -12
- package/android/expo/src/main/java/expo/modules/adapters/reanimated/EXReanimatedPackage.java +0 -26
- package/android/react-native-reanimated-63-hermes.aar +0 -0
- package/android/react-native-reanimated-63-jsc.aar +0 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedProxyPackage.java +0 -15
- package/expo-module.config.json +0 -3
- package/libSo/fbjni/jni/arm64-v8a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/armeabi-v7a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86_64/libfbjni.so +0 -0
package/android/build.gradle
CHANGED
|
@@ -1,26 +1,128 @@
|
|
|
1
|
-
import
|
|
1
|
+
import java.nio.file.Paths
|
|
2
|
+
import org.apache.tools.ant.filters.ReplaceTokens
|
|
3
|
+
|
|
2
4
|
import java.util.regex.Matcher
|
|
3
5
|
import java.util.regex.Pattern
|
|
4
|
-
|
|
6
|
+
import groovy.json.JsonSlurper
|
|
7
|
+
import java.util.zip.ZipFile
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Finds the path of the installed npm package with the given name using Node's
|
|
11
|
+
* module resolution algorithm, which searches "node_modules" directories up to
|
|
12
|
+
* the file system root. This handles various cases, including:
|
|
13
|
+
*
|
|
14
|
+
* - Working in the open-source RN repo:
|
|
15
|
+
* Gradle: /path/to/react-native/ReactAndroid
|
|
16
|
+
* Node module: /path/to/react-native/node_modules/[package]
|
|
17
|
+
*
|
|
18
|
+
* - Installing RN as a dependency of an app and searching for hoisted
|
|
19
|
+
* dependencies:
|
|
20
|
+
* Gradle: /path/to/app/node_modules/react-native/ReactAndroid
|
|
21
|
+
* Node module: /path/to/app/node_modules/[package]
|
|
22
|
+
*
|
|
23
|
+
* - Working in a larger repo (e.g., Facebook) that contains RN:
|
|
24
|
+
* Gradle: /path/to/repo/path/to/react-native/ReactAndroid
|
|
25
|
+
* Node module: /path/to/repo/node_modules/[package]
|
|
26
|
+
*
|
|
27
|
+
* The search begins at the given base directory (a File object). The returned
|
|
28
|
+
* path is a string.
|
|
29
|
+
*/
|
|
30
|
+
static def findNodeModulePath(baseDir, packageName) {
|
|
31
|
+
def basePath = baseDir.toPath().normalize()
|
|
32
|
+
// Node's module resolution algorithm searches up to the root directory,
|
|
33
|
+
// after which the base path will be null
|
|
34
|
+
while (basePath) {
|
|
35
|
+
def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName)
|
|
36
|
+
if (candidatePath.toFile().exists()) {
|
|
37
|
+
return candidatePath.toString()
|
|
38
|
+
}
|
|
39
|
+
basePath = basePath.getParent()
|
|
40
|
+
}
|
|
41
|
+
return null
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
def safeExtGet(prop, fallback) {
|
|
45
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
46
|
+
}
|
|
47
|
+
|
|
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"
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
def resolveBuildType() {
|
|
61
|
+
def buildType = System.getenv("CLIENT_SIDE_BUILD")
|
|
62
|
+
if (buildType != null) {
|
|
63
|
+
return buildType == "True"
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (hasProperty("clientSideBuild")) {
|
|
67
|
+
return property("clientSideBuild") == "true"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (isDeveloperMode()) {
|
|
71
|
+
return false
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return true
|
|
75
|
+
}
|
|
10
76
|
|
|
11
|
-
def
|
|
77
|
+
def isDeveloperMode() {
|
|
78
|
+
// developer mode, to run Example app
|
|
79
|
+
return file("$projectDir/../node_modules/react-native/package.json").exists()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
def resolveReactNativeDirectory() {
|
|
83
|
+
if (isDeveloperMode()) {
|
|
84
|
+
return file("$projectDir/../node_modules/react-native")
|
|
85
|
+
}
|
|
86
|
+
return file("$projectDir/../../react-native")
|
|
87
|
+
}
|
|
12
88
|
|
|
13
89
|
abstract class replaceSoTask extends DefaultTask {
|
|
14
90
|
public static String appName = ":app"
|
|
15
91
|
public static String buildDir = "../../../android/app/build"
|
|
92
|
+
public static String fbjniVersion = "0.3.0"
|
|
16
93
|
|
|
17
94
|
@TaskAction
|
|
18
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
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
19
121
|
for(def abiVersion in ["x86", "x86_64", "armeabi-v7a", "arm64-v8a"]) {
|
|
20
122
|
ant.sequential {
|
|
21
123
|
copy(
|
|
22
124
|
tofile: "${buildDir}/intermediates/merged_native_libs/debug/out/lib/${abiVersion}/libfbjni.so",
|
|
23
|
-
file: "
|
|
125
|
+
file: "${buildDir}/tmp/libSo/jni/${abiVersion}/libfbjni.so",
|
|
24
126
|
overwrite: true
|
|
25
127
|
)
|
|
26
128
|
}
|
|
@@ -28,84 +130,585 @@ abstract class replaceSoTask extends DefaultTask {
|
|
|
28
130
|
}
|
|
29
131
|
}
|
|
30
132
|
|
|
31
|
-
def
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Pattern pattern = Pattern.compile("(assemble|bundle|install|generate)(\\w*)(Release|Debug)")
|
|
35
|
-
Matcher matcher = pattern.matcher(taskRequestName)
|
|
133
|
+
def detectAAR(minor, engine) {
|
|
134
|
+
def rnMinorVersionCopy = Integer.parseInt(minor)
|
|
135
|
+
def aar = file("react-native-reanimated-${rnMinorVersionCopy}-${engine}.aar")
|
|
36
136
|
|
|
37
|
-
if(
|
|
38
|
-
|
|
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 $rnMinorVersion 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 $rnMinorVersion to the reanimated repo."
|
|
156
|
+
println "Thanks!"
|
|
157
|
+
println "\n\n\n"
|
|
158
|
+
println "****************************************************************************************"
|
|
159
|
+
|
|
160
|
+
return aar
|
|
161
|
+
}
|
|
39
162
|
}
|
|
163
|
+
return null
|
|
164
|
+
}
|
|
40
165
|
|
|
41
|
-
|
|
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
|
|
42
176
|
}
|
|
43
177
|
|
|
44
|
-
def
|
|
45
|
-
def
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
+
}
|
|
192
|
+
|
|
193
|
+
def shouldBuildFromSource(aar) {
|
|
194
|
+
if (isDeveloperMode()) {
|
|
195
|
+
// Example app
|
|
196
|
+
return true
|
|
197
|
+
}
|
|
198
|
+
else if (detectReanimatedConfig()) {
|
|
199
|
+
// on user demand
|
|
200
|
+
return true
|
|
201
|
+
}
|
|
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
|
+
}
|
|
214
|
+
def reactNative = resolveReactNativeDirectory()
|
|
215
|
+
def reactNativeManifest = file("$reactNative/package.json")
|
|
216
|
+
def reactNativeManifestAsJson = new JsonSlurper().parseText(reactNativeManifest.text)
|
|
217
|
+
def reactNativeVersion = reactNativeManifestAsJson.version as String
|
|
218
|
+
def (major, minor, patch) = reactNativeVersion.tokenize('.')
|
|
219
|
+
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)
|
|
51
232
|
}
|
|
52
233
|
|
|
53
|
-
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
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
|
+
})
|
|
57
276
|
}
|
|
277
|
+
}
|
|
58
278
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
final NOTFOUND = "NOT-FOUND"
|
|
62
|
-
if(!NOTFOUND.equals(getCurrentFlavor()) && (!projectProperties.get("reanimated")
|
|
63
|
-
|| (projectProperties.get("reanimated") && projectProperties.get("reanimated").get("enablePackagingOptions")))
|
|
64
|
-
) {
|
|
65
|
-
def flavorString = getCurrentFlavor()
|
|
66
|
-
replaceSoTask.appName = project.getProperties().path
|
|
67
|
-
replaceSoTask.buildDir = project.getProperties().buildDir
|
|
68
|
-
def appName = project.getProperties().path
|
|
69
|
-
|
|
70
|
-
replaceSoTaskDebug.dependsOn(
|
|
71
|
-
project.getTasks().getByPath("${appName}:merge${flavorString}DebugNativeLibs"),
|
|
72
|
-
project.getTasks().getByPath("${appName}:strip${flavorString}DebugDebugSymbols")
|
|
73
|
-
)
|
|
74
|
-
project.getTasks().getByPath("${appName}:package${flavorString}Debug").dependsOn(replaceSoTaskDebug)
|
|
279
|
+
artifacts.add("default", aar)
|
|
280
|
+
}
|
|
75
281
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
282
|
+
// end if already loaded aar
|
|
283
|
+
if (!BUILD_FROM_SOURCE) return
|
|
284
|
+
|
|
285
|
+
def localProps = new Properties()
|
|
286
|
+
def localPropertiesFile = file("local.properties")
|
|
287
|
+
if (localPropertiesFile.exists()) {
|
|
288
|
+
localProps.load(new InputStreamReader(new FileInputStream(localPropertiesFile), "UTF-8"))
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
def debugNativeLibraries = localProps.getProperty('NATIVE_DEBUG_ON', 'FALSE').toBoolean()
|
|
292
|
+
def reactProperties = new Properties()
|
|
293
|
+
file("$reactNative/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
|
|
294
|
+
|
|
295
|
+
def BOOST_VERSION = reactProperties.getProperty("BOOST_VERSION")
|
|
296
|
+
def DOUBLE_CONVERSION_VERSION = reactProperties.getProperty("DOUBLE_CONVERSION_VERSION")
|
|
297
|
+
def FOLLY_VERSION = reactProperties.getProperty("FOLLY_VERSION")
|
|
298
|
+
def GLOG_VERSION = reactProperties.getProperty("GLOG_VERSION")
|
|
299
|
+
def REACT_VERSION = reactProperties.getProperty("VERSION_NAME").split("\\.")[1].toInteger()
|
|
300
|
+
def FBJNI_VERSION = "0.3.0"
|
|
301
|
+
|
|
302
|
+
// We download various C++ open-source dependencies into downloads.
|
|
303
|
+
// We then copy both the downloaded code and our custom makefiles and headers into third-party-ndk.
|
|
304
|
+
// After that we build native code from src/main/jni with module path pointing at third-party-ndk.
|
|
305
|
+
|
|
306
|
+
def downloadsDir = new File("$buildDir/downloads")
|
|
307
|
+
def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
|
|
308
|
+
|
|
309
|
+
def reactNativeThirdParty = new File("$reactNative/ReactAndroid/src/main/jni/third-party")
|
|
310
|
+
|
|
311
|
+
def _stackProtectorFlag = true
|
|
312
|
+
def FOR_HERMES = ""
|
|
313
|
+
|
|
314
|
+
if (findProject(":app")) {
|
|
315
|
+
FOR_HERMES = project(":app").ext.react.enableHermes;
|
|
316
|
+
} else {
|
|
317
|
+
FOR_HERMES = System.getenv("FOR_HERMES") == "True";
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
def reactNativeArchitectures() {
|
|
321
|
+
def value = project.getProperties().get("reactNativeArchitectures")
|
|
322
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// You need to have following folders in this directory:
|
|
326
|
+
// - boost_1_63_0
|
|
327
|
+
// - double-conversion-1.1.6
|
|
328
|
+
// - folly-deprecate-dynamic-initializer
|
|
329
|
+
// - glog-0.3.5
|
|
330
|
+
def dependenciesPath = System.getenv("REACT_NATIVE_DEPENDENCIES")
|
|
331
|
+
|
|
332
|
+
// The Boost library is a very large download (>100MB).
|
|
333
|
+
// If Boost is already present on your system, define the REACT_NATIVE_BOOST_PATH env variable
|
|
334
|
+
// and the build will use that.
|
|
335
|
+
def boostPath = dependenciesPath ?: System.getenv("REACT_NATIVE_BOOST_PATH")
|
|
336
|
+
|
|
337
|
+
def follyReplaceContent = '''
|
|
338
|
+
ssize_t r;
|
|
339
|
+
do {
|
|
340
|
+
r = open(name, flags, mode);
|
|
341
|
+
} while (r == -1 && errno == EINTR);
|
|
342
|
+
return r;
|
|
343
|
+
'''
|
|
344
|
+
|
|
345
|
+
buildscript {
|
|
346
|
+
repositories {
|
|
347
|
+
google()
|
|
348
|
+
mavenCentral()
|
|
349
|
+
maven {
|
|
350
|
+
url "https://plugins.gradle.org/m2/"
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
dependencies {
|
|
354
|
+
classpath "com.android.tools.build:gradle:4.2.2"
|
|
355
|
+
classpath "de.undercouch:gradle-download-task:4.1.2"
|
|
356
|
+
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.15.0"
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (project == rootProject) {
|
|
361
|
+
apply from: "spotless.gradle"
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
apply plugin: "com.android.library"
|
|
365
|
+
apply plugin: "maven-publish"
|
|
366
|
+
apply plugin: "de.undercouch.download"
|
|
367
|
+
|
|
368
|
+
android {
|
|
369
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 30)
|
|
370
|
+
defaultConfig {
|
|
371
|
+
minSdkVersion safeExtGet("minSdkVersion", 16)
|
|
372
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 30)
|
|
373
|
+
versionCode 1
|
|
374
|
+
versionName "1.0"
|
|
375
|
+
externalNativeBuild {
|
|
376
|
+
cmake {
|
|
377
|
+
arguments "-DANDROID_STL=c++_shared",
|
|
378
|
+
"-DNATIVE_DEBUG=${debugNativeLibraries}",
|
|
379
|
+
"-DREACT_NATIVE_TARGET_VERSION=${REACT_VERSION}",
|
|
380
|
+
"-DANDROID_TOOLCHAIN=clang",
|
|
381
|
+
"-DBOOST_VERSION=${BOOST_VERSION}",
|
|
382
|
+
"-DBUILD_DIR=${buildDir}",
|
|
383
|
+
"-DFOR_HERMES=${FOR_HERMES}",
|
|
384
|
+
"-DCLIENT_SIDE_BUILD=${CLIENT_SIDE_BUILD}",
|
|
385
|
+
"--clean-first"
|
|
386
|
+
abiFilters (*reactNativeArchitectures())
|
|
387
|
+
_stackProtectorFlag ? (cppFlags("-fstack-protector-all")) : null
|
|
81
388
|
}
|
|
82
389
|
}
|
|
390
|
+
|
|
391
|
+
buildConfigField("boolean", "IS_INTERNAL_BUILD", "false")
|
|
392
|
+
buildConfigField("int", "EXOPACKAGE_FLAGS", "0")
|
|
83
393
|
}
|
|
84
|
-
|
|
394
|
+
externalNativeBuild {
|
|
395
|
+
cmake {
|
|
396
|
+
path "CMakeLists.txt"
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
lintOptions {
|
|
400
|
+
abortOnError false
|
|
401
|
+
}
|
|
402
|
+
packagingOptions {
|
|
403
|
+
println "Native libs debug enabled: ${debugNativeLibraries}"
|
|
404
|
+
doNotStrip debugNativeLibraries ? "**/**/*.so" : ''
|
|
405
|
+
excludes = [
|
|
406
|
+
"**/libc++_shared.so",
|
|
407
|
+
"**/libfbjni.so",
|
|
408
|
+
"**/libjsi.so",
|
|
409
|
+
"**/libfolly_json.so",
|
|
410
|
+
"**/libglog.so",
|
|
411
|
+
"**/libhermes.so",
|
|
412
|
+
"**/libreactnativejni.so",
|
|
413
|
+
"**/libjscexecutor.so",
|
|
414
|
+
]
|
|
415
|
+
}
|
|
416
|
+
tasks.withType(JavaCompile) {
|
|
417
|
+
compileTask ->
|
|
418
|
+
compileTask.dependsOn(packageNdkLibs)
|
|
419
|
+
}
|
|
420
|
+
configurations {
|
|
421
|
+
extractHeaders
|
|
422
|
+
extractSO
|
|
423
|
+
}
|
|
424
|
+
compileOptions {
|
|
425
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
426
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
task cleanCmakeCache() {
|
|
431
|
+
tasks.getByName("clean").dependsOn(cleanCmakeCache)
|
|
432
|
+
doFirst {
|
|
433
|
+
delete "${projectDir}/.cxx"
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
task printVersions {
|
|
438
|
+
println "Android gradle plugin: ${com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION}"
|
|
439
|
+
println "Gradle: ${project.gradle.gradleVersion}"
|
|
440
|
+
}
|
|
85
441
|
|
|
86
|
-
|
|
87
|
-
|
|
442
|
+
task Log {
|
|
443
|
+
println("building Reanimated2")
|
|
444
|
+
}
|
|
88
445
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
446
|
+
task applyJavaPatches(type: Copy) {
|
|
447
|
+
def patchDirectory = file("${projectDir}/rnVersionPatch/${rnMinorVersion}")
|
|
448
|
+
if (patchDirectory.exists()) {
|
|
449
|
+
from ("${patchDirectory}") {
|
|
450
|
+
include "**/*.java"
|
|
451
|
+
}
|
|
452
|
+
into ("${projectDir}/src/main/java/com/swmansion/reanimated")
|
|
94
453
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
task createNativeDepsDirectories(dependsOn: applyJavaPatches) {
|
|
457
|
+
downloadsDir.mkdirs()
|
|
458
|
+
thirdPartyNdkDir.mkdirs()
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
|
|
462
|
+
src("https://github.com/react-native-community/boost-for-react-native/releases/download/v${BOOST_VERSION.replace("_", ".")}-0/boost_${BOOST_VERSION}.tar.gz")
|
|
463
|
+
onlyIfNewer(true)
|
|
464
|
+
overwrite(false)
|
|
465
|
+
dest(new File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz"))
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
|
|
469
|
+
from(boostPath ?: tarTree(resources.gzip(downloadBoost.dest)))
|
|
470
|
+
from("$reactNativeThirdParty/boost/Android.mk")
|
|
471
|
+
include("Android.mk", "boost_${BOOST_VERSION}/boost/**/*.hpp", "boost/boost/**/*.hpp")
|
|
472
|
+
includeEmptyDirs = false
|
|
473
|
+
into("$thirdPartyNdkDir/boost")
|
|
474
|
+
doLast {
|
|
475
|
+
file("$thirdPartyNdkDir/boost/boost").renameTo("$thirdPartyNdkDir/boost/boost_${BOOST_VERSION}")
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Download) {
|
|
480
|
+
src("https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz")
|
|
481
|
+
onlyIfNewer(true)
|
|
482
|
+
overwrite(false)
|
|
483
|
+
dest(new File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz"))
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
task prepareDoubleConversion(dependsOn: dependenciesPath ? [] : [downloadDoubleConversion], type: Copy) {
|
|
487
|
+
from(dependenciesPath ?: tarTree(downloadDoubleConversion.dest))
|
|
488
|
+
from("$reactNativeThirdParty/double-conversion/Android.mk")
|
|
489
|
+
include("double-conversion-${DOUBLE_CONVERSION_VERSION}/src/**/*", "Android.mk")
|
|
490
|
+
filesMatching("*/src/**/*", { fname -> fname.path = "double-conversion/${fname.name}" })
|
|
491
|
+
includeEmptyDirs = false
|
|
492
|
+
into("$thirdPartyNdkDir/double-conversion")
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
|
|
496
|
+
src("https://github.com/facebook/folly/archive/v${FOLLY_VERSION}.tar.gz")
|
|
497
|
+
onlyIfNewer(true)
|
|
498
|
+
overwrite(false)
|
|
499
|
+
dest(new File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz"))
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy) {
|
|
503
|
+
from(dependenciesPath ?: tarTree(downloadFolly.dest))
|
|
504
|
+
from("$reactNativeThirdParty/folly/Android.mk")
|
|
505
|
+
include("folly-${FOLLY_VERSION}/folly/**/*", "Android.mk")
|
|
506
|
+
eachFile { fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/") }
|
|
507
|
+
// Fixes problem with Folly failing to build on certain systems. See
|
|
508
|
+
// https://github.com/software-mansion/react-native-reanimated/issues/1024
|
|
509
|
+
filter { line -> line.replaceAll("return int\\(wrapNoInt\\(open, name, flags, mode\\)\\);", follyReplaceContent) }
|
|
510
|
+
includeEmptyDirs = false
|
|
511
|
+
into("$thirdPartyNdkDir/folly")
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
task downloadGlog(dependsOn: createNativeDepsDirectories, type: Download) {
|
|
515
|
+
src("https://github.com/google/glog/archive/v${GLOG_VERSION}.tar.gz")
|
|
516
|
+
onlyIfNewer(true)
|
|
517
|
+
overwrite(false)
|
|
518
|
+
dest(new File(downloadsDir, "glog-${GLOG_VERSION}.tar.gz"))
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// Prepare glog sources to be compiled, this task will perform steps that normally should've been
|
|
522
|
+
// executed by automake. This way we can avoid dependencies on make/automake
|
|
523
|
+
task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy) {
|
|
524
|
+
duplicatesStrategy = "include"
|
|
525
|
+
from(dependenciesPath ?: tarTree(downloadGlog.dest))
|
|
526
|
+
from("$reactNativeThirdParty/glog/")
|
|
527
|
+
include("glog-${GLOG_VERSION}/src/**/*", "Android.mk", "config.h")
|
|
528
|
+
includeEmptyDirs = false
|
|
529
|
+
filesMatching("**/*.h.in") {
|
|
530
|
+
filter(ReplaceTokens, tokens: [
|
|
531
|
+
ac_cv_have_unistd_h : "1",
|
|
532
|
+
ac_cv_have_stdint_h : "1",
|
|
533
|
+
ac_cv_have_systypes_h : "1",
|
|
534
|
+
ac_cv_have_inttypes_h : "1",
|
|
535
|
+
ac_cv_have_libgflags : "0",
|
|
536
|
+
ac_google_start_namespace : "namespace google {",
|
|
537
|
+
ac_cv_have_uint16_t : "1",
|
|
538
|
+
ac_cv_have_u_int16_t : "1",
|
|
539
|
+
ac_cv_have___uint16 : "0",
|
|
540
|
+
ac_google_end_namespace : "}",
|
|
541
|
+
ac_cv_have___builtin_expect : "1",
|
|
542
|
+
ac_google_namespace : "google",
|
|
543
|
+
ac_cv___attribute___noinline : "__attribute__ ((noinline))",
|
|
544
|
+
ac_cv___attribute___noreturn : "__attribute__ ((noreturn))",
|
|
545
|
+
ac_cv___attribute___printf_4_5: "__attribute__((__format__ (__printf__, 4, 5)))"
|
|
546
|
+
])
|
|
547
|
+
it.path = (it.name - ".in")
|
|
548
|
+
}
|
|
549
|
+
into("$thirdPartyNdkDir/glog")
|
|
550
|
+
|
|
551
|
+
doLast {
|
|
552
|
+
copy {
|
|
553
|
+
from(fileTree(dir: "$thirdPartyNdkDir/glog", includes: ["stl_logging.h", "logging.h", "raw_logging.h", "vlog_is_on.h", "**/src/glog/log_severity.h"]).files)
|
|
554
|
+
includeEmptyDirs = false
|
|
555
|
+
into("$thirdPartyNdkDir/glog/exported/glog")
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
task prepareHermes() {
|
|
561
|
+
def hermesPackagePath = findNodeModulePath(projectDir, "hermes-engine")
|
|
562
|
+
if (!hermesPackagePath) {
|
|
563
|
+
throw new GradleScriptException("Could not find the hermes-engine npm package", null)
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
def hermesAAR = file("$hermesPackagePath/android/hermes-debug.aar")
|
|
567
|
+
if (!hermesAAR.exists()) {
|
|
568
|
+
throw new GradleScriptException("The hermes-engine npm package is missing \"android/hermes-debug.aar\"", null)
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
def soFiles = zipTree(hermesAAR).matching({ it.include "**/*.so" })
|
|
572
|
+
|
|
573
|
+
copy {
|
|
574
|
+
from soFiles
|
|
575
|
+
from "$reactNative/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
|
|
576
|
+
into "$thirdPartyNdkDir/hermes"
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
task prepareJSC {
|
|
581
|
+
doLast {
|
|
582
|
+
def jscPackagePath = findNodeModulePath(projectDir, "jsc-android")
|
|
583
|
+
if (!jscPackagePath) {
|
|
584
|
+
throw new GradleScriptException("Could not find the jsc-android npm package", null)
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
def jscDist = file("$jscPackagePath/dist")
|
|
588
|
+
if (!jscDist.exists()) {
|
|
589
|
+
throw new GradleScriptException("The jsc-android npm package is missing its \"dist\" directory", null)
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
def jscAAR = fileTree(jscDist).matching({ it.include "**/android-jsc/**/*.aar" }).singleFile
|
|
593
|
+
def soFiles = zipTree(jscAAR).matching({ it.include "**/*.so" })
|
|
594
|
+
|
|
595
|
+
def headerFiles = fileTree(jscDist).matching({ it.include "**/include/*.h" })
|
|
596
|
+
|
|
597
|
+
copy {
|
|
598
|
+
from(soFiles)
|
|
599
|
+
from(headerFiles)
|
|
600
|
+
from("$reactNative/ReactAndroid/src/main/jni/third-party/jsc/Android.mk")
|
|
601
|
+
|
|
602
|
+
filesMatching("**/*.h", { it.path = "JavaScriptCore/${it.name}" })
|
|
603
|
+
|
|
604
|
+
includeEmptyDirs(false)
|
|
605
|
+
into("$thirdPartyNdkDir/jsc")
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
task extractAARHeaders {
|
|
611
|
+
doLast {
|
|
612
|
+
configurations.extractHeaders.files.each {
|
|
613
|
+
def file = it.absoluteFile
|
|
614
|
+
def packageName = file.name.tokenize('-')[0]
|
|
615
|
+
copy {
|
|
616
|
+
from zipTree(file)
|
|
617
|
+
into "$reactNative/ReactAndroid/src/main/jni/first-party/$packageName/headers"
|
|
618
|
+
include "**/*.h"
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
task extractSOFiles {
|
|
625
|
+
doLast {
|
|
626
|
+
configurations.extractSO.files.each {
|
|
627
|
+
def file = it.absoluteFile
|
|
628
|
+
def packageName = file.name.tokenize('-')[0]
|
|
629
|
+
copy {
|
|
630
|
+
from zipTree(file)
|
|
631
|
+
into "$reactNative/ReactAndroid/src/main/jni/first-party/$packageName/"
|
|
632
|
+
include "jni/**/*.so"
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
task packageNdkLibs(type: Copy) {
|
|
639
|
+
from("$buildDir/reanimated-ndk/all")
|
|
640
|
+
include("**/libreanimated.so")
|
|
641
|
+
if(REACT_VERSION < 64) {
|
|
642
|
+
include("**/libturbomodulejsijni.so")
|
|
643
|
+
}
|
|
644
|
+
into("$projectDir/src/main/jniLibs")
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
repositories {
|
|
648
|
+
mavenCentral()
|
|
649
|
+
mavenLocal()
|
|
650
|
+
maven {
|
|
651
|
+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
652
|
+
url "$reactNative/android"
|
|
653
|
+
}
|
|
654
|
+
maven {
|
|
655
|
+
// Android JSC is installed from npm
|
|
656
|
+
url "$reactNative/../jsc-android/dist"
|
|
657
|
+
}
|
|
658
|
+
google()
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
dependencies {
|
|
662
|
+
// noinspection GradleDynamicVersion
|
|
663
|
+
implementation "com.facebook.yoga:proguard-annotations:1.19.0"
|
|
664
|
+
if (isDeveloperMode()) {
|
|
665
|
+
implementation "com.facebook.fbjni:fbjni:" + FBJNI_VERSION
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
implementation "com.facebook.fbjni:fbjni-java-only:" + FBJNI_VERSION
|
|
669
|
+
}
|
|
670
|
+
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
671
|
+
implementation "androidx.transition:transition:1.1.0"
|
|
672
|
+
extractHeaders("com.facebook.fbjni:fbjni:" + FBJNI_VERSION + ":headers")
|
|
673
|
+
extractSO("com.facebook.fbjni:fbjni:" + FBJNI_VERSION)
|
|
674
|
+
|
|
675
|
+
def rnAAR = fileTree("$reactNative/android").matching({ it.include "**/**/*.aar" }).singleFile
|
|
676
|
+
def jscAAR = fileTree("$reactNative/../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*.aar" }).singleFile
|
|
677
|
+
extractSO(files(rnAAR, jscAAR))
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
task downloadNdkBuildDependencies {
|
|
681
|
+
if (!boostPath) {
|
|
682
|
+
dependsOn(downloadBoost)
|
|
683
|
+
}
|
|
684
|
+
dependsOn(downloadDoubleConversion)
|
|
685
|
+
dependsOn(downloadFolly)
|
|
686
|
+
dependsOn(downloadGlog)
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
task prepareThirdPartyNdkHeaders(dependsOn:[downloadNdkBuildDependencies, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog]) {
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
def nativeBuildDependsOn(dependsOnTask) {
|
|
693
|
+
def buildTasks = tasks.findAll({ task ->
|
|
694
|
+
!task.name.contains("Clean") && (task.name.contains("externalNative") || task.name.contains("CMake")) })
|
|
695
|
+
buildTasks.forEach { task -> task.dependsOn(dependsOnTask) }
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
afterEvaluate {
|
|
699
|
+
extractAARHeaders.dependsOn(prepareThirdPartyNdkHeaders)
|
|
700
|
+
extractSOFiles.dependsOn(prepareThirdPartyNdkHeaders)
|
|
701
|
+
|
|
702
|
+
nativeBuildDependsOn(prepareThirdPartyNdkHeaders)
|
|
703
|
+
nativeBuildDependsOn(extractAARHeaders)
|
|
704
|
+
nativeBuildDependsOn(extractSOFiles)
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
if (CLIENT_SIDE_BUILD) {
|
|
708
|
+
def aarDir = "${buildDir}/outputs"
|
|
709
|
+
aar = file("${aarDir}/android-debug.aar")
|
|
710
|
+
if (aar == null) {
|
|
711
|
+
throw GradleScriptException("AAR build failed. No AAR found in ${aarDir}.")
|
|
712
|
+
}
|
|
713
|
+
artifacts.add("default", aar)
|
|
714
|
+
}
|