Commit Graph

126 Commits

Author SHA1 Message Date
Blake Friedman
2ac997abcc Remove references to old template (#46082)
Summary:
## Summary
There are old references to the react-native/template. This code has
moved to react-native-community/template.

Changelog: [Internal]

Pull Request resolved: https://github.com/facebook/react-native/pull/46082

Test Plan:
CI

closes facebook/metro#1324

Reviewed By: cipolleschi

Differential Revision: D61472439

Pulled By: blakef

fbshipit-source-id: fc40145c03002a7c3117b72d07981a96aa3d8760
2024-08-19 09:19:35 -07:00
Nicola Corti
a272e8ee66 Remove unused rn-tester e2e tests (#45032)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45032

Those tests haven't been running since ~1 year now.
I know it's not ideal but I'd rather remove them instead of keeping them around not executing.
We can still revert them back from the history once we decide to revive the E2E testing effort.

Changelog:
[Internal] [Changed] - Remove unused rn-tester e2e tests

Reviewed By: cipolleschi

Differential Revision: D58729123

fbshipit-source-id: f0f47e3c2e087141fdff506b7c5c9b460263721b
2024-06-18 09:06:42 -07:00
Alex Hunt
53dda9e542 Format code-workspace file, clarify use of .vscode/ dir (#44874)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44874

While reviewing https://github.com/facebook/react/pull/29830, I noticed this file was committed with tab indentation in React Native. I have also used the `.gitignore` entry to clarify how `react-native.code-workspace` interacts with an optional user `.vscode/` config directory.

Note: The `json-stringify` parser can be used with Prettier 3+ only, so we use `json` instead.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D58413581

fbshipit-source-id: 58c14db6648fed10736062b1f055475154aa74a4
2024-06-11 09:27:48 -07:00
Nicola Corti
cf914e412d RNGP - Autolinking. Add support for linking projects. (#44799)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44799

This is the final part of core autolinking:
1. I split RNGP into an `app-plugin` and a `settings-plugin`. This was necessary as the Gradle modules need to be loaded inside the settings.gradle.kts.
2. I've introduced a Settings Plugin to take care of either invoking the `config` command from CLI or receiving a file in input.
3. I've removed the former `RunAutolinkingConfigTask` as now the command is invoked inside the settings plugin
4. I've added hashing computed based on the lockfiles so we won't be re-executing teh `config` command if the lockfiles are not changed.
5. I've updated RN-Tester to use the core autolinking rather than manual linking for the 2 libraries it's using.

Changelog:linking
[Internal] [Changed] - RNGP - Autolinking. Add support for linking projects

Reviewed By: blakef

Differential Revision: D58190363

fbshipit-source-id: 6ab8b36729e77ca715f50a4a00aa0ca4eb5b63b1
2024-06-07 10:32:16 -07:00
Blake Friedman
995d5b832d Add an internal HelloWorld template
Summary:
This is a copy of the current packages/react-native/template that we exclusively use internally for testing.

Changelog: [Internal]

NOTE: Best contribution would be to scan the file list and ensure there isn't anything that shouldn't be in there.

bypass-github-export-checks

Reviewed By: cortinico, cipolleschi

Differential Revision: D56242484

fbshipit-source-id: 0913ff7acff9b0314b49f48e986674b77dbb908e
2024-04-23 15:07:59 -07:00
Dmitry Rykun
1cb0a3342a Add react-native-test-library package (#43068)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43068

This diff adds `react-native-test-library` package.
It contains native module and native component example, and targets both the new and the old architecture. It has structure similar to many OSS React Native libraries, and is supposed to be used to test the integration with third-party libraries.

It is integrated with RNTester as the **OSS Library Example** screen.

{F1457510909}

**Change Background** tests native commands.
**Set Opacity** tests native props.
**Get Random Number** tests native module.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D50793835

fbshipit-source-id: ff6daefab10e6e9f13049e3013f8f63cfa8a929e
2024-04-09 11:35:43 -07:00
Pieter De Baets
6014dce04c Revert D54630694: Fix duplication across and rncore and FBReactNativeComponentSpec
Differential Revision:
D54630694

Original commit changeset: 75cb961ded9f

Original Phabricator Diff: D54630694

fbshipit-source-id: 50832c934e5bcc1a92456d949995c05a33767a92
2024-03-18 10:38:35 -07:00
Pieter De Baets
ef77087293 Fix duplication across and rncore and FBReactNativeComponentSpec (#43385)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43385

`rncore` and `FBReactNativeComponentSpec` contain the same symbols, which leads to conflicts when we try to merge them into a single shared library. Cleanup the duplication and standardize on `FBReactNativeComponentSpec` everywhere. I've left the Android OSS targets as is, to avoid breaking deps.

Changelog: [Internal]

Reviewed By: cortinico, dmytrorykun

Differential Revision: D54630694

fbshipit-source-id: 75cb961ded9fd75508755c0530e29409fef801cf
2024-03-18 07:30:33 -07:00
Ramanpreet Nara
8bced4b29d Pull PopupMenuAndroid out of React Native core
Summary:
**History:** This component was originally introduced into React Native core in D52712758, to replace UIManagerModule.showPopupMenu().

**Problem:** But, React Native core should be lean. Adding this component to React Native bloats the core.

**Changes:** So, this diff pulls PopupMenuAndroid out into its own package in the react-native GitHub repository.

In the future, this will be migrated to a community package!

Changelog: [Android][Removed] Move PopupMenu out of React Native core

Reviewed By: NickGerleman

Differential Revision: D53328110

fbshipit-source-id: 469d8dc3e756c06040c72e08fa004aafa1bd6e18
2024-02-23 16:43:18 -08:00
Alex Hunt
fb446598f9 Rename E2E template init script, relocate Verdaccio config + storage (#43001)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43001

More understandable name: ~"React Native init, for E2E testing". Also relocates Verdaccio config and storage location under `scripts/e2e/` (resolving TODO comment).

The intent is for the `scripts/e2e/` dir to also group the existing E2E testing-related scripts — although I will stop here for the current release-related work.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53609332

fbshipit-source-id: fb2f6502a18c4a4ac2368b46af1e3ee42edbadd6
2024-02-15 14:51:48 -08:00
Rob Hogan
48a19d7020 Back out "Standalone Gradle plugin: Node.js package resolver"
Summary:
Original commit changeset: 32898e1ba30b

Original Phabricator Diff: D52998256

[General][Removed] - Back out: Gradle plugin for resolving node_modules packages.

Backing this (my own diff) out as it breaks CI - I'm not sure why it landed.

Reviewed By: cipolleschi

Differential Revision: D53427912

fbshipit-source-id: baec254a463e3f7827d6a8675499aab34069ddd1
2024-02-05 09:16:10 -08:00
Rob Hogan
8456ccad78 Standalone Gradle plugin: Node.js package resolver (#42823)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42823

This is a tiny new Gradle plugin intended to be published to the Gradle Plugin Portal independently of React Native. It's only function is to resolve `node_modules` package roots using a sufficient subset of the Node JS resolution algorithm - e.g, we can use it to find `react-native` itself from a user's project, whatever package manager or workspace setup they're using, in a Gradle-friendly, cacheable manner.

The plugin is both a `Settings` plugin and a `Project` plugin, so that it may be used from both `settings.gradle` (where we need it to resolve `react-native`) and `app/build.gradle` (which currently applies from `cli-platform-android`).

The setup is mostly `gradle init` with a few modifications (eg, Kotlin JVM version) to stay close to the setup for `react-native-gradle-plugin`. I think it's easier to reason about this currently as an entirely separate Gradle project, but we may be able to merge the two and reduce some duplication once it's proven.

Changelog:
[General][Added] - Gradle plugin for resolving node_modules packages.

Reviewed By: cortinico

Differential Revision: D52998256

fbshipit-source-id: 32898e1ba30bccabca11b623f03959a51898afe8
2024-02-05 08:30:32 -08:00
Nicola Corti
d992abc56d Move legacy tests from OSS to fbandroid/java/com/facebook/fbreact (#41802)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41802

Those tests are not executing at all, they're just compiled.
Our internal infra is still depending on some bits of it though, so I'm moving them to `fbandroid/java/com/facebook/fbreact

Changelog:
[Internal] [Changed] - Move legacy tests from OSS to  fbandroid/java/com/facebook/fbreact

Reviewed By: rshest

Differential Revision: D51805702

fbshipit-source-id: 2c5cec68efa9854184e981220202d8f356ff690a
2023-12-27 17:34:29 -08:00
Oskar Kwaśniewski
09b110fef8 fix: add verdaccio generated files to .gitignore (#41783)
Summary:
When working with Verdaccio (testing the template, releasing packages) - I've stumbled upon a lot of changes in the repo:

![CleanShot 2023-12-04 at 13 14 12@2x](https://github.com/facebook/react-native/assets/52801365/74ce53a2-b885-41f4-9a12-968a8577285e)

## Changelog:

[INTERNAL] [ADDED] - Add verdaccio generated files to .gitignore

Pull Request resolved: https://github.com/facebook/react-native/pull/41783

Test Plan: CI Green

Reviewed By: christophpurrer

Differential Revision: D51808583

Pulled By: huntie

fbshipit-source-id: fec2a13883590d0c6af179c3804fba9d4235dde2
2023-12-04 07:52:06 -08:00
Riccardo Cipolleschi
475b835e43 Add Hermes Xcode integration test to GH Actions (#41187)
Summary:
After disabling the E2E tests, we lost a test that was verifying that Hermes works well with the latest version of React Native for iOS
This change introduce this test back in GH actions

## Changelog:
[Internal] Add tests for Hermes-Xcode integration to GH Actions

Pull Request resolved: https://github.com/facebook/react-native/pull/41187

Test Plan: CI is green 🤞

Reviewed By: NickGerleman

Differential Revision: D50737860

Pulled By: cipolleschi

fbshipit-source-id: f4bc09be879af7aba0ca42f1b7e407a5d5dc0986
2023-10-31 09:37:24 -07:00
Gijs Weterings
d4ad19c969 Revert D49370200: Migrate codegen to shared build setup, remove package build pre-step from RNTester
Differential Revision:
D49370200

Original commit changeset: 992913155169

Original Phabricator Diff: D49370200

fbshipit-source-id: e8232c97c22065fb54ac940ee2351b2155eb51e0
2023-10-23 12:00:54 -07:00
Alex Hunt
4db31a3110 Migrate codegen to shared build setup, remove package build pre-step from RNTester (#39540)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39540

This simplifies the use of Codegen when creating dev builds of `rn-tester` in the monorepo. It now runs from source for this internal scenario, and this package is now built using the shared monorepo build setup.

Changes:
- Migrate `packages/react-native-codegen` to the shared `yarn build` setup.
    - Update package to use `"exports"` field and wrap entry point modules with `babel-register` (NOTE: This is only required for each entry point internally used in the monorepo).
- Fixup small Flow syntax quirks that fail under `hermes-parser`.
- Remove `BuildCodegenCLITask` task from Android build.
- Remove Codegen `build.sh` call from iOS build, use `require.resolve` for `combine-js-to-schema-cli.js` entry point.

Externally significant FYIs:
- `react-native/codegen` is converted to use the `"exports"` field — it should export all `.js` files, as before.
- `codegenPath` is now ignored and marked as deprecated on `ReactExtensions.kt`.

NOTE: TypeScript auto-generation is not yet enabled on this package, since it uses CommonJS `module.exports` syntax (unsupported by `flow-api-translator`).

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D49370200

fbshipit-source-id: 992913155169912ea1a3cb24cb26efbd3f783058
2023-10-23 08:32:33 -07:00
Riccardo Cipolleschi
5678422504 Gitignore RCTLegacyInteropComponents.mm as it is generated by Xcode (#41010)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41010

## Changelog
[Internal] - Gitignore RCTLegacyInteropComponents.mm as it is generated by Xcode

Reviewed By: dmytrorykun

Differential Revision: D50323800

fbshipit-source-id: 63fdb82a97ff3c4d94d341555a0a3dcce8226a96
2023-10-17 02:33:19 -07:00
Nicola Corti
171a479150 Remove ReactNative/Flipper Integration (#40935)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40935

This is scheduled to land in 0.74, so I'm removed the native integration as this is not needed anymore.
The only thing I left is a stub class to ease the migration out of `ReactNativeFlipper`.

Changelog:
[Android] [Removed] - Remove ReactNative/Flipper Integration

Reviewed By: mdvacca, huntie, cipolleschi

Differential Revision: D50259817

fbshipit-source-id: 28427425340896635607202cd78936f6030e78e0
2023-10-16 05:32:55 -07:00
Christoph Purrer
c9d661226a RCTAppDelegate.mm > Honor Wnullable-to-nonnull-conversion setting (#40887)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40887

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D50244466

fbshipit-source-id: 17eb9f37b3dc7131a3178cd931246b3686141649
2023-10-12 17:32:40 -07:00
Dmitry Rykun
12eef6ea57 Store hermes stable artifacts inside Pods directory (#40733)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40733

Node package managers may purge or recreate `node_modules/react-native` when adding/removenf project dependencies. Storing hermes iOS artifacts inside `node_modules/react-native/sdks` is not reliable.
This diff moves those artifacts to `Pods/hermes-engine-artifacts`.
Should fix https://github.com/facebook/react-native/issues/39903
Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D50081559

fbshipit-source-id: a130898e12fb6275cadaef7617bf4b6a09e6487e
2023-10-09 08:26:05 -07:00
Fabrizio Cucci
60f5a80c1d Drop RCT prefix from RCTRequired folder (#39955)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39955

Align `RCTRequired` to the rest of the targets in `react-native-github/packages/react-native/Libraries`.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D50009827

fbshipit-source-id: c2ec9eb9e5fb081a2e2e8f53d33bc21dcf95b279
2023-10-06 13:25:37 -07:00
Luna Wei
b9612e7a00 Fix .gitignore for packages/react-native/sdks/downloads (#39963)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39963

Changelog: [Internal] - Fix typo in .gitignore for downloaded sdks

ignore-github-export-checks

Reviewed By: huntie

Differential Revision: D50018994

fbshipit-source-id: 3a92bb6cfee214d7265639a8dd19c6367ff0c7cd
2023-10-06 11:37:21 -07:00
Dmitry Rykun
45f7e117ad Consume Hermes from local source directory (#38967)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38967

Changelog: [IOS][Added] - Now it is possible to build Hermes form local source directory. Just set REACT_NATIVE_OVERRIDE_HERMES_DIR to the path to that directory.

Known shortcoming: changes made to the Hermes source will not be reflected in the RN project. You should manually delete `Pods/hermes-engine` and rerun `pod install`.

Reviewed By: cipolleschi

Differential Revision: D48121314

fbshipit-source-id: 0389662396921bdf120d390de36a586c52eb47f1
2023-08-24 04:54:14 -07:00
Riccardo Cipolleschi
641be98b1e Split Config.yml to run jobs selectively (#39042)
Summary:
Right now, every PR runs the whole test suite. For example, a changelog PR, will run all the tests. As of last month, that meant quite a few $s per single run.

With this PR, we are going to leverage dynamic configuration and file filtering to create a config.yml on the flight, depending on the files changed by the commit/pr.

They way it works is the following:
- It starts a setup workflow in CircleCI.
- This workflow fetch the list of files that have been changed in the current commit.
- It executes a bunch of filtering and computation to understand which tests makes sense to run.
- It creates a config on the flight to run those.
- It continue the pipeline on that config.

Currently, the way it works is the following:
- If a `.md` file has been modified => run nothing
- If only files in the `ReactAndroid` folder are modified => run tests for android only
- If only files in the `React` folder are modified or `ruby` files are modified => run only iOS tests
- If only js files, not in the scripts folder are modified => run only JS tests
- if only files in the e2e folder are modified => run only e2e tests
- else => run everything.

Of course, we can play and modify those filters t make sure that they reflect the work and the tests to the best we can.

bypass-github-exports-checks

## Changelog:
[Internal] - Split circleci config and run test selectively.

Pull Request resolved: https://github.com/facebook/react-native/pull/39042

Test Plan:
- [X] Tested on the local branch for general sanity check.
- [X] Import it in fbsource
- [x] Create a stacked diff which changes only a md file => verify that no tests are run.
- [x] Create a stacked diff which changes only files in ReactAndroid => verify that only android tests run.
- [x] Create a stacked diff which changes only files in React => verify that only iOS tests run.
- [x] Create a stacked diff which changes only ruby files => verify that only iOS tests run.
- [x] Create a stacked diff which changes ruby files and file in React => verify that only iOS tests run.
- [x] Create a stacked diff which changes only files JS not in the script folder => verify that JS tests run.
- [x] Create a stacked diff which changes only JS files in the script folder => verify that the whole suite starts.
- [x] Create a stacked diff which changes only files in the E2E folder => verify that only E2E files runs.
- [x] Trigger a nightly pipeline => verify that parameters are passed to the generated config.

Reviewed By: NickGerleman

Differential Revision: D48394437

Pulled By: cipolleschi

fbshipit-source-id: 771f3e68daa8318d2b73dd91ce85a41488110c04
2023-08-18 07:22:22 -07:00
Riccardo Cipolleschi
623f44c7ce Revert D48118162: Split CircleCI config
Differential Revision:
D48118162

Original commit changeset: 73c8071a7e80

Original Phabricator Diff: D48118162

fbshipit-source-id: f070601c8631a9b91bb298ce94a9eb7cee13e059
2023-08-16 05:46:52 -07:00
Riccardo Cipolleschi
67f8d4014e Split CircleCI config (#38793)
Summary:
Right now, every PR runs the whole test suite. For example, a changelog PR, will run all the tests. As of last month, that meant quite a few $s per single run.

With this PR, we are going to leverage dynamic configuration and file filtering to create a config.yml on the flight, depending on the files changed by the commit/pr.

They way it works is the following:
- It starts a setup workflow in CircleCI.
- This workflow fetch the list of files that have been changed in the current commit.
- It executes a bunch of filtering and computation to understand which tests makes sense to run.
- It creates a config on the flight to run those.
- It continue the pipeline on that config.

Currently, the way it works is the following:
- If a `.md` file has been modified => run nothing
- If only files in the `ReactAndroid` folder are modified => run tests for android only
- If only files in the `React` folder are modified or `ruby` files are modified => run only iOS tests
- If only js files, not in the scripts folder are modified => run only JS tests
- if only files in the e2e folder are modified => run only e2e tests
- else => run everything.

Of course, we can play and modify those filters t make sure that they reflect the work and the tests to the best we can.

bypass-github-export-checks

## Changelog:

[Internal] - Split circleci config and run test selectively.

Pull Request resolved: https://github.com/facebook/react-native/pull/38793

Test Plan:
- [X] Tested on the local branch for general sanity check.
- [X] Import it in fbsource
- [x] Create a stacked diff which changes only a md file => verify that no tests are run.
- [x] Create a stacked diff which changes only files in ReactAndroid => verify that only android tests run.
- [x] Create a stacked diff which changes only files in React => verify that only iOS tests run.
- [x] Create a stacked diff which changes only ruby files => verify that only iOS tests run.
- [x] Create a stacked diff which changes ruby files and file in React => verify that only iOS tests run.
- [x] Create a stacked diff which changes only files JS not in the script folder => verify that JS tests run.
- [x] Create a stacked diff which changes only JS files in the script folder => verify that the whole suite starts.
- [x] Create a stacked diff which changes only files in the E2E folder => verify that only E2E files runs.
- [x] Trigger a nightly pipeline => verify that parameters are passed to the generated config.

Reviewed By: rshest

Differential Revision: D48118162

Pulled By: cipolleschi

fbshipit-source-id: 73c8071a7e80cd930fe538f77d7bb5de75f22ab7
2023-08-16 04:30:54 -07:00
Ruslan Shestopalyuk
0fb71630c7 Add .cpplsp-buck-out to .gitignore files
Summary:
## Changelog:
[Internal] -

This must be some new thing coming from the C++ language service provider (from the VSCode plugins?..), but this keeps popping up since recently as untracked files in the yoga subfolder.

Add it to .gitignore.

Reviewed By: NickGerleman

Differential Revision: D48022954

fbshipit-source-id: dad608f303f3d50b701d776795f6e25f007811b2
2023-08-03 02:10:25 -07:00
Ruslan Shestopalyuk
4b84a2b913 Add .cpplsp-buck-out to .gitignore (#38723)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38723

## Changelog:
[Internal] -

Add a buck-specific (on Windows) non-source file type to .gitignore.

Reviewed By: christophpurrer

Differential Revision: D47957053

fbshipit-source-id: 732fdc554730037da5b5daa11ebff58a56f21c21
2023-08-01 10:56:21 -07:00
Lorenzo Sciandra
3c6dbec23b add RNTester-E2E: tests for iOS and Android via Appium, WDIO and Jest (#36267)
Summary:
The motivation is to create an E2E testing solution for the RNTester app that can be used to flag when things break and the release crew can use to validate more of the codebase ahead of a release.

This first PR wants to just showcase the main flow (how tests are made, where the E2E folder lives, how it's used by CircleCI) and then we can build on top of it with subsequent PRs, with the help of an umbrella issue to get the community involved in making more tests!

This work is being done cooperation with Callstack developers (mateuszm22 , adzironman, and others) - reason why the branch [lives in a fork](https://github.com/mateuszm22/react-native/tree/k%2Bm/new-rn-tester-E2E).

### [Read the RFC for more details ](https://github.com/react-native-community/discussions-and-proposals/pull/684)

### Extra notes

We are still on WebDriverIO 7 because during the exploratory phase, WDIO was a bit problematic and the workarounds needed to make it work don't seem very nice - see this PR: https://github.com/kelset/react-native-e2e-jest-appium-webdriverio/pull/4 --- this will be revisited in the future, once there's a better path for upgrading.

### Things that will be handled as follow up work

* upgrade to WDIO 8
* [an automated yarn run-e2e-test script](https://github.com/facebook/react-native/pull/36267#discussion_r1269378065)
* [a small refactoring into a js script](https://github.com/facebook/react-native/pull/36267#discussion_r1272050735)

## Changelog:

[INTERNAL] [ADDED] - Added first working configuration for e2e testing

Pull Request resolved: https://github.com/facebook/react-native/pull/36267

Test Plan:
You can play with this locally by [follow the readme](https://github.com/mateuszm22/react-native/blob/k+m/new-rn-tester-E2E/packages/rn-tester-e2e/README.md).

CircleCI jobs will be added.

Reviewed By: cipolleschi

Differential Revision: D47763012

Pulled By: cortinico

fbshipit-source-id: 6eb9674182b8ee97aea4784158c69bf017f379e5
2023-07-26 07:23:31 -07:00
Jiaqi Duan
dd1c8a6ba0 Revert D46225747: add RNTester-E2E: tests for iOS and Android via Appium, WDIO and Jest
Differential Revision:
D46225747

Original commit changeset: e5428c439afd

Original Phabricator Diff: D46225747

fbshipit-source-id: b2136b5338a38fc52493f5c9a47dcb806d6a5f52
2023-07-25 09:44:51 -07:00
Lorenzo Sciandra
3c196fb2f5 add RNTester-E2E: tests for iOS and Android via Appium, WDIO and Jest (#36267)
Summary:
The motivation is to create an E2E testing solution for the RNTester app that can be used to flag when things break and the release crew can use to validate more of the codebase ahead of a release.

This first PR wants to just showcase the main flow (how tests are made, where the E2E folder lives, how it's used by CircleCI) and then we can build on top of it with subsequent PRs, with the help of an umbrella issue to get the community involved in making more tests!

This work is being done cooperation with Callstack developers (mateuszm22 , adzironman, and others) - reason why the branch [lives in a fork](https://github.com/mateuszm22/react-native/tree/k%2Bm/new-rn-tester-E2E).

### [Read the RFC for more details ](https://github.com/react-native-community/discussions-and-proposals/pull/684)

### Extra notes

We are still on WebDriverIO 7 because during the exploratory phase, WDIO was a bit problematic and the workarounds needed to make it work don't seem very nice - see this PR: https://github.com/kelset/react-native-e2e-jest-appium-webdriverio/pull/4 --- this will be revisited in the future, once there's a better path for upgrading.

### Things that will be handled as follow up work

* upgrade to WDIO 8
* [an automated yarn run-e2e-test script](https://github.com/facebook/react-native/pull/36267#discussion_r1269378065)
* [a small refactoring into a js script](https://github.com/facebook/react-native/pull/36267#discussion_r1272050735)

## Changelog:

[INTERNAL] [ADDED] - Added first working configuration for e2e testing

Pull Request resolved: https://github.com/facebook/react-native/pull/36267

Test Plan:
You can play with this locally by [follow the readme](https://github.com/mateuszm22/react-native/blob/k+m/new-rn-tester-E2E/packages/rn-tester-e2e/README.md).

CircleCI jobs will be added.

Reviewed By: cipolleschi

Differential Revision: D46225747

Pulled By: cortinico

fbshipit-source-id: e5428c439afd84ed3dd219d6ada538263120d7c6
2023-07-25 07:58:09 -07:00
Dmitry Rykun
4960fe1352 Add /.cpplsp.buckd to react-native-github/.gitignore
Summary:
Something keeps creating these cpp lsp files in react-native-github, which is annoying.
{F1056848131}
This diff adds `.gitignore` section to ignore them.
Changelog: [Internal] - Add /.cpplsp.buckd to react-native-github/.gitignore

bypass-github-export-checks

Reviewed By: cortinico, cipolleschi

Differential Revision: D47716855

fbshipit-source-id: 78d2008f69c230d746546afad80c9114d27c9026
2023-07-24 07:21:05 -07:00
Nicola Corti
16201f8be3 Move Flipper integration to a separate Gradle module inside ReactAndroid (#37688)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37688

This moves the `ReactNativeFlipper` classes used to configure Flipper on Android from the template to
a separate Gradle artifact that will be published under the coordinates:
```
com.facebook.react:flipper-integration:0.73.x
```

This reduces the footprint of Flipper on the app template and makes easier for user on 0.73 to migrate
to Kotlin (as they will now have to migrate only 2 files rather than 4).

Changelog:
[Android] [Changed] - Move Flipper integration to a separate Gradle module inside `ReactAndroid`

Reviewed By: huntie

Differential Revision: D46441588

fbshipit-source-id: e197f29b7386b52091b8d38ed09bbd8f74a997df
2023-07-04 06:01:09 -07:00
Riccardo Cipolleschi
332be0f0c8 download hermes-engine when the configuration change (#37850)
Summary:
Currently, we ask users to reinstall the pods using the `PRODUCTION` flag when they want to either profile their app or prepare a release.

This way of working with the Release mode is not standard. One of the reason why we introduced it was to provide a different binary for Hermes and reinstalling the pods was the quickest way.

With this change, we are deferring the decision on when Hermes should be installed for apps to the moment where the app is actually build by the system.

These changes are not applied to Nightlies, when a specific tarball is passed to the cocoapods using the `HERMES_ENGINE_TARBALL_PATH` env var, and when hermes is built from source as in these scenarios we are usually not interested in building for Release.

The system is also smart enough not to redownload the tarball if the configuration does not change. It assumes that the default configuration when the pods are installed for the first time is Debug.

## Changelog:

[IOS] [CHANGED] - Download the right `hermes-engine` configuration at build time.

Pull Request resolved: https://github.com/facebook/react-native/pull/37850

Test Plan:
- CircleCI green for the Release template jobs
- Tested locally modifying the `hermes-utils` to force specific versions.
- Tested locally with RNTestProject

Reviewed By: dmytrorykun

Differential Revision: D46687390

Pulled By: cipolleschi

fbshipit-source-id: 375406e0ab351a5d1f5d5146e724f5ed0cd77949
2023-06-14 10:10:16 -07:00
Zihan Chen (MSFT)
9bb71650c9 Add @react-native/codegen-typescript-test to verify .d.ts files in @react-native/codegen (1) (#36562)
Summary:
- Add a typescript project to test `CodegenSchema.d.ts`. More tests for other .d.ts files will be added in future pull requests.
- The build script scans all snapshots from `react-native/codegen`'s typescript frontend and generates .ts files for each snapshot, but they are .gitignore-ed.
- `npm run build` will build these .ts files against `CodegenSchema.d.ts` after generating them.
- A failed jest case is included to ensure CI catch it, it will be removed before merged.

bypass-github-export-checks

## Changelog:

[General] [Added] - Add react-native/codegen-typescript-test to verify .d.ts files in react-native/codegen (1)

Pull Request resolved: https://github.com/facebook/react-native/pull/36562

Test Plan:
`npm run build` in `packages/react-native-codegen-typescript-test` and see all test files appear in `__generated__`.

## Screenshot

![Untitled](https://user-images.githubusercontent.com/53799235/226757755-cab4cb29-7d22-46a1-9ecb-d6732122ed38.png)

Reviewed By: rshest

Differential Revision: D44292277

Pulled By: cipolleschi

fbshipit-source-id: 8d79fe913f9563d64c92aae7c4f4e97a24ae9a21
2023-04-05 07:38:25 -07:00
Ruslan Lesiutin
714b502b0c | RN Monorepo | Migrate to package (#36434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36434

Changelog: [Internal]

This is a squashed stack of 18 commits, starting from D43202126

allow-large-files

Reviewed By: cortinico

Differential Revision: D43977381

fbshipit-source-id: 0da552ddb85f2f61a0be0ef071915b35f3f8555c
2023-03-17 05:03:25 -07:00
Riccardo Cipolleschi
e57b6d11fa Remove .ruby-version and update Gemfile to support multiple versions of Ruby (#36281)
Summary:
This Change remove the need to have a specific version of Ruby installed. We are now supporting a wider range of Ruby versions, starting from Ruby 2.6.10 (the ruby installed on MacOS by default).
We are still using a Gemfile to control the version of cocoapods that needs to be installed.

## Changelog

[IOS] [CHANGED] - Remove `.ruby-version` and update Gemfile to support a wider range of Ruby versions

Pull Request resolved: https://github.com/facebook/react-native/pull/36281

Test Plan:
- Tested locally on RNTester and an app from template, switch across different versions of Ruby
- CircleCI is green on the commit

Reviewed By: cortinico

Differential Revision: D43567660

Pulled By: cipolleschi

fbshipit-source-id: e7edfe5806a898a83ba39cb58b1318ebde56a57c
2023-02-26 09:32:28 -08:00
Riccardo Cipolleschi
e7becb06c1 Update RCTFabric to generate headers in the React folder when using Frameworks
Summary:
By leveraging the `PUBLIC_HEADERS_FOLDER_PATH` build settings of Xcode, we can instruct cocoapods to generate the frameworks Headers in a specific folder, for example the `React` folder.
This allows us to maintain the `#include`/`#import` structure, even if the framework has a different name.
However, we need to update the search paths to take into account this extra folder.

## Changelog:
[iOS][Changed] - Generate RCTFabric framework's headers in the React folder

Reviewed By: sammy-SC, dmytrorykun

Differential Revision: D43425677

fbshipit-source-id: 94a4f3a3c7de86341b3ce3457704e6b8fb9a588e
2023-02-20 11:50:10 -08:00
Pranav Yadav
363a6d253d chore: untrack stack dumps; *.stackdump (#35530)
Summary:
- Untracking StackDump files through `.gitignore`
- Most of the programs like shell (bash) **_crashes_** it generates **_StackDump_**; `*.stackdump` file(s)
- Such files are only for low level debugging purpose and _shouldn't be tracked_
- PS: When using integrated terminals on IDEs it's common to have these files especially on Win m/c :)

## Changelog

[Internal] [Changed] - Untracking Stack Dumps; `*.stackdump` files

Pull Request resolved: https://github.com/facebook/react-native/pull/35530

Test Plan: - [NO-CODE] Diff

Reviewed By: rshest

Differential Revision: D41653070

Pulled By: cortinico

fbshipit-source-id: 0727feb66daa286d077743a451643970555e9c20
2022-12-02 04:04:51 -08:00
Nicola Corti
f0972cb101 RNGP - Various improvements needed for 3rd party libs (#35496)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35496

This commit includes a series of fixes needed for better integration with libraries for 0.71:
- I've added an `android/README.md` file as some libraries were failing the build if the folder was missing
- RNGP now applies dep substitution on app and all the libraries project
- RNGP now adds repositories on app and all the libraries project
- I've removed the maven local repo to the `/android` folder as now is empty
- I've fixed the path for the JSC repo for Windows users
- I've added a bit of backward compat by re-adding an empty `project.react.ext` block that libraries might read from.
- I've removed `codegenDir` from the `GenerateCodegenArtifactsTask` which was unused.

Changelog:
[Internal] [Changed] - RNGP - Various improvements needed for 3rd party libs

Reviewed By: cipolleschi

Differential Revision: D41549489

fbshipit-source-id: 2252da0180ac24fd3fe5a55300527da6781f0f8c
2022-11-29 02:56:35 -08:00
shivenmian
b7a85b59b5 chore: renamed react-native-codegen to @react-native/codegen (#34804)
Summary:
Renamed react-native-codegen package to react-native/codegen and updated references, without changing the folder name; part of RFC480 (https://github.com/facebook/react-native/issues/34692). Follow-up from https://github.com/facebook/react-native/pull/34578

## Changelog

[General] [Changed] - Renamed react-native-codegen package to react-native/codegen and updated references

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

Pull Request resolved: https://github.com/facebook/react-native/pull/34804

Reviewed By: cortinico

Differential Revision: D39883584

Pulled By: hoxyq

fbshipit-source-id: 0ef384b75c6edd248b31e37b8f05f64b4d39ca6f
2022-11-28 08:28:51 -08:00
Dmitry Rykun
a5c77115ae Build hermesc in Xcode run script phase
Summary:
Build hermesc in Xcode run script phase, so it ends up inside `Pods/hermes-engine/buld_host_hermesc`. All the the housekeeping is now done by CocoaPods and Xcode, and we can get rid of all the setup/cleanup code.

Changelog:
[iOS][Changed] - Build hermesc in Xcode run script phase.

Reviewed By: cipolleschi

Differential Revision: D41521987

fbshipit-source-id: 336854fa23582255cba6d161acf2cc791cac9d00
2022-11-24 10:22:40 -08:00
Pranav Yadav
0ba1127c15 untrack test reports generated by test libraries (reporters) (#35187)
Summary:
- Untrack Test Reports generated by test libraries (reporters E.g. `jest-junit`)
- E.g. `/reports/junit/js-test-results.xml` report is generated; when we exec `yarn test-ci`, which is **_shouldn't_ be tracked**

### NOTE: Used `[skip ci]` to avoid wastage of compute resources �🌏
- Feel free to init tests manually if you find it necessary

## 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
-->

[GENERAL] [CHANGED] - Untrack Test Reports generated by test libraries (reporters E.g. `jest-junit`)

Pull Request resolved: https://github.com/facebook/react-native/pull/35187

Test Plan:
`yarn test-ci`
![image](https://user-images.githubusercontent.com/55224033/199709131-240d844c-a98a-419b-a370-cafe8e927de4.png)

Reviewed By: cipolleschi

Differential Revision: D40993282

Pulled By: sshic

fbshipit-source-id: 3fe150d3e8bd45cec56b50f2dc071002412e475e
2022-11-18 05:58:04 -08:00
Dmitry Rykun
6b8e13f53c Integrate Hermes with the Xcode build process
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
2022-11-01 11:55:41 -07:00
Moti Zilberman
19715cf4fb Add .metro-health-check to .gitignore
Summary:
Changelog:
[General][Changed] - Add Metro health check files to the template's `.gitignore`

We're adding an opt-in watcher health check to Metro, which can occasionally leave files named `.metro-health-check*` in the project. To ensure this doesn't clutter people's repos accidentally if enabled, we preemptively add this as a pattern to `.gitignore` in the new project template. We also add it to the React Native repo's `.gitignore` file just in case.

Reviewed By: arushikesarwani94

Differential Revision: D40352040

fbshipit-source-id: 261803b684d79292c014205084e61d5e4f7aeb3d
2022-10-14 06:51:52 -07:00
Nicola Corti
0e2f090631 Setup publishing for Snapshot and Stable on Maven (#34967)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34967

This diff is a preparatory work for publishing artifacts on Maven Central.
What it does is:
1. It sets up all the 3 modules (react-native, hermes-engine, external-artifacts) for publishg
2. Adds coordinates to publish on the Snapshot repository
3. Adds support for appendign -SNAPSHOT version if invoked with `-PisNightly=true`
4. Configures GPG signing of artifacts.

I haven't touched the CircleCI and JS code yet. I'll do it in another diff.

Changelog:
[General] [Changed] - Setup publishing for Snapshot and Stable on Maven

Reviewed By: mdvacca, cipolleschi

Differential Revision: D40146212

fbshipit-source-id: 9321e16f6c18b35bc3ae785749d613085c56e7bc
2022-10-13 03:08:22 -07:00
Héctor Ramos
1b30df10c6 Remove old __offline_mirrors__ from gitignore
Summary:
Remove old `__offline_mirrors__` from `.gitignore`.
This directory is not synced to GitHub.

Changelog: [Internal]

Reviewed By: fbmal7

Differential Revision: D40245262

fbshipit-source-id: ccc93ea4cb5729432f590f78e463b14ba6e78b22
2022-10-12 15:34:55 -07:00
Héctor Ramos
041ccf31df Add offline mirrors to .gitignore
Summary:
Add internal CocoaPods offline mirrors paths to .gitignore.

Changelog: [Internal]

Reviewed By: fbmal7

Differential Revision: D40241900

fbshipit-source-id: 712059f6d8f16bbd1964e13d49b257adad8aa8a2
2022-10-12 15:34:55 -07:00
Luna Wei
dc56eb99f1 Fix missing renames from bots to react-native-bots (#34713)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34713

Changelog: [Internal] - Fix up missing bots usage after we moved everything to packages/react-native-bots in 767f8e0249

Reviewed By: NickGerleman

Differential Revision: D39583230

fbshipit-source-id: 6cc6b7923e67139dc3c81dfe0c39005dde905248
2022-09-16 12:41:06 -07:00