react-native-reanimated 2.9.1 → 2.11.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 +7 -4
- package/Common/cpp/{headers/AnimatedSensor → AnimatedSensor}/AnimatedSensorModule.h +0 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +2 -0
- package/Common/cpp/{headers/LayoutAnimations → LayoutAnimations}/LayoutAnimationsProxy.h +0 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +40 -0
- package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModule.h +13 -0
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +25 -0
- package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModuleSpec.h +9 -1
- package/Common/cpp/{headers/Registries → Registries}/EventHandlerRegistry.h +0 -0
- package/Common/cpp/Registries/MapperRegistry.cpp +3 -1
- package/Common/cpp/{headers/Registries → Registries}/MapperRegistry.h +0 -0
- package/Common/cpp/Registries/WorkletsCache.cpp +3 -0
- package/Common/cpp/{headers/Registries → Registries}/WorkletsCache.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/FrozenObject.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/HostFunctionHandler.h +0 -0
- package/Common/cpp/SharedItems/MutableValue.cpp +2 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/MutableValue.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/MutableValueSetterProxy.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/RemoteObject.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/RuntimeManager.h +0 -0
- package/Common/cpp/SharedItems/ShareableValue.cpp +7 -2
- package/Common/cpp/{headers/SharedItems → SharedItems}/ShareableValue.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/SharedParent.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/ValueWrapper.h +0 -0
- package/Common/cpp/{headers/SpecTools → SpecTools}/ErrorHandler.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/FeaturesConfig.h +0 -0
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +2 -2
- package/Common/cpp/{headers/Tools → Tools}/JSIStoreValueUser.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/Mapper.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/PlatformDepMethodsHolder.h +5 -0
- package/Common/cpp/{headers/Tools → Tools}/ReanimatedHiddenHeaders.h +1 -1
- package/Common/cpp/{headers/Tools → Tools}/RuntimeDecorator.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/Scheduler.h +0 -0
- package/Common/cpp/Tools/SingleInstanceChecker.h +58 -0
- package/Common/cpp/{headers/Tools → Tools}/WorkletEventHandler.h +0 -0
- package/RNReanimated.podspec +18 -58
- package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
- package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/{7.2 → 7.5.1}/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.5.1/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/{7.2 → 7.5.1}/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/{7.2 → 7.5.1}/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/{7.2 → 7.5.1}/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/CMakeLists.txt +223 -113
- package/android/build.gradle +480 -195
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- 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/react-native-reanimated-69-hermes.aar +0 -0
- package/android/react-native-reanimated-69-jsc.aar +0 -0
- package/android/react-native-reanimated-70-hermes.aar +0 -0
- package/android/react-native-reanimated-70-jsc.aar +0 -0
- package/{lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts → android/rnVersionPatch/70/.gitkeep} +0 -0
- package/android/src/main/cpp/AndroidErrorHandler.cpp +3 -4
- package/android/src/main/cpp/{headers/AndroidErrorHandler.h → AndroidErrorHandler.h} +1 -4
- package/android/src/main/cpp/AndroidLogger.cpp +4 -1
- package/android/src/main/cpp/{headers/AndroidLogger.h → AndroidLogger.h} +0 -0
- package/android/src/main/cpp/{headers/AndroidScheduler.h → AndroidScheduler.h} +0 -0
- package/android/src/main/cpp/{headers/JNIHelper.h → JNIHelper.h} +0 -0
- package/android/src/main/cpp/{headers/LayoutAnimations.h → LayoutAnimations.h} +0 -0
- package/android/src/main/cpp/NativeProxy.cpp +60 -28
- package/android/src/main/cpp/{headers/NativeProxy.h → NativeProxy.h} +29 -0
- package/android/src/main/cpp/OnLoad.cpp +1 -0
- package/android/src/main/cpp/{headers/TurboModule.h → TurboModule.h} +0 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +29 -5
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +3 -1
- package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +166 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +19 -16
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +5 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +1 -1
- package/ios/{REAModule.m → REAModule.mm} +12 -0
- package/ios/REANodesManager.m +31 -8
- package/ios/keyboardObserver/REAKeyboardEventObserver.h +17 -0
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +198 -0
- package/ios/native/NativeProxy.mm +24 -3
- package/ios/native/REAInitializer.h +2 -2
- package/ios/native/REAInitializer.mm +10 -14
- package/ios/native/UIResponder+Reanimated.mm +1 -1
- package/ios/sensor/ReanimatedSensor.m +26 -17
- package/lib/index.js +11 -3
- package/lib/index.web.js +6 -0
- package/lib/reanimated2/Colors.js +1 -1
- package/lib/reanimated2/NativeMethods.js +34 -17
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +6 -0
- package/lib/reanimated2/animation/util.js +4 -1
- package/lib/reanimated2/commonTypes.js +8 -1
- package/lib/reanimated2/component/FlatList.js +5 -5
- package/lib/reanimated2/core.js +5 -4
- package/lib/reanimated2/frameCallback/FrameCallbackRegistryJS.js +32 -0
- package/lib/reanimated2/frameCallback/FrameCallbackRegistryUI.js +76 -0
- package/lib/reanimated2/globals.d.ts +5 -2
- package/lib/reanimated2/hook/index.js +3 -0
- package/lib/reanimated2/hook/useAnimatedKeyboard.js +31 -0
- package/lib/reanimated2/hook/useAnimatedSensor.js +3 -3
- package/lib/reanimated2/hook/useFrameCallback.js +23 -0
- package/lib/reanimated2/hook/useScrollViewOffset.js +26 -0
- package/lib/reanimated2/jestUtils.js +11 -3
- package/lib/reanimated2/js-reanimated/JSReanimated.js +7 -0
- package/lib/reanimated2/js-reanimated/global.js +33 -22
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +1 -1
- package/lib/reanimated2/utils.js +10 -3
- package/lib/types/{lib/Animated.d.ts → Animated.d.ts} +0 -0
- package/lib/types/{lib/ConfigHelper.d.ts → ConfigHelper.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedEventEmitter.d.ts → ReanimatedEventEmitter.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.d.ts → ReanimatedModule.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.macos.d.ts → ReanimatedModule.macos.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.native.d.ts → ReanimatedModule.native.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModule.windows.d.ts → ReanimatedModule.windows.d.ts} +0 -0
- package/lib/types/{lib/ReanimatedModuleCompat.d.ts → ReanimatedModuleCompat.d.ts} +0 -0
- package/lib/types/{lib/createAnimatedComponent.d.ts → createAnimatedComponent.d.ts} +0 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/{lib/index.d.ts → index.web.d.ts} +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/Bezier.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/Colors.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/Easing.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/NativeMethods.d.ts +3 -10
- package/lib/types/{lib/reanimated2 → reanimated2}/NativeReanimated/NativeReanimated.d.ts +3 -1
- package/lib/types/{lib/reanimated2 → reanimated2}/NativeReanimated/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/PlatformChecker.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/PropAdapters.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/UpdateProps.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/ViewDescriptorsSet.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/WorkletEventHandler.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/MutableValue.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/__mocks__/NativeReanimated.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/commonTypes.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/decay.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/delay.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/repeat.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/sequence.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/spring.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/styleAnimation.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/timing.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/animation/util.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/commonTypes.d.ts +20 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/component/FlatList.d.ts +2 -2
- package/lib/types/{lib/reanimated2 → reanimated2}/component/Image.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/component/ScrollView.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/component/Text.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/component/View.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/core.d.ts +0 -0
- package/lib/types/reanimated2/frameCallback/FrameCallbackRegistryJS.d.ts +8 -0
- package/lib/types/reanimated2/frameCallback/FrameCallbackRegistryUI.d.ts +6 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/Hooks.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/commonTypes.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/index.d.ts +4 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedGestureHandler.d.ts +0 -0
- package/lib/types/reanimated2/hook/useAnimatedKeyboard.d.ts +2 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedReaction.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedRef.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedScrollHandler.d.ts +1 -2
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedSensor.d.ts +1 -1
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useAnimatedStyle.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useDerivedValue.d.ts +0 -0
- package/lib/types/reanimated2/hook/useFrameCallback.d.ts +7 -0
- package/lib/types/reanimated2/hook/useScrollViewOffset.d.ts +4 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/useSharedValue.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/hook/utils.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/interpolateColor.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/interpolation.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/jestUtils.d.ts +1 -1
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/JSReanimated.d.ts +3 -1
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/Mapper.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/MapperRegistry.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/MutableValue.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/commonTypes.d.ts +0 -0
- package/lib/types/reanimated2/js-reanimated/global.d.ts +2 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/js-reanimated/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/LayoutAnimationRepository.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/commonTypes.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Default.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Fade.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Flip.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Roll.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Slide.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/layoutReanimation/index.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/mock.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/platform-specific/RNRenderer.d.ts +0 -0
- package/lib/types/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
- package/lib/types/{lib/reanimated2 → reanimated2}/utils.d.ts +5 -1
- package/lib/types/{lib/setAndForwardRef.d.ts → setAndForwardRef.d.ts} +0 -0
- package/mock.js +1 -0
- package/package.json +8 -8
- package/plugin.js +8 -17
- package/react-native-reanimated.d.ts +67 -12
- package/scripts/reanimated_utils.rb +65 -0
- package/src/index.ts +11 -3
- package/src/index.web.ts +7 -0
- package/src/reanimated2/Colors.ts +1 -1
- package/src/reanimated2/NativeMethods.ts +47 -30
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +9 -0
- package/src/reanimated2/animation/util.ts +8 -1
- package/src/reanimated2/commonTypes.ts +24 -0
- package/src/reanimated2/component/FlatList.tsx +29 -19
- package/src/reanimated2/core.ts +8 -8
- package/src/reanimated2/frameCallback/FrameCallbackRegistryJS.ts +40 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +115 -0
- package/src/reanimated2/globals.d.ts +5 -2
- package/src/reanimated2/hook/index.ts +4 -0
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +35 -0
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -1
- package/src/reanimated2/hook/useAnimatedSensor.ts +5 -5
- package/src/reanimated2/hook/useFrameCallback.ts +40 -0
- package/src/reanimated2/hook/useScrollViewOffset.ts +36 -0
- package/src/reanimated2/jestUtils.ts +11 -3
- package/src/reanimated2/js-reanimated/JSReanimated.ts +16 -1
- package/src/reanimated2/js-reanimated/global.ts +41 -29
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +1 -1
- package/src/reanimated2/utils.ts +12 -5
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +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/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +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/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +0 -8
- package/lib/reanimated2/__mocks__/NativeReanimated.native.js +0 -20
- package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.native.d.ts +0 -13
- package/lib/types/lib/reanimated2/js-reanimated/global.d.ts +0 -1
- package/lib/types/react-native-reanimated-tests.d.ts +0 -1
package/android/build.gradle
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import com.android.Version
|
|
2
2
|
import org.apache.tools.ant.filters.ReplaceTokens
|
|
3
3
|
|
|
4
|
-
import java.
|
|
5
|
-
import java.util.regex.Pattern
|
|
6
|
-
import groovy.json.JsonSlurper
|
|
7
|
-
import java.util.zip.ZipFile
|
|
4
|
+
import java.nio.file.Paths
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* Finds the path of the installed npm package with the given name using Node's
|
|
@@ -45,22 +42,27 @@ def safeExtGet(prop, fallback) {
|
|
|
45
42
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
46
43
|
}
|
|
47
44
|
|
|
48
|
-
def
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return matcher.group(2)
|
|
45
|
+
def safeAppExtGet(prop, fallback) {
|
|
46
|
+
def appProject = null
|
|
47
|
+
try {
|
|
48
|
+
appProject = project(":app")
|
|
49
|
+
} catch(Exception e) {
|
|
50
|
+
return fallback
|
|
55
51
|
}
|
|
56
|
-
|
|
57
|
-
return "NOT-FOUND"
|
|
52
|
+
appProject?.ext?.has(prop) ? appProject.ext.get(prop) : fallback
|
|
58
53
|
}
|
|
59
54
|
|
|
60
55
|
def resolveBuildType() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
Gradle gradle = getGradle()
|
|
57
|
+
String tskReqStr = gradle.getStartParameter().getTaskRequests()['args'].toString()
|
|
58
|
+
|
|
59
|
+
return tskReqStr.contains('Release') ? 'release' : 'debug'
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
def resolveClientSideBuild() {
|
|
63
|
+
def clientSideBuild = System.getenv("CLIENT_SIDE_BUILD")
|
|
64
|
+
if (clientSideBuild != null) {
|
|
65
|
+
return clientSideBuild == "True"
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
if (hasProperty("clientSideBuild")) {
|
|
@@ -76,62 +78,174 @@ def resolveBuildType() {
|
|
|
76
78
|
|
|
77
79
|
def isDeveloperMode() {
|
|
78
80
|
// developer mode, to run Example app
|
|
79
|
-
return
|
|
81
|
+
return safeAppExtGet("isReanimatedExampleApp", false) || System.getenv("REANIMATED_PACKAGE_BUILD") == "1"
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
def isNewArchitectureEnabled() {
|
|
85
|
+
// To opt-in for the New Architecture, you can either:
|
|
86
|
+
// - Set `newArchEnabled` to true inside the `gradle.properties` file
|
|
87
|
+
// - Invoke gradle with `-newArchEnabled=true`
|
|
88
|
+
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
|
|
89
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
def resolveReactNativeDirectory() {
|
|
93
|
+
def reactNativeLocation = safeAppExtGet("REACT_NATIVE_NODE_MODULES_DIR", null)
|
|
94
|
+
if (reactNativeLocation != null) {
|
|
95
|
+
return file(reactNativeLocation)
|
|
96
|
+
}
|
|
97
|
+
|
|
83
98
|
if (isDeveloperMode()) {
|
|
84
|
-
return file("$projectDir
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
}
|
|
121
|
-
for(def abiVersion in ["x86", "x86_64", "armeabi-v7a", "arm64-v8a"]) {
|
|
122
|
-
ant.sequential {
|
|
123
|
-
copy(
|
|
124
|
-
tofile: "${buildDir}/intermediates/merged_native_libs/debug/out/lib/${abiVersion}/libfbjni.so",
|
|
125
|
-
file: "${buildDir}/tmp/libSo/jni/${abiVersion}/libfbjni.so",
|
|
126
|
-
overwrite: true
|
|
127
|
-
)
|
|
99
|
+
return file("$projectDir/../${getPlaygroundAppName()}/node_modules/react-native")
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// monorepo workaround
|
|
103
|
+
// react-native can be hoisted or in project's own node_modules
|
|
104
|
+
def reactNativeFromProjectNodeModules = file("${rootProject.projectDir}/../node_modules/react-native")
|
|
105
|
+
if (reactNativeFromProjectNodeModules.exists()) {
|
|
106
|
+
return reactNativeFromProjectNodeModules
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
def reactNativeFromNodeModulesWithReanimated = file("${projectDir}/../../react-native")
|
|
110
|
+
if (reactNativeFromNodeModulesWithReanimated.exists()) {
|
|
111
|
+
return reactNativeFromNodeModulesWithReanimated
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
throw new Exception(
|
|
115
|
+
"[Reanimated] Unable to resolve react-native location in " +
|
|
116
|
+
"node_modules. You should project extension property (in app/build.gradle) " +
|
|
117
|
+
"`REACT_NATIVE_NODE_MODULES_DIR` with path to react-native."
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
def getPlaygroundAppName() { // only for the development
|
|
122
|
+
String playgroundAppName = ""
|
|
123
|
+
try {
|
|
124
|
+
rootProject.getSubprojects().forEach({project ->
|
|
125
|
+
if (project.plugins.hasPlugin("com.android.application")) {
|
|
126
|
+
var projectCatalogAbsolutePath = project.projectDir.toString().replace("/android/app", "")
|
|
127
|
+
var slashPosition = projectCatalogAbsolutePath.lastIndexOf("/")
|
|
128
|
+
playgroundAppName = projectCatalogAbsolutePath.substring(slashPosition + 1)
|
|
128
129
|
}
|
|
130
|
+
})
|
|
131
|
+
} catch(_) {
|
|
132
|
+
return "NOT_FOUND"
|
|
133
|
+
}
|
|
134
|
+
return playgroundAppName
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
def shouldAssertNoMultipleInstances() {
|
|
138
|
+
if (rootProject.hasProperty("disableMultipleInstancesCheck")) {
|
|
139
|
+
return rootProject.property("disableMultipleInstancesCheck") != "true"
|
|
140
|
+
} else {
|
|
141
|
+
return true
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
def findReanimatedInstancesForPath(String path) {
|
|
146
|
+
return fileTree(path) {
|
|
147
|
+
include "**/react-native-reanimated/package.json"
|
|
148
|
+
exclude "**/.yarn/**"
|
|
149
|
+
exclude {{ file, attr -> attr.isSymbolicLink() }}
|
|
150
|
+
}.files
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
def assertNoMultipleInstances() {
|
|
154
|
+
// Assert there are no multiple installations of Reanimated
|
|
155
|
+
Set<File> files
|
|
156
|
+
if (projectDir.path.contains(rootDir.parent)) {
|
|
157
|
+
// standard app
|
|
158
|
+
files = findReanimatedInstancesForPath(rootDir.parent + "/node_modules")
|
|
159
|
+
} else {
|
|
160
|
+
// monorepo
|
|
161
|
+
files = findReanimatedInstancesForPath(rootDir.parent + "/node_modules")
|
|
162
|
+
files.addAll(
|
|
163
|
+
findReanimatedInstancesForPath(file(projectDir.parent).parent)
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
if (files.size() > 1) {
|
|
167
|
+
String parsedLocation = files.stream().map({
|
|
168
|
+
File file -> "- " + file.toString().replace("/package.json", "")
|
|
169
|
+
}).collect().join("\n")
|
|
170
|
+
String exceptionMessage = "\nMultiple versions of Reanimated were detected. Only one " +
|
|
171
|
+
"instance of react-native-reanimated can be installed in a project. You need to " +
|
|
172
|
+
"resolve the conflict manually. Check out the documentation: " +
|
|
173
|
+
"https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/" +
|
|
174
|
+
"troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict " +
|
|
175
|
+
"between: \n" + parsedLocation + "\n";
|
|
176
|
+
throw new Exception(exceptionMessage)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
boolean CLIENT_SIDE_BUILD = resolveClientSideBuild()
|
|
181
|
+
if (CLIENT_SIDE_BUILD) {
|
|
182
|
+
configurations.maybeCreate("default")
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
def reactNativeRootDir = resolveReactNativeDirectory()
|
|
186
|
+
|
|
187
|
+
def reactProperties = new Properties()
|
|
188
|
+
file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
|
|
189
|
+
|
|
190
|
+
def BOOST_VERSION = reactProperties.getProperty("BOOST_VERSION")
|
|
191
|
+
def DOUBLE_CONVERSION_VERSION = reactProperties.getProperty("DOUBLE_CONVERSION_VERSION")
|
|
192
|
+
def FOLLY_VERSION = reactProperties.getProperty("FOLLY_VERSION")
|
|
193
|
+
def GLOG_VERSION = reactProperties.getProperty("GLOG_VERSION")
|
|
194
|
+
def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
|
|
195
|
+
def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
|
|
196
|
+
def FBJNI_VERSION = "0.3.0"
|
|
197
|
+
def REANIMATED_PACKAGE_BUILD = System.getenv("REANIMATED_PACKAGE_BUILD")
|
|
198
|
+
|
|
199
|
+
// We download various C++ open-source dependencies into downloads.
|
|
200
|
+
// We then copy both the downloaded code and our custom makefiles and headers into third-party-ndk.
|
|
201
|
+
// After that we build native code from src/main/jni with module path pointing at third-party-ndk.
|
|
202
|
+
|
|
203
|
+
def customDownloadsDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR")
|
|
204
|
+
def downloadsDir = customDownloadsDir ? new File(customDownloadsDir) : new File("$buildDir/downloads")
|
|
205
|
+
def thirdPartyNdkDir = new File("$buildDir/third-party-ndk")
|
|
206
|
+
|
|
207
|
+
def reactNativeThirdParty = new File("$reactNativeRootDir/ReactAndroid/src/main/jni/third-party")
|
|
208
|
+
def reactNativeAndroidDownloadDir = new File("$reactNativeRootDir/ReactAndroid/build/downloads")
|
|
209
|
+
|
|
210
|
+
def _stackProtectorFlag = true
|
|
211
|
+
|
|
212
|
+
def JS_RUNTIME = {
|
|
213
|
+
// Returns the js runtime explicitly requested in the environment variable
|
|
214
|
+
if (System.getenv("JS_RUNTIME")) {
|
|
215
|
+
return System.getenv("JS_RUNTIME")
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Detect js runtime from project setup
|
|
219
|
+
def defaultRuntimeType = "jsc";
|
|
220
|
+
def v8Project = rootProject.getSubprojects().find { project -> project.name == "react-native-v8" }
|
|
221
|
+
if (v8Project != null) {
|
|
222
|
+
return "v8"
|
|
223
|
+
}
|
|
224
|
+
def appProject = findProject(":app") ? project(":app") : null
|
|
225
|
+
return appProject?.ext?.react?.enableHermes ? "hermes" : defaultRuntimeType
|
|
226
|
+
}.call()
|
|
227
|
+
|
|
228
|
+
def jsRuntimeDir = {
|
|
229
|
+
if (JS_RUNTIME == "hermes") {
|
|
230
|
+
if (REACT_NATIVE_MINOR_VERSION >= 69) {
|
|
231
|
+
return Paths.get(reactNativeRootDir.path, "sdks", "hermes")
|
|
232
|
+
} else {
|
|
233
|
+
return Paths.get(reactNativeRootDir.path, "..", "hermes-engine")
|
|
129
234
|
}
|
|
235
|
+
} else if (JS_RUNTIME == "v8") {
|
|
236
|
+
return findProject(":react-native-v8").getProjectDir().getParent()
|
|
237
|
+
} else {
|
|
238
|
+
return Paths.get(reactNativeRootDir.path, "ReactCommon", "jsi")
|
|
130
239
|
}
|
|
240
|
+
}.call()
|
|
241
|
+
|
|
242
|
+
def reactNativeArchitectures() {
|
|
243
|
+
def value = project.getProperties().get("reactNativeArchitectures")
|
|
244
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
131
245
|
}
|
|
132
246
|
|
|
133
|
-
def detectAAR(
|
|
134
|
-
def rnMinorVersionCopy =
|
|
247
|
+
def detectAAR(Integer rnMinorVersion, String engine) { // Reanimated2 only
|
|
248
|
+
def rnMinorVersionCopy = rnMinorVersion
|
|
135
249
|
def aar = file("react-native-reanimated-${rnMinorVersionCopy}-${engine}.aar")
|
|
136
250
|
|
|
137
251
|
if (aar.exists()) {
|
|
@@ -163,25 +277,13 @@ def detectAAR(minor, engine) {
|
|
|
163
277
|
return null
|
|
164
278
|
}
|
|
165
279
|
|
|
166
|
-
def
|
|
167
|
-
def runtimeType = "jsc"
|
|
168
|
-
rootProject.getSubprojects().forEach({project ->
|
|
169
|
-
if (project.plugins.hasPlugin("com.android.application")) {
|
|
170
|
-
if (project.ext.react.enableHermes) {
|
|
171
|
-
runtimeType = "hermes"
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
})
|
|
175
|
-
return runtimeType
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
def detectReanimatedConfig() {
|
|
280
|
+
def isUserDemandToBuildFromSource() { // Reanimated2 only
|
|
179
281
|
def buildFromSourceConf = false
|
|
180
282
|
rootProject.getSubprojects().forEach({project ->
|
|
181
283
|
if (project.plugins.hasPlugin("com.android.application")) {
|
|
182
284
|
if (
|
|
183
|
-
|
|
184
|
-
|
|
285
|
+
project.ext.has("reanimated")
|
|
286
|
+
&& project.ext.reanimated.buildFromSource
|
|
185
287
|
) {
|
|
186
288
|
buildFromSourceConf = true
|
|
187
289
|
}
|
|
@@ -190,12 +292,15 @@ def detectReanimatedConfig() {
|
|
|
190
292
|
return buildFromSourceConf
|
|
191
293
|
}
|
|
192
294
|
|
|
193
|
-
def shouldBuildFromSource(aar) {
|
|
194
|
-
if (
|
|
295
|
+
def shouldBuildFromSource(aar, jsRuntimeName) { // Reanimated2 only
|
|
296
|
+
if (jsRuntimeName == "v8") {
|
|
297
|
+
return true
|
|
298
|
+
}
|
|
299
|
+
else if (isDeveloperMode()) {
|
|
195
300
|
// Example app
|
|
196
301
|
return true
|
|
197
302
|
}
|
|
198
|
-
else if (
|
|
303
|
+
else if (isUserDemandToBuildFromSource()) {
|
|
199
304
|
// on user demand
|
|
200
305
|
return true
|
|
201
306
|
}
|
|
@@ -207,21 +312,13 @@ def shouldBuildFromSource(aar) {
|
|
|
207
312
|
return true
|
|
208
313
|
}
|
|
209
314
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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) {
|
|
315
|
+
def getTaskByPath(
|
|
316
|
+
project,
|
|
317
|
+
String appName,
|
|
318
|
+
String secondPart,
|
|
319
|
+
String flavorString,
|
|
320
|
+
String lastPart
|
|
321
|
+
) { // Reanimated2 only
|
|
225
322
|
String pathName = "${appName}:${secondPart}${flavorString}${lastPart}"
|
|
226
323
|
Task task = project.getTasks().findByPath(pathName)
|
|
227
324
|
if (task != null) {
|
|
@@ -231,8 +328,11 @@ def getTaskByPath(project, String appName, String secondPart, String flavorStrin
|
|
|
231
328
|
return project.getTasks().findByPath(pathName)
|
|
232
329
|
}
|
|
233
330
|
|
|
234
|
-
|
|
235
|
-
|
|
331
|
+
def aar = detectAAR(REACT_NATIVE_MINOR_VERSION, JS_RUNTIME)
|
|
332
|
+
boolean BUILD_FROM_SOURCE = shouldBuildFromSource(aar, JS_RUNTIME)
|
|
333
|
+
|
|
334
|
+
if (!BUILD_FROM_SOURCE && !isNewArchitectureEnabled()) { // Reanimated2 only
|
|
335
|
+
if (REACT_NATIVE_MINOR_VERSION < 65) {
|
|
236
336
|
tasks.register("replaceSoTaskDebug", replaceSoTask)
|
|
237
337
|
tasks.register("replaceSoTaskRelease", replaceSoTask)
|
|
238
338
|
Task replaceSoTaskDebug = project.getTasks().findByPath(":react-native-reanimated:replaceSoTaskDebug")
|
|
@@ -246,8 +346,8 @@ if (!BUILD_FROM_SOURCE) {
|
|
|
246
346
|
def reanimatedConf = projectProperties.get("reanimated")
|
|
247
347
|
|
|
248
348
|
if (
|
|
249
|
-
|
|
250
|
-
|
|
349
|
+
flavorString != "NOT-FOUND"
|
|
350
|
+
&& (!reanimatedConf || (reanimatedConf && !reanimatedConf.get("enablePackagingOptions")))
|
|
251
351
|
) {
|
|
252
352
|
replaceSoTask.appName = projectProperties.path
|
|
253
353
|
replaceSoTask.buildDir = projectProperties.buildDir
|
|
@@ -261,9 +361,9 @@ if (!BUILD_FROM_SOURCE) {
|
|
|
261
361
|
Task releaseTask = getTaskByPath(project, appName, "package", flavorString, "Release")
|
|
262
362
|
|
|
263
363
|
if (
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
364
|
+
debugNativeLibsTask != null && debugDebugSymbolsTask != null
|
|
365
|
+
&& releaseNativeLibsTask != null && releaseDebugSymbolsTask != null
|
|
366
|
+
&& debugTask != null && releaseTask != null
|
|
267
367
|
) {
|
|
268
368
|
replaceSoTaskDebug.dependsOn(debugNativeLibsTask, debugDebugSymbolsTask)
|
|
269
369
|
debugTask.dependsOn(replaceSoTaskDebug)
|
|
@@ -280,48 +380,9 @@ if (!BUILD_FROM_SOURCE) {
|
|
|
280
380
|
}
|
|
281
381
|
|
|
282
382
|
// end if already loaded aar
|
|
283
|
-
if (!BUILD_FROM_SOURCE)
|
|
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"]
|
|
383
|
+
if (!BUILD_FROM_SOURCE) {
|
|
384
|
+
return
|
|
323
385
|
}
|
|
324
|
-
|
|
325
386
|
// You need to have following folders in this directory:
|
|
326
387
|
// - boost_1_63_0
|
|
327
388
|
// - double-conversion-1.1.6
|
|
@@ -351,9 +412,9 @@ buildscript {
|
|
|
351
412
|
}
|
|
352
413
|
}
|
|
353
414
|
dependencies {
|
|
354
|
-
classpath "com.android.tools.build:gradle:7.
|
|
415
|
+
classpath "com.android.tools.build:gradle:7.3.0"
|
|
355
416
|
classpath "de.undercouch:gradle-download-task:5.0.1"
|
|
356
|
-
classpath "com.diffplug.spotless:spotless-plugin-gradle:
|
|
417
|
+
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.11.0"
|
|
357
418
|
}
|
|
358
419
|
}
|
|
359
420
|
|
|
@@ -372,16 +433,20 @@ android {
|
|
|
372
433
|
targetSdkVersion safeExtGet("targetSdkVersion", 30)
|
|
373
434
|
versionCode 1
|
|
374
435
|
versionName "1.0"
|
|
436
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
375
437
|
externalNativeBuild {
|
|
376
438
|
cmake {
|
|
377
439
|
arguments "-DANDROID_STL=c++_shared",
|
|
378
|
-
"-
|
|
379
|
-
"-DREACT_NATIVE_TARGET_VERSION=${REACT_VERSION}",
|
|
440
|
+
"-DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION}",
|
|
380
441
|
"-DANDROID_TOOLCHAIN=clang",
|
|
381
442
|
"-DBOOST_VERSION=${BOOST_VERSION}",
|
|
382
|
-
"-
|
|
383
|
-
"-
|
|
384
|
-
"-
|
|
443
|
+
"-DREACT_NATIVE_DIR=${reactNativeRootDir.path}",
|
|
444
|
+
"-DJS_RUNTIME=${JS_RUNTIME}",
|
|
445
|
+
"-DJS_RUNTIME_DIR=${jsRuntimeDir}",
|
|
446
|
+
"-DCLIENT_SIDE_BUILD=${CLIENT_SIDE_BUILD}",
|
|
447
|
+
"-DIS_NEW_ARCHITECTURE_ENABLED=${isNewArchitectureEnabled()}",
|
|
448
|
+
"-DPLAYGROUND_APP_NAME=${getPlaygroundAppName()}",
|
|
449
|
+
"-DREANIMATED_PACKAGE_BUILD=${REANIMATED_PACKAGE_BUILD}"
|
|
385
450
|
abiFilters (*reactNativeArchitectures())
|
|
386
451
|
_stackProtectorFlag ? (cppFlags("-fstack-protector-all")) : null
|
|
387
452
|
}
|
|
@@ -389,19 +454,41 @@ android {
|
|
|
389
454
|
|
|
390
455
|
buildConfigField("boolean", "IS_INTERNAL_BUILD", "false")
|
|
391
456
|
buildConfigField("int", "EXOPACKAGE_FLAGS", "0")
|
|
457
|
+
buildConfigField("int", "REACT_NATIVE_MINOR_VERSION", REACT_NATIVE_MINOR_VERSION.toString())
|
|
392
458
|
}
|
|
393
459
|
externalNativeBuild {
|
|
394
460
|
cmake {
|
|
395
461
|
path "CMakeLists.txt"
|
|
396
462
|
}
|
|
397
463
|
}
|
|
464
|
+
buildTypes {
|
|
465
|
+
debug {
|
|
466
|
+
externalNativeBuild {
|
|
467
|
+
cmake {
|
|
468
|
+
if (JS_RUNTIME == "hermes") {
|
|
469
|
+
arguments "-DHERMES_ENABLE_DEBUGGER=1"
|
|
470
|
+
} else {
|
|
471
|
+
arguments "-DHERMES_ENABLE_DEBUGGER=0"
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
release {
|
|
477
|
+
externalNativeBuild {
|
|
478
|
+
cmake {
|
|
479
|
+
arguments "-DHERMES_ENABLE_DEBUGGER=0"
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
398
484
|
lintOptions {
|
|
399
485
|
abortOnError false
|
|
400
486
|
}
|
|
401
487
|
packagingOptions {
|
|
402
|
-
|
|
403
|
-
doNotStrip debugNativeLibraries ? "**/**/*.so" : ''
|
|
488
|
+
doNotStrip resolveBuildType() == 'debug' ? "**/**/*.so" : ''
|
|
404
489
|
excludes = [
|
|
490
|
+
"META-INF",
|
|
491
|
+
"META-INF/**",
|
|
405
492
|
"**/libc++_shared.so",
|
|
406
493
|
"**/libfbjni.so",
|
|
407
494
|
"**/libjsi.so",
|
|
@@ -409,8 +496,10 @@ android {
|
|
|
409
496
|
"**/libfolly_runtime.so",
|
|
410
497
|
"**/libglog.so",
|
|
411
498
|
"**/libhermes.so",
|
|
499
|
+
"**/libhermes-executor-debug.so",
|
|
412
500
|
"**/libreactnativejni.so",
|
|
413
501
|
"**/libjscexecutor.so",
|
|
502
|
+
"**/libv8executor.so",
|
|
414
503
|
]
|
|
415
504
|
}
|
|
416
505
|
tasks.withType(JavaCompile) {
|
|
@@ -425,6 +514,38 @@ android {
|
|
|
425
514
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
426
515
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
427
516
|
}
|
|
517
|
+
packagingOptions {
|
|
518
|
+
// For some reason gradle only complains about the duplicated version of librrc_root and libreact_render libraries
|
|
519
|
+
// while there are more libraries copied in intermediates folder of the lib build directory, we exclude
|
|
520
|
+
// only the ones that make the build fail (ideally we should only include libreanimated but we
|
|
521
|
+
// are only allowed to specify exlude patterns)
|
|
522
|
+
exclude "**/libreact_render*.so"
|
|
523
|
+
exclude "**/librrc_root.so"
|
|
524
|
+
}
|
|
525
|
+
sourceSets.main {
|
|
526
|
+
java {
|
|
527
|
+
if (isNewArchitectureEnabled()) {
|
|
528
|
+
srcDirs += [
|
|
529
|
+
"src/fabric/java",
|
|
530
|
+
]
|
|
531
|
+
} else {
|
|
532
|
+
srcDirs += [
|
|
533
|
+
"src/paper/java",
|
|
534
|
+
]
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
def assertionTask = task assertNoMultipleInstancesTask {
|
|
541
|
+
onlyIf { shouldAssertNoMultipleInstances() && CLIENT_SIDE_BUILD }
|
|
542
|
+
doFirst {
|
|
543
|
+
assertNoMultipleInstances()
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
tasks.preBuild {
|
|
548
|
+
dependsOn assertionTask
|
|
428
549
|
}
|
|
429
550
|
|
|
430
551
|
task cleanCmakeCache() {
|
|
@@ -435,7 +556,7 @@ task cleanCmakeCache() {
|
|
|
435
556
|
}
|
|
436
557
|
|
|
437
558
|
task printVersions {
|
|
438
|
-
println "Android gradle plugin: ${
|
|
559
|
+
println "Android gradle plugin: ${Version.ANDROID_GRADLE_PLUGIN_VERSION}"
|
|
439
560
|
println "Gradle: ${project.gradle.gradleVersion}"
|
|
440
561
|
}
|
|
441
562
|
|
|
@@ -444,7 +565,7 @@ task Log {
|
|
|
444
565
|
}
|
|
445
566
|
|
|
446
567
|
task applyJavaPatches(type: Copy) {
|
|
447
|
-
def patchDirectory = file("${projectDir}/rnVersionPatch/${
|
|
568
|
+
def patchDirectory = file("${projectDir}/rnVersionPatch/${REACT_NATIVE_MINOR_VERSION}")
|
|
448
569
|
if (patchDirectory.exists()) {
|
|
449
570
|
from ("${patchDirectory}") {
|
|
450
571
|
include "**/*.java"
|
|
@@ -458,16 +579,70 @@ task createNativeDepsDirectories(dependsOn: applyJavaPatches) {
|
|
|
458
579
|
thirdPartyNdkDir.mkdirs()
|
|
459
580
|
}
|
|
460
581
|
|
|
461
|
-
|
|
582
|
+
def resolveTaskFactory(String taskName, String artifactLocalName, File reactNativeAndroidDownloadDir, File reanimatedDownloadDir) {
|
|
583
|
+
return tasks.create(name: taskName, dependsOn: createNativeDepsDirectories, type: Copy) {
|
|
584
|
+
from reactNativeAndroidDownloadDir
|
|
585
|
+
include artifactLocalName
|
|
586
|
+
into reanimatedDownloadDir
|
|
587
|
+
|
|
588
|
+
onlyIf {
|
|
589
|
+
// First we check whether the file is already in our download directory
|
|
590
|
+
if (file("$reanimatedDownloadDir/$artifactLocalName").isFile()) {
|
|
591
|
+
return false
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// If it is not the case we check whether it was downloaded by ReactAndroid project
|
|
595
|
+
if (file("$reactNativeAndroidDownloadDir/$artifactLocalName").isFile()) {
|
|
596
|
+
return true
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
return false
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
Task resolveBoost = resolveTaskFactory("resolveBoost", "boost_${BOOST_VERSION}.tar.gz", reactNativeAndroidDownloadDir, downloadsDir)
|
|
605
|
+
Task resolveDoubleConversion = resolveTaskFactory(
|
|
606
|
+
"resolveDoubleConversion",
|
|
607
|
+
"double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz",
|
|
608
|
+
reactNativeAndroidDownloadDir,
|
|
609
|
+
downloadsDir
|
|
610
|
+
)
|
|
611
|
+
Task resolveFolly = resolveTaskFactory("resolveFolly", "folly-${FOLLY_VERSION}.tar.gz", reactNativeAndroidDownloadDir, downloadsDir)
|
|
612
|
+
Task resolveGlog = resolveTaskFactory("resolveGlog", "glog-${GLOG_VERSION}.tar.gz", reactNativeAndroidDownloadDir, downloadsDir)
|
|
613
|
+
|
|
614
|
+
if (isNewArchitectureEnabled()) {
|
|
615
|
+
def reactNativeAndroidProject = findProject(":ReactAndroid")
|
|
616
|
+
if (reactNativeAndroidProject != null) {
|
|
617
|
+
reactNativeAndroidProject.afterEvaluate {
|
|
618
|
+
def resolveTasks = [resolveBoost, resolveGlog, resolveDoubleConversion, resolveFolly]
|
|
619
|
+
resolveTasks.forEach({ task ->
|
|
620
|
+
String reactAndroidDownloadTaskName = "download" + task.name.replace("resolve", "")
|
|
621
|
+
def reactAndroidDownloadTask = reactNativeAndroidProject.getTasks().findByName(reactAndroidDownloadTaskName)
|
|
622
|
+
if (reactAndroidDownloadTask != null) {
|
|
623
|
+
task.dependsOn(reactAndroidDownloadTask)
|
|
624
|
+
} else {
|
|
625
|
+
logger.warn("[Reanimated] Failed to find task named `$reactAndroidDownloadTaskName` in `:ReactAndroid` project." +
|
|
626
|
+
" Explicit dependency between it and $task.name task can not be set.")
|
|
627
|
+
}
|
|
628
|
+
})
|
|
629
|
+
}
|
|
630
|
+
} else {
|
|
631
|
+
throw new GradleScriptException("[Reanimated] Failed to find `:ReactAndroid` project. Explicit dependency between download tasks can not be set.")
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
task downloadBoost(dependsOn: resolveBoost, type: Download) {
|
|
462
636
|
def transformedVersion = BOOST_VERSION.replace("_", ".")
|
|
637
|
+
def artifactLocalName = "boost_${BOOST_VERSION}.tar.gz"
|
|
463
638
|
def srcUrl = "https://boostorg.jfrog.io/artifactory/main/release/${transformedVersion}/source/boost_${BOOST_VERSION}.tar.gz"
|
|
464
|
-
if (
|
|
639
|
+
if (REACT_NATIVE_MINOR_VERSION < 69) {
|
|
465
640
|
srcUrl = "https://github.com/react-native-community/boost-for-react-native/releases/download/v${transformedVersion}-0/boost_${BOOST_VERSION}.tar.gz"
|
|
466
641
|
}
|
|
467
642
|
src(srcUrl)
|
|
468
643
|
onlyIfNewer(true)
|
|
469
644
|
overwrite(false)
|
|
470
|
-
dest(new File(downloadsDir,
|
|
645
|
+
dest(new File(downloadsDir, artifactLocalName))
|
|
471
646
|
}
|
|
472
647
|
|
|
473
648
|
task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
|
|
@@ -481,7 +656,7 @@ task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
|
|
|
481
656
|
}
|
|
482
657
|
}
|
|
483
658
|
|
|
484
|
-
task downloadDoubleConversion(dependsOn:
|
|
659
|
+
task downloadDoubleConversion(dependsOn: resolveDoubleConversion, type: Download) {
|
|
485
660
|
src("https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz")
|
|
486
661
|
onlyIfNewer(true)
|
|
487
662
|
overwrite(false)
|
|
@@ -497,7 +672,7 @@ task prepareDoubleConversion(dependsOn: dependenciesPath ? [] : [downloadDoubleC
|
|
|
497
672
|
into("$thirdPartyNdkDir/double-conversion")
|
|
498
673
|
}
|
|
499
674
|
|
|
500
|
-
task downloadFolly(dependsOn:
|
|
675
|
+
task downloadFolly(dependsOn: resolveFolly, type: Download) {
|
|
501
676
|
src("https://github.com/facebook/folly/archive/v${FOLLY_VERSION}.tar.gz")
|
|
502
677
|
onlyIfNewer(true)
|
|
503
678
|
overwrite(false)
|
|
@@ -516,7 +691,7 @@ task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy
|
|
|
516
691
|
into("$thirdPartyNdkDir/folly")
|
|
517
692
|
}
|
|
518
693
|
|
|
519
|
-
task downloadGlog(dependsOn:
|
|
694
|
+
task downloadGlog(dependsOn: resolveGlog, type: Download) {
|
|
520
695
|
src("https://github.com/google/glog/archive/v${GLOG_VERSION}.tar.gz")
|
|
521
696
|
onlyIfNewer(true)
|
|
522
697
|
overwrite(false)
|
|
@@ -562,23 +737,97 @@ task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy)
|
|
|
562
737
|
}
|
|
563
738
|
}
|
|
564
739
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
740
|
+
/*
|
|
741
|
+
Reanimated includes "hermes/hermes.h" header file in `NativeProxy.cpp`.
|
|
742
|
+
Previously, we used header files from `hermes-engine` package in `node_modules`.
|
|
743
|
+
Starting from React Native 0.69, Hermes is no longer distributed as package on NPM.
|
|
744
|
+
On the new architecture, Hermes is downloaded from GitHub and then compiled from sources.
|
|
745
|
+
However, on the old architecture, we need to download Hermes header files on our own
|
|
746
|
+
as well as unzip Hermes AAR in order to obtain `libhermes.so` shared library.
|
|
747
|
+
For more details, see https://reactnative.dev/architecture/bundled-hermes
|
|
748
|
+
or https://github.com/reactwg/react-native-new-architecture/discussions/4
|
|
749
|
+
*/
|
|
750
|
+
if (REACT_NATIVE_MINOR_VERSION >= 69 && !isNewArchitectureEnabled()) {
|
|
751
|
+
// copied from `react-native/ReactAndroid/hermes-engine/build.gradle`
|
|
752
|
+
|
|
753
|
+
def downloadDir = customDownloadsDir ? new File(customDownloadsDir) : new File(reactNativeRootDir, "sdks/download")
|
|
754
|
+
|
|
755
|
+
// By default we are going to download and unzip hermes inside the /sdks/hermes folder
|
|
756
|
+
// but you can provide an override for where the hermes source code is located.
|
|
757
|
+
def hermesDir = System.getenv("REACT_NATIVE_OVERRIDE_HERMES_DIR") ?: new File(reactNativeRootDir, "sdks/hermes")
|
|
758
|
+
|
|
759
|
+
def hermesVersion = "main"
|
|
760
|
+
def hermesVersionFile = new File(reactNativeRootDir, "sdks/.hermesversion")
|
|
761
|
+
if (hermesVersionFile.exists()) {
|
|
762
|
+
hermesVersion = hermesVersionFile.text
|
|
569
763
|
}
|
|
570
764
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
765
|
+
task downloadHermes(type: Download) {
|
|
766
|
+
src("https://github.com/facebook/hermes/tarball/${hermesVersion}")
|
|
767
|
+
onlyIfNewer(true)
|
|
768
|
+
overwrite(false)
|
|
769
|
+
dest(new File(downloadDir, "hermes.tar.gz"))
|
|
574
770
|
}
|
|
575
771
|
|
|
576
|
-
|
|
772
|
+
task unzipHermes(dependsOn: downloadHermes, type: Copy) {
|
|
773
|
+
from(tarTree(downloadHermes.dest)) {
|
|
774
|
+
eachFile { file ->
|
|
775
|
+
// We flatten the unzip as the tarball contains a `facebook-hermes-<SHA>`
|
|
776
|
+
// folder at the top level.
|
|
777
|
+
if (file.relativePath.segments.size() > 1) {
|
|
778
|
+
file.relativePath = new RelativePath(!file.isDirectory(), file.relativePath.segments.drop(1))
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
into(hermesDir)
|
|
783
|
+
}
|
|
784
|
+
}
|
|
577
785
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
786
|
+
task prepareHermes() {
|
|
787
|
+
if (REACT_NATIVE_MINOR_VERSION >= 69) {
|
|
788
|
+
if (!isNewArchitectureEnabled()) {
|
|
789
|
+
dependsOn(unzipHermes)
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
doLast {
|
|
793
|
+
// e.g. hermes-engine-0.70.0-rc.1-debug.aar
|
|
794
|
+
def hermesAAR = file(
|
|
795
|
+
"$reactNativeRootDir/android/com/facebook/react/hermes-engine/" +
|
|
796
|
+
"${REACT_NATIVE_VERSION}/hermes-engine-${REACT_NATIVE_VERSION}-" +
|
|
797
|
+
"${resolveBuildType()}.aar"
|
|
798
|
+
)
|
|
799
|
+
if (!hermesAAR.exists()) {
|
|
800
|
+
throw new GradleScriptException("Could not find hermes-engine AAR", null)
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
def soFiles = zipTree(hermesAAR).matching({ it.include "**/*.so" })
|
|
804
|
+
|
|
805
|
+
copy {
|
|
806
|
+
from soFiles
|
|
807
|
+
from "$reactNativeRootDir/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
|
|
808
|
+
into "$thirdPartyNdkDir/hermes"
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
} else {
|
|
812
|
+
doLast {
|
|
813
|
+
def hermesPackagePath = findNodeModulePath(projectDir, "hermes-engine")
|
|
814
|
+
if (!hermesPackagePath) {
|
|
815
|
+
throw new GradleScriptException("Could not find the hermes-engine npm package", null)
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
def hermesAAR = file("$hermesPackagePath/android/hermes-${resolveBuildType()}.aar") // e.g. hermes-debug.aar
|
|
819
|
+
if (!hermesAAR.exists()) {
|
|
820
|
+
throw new GradleScriptException("The hermes-engine npm package is missing \"android/hermes-${resolveBuildType()}.aar\"", null)
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
def soFiles = zipTree(hermesAAR).matching({ it.include "**/*.so" })
|
|
824
|
+
|
|
825
|
+
copy {
|
|
826
|
+
from soFiles
|
|
827
|
+
from "$reactNativeRootDir/ReactAndroid/src/main/jni/first-party/hermes/Android.mk"
|
|
828
|
+
into "$thirdPartyNdkDir/hermes"
|
|
829
|
+
}
|
|
830
|
+
}
|
|
582
831
|
}
|
|
583
832
|
}
|
|
584
833
|
|
|
@@ -602,7 +851,7 @@ task prepareJSC {
|
|
|
602
851
|
copy {
|
|
603
852
|
from(soFiles)
|
|
604
853
|
from(headerFiles)
|
|
605
|
-
from("$
|
|
854
|
+
from("$reactNativeRootDir/ReactAndroid/src/main/jni/third-party/jsc/Android.mk")
|
|
606
855
|
|
|
607
856
|
filesMatching("**/*.h", { it.path = "JavaScriptCore/${it.name}" })
|
|
608
857
|
|
|
@@ -619,7 +868,7 @@ task extractAARHeaders {
|
|
|
619
868
|
def packageName = file.name.tokenize('-')[0]
|
|
620
869
|
copy {
|
|
621
870
|
from zipTree(file)
|
|
622
|
-
into "$
|
|
871
|
+
into "$reactNativeRootDir/ReactAndroid/src/main/jni/first-party/$packageName/headers"
|
|
623
872
|
include "**/*.h"
|
|
624
873
|
}
|
|
625
874
|
}
|
|
@@ -633,7 +882,7 @@ task extractSOFiles {
|
|
|
633
882
|
def packageName = file.name.tokenize('-')[0]
|
|
634
883
|
copy {
|
|
635
884
|
from zipTree(file)
|
|
636
|
-
into "$
|
|
885
|
+
into "$reactNativeRootDir/ReactAndroid/src/main/jni/first-party/$packageName/"
|
|
637
886
|
include "jni/**/*.so"
|
|
638
887
|
}
|
|
639
888
|
}
|
|
@@ -643,7 +892,7 @@ task extractSOFiles {
|
|
|
643
892
|
task packageNdkLibs(type: Copy) {
|
|
644
893
|
from("$buildDir/reanimated-ndk/all")
|
|
645
894
|
include("**/libreanimated.so")
|
|
646
|
-
if(
|
|
895
|
+
if(REACT_NATIVE_MINOR_VERSION < 64) {
|
|
647
896
|
include("**/libturbomodulejsijni.so")
|
|
648
897
|
}
|
|
649
898
|
into("$projectDir/src/main/jniLibs")
|
|
@@ -654,11 +903,11 @@ repositories {
|
|
|
654
903
|
mavenLocal()
|
|
655
904
|
maven {
|
|
656
905
|
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
657
|
-
url "$
|
|
906
|
+
url "$reactNativeRootDir/android"
|
|
658
907
|
}
|
|
659
908
|
maven {
|
|
660
909
|
// Android JSC is installed from npm
|
|
661
|
-
url "$
|
|
910
|
+
url "$reactNativeRootDir/../jsc-android/dist"
|
|
662
911
|
}
|
|
663
912
|
google()
|
|
664
913
|
}
|
|
@@ -666,7 +915,7 @@ repositories {
|
|
|
666
915
|
dependencies {
|
|
667
916
|
// noinspection GradleDynamicVersion
|
|
668
917
|
implementation "com.facebook.yoga:proguard-annotations:1.19.0"
|
|
669
|
-
if (isDeveloperMode()) {
|
|
918
|
+
if (isDeveloperMode() && !isNewArchitectureEnabled()) {
|
|
670
919
|
implementation "com.facebook.fbjni:fbjni:" + FBJNI_VERSION
|
|
671
920
|
}
|
|
672
921
|
else {
|
|
@@ -674,22 +923,29 @@ dependencies {
|
|
|
674
923
|
}
|
|
675
924
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
676
925
|
implementation "androidx.transition:transition:1.1.0"
|
|
926
|
+
implementation "androidx.core:core:1.6.0"
|
|
927
|
+
|
|
677
928
|
extractHeaders("com.facebook.fbjni:fbjni:" + FBJNI_VERSION + ":headers")
|
|
678
929
|
extractSO("com.facebook.fbjni:fbjni:" + FBJNI_VERSION)
|
|
679
930
|
|
|
680
|
-
def
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
931
|
+
def jscAAR = fileTree("$reactNativeRootDir/../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*.aar" }).singleFile
|
|
932
|
+
extractSO(files(jscAAR))
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
task unpackReactNativeAAR {
|
|
936
|
+
def buildType = resolveBuildType()
|
|
686
937
|
def rnAarMatcher = "**/react-native/**/*${buildType}.aar"
|
|
687
|
-
if (
|
|
938
|
+
if (REACT_NATIVE_MINOR_VERSION < 69) {
|
|
688
939
|
rnAarMatcher = "**/**/*.aar"
|
|
689
940
|
}
|
|
690
|
-
def rnAAR = fileTree("$
|
|
691
|
-
def
|
|
692
|
-
|
|
941
|
+
def rnAAR = fileTree("$reactNativeRootDir/android").matching({ it.include rnAarMatcher }).singleFile
|
|
942
|
+
def file = rnAAR.absoluteFile
|
|
943
|
+
def packageName = file.name.tokenize('-')[0]
|
|
944
|
+
copy {
|
|
945
|
+
from zipTree(file)
|
|
946
|
+
into "$reactNativeRootDir/ReactAndroid/src/main/jni/first-party/$packageName/"
|
|
947
|
+
include "jni/**/*.so"
|
|
948
|
+
}
|
|
693
949
|
}
|
|
694
950
|
|
|
695
951
|
task downloadNdkBuildDependencies {
|
|
@@ -701,8 +957,14 @@ task downloadNdkBuildDependencies {
|
|
|
701
957
|
dependsOn(downloadGlog)
|
|
702
958
|
}
|
|
703
959
|
|
|
704
|
-
task prepareThirdPartyNdkHeaders(dependsOn:[
|
|
705
|
-
|
|
960
|
+
task prepareThirdPartyNdkHeaders(dependsOn:[
|
|
961
|
+
downloadNdkBuildDependencies,
|
|
962
|
+
prepareBoost,
|
|
963
|
+
prepareDoubleConversion,
|
|
964
|
+
prepareFolly,
|
|
965
|
+
prepareGlog,
|
|
966
|
+
unpackReactNativeAAR]
|
|
967
|
+
) {}
|
|
706
968
|
|
|
707
969
|
def nativeBuildDependsOn(dependsOnTask) {
|
|
708
970
|
def buildTasks = tasks.findAll({ task ->
|
|
@@ -717,13 +979,36 @@ afterEvaluate {
|
|
|
717
979
|
nativeBuildDependsOn(prepareThirdPartyNdkHeaders)
|
|
718
980
|
nativeBuildDependsOn(extractAARHeaders)
|
|
719
981
|
nativeBuildDependsOn(extractSOFiles)
|
|
982
|
+
|
|
983
|
+
tasks.forEach({ task ->
|
|
984
|
+
if (task.name.contains("JniLibFolders")) {
|
|
985
|
+
task.dependsOn(packageNdkLibs)
|
|
986
|
+
}
|
|
987
|
+
})
|
|
988
|
+
|
|
989
|
+
if (JS_RUNTIME == "hermes") {
|
|
990
|
+
extractAARHeaders.dependsOn(prepareHermes)
|
|
991
|
+
extractSOFiles.dependsOn(prepareHermes)
|
|
992
|
+
} else if (JS_RUNTIME == "v8") {
|
|
993
|
+
def buildTasks = tasks.findAll({ task ->
|
|
994
|
+
!task.name.contains("Clean") && (task.name.contains("externalNative") || task.name.contains("CMake") || task.name.startsWith("generateJsonModel")) })
|
|
995
|
+
buildTasks.forEach { task ->
|
|
996
|
+
def buildType = task.name.endsWith('Debug') ? 'Debug' : 'Release'
|
|
997
|
+
task.dependsOn(":react-native-v8:copy${buildType}JniLibsProjectOnly")
|
|
998
|
+
}
|
|
999
|
+
} else if (JS_RUNTIME == "jsc") {
|
|
1000
|
+
extractAARHeaders.dependsOn(prepareJSC)
|
|
1001
|
+
extractSOFiles.dependsOn(prepareJSC)
|
|
1002
|
+
} else {
|
|
1003
|
+
throw GradleScriptException("Unknown JS runtime ${JS_RUNTIME}.")
|
|
1004
|
+
}
|
|
720
1005
|
}
|
|
721
1006
|
|
|
722
1007
|
if (CLIENT_SIDE_BUILD) {
|
|
723
1008
|
def aarDir = "${buildDir}/outputs"
|
|
724
|
-
aar = file("${aarDir}/android-debug.aar
|
|
1009
|
+
aar = file("${aarDir}/android-${resolveBuildType()}.aar") // e.g. android-debug.aar
|
|
725
1010
|
if (aar == null) {
|
|
726
1011
|
throw GradleScriptException("AAR build failed. No AAR found in ${aarDir}.")
|
|
727
1012
|
}
|
|
728
1013
|
artifacts.add("default", aar)
|
|
729
|
-
}
|
|
1014
|
+
}
|