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