Skip to content

Commit 5cd6eb5

Browse files
authored
refactor(Reanimated): use worklets prefab again (#8685)
## Summary Reanimated can safely consume worklets as a prefab after the following fix - #8684 ## Test plan 1. Clean your repo with git clean -Xdf 2. Install deps with yarn 3. Open apps/fabric-example/android with AndroidStudio 4. Run build 5. Run clean 6. Run build 7. 🥳
1 parent b86f04c commit 5cd6eb5

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

packages/react-native-reanimated/android/CMakeLists.txt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ file(GLOB_RECURSE REANIMATED_ANDROID_CPP_SOURCES CONFIGURE_DEPENDS
4545

4646
find_package(fbjni REQUIRED CONFIG)
4747
find_package(ReactAndroid REQUIRED CONFIG)
48+
find_package(react-native-worklets REQUIRED CONFIG)
4849

4950
add_library(reanimated SHARED ${REANIMATED_COMMON_CPP_SOURCES}
5051
${REANIMATED_ANDROID_CPP_SOURCES})
@@ -69,8 +70,7 @@ target_include_directories(
6970
"${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor"
7071
"${REACT_NATIVE_DIR}/ReactCommon/jsiexecutor"
7172
"${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx"
72-
"${REACT_NATIVE_WORKLETS_DIR}/Common/cpp"
73-
"${REACT_NATIVE_WORKLETS_DIR}/android/src/main/cpp")
73+
)
7474

7575
set_target_properties(reanimated PROPERTIES LINKER_LANGUAGE CXX)
7676

@@ -80,15 +80,6 @@ else()
8080
set(BUILD_TYPE "release")
8181
endif()
8282

83-
add_library(worklets SHARED IMPORTED)
84-
85-
set_target_properties(
86-
worklets
87-
PROPERTIES
88-
IMPORTED_LOCATION
89-
"${REACT_NATIVE_WORKLETS_DIR}/android/build/intermediates/cmake/${BUILD_TYPE}/obj/${ANDROID_ABI}/libworklets.so"
90-
)
91-
9283
set_target_properties(reanimated PROPERTIES LINKER_LANGUAGE CXX)
9384
# remove dead code sections
9485
set_target_properties(reanimated PROPERTIES LINK_FLAGS "-Wl,--gc-sections")
@@ -108,4 +99,4 @@ target_link_libraries(
10899
ReactAndroid::jsi
109100
fbjni::fbjni
110101
android
111-
worklets)
102+
react-native-worklets::worklets)

packages/react-native-reanimated/android/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ android {
193193
"-DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION}",
194194
"-DANDROID_TOOLCHAIN=clang",
195195
"-DREACT_NATIVE_DIR=${toPlatformFileString(reactNativeRootDir.path)}",
196-
"-DREACT_NATIVE_WORKLETS_DIR=${toPlatformFileString(reactNativeWorkletsRootDir.path)}",
197196
"-DIS_REANIMATED_EXAMPLE_APP=${IS_REANIMATED_EXAMPLE_APP}",
198197
"-DREANIMATED_PROFILING=${REANIMATED_PROFILING}",
199198
"-DREANIMATED_VERSION=${REANIMATED_VERSION}",

0 commit comments

Comments
 (0)