Skip to content

Commit

Permalink
Expose react_timing headers in reactnative prefab (#46427)
Browse files Browse the repository at this point in the history
Summary:
This PR fixes the following error when building third-party libraries that `#include <react/fabric/Binding.h>` which includes `react/timing/primitives.h` which is not included in `reactnative` prefab.

```
FAILED: CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o
/Users/tomekzaw/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android24 --sysroot=/Users/tomekzaw/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DFOLLY_NO_CONFIG=1 -Drnscreens_EXPORTS -I/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/../cpp -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/jsi/include -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include -isystem /Users/tomekzaw/.gradle/caches/8.10.1/transforms/b0878eb14f826ac5f04db98523604de2/transformed/fbjni-0.6.0/prefab/modules/fbjni/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -fPIC -std=c++20 -MD -MT CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o -MF CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o.d -o CMakeFiles/rnscreens.dir/src/main/cpp/NativeProxy.cpp.o -c /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/src/main/cpp/NativeProxy.cpp
In file included from /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/react-native-screens/android/src/main/cpp/NativeProxy.cpp:2:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/fabric/Binding.h:17:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/jni/JRuntimeScheduler.h:11:
In file included from /Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/renderer/runtimescheduler/RuntimeScheduler.h:11:
/Users/tomekzaw/.gradle/caches/8.10.1/transforms/eb5443cef7868b6c3cc54bbf3f161a63/transformed/react-android-0.76.0-rc.0-debug/prefab/modules/reactnative/include/react/performance/timeline/PerformanceEntryReporter.h:10:10: fatal error: 'react/timing/primitives.h' file not found
#include <react/timing/primitives.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```

## Changelog:

[ANDROID] [FIXED] - Expose `react_timing` headers in `reactnative` prefab

Pull Request resolved: #46427

Test Plan: Tested on Reanimated fabric-example app with react-native-screens installed built from source on top of RN 0.76.0-rc.0 with new arch enabled

Reviewed By: cipolleschi

Differential Revision: D62492707

Pulled By: cortinico

fbshipit-source-id: 94ed7044457bea53660a6ca6d5342cf8ea20a8b4
  • Loading branch information
tomekzaw authored and facebook-github-bot committed Sep 11, 2024
1 parent 69325c1 commit b1d42c8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/react-native/ReactAndroid/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ val preparePrefab by
Pair(
"../ReactCommon/react/renderer/observers/events/",
"react/renderer/observers/events/"),
// react_timing
Pair("../ReactCommon/react/timing/", "react/timing/"),
// yoga
Pair("../ReactCommon/yoga/", ""),
Pair("src/main/jni/first-party/yogajni/jni", ""),
Expand Down

0 comments on commit b1d42c8

Please sign in to comment.