Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge 0.71 stable to 0.63-stable #36379

Closed
wants to merge 6,333 commits into from

Conversation

mtjiangliancheng
Copy link

Summary

Changelog

Test Plan

gabrieldonadel and others added 30 commits October 31, 2022 13:56
…ation (facebook#35086)

Summary:
This PR unifies the Flow and TS `default:` case from codegen `translateTypeAnnotation` function into a single function
called `translateDefault` inside `parser-commons.js` as requested on facebook#34872.

## Changelog

[Internal] [Changed] - Unify codegen Flow and TS default case from translateTypeAnnotation

Pull Request resolved: facebook#35086

Test Plan:
Run `yarn jest react-native-codegen` and ensure CI is green

![image](https://user-images.githubusercontent.com/11707729/197931439-a0f0f7cd-eee7-4908-a7f1-856b40954178.png)

Reviewed By: cortinico

Differential Revision: D40801612

Pulled By: cipolleschi

fbshipit-source-id: 612768d6fabe091ac428e7d8416c6da059fe1332
…ong error (facebook#35134)

Summary:
1. I noticed there was a mistake in the [IncorrectlyParameterizedGenericParserError](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/errors.js#L159):
```
if (
  genericTypeAnnotation.typeParameters.type ===
    'TypeParameterInstantiation' &&
  genericTypeAnnotation.typeParameters.params.length !== 1
) {
```

Here we should replace ` 'TypeParameterInstantiation'` with ` 'TSTypeParameterInstantiation'` when the language is `TypeScript`.

The result is that we get a ["Couldn't create IncorrectlyParameterizedGenericParserError"](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/errors.js#L172) error instead of ["Module testModuleName: Generic 'typeAnnotationName' must have exactly one type parameter."](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L88).

I added a [test case](facebook@2f16116) to cover this case:
<img width="1008" alt="Capture d’écran 2022-10-30 à 13 55 56" src="https://user-images.githubusercontent.com/17070498/198879598-ab5a6092-8cbf-422a-9993-2f3f92c9d84c.png">

2. Looking closely at where IncorrectlyParameterizedGenericParserError is used, I noticed that the logic was duplicated in [assertGenericTypeAnnotationHasExactlyOneTypeParameter](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L65).

I believe that the logic should reside in `assertGenericTypeAnnotationHasExactlyOneTypeParameter` so I split the `IncorrectlyParameterizedGenericParserError` in 2 different errors.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Changed] - Fix assertGenericTypeAnnotationHasExactlyOneTypeParameter throwing wrong error

Pull Request resolved: facebook#35134

Test Plan: I tested using Jest and Flow commands.

Reviewed By: rshest

Differential Revision: D40853200

Pulled By: cipolleschi

fbshipit-source-id: 7040e57e0a2f511ba23fd4c54beae2ccff2fa89d
Summary:
This PR is a task from facebook#34872:
> Extract the function isModuleRegistryCall ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/utils.js#L175-L211) [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/utils.js#L167-L203)) into a single function in the parsers/utils.js file and replace its invocation with this new function.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Changed] - Extract the function isModuleRegistryCall in parsers/utils

Pull Request resolved: facebook#35139

Test Plan: I tested using Jest and Flow commands.

Reviewed By: rshest

Differential Revision: D40850471

Pulled By: cipolleschi

fbshipit-source-id: 34ec8ea4d7175e205315d60f200df093f1204b7b
Summary:
## Changelog:
[Android] [Removed] - Removed AsyncStorage module

Reviewed By: lunaleaps

Differential Revision: D40175995

fbshipit-source-id: b583579b8c2fa6c502f265ffe464b81672bd7da5
Summary:
## Changelog:
[iOS][Removed] - Removed AsyncStorage module

Reviewed By: lunaleaps

Differential Revision: D40283712

fbshipit-source-id: 5e74c71915c2fbba4363e3fc917555039069038e
Summary:
## Changelog
[JS][Removed] - Removed AsyncStorage module from react-native

Reviewed By: NickGerleman

Differential Revision: D40302352

fbshipit-source-id: 9377ea12036e498dde0b4b0f56de5c4fb9bd2461
…code and prebuilt artifacts (facebook#35156)

Summary:
Pull Request resolved: facebook#35156

There are two tarballs: the source code for Hermes that is downloaded from GitHub, and the hermes-runtime-darwin-{}-v{}.tar.gz tarball with prebuilt artifacts that is built in CI.
Renamed some methods to make it clearer which tarball they work with.

Changelog: [internal]

Reviewed By: cipolleschi, dmytrorykun

Differential Revision: D40812290

fbshipit-source-id: a2c865e1d1461829fe8d468f52deeb55f3565cb0
Summary:
`exact_empty_objects` is on by default in 0.191, delete usage

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D40822684

fbshipit-source-id: 8e84f0542e6b66049cac34e429f0b724f85a9557
…#35084)

Summary:
This pull request migrates the dimensions example to using React Hooks.

## Changelog
[General] [Changed] - RNTester: Migrate Dimensions to hooks

Pull Request resolved: facebook#35084

Test Plan: The animation works exactly as it did as when it was a class component

Reviewed By: yungsters

Differential Revision: D40779014

Pulled By: NickGerleman

fbshipit-source-id: e740684d3022a945da5abc33b2e8834c6cfabb97
Summary: Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D40879099

fbshipit-source-id: ff302819829aa21a1dd7c19c06ed8c29821ba815
Summary:
Pull Request resolved: facebook#35160

With the simplified migration to the new arch, we are offering a function in cocoapods that takes care of configuring all the dependencies for libraries.

That function was not setting the proper version of C++ for the library. This could lead to build problems.

This Diff make sure that the libraries that are created with this function call have the proper C++ version.

NOTE: we already have a post install hook that was setting the the proper C++ version, but that was only working for the project. Plus, we can't read that version from the React-Core podspec because at the podspec definition time, cocoapods has not read that yet. Therefore, I just hardcoded the C++ version on top of the file, so it will be easier to update if we decide to change it.

## Changelog
[iOS][Fixed] - Make sure that libraries created with `install_modules_dependencies` has the right C++ version.

Reviewed By: dmytrorykun

Differential Revision: D40894561

fbshipit-source-id: a5187be2d85888a335d4c033f16fdacaf2c945f9
Summary:
This sync includes the following changes:
- **[ab075a232](facebook/react@ab075a232 )**: Do not unmount layout effects on initial Offscreen mount ([facebook#25592](facebook/react#25592)) //<Samuel Susla>//
- **[765805bf8](facebook/react@765805bf8 )**: Fix type check for null ([facebook#25595](facebook/react#25595)) //<Sebastian Markbåge>//
- **[2ac77aab9](facebook/react@2ac77aab9 )**: Clean up vestige of useOpaqueIdentifier ([facebook#25587](facebook/react#25587)) //<Andrew Clark>//
- **[bdd3d0807](facebook/react@bdd3d0807 )**: Extract logic for detecting bad fallback to helper //<Andrew Clark>//
- **[952dfff3f](facebook/react@952dfff3f )**: Split suspended work loop logic into separate functions //<Andrew Clark>//
- **[d2c0ab10d](facebook/react@d2c0ab10d )**: In work loop, add enum of reasons for suspending //<Andrew Clark>//
- **[5450dd409](facebook/react@5450dd409 )**: Strict Mode: Reuse memoized result from first pass ([facebook#25583](facebook/react#25583)) //<Andrew Clark>//
- **[d2a0176a1](facebook/react@d2a0176a1 )**: Detect and warn if use(promise) is wrapped with try/catch block ([facebook#25543](facebook/react#25543)) //<Andrew Clark>//
- **[cf3932be5](facebook/react@cf3932be5 )**: Remove old react-fetch, react-fs and react-pg libraries ([facebook#25577](facebook/react#25577)) //<Sebastian Markbåge>//
- **[28a574ea8](facebook/react@28a574ea8 )**: Try assigning fetch to globalThis if global assignment fails ([facebook#25571](facebook/react#25571)) //<Sebastian Markbåge>//
- **[09def5990](facebook/react@09def5990 )**: [Float] handle noscript context for Resources ([facebook#25559](facebook/react#25559)) //<Josh Story>//
- **[17204056d](facebook/react@17204056d )**: [Float] fix coordination of resource identity and hydration ([facebook#25569](facebook/react#25569)) //<Josh Story>//
- **[d925a8d0b](facebook/react@d925a8d0b )**: Flight client error stack ([facebook#25560](facebook/react#25560)) //<Josh Story>//
- **[996b00b78](facebook/react@996b00b78 )**: [Tiny] Fixed incorrect import in `react-server-dom-webpack` ([facebook#25554](facebook/react#25554)) //<Leo Lamprecht>//
- **[e7c5af45c](facebook/react@e7c5af45c )**: Update cache() and use() to the canary aka next channel ([facebook#25502](facebook/react#25502)) //<Sebastian Markbåge>//
- **[fa77f52e7](facebook/react@fa77f52e7 )**: Unify promise switch statements //<Andrew Clark>//
- **[7572e4931](facebook/react@7572e4931 )**: Track thenable state in work loop //<Andrew Clark>//
- **[7fc3eefd8](facebook/react@7fc3eefd8 )**: Revert yieldy behavior for non-use Suspense (in Flight, too) //<Andrew Clark>//
- **[61f9b5e97](facebook/react@61f9b5e97 )**: [Float] support <base> as Resource ([facebook#25546](facebook/react#25546)) //<Josh Story>//
- **[1d3fc9c9c](facebook/react@1d3fc9c9c )**: Bug fix when resolving cache ([facebook#25545](facebook/react#25545)) //<Sebastian Markbåge>//
- **[cce18e350](facebook/react@cce18e350 )**: [Flight] Use AsyncLocalStorage to extend the scope of the cache to micro tasks ([facebook#25542](facebook/react#25542)) //<Sebastian Markbåge>//
- **[caa84c8da](facebook/react@caa84c8da )**: Revert fetch instrumentation to only RSC ([facebook#25540](facebook/react#25540)) //<Sebastian Markbåge>//
- **[0c11baa6a](facebook/react@0c11baa6a )**: add warnings for non-resources rendered outside body or head ([facebook#25532](facebook/react#25532)) //<Josh Story>//
- **[9236abdb5](facebook/react@9236abdb5 )**: when float is enabled only push title and script as a single unit ([facebook#25536](facebook/react#25536)) //<Josh Story>//
- **[dd5c20825](facebook/react@dd5c20825 )**: Revert yieldy behavior for non-use Suspense ([facebook#25537](facebook/react#25537)) //<Andrew Clark>//
- **[934177598](facebook/react@934177598 )**: fix transposed escape functions ([facebook#25534](facebook/react#25534)) //<Josh Story>//
- **[d1ced9fd5](facebook/react@d1ced9fd5 )**: [Float] support all links as Resources ([facebook#25515](facebook/react#25515)) //<Josh Story>//
- **[973b90bdf](facebook/react@973b90bdf )**: [Float] support meta tags as Resources ([facebook#25514](facebook/react#25514)) //<Josh Story>//
- **[79c582981](facebook/react@79c582981 )**: Let ReactDOM initialize in RSC ([facebook#25503](facebook/react#25503)) //<Sebastian Markbåge>//
- **[1f7a2f577](facebook/react@1f7a2f577 )**: [Float] support title tags as Resources ([facebook#25508](facebook/react#25508)) //<Josh Story>//
- **[c63580787](facebook/react@c63580787 )**: Support `use` in `act` testing API ([facebook#25523](facebook/react#25523)) //<Andrew Clark>//
- **[65e32e58b](facebook/react@65e32e58b )**: Add fetch Instrumentation to Dedupe Fetches ([facebook#25516](facebook/react#25516)) //<Sebastian Markbåge>//
- **[9336e29d9](facebook/react@9336e29d9 )**: [useEvent] Lint for presence of useEvent functions in dependency lists ([facebook#25512](facebook/react#25512)) //<lauren>//
- **[3cc792bfb](facebook/react@3cc792bfb )**: [useEvent] Non-stable function identity ([facebook#25473](facebook/react#25473)) //<lauren>//
- **[987292815](facebook/react@987292815 )**: Remove feature flag enableStrictEffects ([facebook#25387](facebook/react#25387)) //<Samuel Susla>//
- **[8e2bde6f2](facebook/react@8e2bde6f2 )**: Add cache() API ([facebook#25506](facebook/react#25506)) //<Sebastian Markbåge>//
- **[9cdf8a99e](facebook/react@9cdf8a99e )**: [Codemod] Update copyright header to Meta ([facebook#25315](facebook/react#25315)) //<Andrew Clark>//
- **[e54015e26](facebook/react@e54015e26 )**: Refactor: fill in the flow missing type ([facebook#25496](facebook/react#25496)) //<c0dedance>//
- **[3b1fd5767](facebook/react@3b1fd5767 )**: refactor: Flow: typing of Scheduler ([facebook#25485](facebook/react#25485)) //<bubucuo>//
- **[14072ce64](facebook/react@14072ce64 )**: Add detach to Offscreen component ([facebook#25265](facebook/react#25265)) //<Samuel Susla>//
- **[3bb71dfd4](facebook/react@3bb71dfd4 )**: Rename react-server-dom-webpack entry points to /client and /server ([facebook#25504](facebook/react#25504)) //<Sebastian Markbåge>//
- **[71f2c8cf1](facebook/react@71f2c8cf1 )**: move resource acquisition to mutation phase ([facebook#25500](facebook/react#25500)) //<Josh Story>//
- **[500bea532](facebook/react@500bea532 )**: Add option to load Fizz runtime from external file ([facebook#25499](facebook/react#25499)) //<Andrew Clark>//
- **[4494f2a86](facebook/react@4494f2a86 )**: [Float] add support for scripts and other enhancements ([facebook#25480](facebook/react#25480)) //<Josh Story>//
- **[9ecf84ed7](facebook/react@9ecf84ed7 )**: Bugfix: Suspending in shell during discrete update ([facebook#25495](facebook/react#25495)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 54f297a...ab075a2

jest_e2e[run_all_tests]

Reviewed By: kassens

Differential Revision: D40897093

fbshipit-source-id: 6a040315834dea5c0ab994ea94d91f5605b9d6b0
Summary:
## Context
If React Native is built from *main* of any non-stable commit, then Hermes is built from source. The build is performed by `build-ios-framework.sh` and `build-mac-framework.sh` scripts in `hermes-engine.podspec` `prepare_command` stage. Since those scripts have no access build target information, they build all possible architectures and platforms just in case. That takes ages.
## Solution
The idea is to integrate build script into Xcode *run script* phase, and use build target information to build Hermes for active architecture only.
## Implementation
- Existing behaviour remains unchanged for local tarball and remote prebuild cases.
- `build-hermesc-xcode.sh` builds Hermesc as `hermes-engine.podspec` `prepare_command`. Default build location is `react-native/sdks/hermes-engine/build_host_hermesc`.
- `build-hermes-xcode.sh` builds Hermes in 'Build Hermes' Xcode script phase. It uses `$PLATFORM_NAME`, `$CONFIGURATION`, `$ARCHS`, `$IPHONEOS_DEPLOYMENT_TARGET` and `$MACOSX_DEPLOYMENT_TARGET` environment variables to configure cmake project so it builds only active architecture. The script also gets RN version, *cmake* path and *hermesc* path from the podspec.
- `copy-hermes-xcode.sh` copies Hermes.framework inside the app bundle. This script phase is added to the user app target in a `post_install` hook, after pods are integrated in a user project.
- `OTHER_LDFLAGS -framework "hermes"` added to the user project to enable linking against Hermes.framework.
- If `HERMES_OVERRIDE_HERMESC_PATH` is set, then Hermesc building is skipped, and `HERMES_OVERRIDE_HERMESC_PATH` is used for `build-hermes-xcode.sh`.
- `HERMES_CLI_PATH` is injected into user project config to enable Hermes source maps in `react-native-xcode.sh`.
## Things that didn't work
- *Running build-hermesc-xcode.sh in Xcode run script phase*. This doesn't work because Hermesc is supposed to be built for macos, and if build target is ios, then Xcode configures environment in such a way that Hermesc build fails.
- *Installing Hermesc into CocoaPods download folder*. So it then ends up in `Pods/hermes-engine/build_host_hermesc`, and all the housekeeping is handled by CocoaPods. This doesn't work because cmake uses absolute paths in a configured project. If configured project is moved to a different location, nothing builds.
- *Installing Hermesc directly into Pods/hermes-engine*. This doesn't work because CocoaPods runs prepare_command before Pods folder clean up, and everything gets wiped.
## Known issue
-  If `Pods/hermes-engine` is manually removed, then `sdks/hermes-engine/build_host_hermesc` must also be removed before running `pod install`. Otherwise cmake will complain about stale cache:
```
CMake Error: The source "<CocoaPodsCache>/hermes-engine/<hash2>/CMakeLists.txt" does not match the source
"<CocoaPodsCache>/hermes-engine/<has1>/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.
```
## Benchmark
MacBook M1 2021 32 GB.
```
export REACT_NATIVE_PATH=~/fbsource/xplat/js/react-native-github
cd $REACT_NATIVE_PATH/packages/rn-tester
pod install
rm -rf $REACT_NATIVE_PATH/sdks/hermes-engine/build_host_hermesc
cd $REACT_NATIVE_PATH/packages/rn-tester/Pods/hermes-engine
echo 't1=$(date +%s); $@; t2=$(date +%s); diff=$(echo "$t2 - $t1" | bc); echo Operation took $diff seconds.' > /tmp/benchmark.sh
```
```
# Before
export BUILD_TYPE=Debug
export JSI_PATH=$REACT_NATIVE_PATH/ReactCommon/jsi
export RELEASE_VERSION=1000.0
export IOS_DEPLOYMENT_TARGET=iphonesimulator
export MAC_DEPLOYMENT_TARGET=12.6
cd $REACT_NATIVE_PATH/packages/rn-tester/Pods/hermes-engine
. /tmp/benchmark.sh $REACT_NATIVE_PATH/sdks/hermes-engine/utils/build-ios-framework.sh
# Operation took 252 seconds
. /tmp/benchmark.sh $REACT_NATIVE_PATH/sdks/hermes-engine/utils/build-mac-framework.sh
# Operation took 179 seconds
```
```
# After
. /tmp/benchmark.sh source $REACT_NATIVE_PATH/sdks/hermes-engine/utils/build-hermesc-xcode.sh $REACT_NATIVE_PATH/sdks/hermes-engine/build_host_hermesc
# Operation took 59 seconds.
. /tmp/benchmark.sh xcodebuild -workspace $REACT_NATIVE_PATH/packages/rn-tester/RNTesterPods.xcworkspace -scheme hermes-engine
# Operation took 106 seconds.
```
|Before|||After|||
|--|
|iOS framework (s)|Mac framework (s)|Total (s)|Hermesc (s)|Target-specific framework (s)|Total (s)|
|252|179|431|59|106|**165 (-266) (-61%)**|
The performance win is fixed, and does not depend on the project size and structure.
As an example, this is how these changes affect build time of RNTester.
|Before||||After|||
|--|
||Pod install (s)|Xcode build (s)|Total (s)|Pod install (s)|Xcode build (s)|Total (s)|
|Clean build|1219|132|1352|734 (-485)|249(+117)|**983 (-369)**|
|Incremental build|82|30|112|105 (+23)|**34 (+4)**|139 (+27)|
The most important values here are the total clean build time and the incremental Xcode build time. The first one went down by 369 seconds, the second one went up by 4 seconds. I consider it a reasonable tradeoff.
The extra 4 seconds in  the incremental Xcode build time can potentially be mitigated by setting up output file lists for the new script phases.

allow-large-files

Changelog:
[iOS][Changed] - Hermes is integrated into Xcode build.

Reviewed By: hramos

Differential Revision: D40063686

fbshipit-source-id: e6993d62225789377db769244bc07786cc978a27
Summary:
This is a follow up action item from S295231 and T136039462 where we want to make sure null uri in image source is handled properly. This diff adds an unit test to make sure we are using transparent image when uri is null.

Changelog:
[Android][Internal] - Add unit test to ImageView for null uri in source

Reviewed By: javache

Differential Revision: D40732791

fbshipit-source-id: fd468bfe7c33a4f3f8913ead3e84a1770d7c907f
Summary:
## Changelog:
[Internal] [Added] - Adding new markerAnnotateWithMap to the QPL.

This is part of bigger effort to unify JS QPL interfaces across platforms.

Reviewed By: eddyerburgh

Differential Revision: D40796537

fbshipit-source-id: a75b97c20ca411653552228f7dc2fcbedd8ddca9
Summary:
As part of unifying JS QPL interface, I'm bringing markerAnnotate to the parity with Web version.

At the moment it supports only string annotations, but I'm adding support for ints, arrays of ints, arrays of strings, etc.

## Changelog:
[Internal] [Changed] - Refactored markerAnnotateWithMap -> markerAnnotate

Reviewed By: eddyerburgh

Differential Revision: D40796535

fbshipit-source-id: 9831e353036835b97bb7b2f60085016034c04269
Summary:
Changelog: [Internal] - Refactor match logic on determining whether to run an EventAnimationDriver (drivers for natively animated events) for an Event dispatched.

Previously, drivers were stored by key on the NativeAnimatedNodesManager (based on event handler and viewTag) and has been refactored to be stored in a list for easier matching.

This diff changes it so the match logic for running an EventAnimationDriver happens on the Event instance. This change is motivated by PointerEvents needing custom match logic (done on a following change).

Reviewed By: javache

Differential Revision: D40691002

fbshipit-source-id: e4f6742a2af3b751214aefa1fc069f65e8e71d77
Summary:
Changelog: [Internal]

Override logic for determining whether a dispatched `Event` triggers a native `EventAnimationDriver`.

Natively driven AnimatedEvents on bubbling events is not supported.  `PointerEvents` requires this and this diff adds custom matching logic such that if a parent specifies an `AnimatedEvent` on `onPointerMove` and a child view dispatches it, the `AnimatedEvent` will still fire.

Reviewed By: javache

Differential Revision: D38722563

fbshipit-source-id: 7cde57eaff9584b33c6ab15f1fe85c0a9bac132e
Summary: Changelog: [Internal]

Differential Revision: D40840078

fbshipit-source-id: 0104444060d8d6a1a22066d63579ac06ff715226
…5162)

Summary:
Pull Request resolved: facebook#35162

The dSYMs for Apple will not be distributed as part of the prebuilts tarball. They can still be included in the tarball by passing a `-d` flag to the create-tarball script.

Changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D40813679

fbshipit-source-id: 26dee8251684c5ecad649ccd27ce688cfe88ec8f
Summary:
Add annotations using flow codemod annotate-cycles --write

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D40896688

fbshipit-source-id: 0c32932d17542be070360db29b7797f8e6e5978b
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D40824468

fbshipit-source-id: c840610e923c35cc5c36b37e5c580d0296c1e46b
Summary:
Include dSYMs when building the universal XCFramework for Hermes iOS.

CocoaPods should pick up dSYMs automatically when using `vendored_framework` if:
- `hermes.framework` has a `hermes.framework.dSYM` in the same base directory
- `hermes.xcframework` has a `dSYMs` folder with a `hermes.framework.dSYM` in it, for each slice

The dSYMs for the macOS hermes.framework are already being created.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D40790250

fbshipit-source-id: 50fcb3492434637b00458c1aa443ac6ec5472fac
Summary:
Improving test coverage in anticipation of some changes being made to `hermes-utils.js`.

Moved test scripts to `hermes/__tests__` and grouped related tests.

We have been delegating some of the work to local binaries via `execSync`, which can be hard to mock or test.  We now use a proxy `delegateSync` method that uses `spawnSync` internally to break down the invocation into `command`, `arguments`, `options`. Instead of simply mocking based on the command being executed, we can now conditionally mock based on the arguments being passed.

Added a `createTarballFromDirectory` method. This can be used later when creating different tarballs.

Added `populateMockFilesystemWithHermesBuildArtifacts()` to mock the filesystem state after Hermes has been built.

Changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D40871802

fbshipit-source-id: 4348d3c38926ec7eb13d794040a9040010879f58
Summary:
The documentation for `useColorScheme()` suggested that the user's preferred color scheme will be 'Dark Mode'. Instead suggesting 'Dark Mode' as an example of what the user's preferred color scheme could be is more correct.

## Changelog
[INTERNAL] [FIXED] - Edited documentation for `useColorScheme()` hook
Edited
```javascript
/**
 * A new useColorScheme hook is provided as the preferred way of accessing
 * the user's preferred color scheme (aka Dark Mode).
 */
export function useColorScheme(): ColorSchemeName;
```
to
```javascript
/**
 * A new useColorScheme hook is provided as the preferred way of accessing
 * the user's preferred color scheme (e.g. Dark Mode).
 */
export function useColorScheme(): ColorSchemeName;
```

Pull Request resolved: facebook#35141

Test Plan: Documentation only - no testing required.

Reviewed By: cipolleschi

Differential Revision: D40934781

Pulled By: rshest

fbshipit-source-id: acac8947c3f99016839be27f505066e8992a20fa
Summary:
changelog: [internal]

Fix lint error

Reviewed By: cipolleschi

Differential Revision: D40936194

fbshipit-source-id: 24987f86f1f95d42f978baaa560bfd57381ca5a4
Summary: Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D40902247

fbshipit-source-id: 5ed8f69bb46e35d5250bd04898765ead500d7db6
Summary:
Pull Request resolved: facebook#35176

This commit extends the ReactNative-application.cmake logic so
that if the app is using codegen at the app level, the generate library
is properly built and linked.

It helps us simplify the RN Tester setup and makes it easier for app users
to use the codegen at the app level.

Changelog:
[Internal] [Changed] - [Android] Link against the app codegen if available

Reviewed By: cipolleschi

Differential Revision: D40936941

fbshipit-source-id: 26fa4d764fb369c987e94e0c3bce61841b982b27
…droid accordingly (facebook#35104)

Summary:
This PR is a follow up of facebook#35075 and facebook@1546666 to ensure that even in the local e2e testing scenario the new maven approach is followed - without this, RNTestProject on Android won't work, like so:
<img width="1905" alt="Screenshot 2022-10-27 at 12 15 38" src="https://user-images.githubusercontent.com/16104054/198334105-30fb2037-4e7c-4814-8c3f-2412ba0bd49f.png">

And iOS will always build everything from source every time.

This PR addresses both by generating the artifacts locally, and passing them to RNTestProject as if they were coming from a url (mimicking as closely as possible the behaviour for the final user)

In doing so, there's been some refactoring to prep the ground for follow up work.
* refactor CI to rely less on scripts directly in the CircleCI config, but invoke .js ones
* we should be able to trigger more the "manual" artifacts generation so that it will only happen once between RNTester and RNTestProject, and we can pass existing artifacts to the other flows.
* once all of this in place, a very good improvement would be to be able to download the maven artifacts kind of like nightlies and stables do. This will only be viable by checking that there's no local changes, after which there needs to be logic to pull down from CircleCI the artifacts based on git commit <-> circleCI job references.
 ---

While at it, I've also fixed the hermes-engine podspec logic for detecting if it's on CI: basically the local e2e script needs to align with the changes done here: facebook@4b51207

but as you can see there, the condition was actually inconsistent across the various files, so realigned to `CI === 'true'`. We probably didn't catch that so far 'cause the other condition in the hermes podspect (existence of `hermestag_file`) is only true on release branches and this new logic has not been in any release branches yet.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] [Fixed] - add logic to local e2e script to handle maven local for iOS and Android accordingly

Pull Request resolved: facebook#35104

Test Plan:
Run ` yarn test-e2e-local -t RNTestProject -p Android` successfully.

Run ` yarn test-e2e-local -t RNTestProject -p iOS` successfully. On the pod install stage, you will see `[Hermes] Using pre-built Hermes binaries from local path.`

Reviewed By: dmytrorykun

Differential Revision: D40893239

Pulled By: cipolleschi

fbshipit-source-id: a31217ec4f177383c62292d00fabc4cbe4391cfd
Summary:
Pull Request resolved: facebook#35173

changelog: [internal]

D40897093 (facebook@f49b251) deleted TypeScript definitions.

Reviewed By: cipolleschi

Differential Revision: D40935747

fbshipit-source-id: 020cba21b8b40c8b0c92bb5ab2dc4f6ba5da610a
eps1lon and others added 26 commits January 30, 2023 12:36
Summary:
Forward-porting DefinitelyTyped/DefinitelyTyped#64100

## Changelog

[GENERAL] [FIXED] - Add `TextInput`'s `inputMode` TypeScript types

Pull Request resolved: facebook#35987

Test Plan: - [x] DefinitelyTyped/DefinitelyTyped#64100 green

Reviewed By: christophpurrer

Differential Revision: D42799862

Pulled By: jacdebug

fbshipit-source-id: b387fd8bc53e66d6125fee810862de3e292e6e74
Summary:
Update the CircleCI configuration to use the proper `exclude` parameter of matrix rather then bootstrap a machine and then kill it.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
## Changelog
[Internal] - Use the `exclude` parameter of matrices to avoid spinning up unnecessary machines

Pull Request resolved: facebook#35794

Test Plan: The number of jobs on CircleCI should decrease.

Reviewed By: dmytrorykun

Differential Revision: D42475445

Pulled By: cipolleschi

fbshipit-source-id: 3d733ac459a3bc9747440a62cb2caecb7a235fec
…acebook#36003)

Summary:
Pull Request resolved: facebook#36003

This diff adds 4 tests in CircleCI to make sure we don't regress in the support of Dynamic Frameworks for the old architecture.

## Changelog
[iOS][Fixed] - Add CircleCI tests for dynamic frameworks with the Old Architecture.

Reviewed By: cortinico

Differential Revision: D42829895

fbshipit-source-id: 5669be45d4f55161a11a6ece161b2a2aa384a644
Summary:
I discovered that 0.69 and 0.70 could run React Native as Dynamic framework with JSC and starting from 0.71 that's not possible anymore.
This diff restore that possibility.

## Changelog
[iOS][Fixed] - Add Back dynamic framework support for the old architecture

Reviewed By: cortinico

Differential Revision: D42829137

fbshipit-source-id: 848672f714d8bab133e42f5e3b80202b350d5261
Summary:
I discovered that 0.69 could run React Native as Dynamic framework with Hermes and starting from 0.70 that's not possible anymore.
This diff restore that possibility.

Notice that now Hermes provisdes JSI and Dynamic Frameworks requires that all the dependencies are explicitly defined, therefore, whenever we have a pod that depended on `React-jsi`, now it also has to explicitly depends on `hermes-engine`

## Changelog
[iOS][Fixed] - Add Back dynamic framework support for the Old Architecture with Hermes

Reviewed By: cortinico

Differential Revision: D42829728

fbshipit-source-id: a660e3b1e346ec6cf3ceb8771dd8bceb0dbcb13a
Summary:
Pull Request resolved: facebook#35992

Fixes software-mansion/react-native-gesture-handler#2382

I've just realized that the default value fo `jsRootDir` is not entirely correct.
That's the root of the folder where the codegen should run.

For apps, it should be defaulted to `root` (i.e. ../../)
For libraries, it should be defaulted to `../` (currently is root).

This causes a problem where libraries without either a `codegenConfig` or a `react{ jsRootDir = ... }`
specified in the build.gradle will be invoking the codegen and generating duplicated symbols.

Changelog:
[Android] [Fixed] - RNGP - Properly set the `jsRootDir` default value

Reviewed By: cipolleschi

Differential Revision: D42806411

fbshipit-source-id: ffe45f9684a22494cc2e4d0a19de9077cb341365
…err (facebook#36004)

Summary:
Pull Request resolved: facebook#36004

Changelog: [Internal]

This fixes CircleCI job, which is responsible for publishing bumped packages. We should not check for `stderr`, apparently `npm` uses it to store debug information:
- npm/npm#118 (comment)

So we've tried to use this on 0.71-stable before and it succesfully published one package, but have exited right after it because `stderr` was not empty

Reviewed By: cortinico, cipolleschi

Differential Revision: D42836212

fbshipit-source-id: 6f2a9a512121683268fe6aae6a187fccb8d9dfbc
…cebook#35984)

Summary:
Pull Request resolved: facebook#35984

[Changelog][Internal]

Codegen for props parsing was failing to add a required include for the case when the type is an array of objects, which in turn use non-trivial types.

Something like:
```
export type NativeProps = $ReadOnly<{
  ...ViewProps,
  bounds: $ReadOnlyArray<
    $ReadOnly<{
      height?: Float,
      left?: Float,
      top?: Float,
      width?: Float,
    }>,
  >,
}>;
```

would cause compilation errors on C++ side, since the required header for the `Float` conversion wasn't included.

Reviewed By: cipolleschi

Differential Revision: D42781128

fbshipit-source-id: d5b133b931a60e414761db0b3ed09893d3fcc9aa
…36080)

Summary:
Pull Request resolved: facebook#36080

For Android release builds on Windows, gradle release build fails if there are spaces in path (facebook#34878). This is due to gradle improperly handling arguments with spaces (this is also [an open issue](gradle/gradle#6072) on Gradle). Since the Hermes compilation and other Gradle exec invocations involve arguments which will contain spaces (if there are spaces in your path), this also means it is hard to get around this by simply escaping the spaces (eg: by using double quotes), since these arguments are not properly handled by Gradle itself.

As a workaround, this PR uses relative paths for all Gradle commands invoked for Android. As long as there aren't any spaces in the react-native directory structure (i.e this repo), this fix should work.

## Changelog

[Android][Fixed] - Used relative paths for gradle commands

Pull Request resolved: facebook#36076

Test Plan: `npx react-native run-android` builds and runs the app successfully on Android device, when run inside an RN0711 project with a path containing spaces (and with the changes in this PR applied) on Windows. This includes release builds (i.e with the `--variant=release` flag).

Reviewed By: cipolleschi

Differential Revision: D43080177

Pulled By: cortinico

fbshipit-source-id: 7625f3502af47e9b28c6fc7dfe1459d7c7f1362d
Summary:
the current jsc-android is still built based on ndk r21, and react-native is now built based on ndk r23. the unwinder between r21 and r23 is incompatible (libgcc vs libunwind). if there's exceptions throwing from jsc, other react native libraries cannot catch these exceptions and cause runtime crash.

this pr updates jsc-android to 235231.0.0 which is the same webkitgtk version as 235230.2.1 but only built by ndk r23. the jsc-android pr is from react-native-community/jsc-android-buildscripts#179. note that the jsc is based on ndk r23c and react-native is based on ndk r23b. the reason is that i cannot get jsc building successfully on r23b. hopefully r23b and r23c are abi safe.

there is another crash from libjscexecutor when testing the new jsc-android. to fix the issue, i have to explicitly link libunwind.a from libjscexecutor.so. supposedly ndk r23 should help to link libunwind under the hood, i still not figure out why it doesn't. but after linking libunwind.a, i can get new jsc-android work successfully.

```
E/art     ( 2669): dlopen("/data/app/com.test-1/lib/x86_64/libjscexecutor.so", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "_Unwind_Resume" referenced by "/data/app/com.test-1/lib/x86_64/libjscexecutor.so"...
W/System.err( 2669): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_Unwind_Resume" referenced by "/data/app/com.test-1/lib/x86_64/libjscexecutor.so"...
W/System.err( 2669): 	at java.lang.Runtime.load(Runtime.java:331)
W/System.err( 2669): 	at java.lang.System.load(System.java:982)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader$1.load(SoLoader.java:558)
W/System.err( 2669): 	at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:110)
W/System.err( 2669): 	at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:63)
W/System.err( 2669): 	at com.facebook.soloader.ApplicationSoSource.loadLibrary(ApplicationSoSource.java:91)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1067)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:943)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:855)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:802)
W/System.err( 2669): 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:772)
W/System.err( 2669): 	at com.facebook.react.jscexecutor.JSCExecutor.loadLibrary(JSCExecutor.java:24)
W/System.err( 2669): 	at com.facebook.react.jscexecutor.JSCExecutor.<clinit>(JSCExecutor.java:20)
W/System.err( 2669): 	at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:363)
W/System.err( 2669): 	at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:316)
W/System.err( 2669): 	at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:94)
W/System.err( 2669): 	at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:41)
W/System.err( 2669): 	at com.test.MainApplication.onCreate(MainApplication.java:60)
W/System.err( 2669): 	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
W/System.err( 2669): 	at androidx.test.runner.MonitoringInstrumentation.callApplicationOnCreate(MonitoringInstrumentation.java:483)
W/System.err( 2669): 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4518)
W/System.err( 2669): 	at android.app.ActivityThread.access$1500(ActivityThread.java:144)
W/System.err( 2669): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
W/System.err( 2669): 	at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 2669): 	at android.os.Looper.loop(Looper.java:135)
W/System.err( 2669): 	at android.app.ActivityThread.main(ActivityThread.java:5221)
W/System.err( 2669): 	at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 2669): 	at java.lang.reflect.Method.invoke(Method.java:372)
W/System.err( 2669): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
W/System.err( 2669): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
```

fixes facebook#36052

## Changelog

[ANDROID][FIXED] - Fixed jscexecutor crash on Android which is caused from NDK incompatibility

Pull Request resolved: facebook#36062

Test Plan: tested on [jsc-android instrumented test](https://github.com/react-native-community/jsc-android-buildscripts/tree/2.26.1/test) (based on react-native 0.71.2)

Reviewed By: cipolleschi

Differential Revision: D43040295

Pulled By: cortinico

fbshipit-source-id: e0e5b8fb7faa8ee5654d4cde5f274bef4b517376
Summary:
Changelog: [Internal]

- While working on 0.71.3, it was discovered that `react-native-codegen` package is being published almost empty (without `lib` folder)
- The reason for it is that `prepare` script is not being executed
- The main reason for it is npm v6, which requires adding `unsafe-perm` flag for it: https://www.vinayraghu.com/blog/npm-unsafe-perm
- Instead of using this flag, changing executor to `nodelts`, which has node v18 and npm v8
- Also adding `run_yarn` before running the script, because `react-native/codegen` uses external dependencies (such as rimraf) for its build scripts

Differential Revision: D43248175

fbshipit-source-id: ea696aae5b75cb284db380d2040e678bb24a0eb4
Summary:
Pull Request resolved: facebook#36348

Changelog: [Internal]

Turns out that Phabricator strips `@` symbol from `@...` tags when exports commits to GitHub. Proposing to use `#` instead.

#publish-packages-to-npm

Reviewed By: cortinico

Differential Revision: D43712415

fbshipit-source-id: 86fc728eb0cb63afb6a9fe592a9ae998da2ce2e4
…bumping-scripts

Cherry-picking changes in CI scripts for packages versions bumping
@facebook-github-bot
Copy link
Contributor

Hi @mtjiangliancheng!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@cortinico cortinico closed this Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.