react-native-reanimated 3.0.0-rc.2 → 3.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +3 -0
  2. package/Common/cpp/{headers/AnimatedSensor → AnimatedSensor}/AnimatedSensorModule.h +0 -0
  3. package/Common/cpp/Fabric/FabricUtils.cpp +1 -1
  4. package/Common/cpp/{headers/Fabric → Fabric}/FabricUtils.h +0 -0
  5. package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +2 -0
  6. package/Common/cpp/{headers/Fabric → Fabric}/ReanimatedUIManagerBinding.h +0 -0
  7. package/Common/cpp/{headers/Fabric → Fabric}/ShadowTreeCloner.h +1 -1
  8. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +2 -0
  9. package/Common/cpp/{headers/LayoutAnimations → LayoutAnimations}/LayoutAnimationsProxy.h +0 -0
  10. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +1 -0
  11. package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModule.h +5 -0
  12. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +2 -0
  13. package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModuleSpec.h +1 -1
  14. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +93 -0
  15. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +125 -0
  16. package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +50 -0
  17. package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.h +27 -0
  18. package/Common/cpp/ReanimatedRuntime/RuntimeInitialization.md +194 -0
  19. package/Common/cpp/{headers/Registries → Registries}/EventHandlerRegistry.h +0 -0
  20. package/Common/cpp/Registries/MapperRegistry.cpp +3 -1
  21. package/Common/cpp/{headers/Registries → Registries}/MapperRegistry.h +0 -0
  22. package/Common/cpp/{headers/Registries → Registries}/NewestShadowNodesRegistry.h +0 -0
  23. package/Common/cpp/Registries/WorkletsCache.cpp +8 -1
  24. package/Common/cpp/{headers/Registries → Registries}/WorkletsCache.h +0 -0
  25. package/Common/cpp/{headers/SharedItems → SharedItems}/FrozenObject.h +0 -0
  26. package/Common/cpp/{headers/SharedItems → SharedItems}/HostFunctionHandler.h +0 -0
  27. package/Common/cpp/SharedItems/MutableValue.cpp +2 -0
  28. package/Common/cpp/{headers/SharedItems → SharedItems}/MutableValue.h +0 -0
  29. package/Common/cpp/{headers/SharedItems → SharedItems}/MutableValueSetterProxy.h +0 -0
  30. package/Common/cpp/{headers/SharedItems → SharedItems}/RemoteObject.h +0 -0
  31. package/Common/cpp/{headers/SharedItems → SharedItems}/RuntimeManager.h +0 -0
  32. package/Common/cpp/SharedItems/ShareableValue.cpp +6 -0
  33. package/Common/cpp/{headers/SharedItems → SharedItems}/ShareableValue.h +0 -0
  34. package/Common/cpp/{headers/SharedItems → SharedItems}/SharedParent.h +0 -0
  35. package/Common/cpp/{headers/SharedItems → SharedItems}/ValueWrapper.h +0 -0
  36. package/Common/cpp/{headers/SpecTools → SpecTools}/ErrorHandler.h +0 -0
  37. package/Common/cpp/{headers/Tools → Tools}/FeaturesConfig.h +0 -0
  38. package/Common/cpp/Tools/JSIStoreValueUser.cpp +2 -2
  39. package/Common/cpp/{headers/Tools → Tools}/JSIStoreValueUser.h +0 -0
  40. package/Common/cpp/{headers/Tools → Tools}/Mapper.h +0 -0
  41. package/Common/cpp/{headers/Tools → Tools}/PlatformDepMethodsHolder.h +0 -0
  42. package/Common/cpp/{headers/Tools → Tools}/ReanimatedHiddenHeaders.h +1 -1
  43. package/Common/cpp/{headers/Tools → Tools}/RuntimeDecorator.h +0 -0
  44. package/Common/cpp/{headers/Tools → Tools}/Scheduler.h +0 -0
  45. package/Common/cpp/Tools/SingleInstanceChecker.h +58 -0
  46. package/Common/cpp/{headers/Tools → Tools}/WorkletEventHandler.h +0 -0
  47. package/RNReanimated.podspec +25 -23
  48. package/android/CMakeLists.txt +41 -38
  49. package/android/build.gradle +91 -72
  50. package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +10 -8
  51. package/android/src/main/cpp/{headers/AndroidErrorHandler.h → AndroidErrorHandler.h} +0 -0
  52. package/android/src/main/cpp/AndroidLogger.cpp +4 -1
  53. package/android/src/main/cpp/{headers/AndroidLogger.h → AndroidLogger.h} +0 -0
  54. package/android/src/main/cpp/{headers/AndroidScheduler.h → AndroidScheduler.h} +0 -0
  55. package/android/src/main/cpp/{headers/JNIHelper.h → JNIHelper.h} +0 -0
  56. package/android/src/main/cpp/{headers/LayoutAnimations.h → LayoutAnimations.h} +0 -0
  57. package/android/src/main/cpp/NativeProxy.cpp +12 -28
  58. package/android/src/main/cpp/{headers/NativeProxy.h → NativeProxy.h} +3 -1
  59. package/android/src/main/cpp/{headers/TurboModule.h → TurboModule.h} +0 -0
  60. package/android/src/main/java/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +77 -0
  61. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +2 -1
  62. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +7 -7
  63. package/ios/REAModule.mm +10 -0
  64. package/ios/native/NativeProxy.mm +12 -19
  65. package/ios/native/REAInitializer.h +2 -2
  66. package/ios/native/REAInitializer.mm +2 -2
  67. package/ios/native/REAMessageThread.h +22 -0
  68. package/ios/native/REAMessageThread.mm +38 -0
  69. package/ios/native/UIResponder+Reanimated.mm +1 -1
  70. package/lib/commonjs/reanimated2/NativeMethods.js +20 -24
  71. package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -1
  72. package/lib/commonjs/reanimated2/animation/delay.js +0 -12
  73. package/lib/commonjs/reanimated2/animation/delay.js.map +1 -1
  74. package/lib/commonjs/reanimated2/animation/repeat.js +0 -24
  75. package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -1
  76. package/lib/commonjs/reanimated2/animation/sequence.js +0 -12
  77. package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -1
  78. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  79. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +4 -4
  80. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  81. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +51 -19
  82. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  83. package/lib/commonjs/reanimated2/hook/index.js +8 -0
  84. package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
  85. package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  86. package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -1
  87. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +31 -0
  88. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -0
  89. package/lib/commonjs/reanimated2/utils.js +12 -3
  90. package/lib/commonjs/reanimated2/utils.js.map +1 -1
  91. package/lib/module/reanimated2/NativeMethods.js +20 -24
  92. package/lib/module/reanimated2/NativeMethods.js.map +1 -1
  93. package/lib/module/reanimated2/animation/delay.js +0 -10
  94. package/lib/module/reanimated2/animation/delay.js.map +1 -1
  95. package/lib/module/reanimated2/animation/repeat.js +0 -20
  96. package/lib/module/reanimated2/animation/repeat.js.map +1 -1
  97. package/lib/module/reanimated2/animation/sequence.js +0 -10
  98. package/lib/module/reanimated2/animation/sequence.js.map +1 -1
  99. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  100. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +4 -4
  101. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  102. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +51 -19
  103. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  104. package/lib/module/reanimated2/hook/index.js +1 -0
  105. package/lib/module/reanimated2/hook/index.js.map +1 -1
  106. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  107. package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
  108. package/lib/module/reanimated2/hook/useScrollViewOffset.js +20 -0
  109. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -0
  110. package/lib/module/reanimated2/utils.js +13 -3
  111. package/lib/module/reanimated2/utils.js.map +1 -1
  112. package/package.json +6 -4
  113. package/plugin.js +105 -47
  114. package/react-native-reanimated.d.ts +13 -9
  115. package/src/reanimated2/NativeMethods.ts +28 -33
  116. package/src/reanimated2/animation/delay.ts +0 -12
  117. package/src/reanimated2/animation/repeat.ts +0 -25
  118. package/src/reanimated2/animation/sequence.ts +0 -13
  119. package/src/reanimated2/commonTypes.ts +9 -0
  120. package/src/reanimated2/frameCallback/FrameCallbackRegistryJS.ts +6 -9
  121. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +78 -27
  122. package/src/reanimated2/hook/index.ts +1 -0
  123. package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -1
  124. package/src/reanimated2/hook/useFrameCallback.ts +2 -1
  125. package/src/reanimated2/hook/useScrollViewOffset.ts +36 -0
  126. package/src/reanimated2/utils.ts +12 -5
  127. package/android/src/main/java/com/swmansion/reanimated/ReanimatedJSIModulePackage.java +0 -29
