Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55729
This is added so that one can easily enables c++ AnimatedModule in open source.
If an app doesn't use `RCTAnimatedModuleProvider`(ios) or `AnimatedCxxReactPackage`(android), it can fallback to this default AnimatedModule when it has both c++animated and shared backend enabled
- shared backend removes the need to pass down start/stop callbacks to NativeAnimatedNodesManagerProvider, so we can cleanly initialize it as static default
- RCTAnimatedModuleProvider uses the version of AnimatedModule that still relies on a dedicated CADisplayLink for start/stop
- AnimatedCxxReactPackage also bundles internal ViewEventModule (for NativeViewEvents) that shares `NativeAnimatedNodesManagerProvider` with AnimatedModule, but NativeViewEvents is not needed for open source
- Alternatively we could also expose `NativeAnimatedNodesManagerProvider` via UIManager so other turbomodules can also use it. However I don't think it makes sense to double down on another animation API on UIManager given we have shared backend.
- This assumes DefaultTurboModules is always the fallback module provider. So it'll not override when app already uses RCTAnimatedModuleProvider or AnimatedCxxReactPackage
[General] [Added] - Add c++ AnimatedModule to DefaultTurboModules
Reviewed By: NickGerleman
Differential Revision: D94244698
fbshipit-source-id: 09e905eb4bad7d03cdf87d5b47352060b0e6212f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55794
Format the error messages coming from bundling to mainting the formatting and make these easier to read.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D94611951
fbshipit-source-id: cbb8b2d1ff517b5487d4b799b1e2e3476629f84c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55735
changelog: [internal]
Add support for profiling C++ code in Fantom tests using Linux `perf`.
When `FANTOM_PROFILE_CPP=1` is set, the fantom_tester binary is wrapped with `perf record` to capture sampling profiler data with DWARF call graphs.
Usage:
```
FANTOM_PROFILE_CPP=1 yarn fantom --benchmarks --testPathPattern="View-benchmark"
```
Output is saved to `.out/cpp-traces/perf-<timestamp>.data` and can be analyzed with:
```
perf report -i .out/cpp-traces/perf-<timestamp>.data
```
Reviewed By: rubennorte
Differential Revision: D92155573
fbshipit-source-id: bde3ffcd11468e4ad88bec4b547726bed7cbde41
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55728
Fixes unwanted side effect launches of the debugger shell in tests (likely introduced in D88161573!).
Also adds error guard on `DefaultAppLauncher` to ensure that the implementation is always mocked.
Changelog: [Internal]
Reviewed By: vzaidman
Differential Revision: D94230761
fbshipit-source-id: 966f6f09c38aa55594091bd7d34a5c78dc6eee93
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55753
The warning "ASAN and TSAN modes cannot be used together" was incorrectly displayed when only ASAN was enabled. This happened because the condition checked only `enableASAN` instead of `enableASAN && enableTSAN`. Updated the conditional logic to properly check that both flags are enabled before showing the conflict warning.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D94393117
fbshipit-source-id: f7a96de11230710e8d54c17d4c89edb569ebaa07
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55736
changelog: [internal]
On macOS with EdenFS backed directories, Buck2's --out flag fails with "Operation not permitted" error.
This fix works around the issue by:
1. Building to a temp directory outside the repo (os.tmpdir())
2. Removing extended attributes with `xattr -rc` on macOS
Reviewed By: cipolleschi
Differential Revision: D92078500
fbshipit-source-id: 437734c068e4bf20a4f8e570e1184565810154d3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55725
changelog: [internal]
By default, `yarn fantom` now excludes benchmark tests (`*-benchmark-itest.js` files) to speed up regular test runs.
Benchmark tests are typically slower and used for performance analysis rather than correctness testing. Excluding them by default improves the developer experience for everyday test runs.
To run benchmark tests, use the new `--benchmarks` flag:
```
yarn fantom --benchmarks
```
Reviewed By: andrewdacenko
Differential Revision: D92150163
fbshipit-source-id: 4c40ef1ba542c4856221373d8239ba603e8f6620
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55713
changelog: [internal]
when running Fantom on Mac, I frequently see this error. This is DevTools standalone app crashing. Let's disable DevTools standalone app, it is not needed with tests anyway.
{F1985865132}
Reviewed By: huntie
Differential Revision: D94092247
fbshipit-source-id: 440e4482102b2f4152eb63c04023b01867250213
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55566
In Animation Backend, we allow animation frameowrks to request a js-thread sync of the current animation state. It is used by c++ Animated, and is meant to serve as a way to push animation changes to react through RSNRU, after the animation finsishes. This way we ensure that subsequent rerenders of the component don't bring back the old style value.
This approach is currently broken when the animation performs any main-thread commits, as in this case the `runtimeShadowNodeReference_` is not copied to new node revisions, so the js-thread sync commit cannot use RSNRU properly. The bug was not visible, because we don't clean up the registry in that case, we only do it for react commits.
This PR fixes the issue for the case when `updateRuntimeShadowNodeReferencesOnCommitThread` is enabled, as this fixes the RSNRU propagation, so we can clean-up the registry. If the flag is disabled, we don't cleanup the registry, as we want the next react commit to make sure the animation state is not overwritten.
# Changelog
[General][Added] - test for the Animation Backend js sync
[General][Changed] - TesterAnimationChoreographer changes the thread_local RSNRU flag when running animation update, to better simulate the real application use-case
[General][Changed] - AnimationBackend now cleans-up the AnimatedPropsRegistry after the js sync when `updateRuntimeShadowNodeReferencesOnCommitThread` is enabled
Reviewed By: zeyap
Differential Revision: D93414839
fbshipit-source-id: 1c2566d117c2da563ae35e95cefc5ea08313fc7d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55614
- enableFragmentRefsInstanceHandles
- Enables a pointer on each element back to the FragmentInstances that control it. Needed to implement the common IntersectionObserver pattern of reusing IntersectionObservers across multiple callbacks. See more in https://github.com/facebook/react/pull/34935
- enableFragmentRefsTextNodes
- This should be a noop on RN as unlike dom, text nodes are considered host components and already handled. Text without a `<Text/>` wrapper throws an error.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D93479122
fbshipit-source-id: 639369893c8aafc1d2bf0ffbdf4bf09fe6dca45c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55206
To avoid timestamp representation bugs with different platforms passing the timestamp as a simple double, we now use `std::chrono::duration<double, std::milli>` to represent timestamps.
# Changelog
[General] [Added] - `AnimationTimestamp` to `UIManagerAnimationBackend`
[General] [Changed] - updated `AnimationBackend` usages to use `AnimationTimestamp`
Reviewed By: zeyap
Differential Revision: D90505538
fbshipit-source-id: 98761ac0060612e9ed9a57c9952656cae70c30f1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55103
This diff decouples AnimationBackend from Animated. Now the backend is intialized in the Scheduler, from where it's passed to UIManager. Animation frontends (such as Animated) can then obtain a reference to the backend, and use it to schedule animation frame updates.
# Changelog
[General] [Changed] - Moved AnimationBackend initiailzation to `Scheduler`
[General] [Added] - `AnimationChoreographer` interface with an implementation for fantom tests
Reviewed By: zeyap
Differential Revision: D89663251
fbshipit-source-id: 428a83d78ef92a89095989fe3121c578cf8d3983
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55202
Changelog: [Internal]
After changing Hermes V1 to be the default engine, Fantom tests started failing. This was due to a combination of changes, one of them being the change of default value for `HERMES_ENABLE_DEBUGGER`. In case of legacy Hermes it was enabled by default, while for Hermes V1 it's disabled by default.
Fantom didn't explicitly set this flag, but the debug build of RN (which Fantom performs) requires it to be enabled. This diff explicitly sets this flag to true for Fantom builds.
Reviewed By: cipolleschi, cortinico
Differential Revision: D90849881
fbshipit-source-id: 17f8393872eacef26f927f50aaf364644d9b94d7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55157
Changelog: [Internal]
At the moment, Fantom doesn't propagate the Hermes V1 opt-in to the React Native build, which causes the code that should be gated by compile-time flags to be compiled. Since Hermes V1 differs in some cases, the headers there are missing.
This diff adds the opt-in propagation, so the code can be correctly compiled out.
Reviewed By: cortinico
Differential Revision: D90674696
fbshipit-source-id: d2adb131af4588e745c023703a893d0ecaaaee01
Summary:
Currently Fantom is completely ignoring the `REACT_NATIVE_DOWNLOADS_DIR` env variable that other scripts in the repo are instead honoring. This fixes it.
## Changelog:
[INTERNAL] -
Pull Request resolved: https://github.com/facebook/react-native/pull/55148
Test Plan: CI
Reviewed By: cipolleschi
Differential Revision: D90594286
Pulled By: cortinico
fbshipit-source-id: 872a26fc15a2acbe3c0e26035407159c20a9a285
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55138
Some tests were failing locally on Mac, since //arvr/mode/mac-arm/opt doesn't correctly undefine REACT_NATIVE_DEBUG. Use `//xplat/mode/hermes/opt` as a short-cut since that directly defines rn_build_mode.
Changelog: [Internal]
Reviewed By: zeyap
Differential Revision: D90536112
fbshipit-source-id: 55aeb78970c9d210206a6d86cd3e57d55b0a6396
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54581
Changelog: [Internal]
This helps us test with opt mode enabled as its the only one available for coverage.
Reviewed By: javache
Differential Revision: D87346884
fbshipit-source-id: 76dcb0848c3d4019739120339dd5b16dd25ef02d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54543
Changelog: [Internal]
We are switching to SH as default, so internally, we need to switch
DEFAULT_HERMES_VARIANT to use SH stable. To keep the tests working in
OSS, we add DEFAULT_OSS_HERMES_VARIANT to use legacy Hermes.
Reviewed By: cipolleschi
Differential Revision: D87082037
fbshipit-source-id: f2fa00d6922816881201d736aeb6591745127d4c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54322
Changelog: [internal]
This just cleans up the feature flag, which is set to `true` by default and it's been enabled in `stable` already.
Reviewed By: lunaleaps, yungsters
Differential Revision: D85782127
fbshipit-source-id: 0a6174708066cfe597b4c6dbc8bb33829c6155e9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54252
## Changelog:
[Internal] [Added] - pass down isAsync arg to start/stopOnRenderCallback to indicate thread
make it more explicit where start/stopOnRenderCallback is invoked so we can handle it on each platform in a more thread safe way
Reviewed By: lenaic
Differential Revision: D85365058
fbshipit-source-id: 5f0ee1343547fe3466fcd23282e0f27e129a2e7d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54221
Changelog: [internal]
Small change in the Fantom API to accept refs and reduce boilerplate. See next diff for examples
Reviewed By: javache
Differential Revision: D85143177
fbshipit-source-id: fd65abcc1b107df8726fee172b284f5dc96e88a6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54091
## Changelog:
[Internal] [Changed] - use processor flag -DRN_USE_ANIMATION_BACKEND to gate animation backend dep
So it's only enabled for catalyst and fantom when building with BUCK while gated from other meta apps, and enabled by default in oss version
Reviewed By: sammy-SC
Differential Revision: D84157729
fbshipit-source-id: e822f11c4b64b77b17a698bf3b60b5c5a4faf4f4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53994
# Summary
This diff introduces the Shared Animation Backend - a class that can be used by animation frameworks to schedule and run animation updates.
## Changelog:
[GENERAL] [ADDED] - AnimationBackend-itest.js AnimationBackend BUCK/CmakeLists
[GENERAL] [ADDED] - useSharedAnimationBackend feature flag
[GENERAL] [CHANGED] - make AnimatedNodesManager use the backend behind the flag
Reviewed By: zeyap, sammy-SC
Differential Revision: D80809364
fbshipit-source-id: dbfe273362410cdf2f9fc37d78adac7faf4cd118
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53921
Changelog: [Internal] `devMiddleware` removed the unused option `projectRoot`
This option was used only in a dead branch of the code inside `InspectorProxy`.
The scenario where it appeared was enabling resolving script sources (`Debugger.getScriptSource`) starting with `file://` which were coming from the file system. However, we don't seem to ever point scripts at the filesystem this way.
Reviewed By: huntie
Differential Revision: D82739662
fbshipit-source-id: 9a130eaa83cb94ae0e36a5a1102c56ff8a36cffc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53912
Changelog: [Internal]
Add new fantom flag `fantom_disable_coverage` to be used in tests that are sensitive to things like memory allocation.
Also disable coverage for any benchmark test.
Reviewed By: arushikesarwani94
Differential Revision: D83070065
fbshipit-source-id: a885e79e3d0c88cfb7adef30cb60ab46a617edac
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53881
Changelog: [Internal]
To make sure that coverage is insertect correctly when run in different metro setup where patterns do not match perfectly, we need to add glob prefix
Reviewed By: sammy-SC
Differential Revision: D82968565
fbshipit-source-id: c2676ef4c774411938039fc5b98a3b953f6ec916
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53842
Changelog: [Internal]
There is a conflict between dotslash in node_modules and in OD it does not invoke buck2
Reviewed By: javache
Differential Revision: D82724326
fbshipit-source-id: c90cab58818e0245f8763b729c7e5432735eb05e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53410
Changelog: [Internal]
Adding babel-istanbul-plugin to instrument bundle code with coverage reporting.
Metro will transform source code only when coverage flag is set up globally in jest.
Coverage map is then provided by runner as part of test result.
Reviewed By: sammy-SC
Differential Revision: D80716433
fbshipit-source-id: 3831f227f8793f874f0d2366759bb6916e747c72
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53362
Changelog: [internal]
This just replaces the polyfills for `Event` and `EventTarget` that we're defining inline in Fantom with the implementations that already exist in RN.
Reviewed By: javache
Differential Revision: D80612067
fbshipit-source-id: 047c8f12cbb1f4afea2d05a5a1235d9dff2e25f9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53320
Changelog: [internal]
This improves the defaults the options related to minimum number of iterations and test duration in benchmarks.
If you indicate a minimum duration, we set the minimum number of iterations so the duration is honored. We do the same if what's specified is the number of iterations.
This is useful when you want to make sure all the tests in a benchmark suite use the same number of iterations without having to explicitly set the time to 0 in all of them.
It also changes the default for warmup iterations to be just 1 (that's enough to load all modules and all the code into memory).
Reviewed By: rshest
Differential Revision: D80405287
fbshipit-source-id: 41a61c4d1979db6a25dd30f0c84b5de319416885
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53321
Changelog: [internal]
Just a rename to make it easier to understand.
Reviewed By: rshest
Differential Revision: D80404378
fbshipit-source-id: 3d7e89797be3b92599e07b4b64d2a720756a4f3b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53322
Changelog: [internal]
This changes the types for benchmark functions to improve safety:
1. It makes the return object be an object instead of an interface, to catch when `overriddenDuration` is misspelled.
2. It makes the function always synchronous, as asynchronous tests aren't supported in Fantom (even though they are in `tinybench`).
Reviewed By: rshest
Differential Revision: D80404121
fbshipit-source-id: c0e2fb9f67174432f50e31c399f5b10cfe098ae6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53323
Changelog: [internal]
This just makes it easier to understand when the benchmark itself has started running and how long the benchmark itself took to run.
Reviewed By: rshest
Differential Revision: D80400268
fbshipit-source-id: b447c4c389d563f7b2b1cbe82822d5d3a93272da
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53278
changelog: [internal]
C++ Animated should be in ReactCommon, it is code shared across all platforms.
Reviewed By: christophpurrer, zeyap
Differential Revision: D80261447
fbshipit-source-id: 8ad5d0bb65c9b499b1d9f60fc8babef8d4d90078
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53300
# Changelog:
[Internal] -
This adds two new modes to Fantom, allowing to run the native (C++) side with enabling either:
* Address sanitizer, which would detect memory overwrites
* Thread sanitizer, which can detect potential threading issues, such as race conditions
This are opt-in for now.
Currently, both modes already detect different errors, which have a high chance to be real issues and have to be fixed.
Reviewed By: lenaic
Differential Revision: D80339524
fbshipit-source-id: 784ddb9f0af79a04b074e107e4955724d54d5685