@@ -1,4 +1,5 @@
1
1
  #include <cxxabi.h>
2
+ #include <utility>
2
3
 
3
4
  #ifdef RCT_NEW_ARCH_ENABLED
4
5
  #include <react/renderer/uimanager/primitives.h>
@@ -10,6 +11,7 @@
10
11
  #include "RemoteObject.h"
11
12
  #include "RuntimeDecorator.h"
12
13
  #include "RuntimeManager.h"
14
+ #include "ShareableValue.h"
13
15
  #include "SharedParent.h"
14
16
 
15
17
  namespace reanimated {
@@ -414,6 +416,10 @@ jsi::Value ShareableValue::toJSValue(jsi::Runtime &rt) {
414
416
  }
415
417
  } catch (jsi::JSError &e) {
416
418
  throw e;
419
+ } catch (std::exception &e) {
420
+ std::string str = e.what();
421
+ runtimeManager->errorHandler->setError(str);
422
+ runtimeManager->errorHandler->raise();
417
423
  } catch (...) {
418
424
  if (demangleExceptionName(
419
425
  abi::__cxa_current_exception_type()->name()) ==
@@ -1,6 +1,6 @@
1
1
  #include "JSIStoreValueUser.h"
2
2
  #include "RuntimeManager.h"
3
- #ifdef ONANDROID
3
+ #ifdef ANDROID
4
4
  #include <AndroidScheduler.h>
5
5
  #endif
6
6
 
@@ -32,7 +32,7 @@ StoreUser::~StoreUser() {
32
32
  std::shared_ptr<Scheduler> strongScheduler = scheduler.lock();
33
33
  if (strongScheduler != nullptr) {
34
34
  std::shared_ptr<StaticStoreUser> sud = storeUserData;
35
- #ifdef ONANDROID
35
+ #ifdef ANDROID
36
36
  jni::ThreadScope::WithClassLoader([&] {
37
37
  strongScheduler->scheduleOnUI([id, sud]() {
38
38
  const std::lock_guard<std::recursive_mutex> lock(sud->storeMutex);
File without changes
@@ -1,6 +1,6 @@
1
1
  #pragma once
2
2
 
3
- #if defined(ONANDROID)
3
+ #ifdef ANDROID
4
4
  #include "Logger.h"
5
5
  #include "LoggerInterface.h"
6
6
  #include "SpeedChecker.h"
File without changes
@@ -0,0 +1,58 @@
1
+ #pragma once
2
+
3
+ #ifdef DEBUG
4
+
5
+ #include <cxxabi.h>
6
+
7
+ #include <iostream>
8
+ #include <string>
9
+
10
+ namespace reanimated {
11
+
12
+ // This is a class that counts how many instances of a different class there
13
+ // are. It is meant only to be used with classes that should only have one
14
+ // instance.
15
+
16
+ template <class T>
17
+ class SingleInstanceChecker {
18
+ public:
19
+ SingleInstanceChecker();
20
+ ~SingleInstanceChecker();
21
+
22
+ private:
23
+ void assertWithMessage(bool condition, std::string message) {
24
+ if (!condition) {
25
+ std::cerr << message << std::endl;
26
+ assert(condition);
27
+ }
28
+ }
29
+
30
+ // A static field will exist separately for every class template.
31
+ // This has to be inline for automatic initialization.
32
+ inline static int instanceCount_;
33
+ };
34
+
35
+ template <class T>
36
+ SingleInstanceChecker<T>::SingleInstanceChecker() {
37
+ int status = 0;
38
+ std::string className =
39
+ __cxxabiv1::__cxa_demangle(typeid(T).name(), nullptr, nullptr, &status);
40
+
41
+ // Only one instance should exist, but it is possible for two instances
42
+ // to co-exist during a reload.
43
+ assertWithMessage(
44
+ instanceCount_ <= 1,
45
+ "More than one instance of " + className +
46
+ " present. This may indicate a memory leak due to a retain cycle.");
47
+
48
+ instanceCount_++;
49
+ }
50
+
51
+ template <class T>
52
+ SingleInstanceChecker<T>::~SingleInstanceChecker() {
53
+ instanceCount_--;
54
+ }
55
+
56
+ } // namespace reanimated
57
+
58
+ #endif // DEBUG
@@ -2,26 +2,29 @@ require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
4
 
5
- reactVersion = '0.0.0'
5
+ reactNativeVersion = '0.0.0'
6
6
  reactTargetTvOS = false
7
7
  isUserApp = false
8
+ nodeModulesDir = File.join(__dir__, "..", "..", "node_modules")
8
9
 
9
10
  begin
10
11
  # user app
11
12
  # /appName/node_modules/react-native-reanimated/RNReanimated.podspec
12
13
  # /appName/node_modules/react-native/package.json
13
- reactJson = JSON.parse(File.read(File.join(__dir__, "..", "..", "node_modules", "react-native", "package.json")))
14
- reactVersion = reactJson["version"]
15
- reactTargetTvOS = reactJson["name"] == "react-native-tvos"
14
+ nodeModulesDir = File.join(__dir__, "..", "..", "node_modules")
15
+ reactNativePackageJson = JSON.parse(File.read(File.join(nodeModulesDir, "react-native", "package.json")))
16
+ reactNativeVersion = reactNativePackageJson["version"]
17
+ reactTargetTvOS = reactNativePackageJson["name"] == "react-native-tvos"
16
18
  isUserApp = true
17
19
  rescue
18
20
  begin
19
21
  # monorepo
20
22
  # /monorepo/packages/appName/node_modules/react-native-reanimated/RNReanimated.podspec
21
23
  # /monorepo/node_modules/react-native/package.json
22
- reactJson = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "node_modules", "react-native", "package.json")))
23
- reactVersion = reactJson["version"]
24
- reactTargetTvOS = reactJson["name"] == "react-native-tvos"
24
+ nodeModulesDir = File.join(__dir__, "..", "..", "..", "..", "node_modules")
25
+ reactNativePackageJson = JSON.parse(File.read(File.join(nodeModulesDir, "react-native", "package.json")))
26
+ reactNativeVersion = reactNativePackageJson["version"]
27
+ reactTargetTvOS = reactNativePackageJson["name"] == "react-native-tvos"
25
28
  rescue
26
29
  begin
27
30
  # Example app in reanimated repo
@@ -34,19 +37,22 @@ rescue
34
37
  else
35
38
  appName = "Example"
36
39
  end
37
- reactJson = JSON.parse(File.read(File.join(__dir__, appName, "node_modules", "react-native", "package.json")))
38
- reactVersion = reactJson["version"]
40
+ nodeModulesDir = File.join(__dir__, appName, "node_modules")
41
+ reactNativePackageJson = JSON.parse(File.read(File.join(nodeModulesDir, "react-native", "package.json")))
42
+ reactNativeVersion = reactNativePackageJson["version"]
39
43
  reactTargetTvOS = ENV["ReanimatedTVOSExample"] == "1"
40
44
  rescue
41
45
  # should never happen
42
- reactVersion = '0.68.0'
43
- puts "[RNReanimated] Unable to recognize your `react-native` version! Default `react-native` version: " + reactVersion
46
+ reactNativeVersion = '0.68.0'
47
+ puts "[RNReanimated] Unable to recognize your `react-native` version! Default `react-native` version: " + reactNativeVersion
44
48
  end
45
49
  end
46
50
  end
47
51
 
52
+ reactCommonDir = File.join(nodeModulesDir, "react-native", "ReactCommon")
53
+
48
54
  if isUserApp
49
- libInstances = %x[find ../../ -name "package.json" | grep "/react-native-reanimated/package.json"]
55
+ libInstances = %x[find ../../ -name "package.json" | grep "/react-native-reanimated/package.json" | grep -v "/.yarn/"]
50
56
  libInstancesArray = libInstances.split("\n")
51
57
  if libInstancesArray.length() > 1
52
58
  parsedLocation = ''
@@ -59,16 +65,16 @@ if isUserApp
59
65
  end
60
66
  end
61
67
 
62
- rnVersion = reactVersion.split('.')[1]
68
+ reactNativeMinorVersion = reactNativeVersion.split('.')[1].to_i
63
69
 
64
70
  fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
65
71
 
66
72
  folly_prefix = ""
67
- if rnVersion.to_i >= 64
73
+ if reactNativeMinorVersion >= 64
68
74
  folly_prefix = "RCT-"
69
75
  end
70
76
 
71
- folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -DRNVERSION=' + rnVersion
77
+ folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -DREACT_NATIVE_MINOR_VERSION=' + reactNativeMinorVersion.to_s
72
78
  folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
73
79
  boost_compiler_flags = '-Wno-documentation'
74
80
  fabric_flags = ''
@@ -92,8 +98,7 @@ Pod::Spec.new do |s|
92
98
 
93
99
  s.source_files = [
94
100
  "ios/**/*.{mm,h,m}",
95
- "Common/cpp/**/*.cpp",
96
- "Common/cpp/headers/**/*.h"
101
+ "Common/cpp/**/*.{cpp,h}"
97
102
  ]
98
103
 
99
104
  s.preserve_paths = [
@@ -105,9 +110,9 @@ Pod::Spec.new do |s|
105
110
  "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\"",
106
111
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
107
112
  }
108
- s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
113
+ s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags + ' -DHERMES_ENABLE_DEBUGGER'
109
114
  s.xcconfig = {
110
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"",
115
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\" \"#{reactCommonDir}\"",
111
116
  "OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags + " " + fabric_flags }
112
117
 
113
118
  s.requires_arc = true
@@ -147,12 +152,9 @@ Pod::Spec.new do |s|
147
152
  s.dependency 'DoubleConversion'
148
153
  s.dependency 'glog'
149
154
 
150
- if reactVersion.match(/^0.62/)
155
+ if reactNativeMinorVersion == 62
151
156
  s.dependency 'ReactCommon/callinvoker'
152
157
  else
153
158
  s.dependency 'React-callinvoker'
154
159
  end
155
-
156
-
157
160
  end
158
-
@@ -1,17 +1,20 @@
1
1
  project(Reanimated)
2
- cmake_minimum_required(VERSION 3.12.0)
2
+ cmake_minimum_required(VERSION 3.8)
3
3
 
4
4
  set (CMAKE_VERBOSE_MAKEFILE ON)
5
5
  set (CMAKE_CXX_STANDARD 17)
6
- set (DEFAULT_FLAGS "-DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DON_ANDROID -DONANDROID -DANDROID -DRNVERSION=${RNVERSION} -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare -std=c++17 -Wall")
6
+ set (DEFAULT_FLAGS "-DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DANDROID -DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION} -DHERMES_ENABLE_DEBUGGER=${HERMES_ENABLE_DEBUGGER} -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare -std=c++17 -Wall -Werror")
7
7
  if(${IS_NEW_ARCHITECTURE_ENABLED})
8
8
  set (ALL_FLAGS "${DEFAULT_FLAGS} -DRCT_NEW_ARCH_ENABLED")
9
9
  else()
10
10
  set (ALL_FLAGS ${DEFAULT_FLAGS})
11
11
  endif()
12
+ if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
13
+ set (ALL_FLAGS "${ALL_FLAGS} -DDEBUG")
14
+ endif()
12
15
  set (CMAKE_CXX_FLAGS ${ALL_FLAGS})
13
16
 
14
- if(${NATIVE_DEBUG})
17
+ if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
15
18
  set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
16
19
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
17
20
  endif()
@@ -23,13 +26,7 @@ set (PACKAGE_NAME "reanimated")
23
26
  set (BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
24
27
  set (SRC_DIR ${CMAKE_SOURCE_DIR}/src)
25
28
 
26
- set (ignoreMe "${PLAYGROUND_APP_NAME}")
27
-
28
- if(${CLIENT_SIDE_BUILD})
29
- set (COMMON_SRC_DIR "${CMAKE_SOURCE_DIR}/../Common")
30
- else()
31
- set (COMMON_SRC_DIR "${SRC_DIR}/main/Common")
32
- endif()
29
+ set (COMMON_SRC_DIR "${CMAKE_SOURCE_DIR}/../Common")
33
30
 
34
31
  if(${IS_NEW_ARCHITECTURE_ENABLED})
35
32
  if(${CLIENT_SIDE_BUILD})
@@ -49,7 +46,7 @@ file (GLOB LIBRN_DIR "${RN_SO_DIR}/${ANDROID_ABI}")
49
46
  file(GLOB_RECURSE SOURCES_COMMON CONFIGURE_DEPENDS "${COMMON_SRC_DIR}/cpp/**.cpp")
50
47
  file(GLOB_RECURSE SOURCES_ANDROID CONFIGURE_DEPENDS "${SRC_DIR}/main/cpp/**.cpp")
51
48
 
52
- if(${REACT_NATIVE_TARGET_VERSION} LESS 66)
49
+ if(${REACT_NATIVE_MINOR_VERSION} LESS 66)
53
50
  set (
54
51
  INCLUDE_JSI_CPP
55
52
  "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
@@ -60,17 +57,6 @@ if(${REACT_NATIVE_TARGET_VERSION} LESS 66)
60
57
  )
61
58
  endif()
62
59
 
63
- if(${IS_NEW_ARCHITECTURE_ENABLED})
64
- set(
65
- FABRIC_UTILS_CPP
66
- "${COMMON_SRC_DIR}/cpp/Fabric/FabricUtils.cpp"
67
- )
68
- set(
69
- REANIMATED_UI_MANAGER_BINDING_CPP
70
- "${COMMON_SRC_DIR}/cpp/Fabric/ReanimatedUIManagerBinding.cpp"
71
- )
72
- endif()
73
-
74
60
  add_library(
75
61
  ${PACKAGE_NAME}
76
62
  SHARED
@@ -78,8 +64,6 @@ add_library(
78
64
  ${SOURCES_ANDROID}
79
65
  ${INCLUDE_JSI_CPP}
80
66
  ${INCLUDE_JSIDYNAMIC_CPP}
81
- ${FABRIC_UTILS_CPP}
82
- ${REANIMATED_UI_MANAGER_BINDING_CPP}
83
67
  )
84
68
 
85
69
  # includes
@@ -102,21 +86,23 @@ target_include_directories(
102
86
  "${NODE_MODULES_DIR}/react-native/ReactCommon"
103
87
  "${NODE_MODULES_DIR}/react-native/ReactCommon/callinvoker"
104
88
  "${NODE_MODULES_DIR}/react-native/ReactCommon/jsi"
89
+ "${NODE_MODULES_DIR}/react-native/ReactCommon/hermes"
105
90
  "${NODE_MODULES_DIR}/react-native/ReactCommon/react/renderer/graphics/platform/cxx"
106
91
  "${NODE_MODULES_DIR}/react-native/ReactCommon/runtimeexecutor"
107
92
  "${NODE_MODULES_DIR}/react-native/ReactCommon/turbomodule/core"
108
93
  "${NODE_MODULES_DIR}/react-native/ReactCommon/turbomodule"
109
94
  "${NODE_MODULES_DIR}/react-native/ReactCommon/yoga"
110
- "${COMMON_SRC_DIR}/cpp/headers/Tools"
111
- "${COMMON_SRC_DIR}/cpp/headers/SpecTools"
112
- "${COMMON_SRC_DIR}/cpp/headers/NativeModules"
113
- "${COMMON_SRC_DIR}/cpp/headers/SharedItems"
114
- "${COMMON_SRC_DIR}/cpp/headers/Registries"
115
- "${COMMON_SRC_DIR}/cpp/headers/LayoutAnimations"
116
- "${COMMON_SRC_DIR}/cpp/headers/AnimatedSensor"
117
- "${COMMON_SRC_DIR}/cpp/headers/Fabric"
95
+ "${COMMON_SRC_DIR}/cpp/Tools"
96
+ "${COMMON_SRC_DIR}/cpp/SpecTools"
97
+ "${COMMON_SRC_DIR}/cpp/NativeModules"
98
+ "${COMMON_SRC_DIR}/cpp/SharedItems"
99
+ "${COMMON_SRC_DIR}/cpp/ReanimatedRuntime"
100
+ "${COMMON_SRC_DIR}/cpp/Registries"
101
+ "${COMMON_SRC_DIR}/cpp/LayoutAnimations"
102
+ "${COMMON_SRC_DIR}/cpp/AnimatedSensor"
103
+ "${COMMON_SRC_DIR}/cpp/Fabric"
118
104
  "${COMMON_SRC_DIR}/cpp/hidden_headers"
119
- "${SRC_DIR}/main/cpp/headers"
105
+ "${SRC_DIR}/main/cpp"
120
106
  )
121
107
 
122
108
  find_library(
@@ -142,7 +128,7 @@ find_library(
142
128
  NO_CMAKE_FIND_ROOT_PATH
143
129
  )
144
130
 
145
- if(${REACT_NATIVE_TARGET_VERSION} LESS 69)
131
+ if(${REACT_NATIVE_MINOR_VERSION} LESS 69)
146
132
  find_library(
147
133
  FOLLY_LIB
148
134
  folly_json
@@ -158,7 +144,7 @@ else()
158
144
  )
159
145
  endif()
160
146
 
161
- if(${REACT_NATIVE_TARGET_VERSION} LESS 66)
147
+ if(${REACT_NATIVE_MINOR_VERSION} LESS 66)
162
148
  set (JSI_LIB "")
163
149
  else()
164
150
  find_library(
@@ -250,7 +236,7 @@ target_link_libraries(
250
236
 
251
237
  if(${JS_RUNTIME} STREQUAL "hermes")
252
238
  string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_HERMES=1")
253
- if(${REACT_NATIVE_TARGET_VERSION} LESS 69)
239
+ if(${REACT_NATIVE_MINOR_VERSION} LESS 69)
254
240
  # From `hermes-engine` npm package
255
241
  target_include_directories(
256
242
  ${PACKAGE_NAME}
@@ -266,6 +252,18 @@ if(${JS_RUNTIME} STREQUAL "hermes")
266
252
  "${JS_RUNTIME_DIR}/public"
267
253
  )
268
254
  endif()
255
+ if (${HERMES_ENABLE_DEBUGGER})
256
+ find_library(
257
+ HERMES_EXECUTOR_LIB
258
+ hermes-executor-debug
259
+ PATHS ${LIBRN_DIR}
260
+ NO_CMAKE_FIND_ROOT_PATH
261
+ )
262
+ target_link_libraries(
263
+ ${PACKAGE_NAME}
264
+ ${HERMES_EXECUTOR_LIB}
265
+ )
266
+ endif()
269
267
  target_link_libraries(
270
268
  ${PACKAGE_NAME}
271
269
  "${BUILD_DIR}/third-party-ndk/hermes/jni/${ANDROID_ABI}/libhermes.so"
@@ -289,7 +287,6 @@ elseif(${JS_RUNTIME} STREQUAL "v8")
289
287
  ${V8EXECUTOR_LIB}
290
288
  )
291
289
  else()
292
- set (ignoreMe "${JS_RUNTIME_DIR}")
293
290
  string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_JSC=1")
294
291
  find_library(
295
292
  JSEXECUTOR_LIB
@@ -319,7 +316,7 @@ if(${IS_NEW_ARCHITECTURE_ENABLED})
319
316
  )
320
317
  endif()
321
318
 
322
- if(${REACT_NATIVE_TARGET_VERSION} LESS 64)
319
+ if(${REACT_NATIVE_MINOR_VERSION} LESS 64)
323
320
  add_library(
324
321
  turbomodulejsijni
325
322
  # Sets the library as a shared library.
@@ -328,3 +325,9 @@ if(${REACT_NATIVE_TARGET_VERSION} LESS 64)
328
325
  ./empty.cpp
329
326
  )
330
327
  endif()
328
+
329
+ # Resolves "CMake Warning: Manually-specified variables were not used by the project"
330
+ # when any of the following variables is not used in some build configuration.
331
+ set (ignoreMe "${CLIENT_SIDE_BUILD}")
332
+ set (ignoreMe "${JS_RUNTIME_DIR}")
333
+ set (ignoreMe "${PLAYGROUND_APP_NAME}")