Граф коммитов

670 Коммитов

Автор SHA1 Сообщение Дата
Dmitry Rykun e0a71fc7b5 Cleanup temporary files after source map generation.
Summary:
Changelog:
[iOS][Fixed] - When source maps are enabled, clean up temporary files from the build directory. Reduces bundle size by at least 1MB.

Reviewed By: cipolleschi

Differential Revision: D38866158

fbshipit-source-id: 0f46faf4e767bb7417b24f283fbe19cfa022941a
2022-08-19 10:23:22 -07:00
Dmitry Rykun 61106ac680 Fix react-native-xcode.sh build script
Summary:
This diff fixes USE_HERMES checks.

Changelog
[iOS][Fixed] - USE_HERMES envvar check fixed in react-native-xcode.sh.

Reviewed By: cipolleschi

Differential Revision: D38704558

fbshipit-source-id: 90a8648fd1094fcf9ab085f37efce9b811e707bc
2022-08-19 09:50:42 -07:00
Riccardo Cipolleschi ae8d01eca1 Install Fabric dependencies when the New Architecture is enabled (#34440)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34440

While testing some recent changes on a nightly, I realized that if we install the dependencies using RCT_NEW_ARCH_ENABLED=1 and we forget to change the flag in the Podfile, Fabric dependencies won't be installed.

However, Fabric is required by the New Architecture. This fix makes sure that we install Fabric dependencies when the New Architecture is enabled.

## Changelog
[iOS][Changed] Install Fabric dependencies when RCT_NEW_ARCH_ENABLED=1

Reviewed By: cortinico

Differential Revision: D38786978

fbshipit-source-id: 664151de0250577a19af949f8850e5efa8a13373
2022-08-18 01:58:24 -07:00
Riccardo Cipolleschi 7cc2d1a249 Create RCTAppDelegate to simplify New Architecture Setup (#34384)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34384

This Diff aims to create a RCTAppDelegate library to offer a subclass which automates some operations required to set up the new architecture.

## Changelog
[iOS][Added] - Added the RCTAppDelegate library

Reviewed By: cortinico

Differential Revision: D38580424

fbshipit-source-id: 38f6c4b8ff2790a2ce9e23d385b36307701cffb7
2022-08-15 01:30:55 -07:00
Riccardo Cipolleschi 0e316ec671 Update ruby codegen to cleanup build folder. (#34398)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34398

This Diff cleans up the codegen folder for iOS when we install the pods. This is useful to start from a clean situation. The codegen runs after this step and we make sure that the file system is clean

## Changelog
[iOS][Changed] - Cleanup codegen build folder before installing the pods

Reviewed By: cortinico

Differential Revision: D38657027

fbshipit-source-id: 8a914457d7963521d6d8dc7819eba864736f50a0
2022-08-15 01:30:55 -07:00
Tim Yung b8425c8ee5 RN: Cleanup Existing ESLint Warnings
Summary:
Sometime over the past few months (and with changes such as migrating to the `hermes-eslint` parser), a bunch of lint warnings crept into the codebase.

This does a pass to clean them all up, ignore generated files, and refactor some code to be... better.

There should be no observable behavior changes as a result of this.

Changelog:
[Internal]

Reviewed By: NickGerleman

Differential Revision: D38646643

fbshipit-source-id: a7b55d1e4cd5700340cc5c21f928baf3ea1d5a58
2022-08-12 17:16:40 -07:00
Nicola Corti 4699a39489 Isolate the buck OSS commands inside test_buck (#34378)
Summary:
This isolates and parallelize all the BUCK related work inside a `test_buck` job, so it's immediately clear where a failure happend.

I've also added a couple of minor improvements:
- Don't clone okbuck just to consume a script. I've copied the script over instead.
- Removed unnecessary `buck_cache_key`

This should reduce ~5 minute of build time from Test Android which was already beyond 10 minutes.

## Changelog

[Internal] - Isolate the buck OSS commands inside test_buck

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

Test Plan: Let's wait for a `test_buck` and `test_android` output.

Reviewed By: cipolleschi

Differential Revision: D38580359

Pulled By: cortinico

fbshipit-source-id: 8b3915bbc28b4a7a169011fe9047f402c2d1f6ee
2022-08-11 02:46:00 -07:00
Dmitry Rykun 03de19745e Fix USE_HERMES envvar check
Summary:
Hermes is enabled by default. We set `USE_HERMES` envvar to `false` to explicilty disable Hermes. The only valid way to check it would be to compare it against `false`. Everything else will produce invalid results if `USE_HERMES` is not defined. For example `$USE_HERMES != true` will turn into `'' != true`, which evaluates to `true`.
Due to this bug source maps were not generated by default.

Changelog:
[iOS][Fixed] - USE_HERMES envvar check fixed in react-native-xcode.sh. Now source maps are generated by default.

Reviewed By: cipolleschi

Differential Revision: D38571971

fbshipit-source-id: bc6b505c225c56d62ee773b401b66d821965e106
2022-08-10 05:24:41 -07:00
Seph Soliman 1bc9ddbce3 Enable Flipper for custom Xcode configurations (#34333)
Summary:
Fixed Flipper not recognizing app when using custom Xcode configuration names.

This fixes the problem that renaming the "Debug" Xcode configuration causes Flipper to not work. Despite using the recommended `:configurations` parameters and instructing Cocoapods that it was a debug build (see https://github.com/facebook/react-native/issues/34332), it still wouldn't recognize the app due to missing C preprocessor flags, specifically it was missing `-DFB_SONARKIT_ENABLED=1`.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Flipper now supports custom Xcode build configuration names

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

Test Plan:
I applied the PR change to 0.68.2 (which work similarly but code was refactored since then). I then used `patch-package` to test the change and the fix worked on 2 separate projects.
Patch-package change equivalent:
```diff
 diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
index f2ceeda..2ea57d6 100644
 --- a/node_modules/react-native/scripts/react_native_pods.rb
+++ b/node_modules/react-native/scripts/react_native_pods.rb
@@ -180,7 +180,7 @@ def flipper_post_install(installer)
     # Enable flipper for React-Core Debug configuration
     if target.name == 'React-Core'
       target.build_configurations.each do |config|
-        if config.name == 'Debug'
+        if config.debug?
           config.build_settings['OTHER_CFLAGS'] = "$(inherited) -DFB_SONARKIT_ENABLED=1"
         end
       end
```

**Screen shot of Xcode after the patch has been applied, for RN v0.68.2:**
![Screen Shot 2022-08-02 at 14 31 49](https://user-images.githubusercontent.com/895369/182477178-387df1b2-d86c-4d82-859c-a2d1e6e6d1d0.jpg)

Reviewed By: dmitryrykun

Differential Revision: D38373812

Pulled By: cipolleschi

fbshipit-source-id: d2949927084160bf0c6f8af37a7966dd22fea9a6
2022-08-09 10:14:23 -07:00
Riccardo Cipolleschi a4599225f5 Silence deprecation warning for react-native dependency. (#34368)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34368

When a user runs `RCT_NEW_ARCH_ENABLED=1 pod install` to install the dependencies for the New Architecture, Cocoapods prints a warning because of React Native is still set up with a legacy configuration.

This diff silences these warnings because they can confuse the final user.

**Note:** We need to keep this legacy configuration to support both the legacy and the New Architecture.

## Changelog

[iOS][Changed] - Silence warning due to react-native internal details.

Reviewed By: cortinico

Differential Revision: D38503405

fbshipit-source-id: b89857aa88435b1c64da52875606003239ff2e05
2022-08-08 12:34:47 -07:00
Peter Velkov a98da32229 Fix `HBC_SOURCEMAP_FILE` in `scripts/react-native-xcode.sh` (#34111)
Summary:
## Summary

Fixes https://github.com/facebook/react-native/issues/32497
Fixes https://github.com/facebook/react-native/issues/34212

The assigned HBC_SOURCEMAP_FILE path is incorrect as it does not reference the hermes bundle source map file

See: https://github.com/facebook/react-native/issues/32497#issuecomment-1171379674

## Changelog
[General] [Fixed] - using SOURCEMAP_FILE during xcode build phase with Hermes enabled

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

Test Plan:
1. In a blank react-native project
1. Enable Hermes
1. Go to xCode -> Project -> Build Phases -> Bundle React Native code and images
3. Add `export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map"` before `react-native-xcode.sh`
   e.g.
   ```sh
   export NODE_BINARY=node
   export SOURCEMAP_FILE="$(pwd)/../ios.jsbundle.map"

   ../node_modules/react-native/scripts/react-native-xcode.sh
   ```
4. Make a release build `npx react-native run-ios --configuration Release` or `CMD + I` in xCode
5. Verify the build is successful
6. Verify the `.map` file is outputted at the specified path (`ios.jsbundle.map` in project root for the example above)

Reviewed By: cipolleschi

Differential Revision: D38460586

Pulled By: dmitryrykun

fbshipit-source-id: 54c1594b37fa2253896ce9739c1a9a712deecd0f
2022-08-08 07:16:36 -07:00
Nicola Corti 1ce23ce435 Fix test-manual-e2e on Android/Hermes for New App Template (#34294)
Summary:
The current `test-manual-e2e.sh` script is broken on Android + Hermes + New App Template.

This commit fixes it. Specifically:
- There is no need to generate Maven Artifacts for RN Tester, as RN Tester consumes them from source.
- There is instead a need to generate Maven Artifacts for New App Template, as they need to be included inside the NPM package.
- The `:ReactAndroid:hermes-engine:installArchives` task needs to invoked to also generate the Hermes-engine .aar for bundling.

## Changelog

[Internal] - Fix test-manual-e2e on Android/Hermes for New App Template

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

Test Plan: I've tested this against the `0.70-stable` branch and I was able to run an App from the New Template properly.

Reviewed By: dmitryrykun

Differential Revision: D38239238

Pulled By: cortinico

fbshipit-source-id: b3d95bad21515b12a91e29147e70ba8323896660
2022-07-28 06:23:11 -07:00
Kudo Chien c4b51e8d76 #34214 for main (#34271)
Summary:
cherry-pick changes from https://github.com/facebook/react-native/issues/34214 to main. because the `react_native_pods.rb` on main is quite different from 0.69, i have separated pr for the change.

## Changelog

[iOS] [Fixed] - Fix React-bridging headers import not found

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

Test Plan: RNTester + pod install and verify pod targets to have `React-bridging` in header search paths.

Reviewed By: cipolleschi

Differential Revision: D38122074

Pulled By: dmitryrykun

fbshipit-source-id: 64569abbfa3a684f0d6b84c9e3222bfc9a171061
2022-07-27 07:56:05 -07:00
LeoTM 77752fc403 Update Podfile for `PRODUCTION=1 pod install` (#34234)
Summary:
### Mentioned
- pr[main]: https://github.com/facebook/react-native/pull/33882
- discussion: https://github.com/reactwg/react-native-releases/discussions/21#discussioncomment-2945972
- pr[0.69-stable]: https://github.com/facebook/react-native/pull/34098

Close: https://github.com/facebook/react-native/issues/33764

Saw the issue ago couple wks too: https://github.com/leotm/react-native-template-new-architecture/issues/757
Fixed similarly: https://github.com/leotm/react-native-template-new-architecture/pull/791

## Changelog

[iOS] [Changed] - Update Podfile to allow `PRODUCTION=1 pod install`

[CATEGORY] [TYPE] - Message

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

Test Plan: Everything builds and runs as expected

Reviewed By: cortinico

Differential Revision: D38029117

Pulled By: cipolleschi

fbshipit-source-id: bdb58200a999cb66f1043a2feb670f9037c8e463
2022-07-22 02:28:07 -07:00
Riccardo Cipolleschi 4b51207735 Simplify logic to choose if we need to build hermes from source or not. (#34232)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34232

This diff simplify the logic to decide whether we want to build hermes from source or not.

The requirement we have is that we don't want our users to build hermes.
So, we don't want to build hermes when there is a precompiled tarball available, while we want to build hermes in CI.

## Changelog

[General][Changed] - Build hermes when in CI and not when there is a tarball

Reviewed By: cortinico

Differential Revision: D37999748

fbshipit-source-id: 7d9cab51c37fb47db216055c057a22081e10df07
2022-07-22 02:13:47 -07:00
Riccardo Cipolleschi 361d939afd Build Hermes in CI also when it is against stable branch (#34224)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34224

This Diff is a copy of this [PR](https://github.com/facebook/react-native/pull/34228) that we have against 0.69-stable.

This Diff makes sure we can build Hermes also in PR that are created against a stable branch

## Changelog

[General] [Changed] - Make sure we can build Hermes from source when PR are opened agains -stable

Reviewed By: cortinico

Differential Revision: D37961092

fbshipit-source-id: 65577fcc69f0e2a68377cbd46e3bd3a6af24e7c3
2022-07-20 08:53:38 -07:00
Dmitry Minkovsky 698b14789c Use readlink instead of realpath in packager.sh (#34145)
Summary:
`realpath` is not available on macOS 12.2 and 12.4. Because of this, the following error is shown when launching an RN app with XCode (which calls `packager.sh` via `launchPackage.command`):

<img width="1123" alt="Screen Shot 2022-07-06 at 1 26 08 PM" src="https://user-images.githubusercontent.com/218725/177608681-0cf4dc5a-b71c-4ddc-8fbe-4d37b2d3e2cb.png">

I am running Bash 5 but realpath is also not available with zsh.

This issue was introduced in bb8ddd6c12 (diff-6ca7c99209bdf630550bb9e2946ce8611948c5a23b32ffb25028792ef5d48b8d), which interestingly did not change `launchPackage.command`. There's a recent comment on that commit that confirms this issue:

bb8ddd6c12 (commitcomment-77818917)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Use readlink instead of realpath in packager.sh

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

Reviewed By: cipolleschi

Differential Revision: D37669417

Pulled By: cortinico

fbshipit-source-id: bcc4cb6e886df059e6598ee811226e3cd1a6ae14
2022-07-20 07:06:18 -07:00
Danilo Bürger af3dfbaa47 Move cocoapods cli native_modules require from template to rn scripts (#34215)
Summary:
This resolves issues where the node_modules structure is not hoisted (like with pnpm). Since the template does not directly depend on the cli, it doesn't exist in the pnpm node_modules root. Moving it to the rn scripts makes sure that the relative require starts in the correct directory for both hoisted and pnpm structures.

## Changelog

[iOS] [Fixed] - Fix cocoapods cli native_modules require for pnpm node_modules

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

Test Plan:
1. react-native init
2. rm -rf node_modules
3. pnpm i
4. bundle install
5. bundle exec pod install --project-directory=ios

This should succeed. Without the patch, it will fail with

```
[!] Invalid `Podfile` file: cannot load such file -- /.../node_modules/react-native-community/cli-platform-ios/native_modules.

 #  from /.../ios/Podfile:2
 #  -------------------------------------------
 #  require_relative '../node_modules/react-native/scripts/react_native_pods'
 >  require_relative '../node_modules/react-native-community/cli-platform-ios/native_modules'
 #
 #  -------------------------------------------
```

Reviewed By: cortinico

Differential Revision: D37959152

Pulled By: cipolleschi

fbshipit-source-id: 7fa9af4a8c153cfd38360f57eca415a8c252dbd5
2022-07-19 09:11:08 -07:00
Riccardo Cipolleschi 79a37e5a88 Destructure use_react_native! parameters and doc (#34177)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34177

This Diff destructures the parameters of the use_react_native! function. It does that in a backward compatible way, so we there should be no disruptions.

It also adds documentation to the various public method we want to export to our users.

## Changelog
[iOS][Changed] - Destruct use_reactnative parameters and ad ddocumentation

Reviewed By: cortinico

Differential Revision: D37787365

fbshipit-source-id: 27f9030db2e8c6c66b9548b4c1287eb8165ae5fc
2022-07-19 00:03:23 -07:00
Riccardo Cipolleschi 7d069b2583 Extract Codegen code from the react_native_pods to its own file (#34176)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34176

It extracts the code related to the codegen from the main `react_native_pods` script to a dedicated file, adding also tests.

## Changelog

[iOS][Changed] - Move codegen in separate files

Reviewed By: cortinico

Differential Revision: D37755818

fbshipit-source-id: 99760d1def26ddbf065fdd234e0d183c2795513c
2022-07-19 00:03:23 -07:00
Héctor Ramos cd8dbd15ff Circle CI: Create GiHub Release draft when bumping version
Summary:
Automatically create a GitHub Release draft when a new React Native release is created.

The GitHub Release will be created by the same Circle CI job that publishes the package to npm.

This job will also upload the built Hermes binaries to the GitHub release.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D36646696

fbshipit-source-id: 0a863dc4e3215fc95f7852f8dc43858cdd852aaa
2022-07-14 13:42:08 -07:00
Ernest Surudo ff785dbcf5 Use `NODE_BINARY` from `.xcode.env` when running packager from Xcode (#34121)
Summary:
Before this change, during the "Start Packager" Xcode build step that runs the packager, `packager.sh` was using my system node version and not the one from `nvm` that is meant to be used with the project.

## Changelog

[iOS] [Fixed] - Use `NODE_BINARY` from `.xcode.env` when running packager from Xcode

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

Test Plan: Perform a build using Xcode and confirm that the packager is using the correct version of node.

Reviewed By: cortinico

Differential Revision: D37746951

Pulled By: cipolleschi

fbshipit-source-id: de697c27fe86ce65e8e3646cb30309ecc7f6c247
2022-07-12 05:52:22 -07:00
Ben f501979f3d Fix error message formatting (#31338)
Summary:
This error message doesn't format correctly when outputted to the terminal.  It seems the 2nd line is missing

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - bug with error message formatting when bundle is missing

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

Test Plan:
Before:
![wHHXtKq](https://user-images.githubusercontent.com/4398635/114310176-f11f8700-9ab7-11eb-9de7-b80aab92d440.png)

After:
![6nIjRHc](https://user-images.githubusercontent.com/4398635/114310470-d6014700-9ab8-11eb-9164-d6edde95c6f8.png)

Reviewed By: cipolleschi, sota000

Differential Revision: D30912237

Pulled By: cortinico

fbshipit-source-id: 68a4b29cdd93cbde7ba4611c5e38775561b73ea2
2022-07-11 03:25:49 -07:00
Riccardo Cipolleschi 468b86bd37 Move Hermes setup in a dedicated ruby file (#34100)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34100

This Diff continue the effort of refactor and test the cocoapods script, moving hermes setup in a dedicated `hermes.rb` file and adding some tests on the logic of the hermes handling.

## Changelog
[iOS][Changed] - move and test Hermes setup from react_native_pods script into a dedicated file

Reviewed By: cortinico

Differential Revision: D37522432

fbshipit-source-id: 91112476aac576a30110e5dcd4e46fa12241962a
2022-07-08 07:25:29 -07:00
Riccardo Cipolleschi 61488449b9 Fix a bug for which is impossible to disable Hermes (#34142)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34142

The `||=` operator in an expression like `x = a ||= b` works in a way that:
- if a is null, it assigns b to x
- if a is `falsy`, it assigns b to x
- otherwise, it assigns a to x.

In our setup, if the user set `hermes_enabled` to `false` in the Podfile (one of the suggested way to disabled Hermes), the `options[:hermes_enabled]` part will evaluate to false and, therefore, `hermes_enabled` will obtain the value of `true`.

## Changelog

[iOS][Changed] - Use the correct operator to decide whether Hermes is enabled or not.

Reviewed By: cortinico

Differential Revision: D37643845

fbshipit-source-id: 387f7bd642250c40873400d22d7d85451462c073
2022-07-06 07:17:10 -07:00
Arkkeeper 2fb6a3393d Mac Catalyst patches (#34026)
Summary:
This PR adds a new method called **__apply_mac_catalyst_patches** to **scripts/react_native_pods.rb**. If it is enabled in the Podfile, it will apply three patches necessary for successful building not only for iOS and tvOS targets, but also for macOS using Apple's Mac Catalyst technology.

These 3 patches are:
- Fixing bundle signing issues by altering CODE_SIGN_IDENTITY
- Explicitly setting dead code stripping flag in project.pbxproj
- Modifying library search paths

The details were discussed here https://github.com/reactwg/react-native-releases/discussions/21#discussioncomment-2754289

## Changelog

[iOS] [Added] - Add Mac Catalyst compatibility (can be enabled in Podfile)

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

Test Plan:
1. Go to project settings in Xcode, to General tab. Enable "iPad" and "Mac Catalyst" checkboxes
2. Go to "Signing & Capabilities" tab, ensure that a correct bundle id and development team are set
3. Edit Podfile, uncomment **__apply_mac_catalyst_patches(installer)** line
4. Run `pod install` in ios directory
5. Get back to Xcode, select "My Mac (Mac Catalyst)" as a target device
6. Build & run

Reviewed By: cipolleschi

Differential Revision: D37362054

Pulled By: cortinico

fbshipit-source-id: 74636f716f112289ab40968bbc8e52406c1e9579
2022-06-30 05:20:14 -07:00
Héctor Ramos 1115bc77db Make Hermes the default engine on iOS (#34085)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34085

Hermes is now the default engine on iOS.

Apps can choose to continue using JSC by setting `hermes_enabled` to `false` in their Podfile.

The RNTester app now uses Hermes, as well. Use JSC in RNTester by setting `USE_HERMES=0` when running `pod install`.

Changelog:

[iOS][Changed] Hermes is now the default engine on iOS. This setting is controlled via `flags[:hermes_enabled]` in the Podfile.

Reviewed By: cortinico, cipolleschi

Differential Revision: D37361468

fbshipit-source-id: e6dda6a23eea4a824ad157d1a26f17e181db33cd
2022-06-28 10:04:51 -07:00
Riccardo Cipolleschi 8fe2b591c7 Move LocalPodspecPatch to dedicated file (#34025)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34025

This diff moves the monkeypatch LocalPodspecPatch to a dedicated ruby file.
It also adds test for that

## Changelog
[iOS][Changed] - Move LocalPodspecPatch to dedicated file

Reviewed By: cortinico

Differential Revision: D37069361

fbshipit-source-id: 28fddb197484f45aa20ccac516c874e79448e999
2022-06-27 01:19:36 -07:00
Simek 1999191881 Update CONTRIBUTING.md, replace wiki links (#34035)
Summary:
This PR is a follow up for the contributing content move on the website:
* https://github.com/facebook/react-native-website/pull/3120

It replaces most of the CONTRIBUTING file content with a reference to the contributing overview page on the website, which has been based off the content of this file.

Additionally I have searched thought the code for the wiki links and replaces theme with the correct website links. There was an instance where comment was referring to an old and removed a while ago wiki page, so I just get rid of this link.

## Changelog

[Internal] [Chore] - Update CONTRIBUTING.md, replace wiki links

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

Test Plan: N/A

Reviewed By: lunaleaps

Differential Revision: D37318814

Pulled By: cortinico

fbshipit-source-id: d3f5e5c5bd477c0de5c4f0f1d5de81f464b9f5b4
2022-06-21 19:30:23 -07:00
Luis Santana 68f3a42fc7 bump RTC-Folly to 2021.07.22 (#33841)
Summary:
Bumping RTC-Folly version used to address CVE-2022-24440.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General][Security] - Bump RTC-Folly to 2021-07-22

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

Reviewed By: Andjeliko, philIip

Differential Revision: D36425598

Pulled By: cortinico

fbshipit-source-id: d38c5f020dbecf794b10f12ed2da30e1825071af
2022-06-21 12:36:43 -07:00
Kudo Chien f97c6a5b49 Fix broken use_frameworks from React-bridging (#34011)
Summary:
`use_frameworks!` is broken again in react-native 0.69 because React-bridging. in the `use_frameworks!` mode, header structures are flattened, so `#include <react/bridging/CallbackWrapper.h>` is not reachable to the header. to somehow workaround the issue without touch React-bridging imports, the pr do these things:

- use `header_mappings_dir` to keep `react/bridging` header structure
- because the header structure is not default framework header structure, explicitly `HEADER_SEARCH_PATHS` is necessary.
- forward declare `CallbackWrapper` and use it internally in ReactCommon. so that we don't need to add `HEADER_SEARCH_PATHS` for React-bridging to every pods depending on `ReactCommon/turbomodule/core`, e.g. React-RCTSettings.podspec.

## Changelog

[iOS] [Fixed] - Fix use_frameworks! for 0.69

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

Test Plan:
```sh
$ npx react-native init RN069 --version next
# add `use_frameworks!` to ios/Podsfile
# comment out use_flipper!() in ios/Podfile
# patch node_modules/react-native with these changes
$ yarn ios
```

Reviewed By: cortinico, cipolleschi

Differential Revision: D37169699

Pulled By: dmitryrykun

fbshipit-source-id: 309c55f1c611a2fc3902a83e8af814daaf2af6a0
2022-06-21 02:56:42 -07:00
Riccardo Cipolleschi 71da21243c Move New Architecture setup to `new_architecture.rb` file (#33990)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33990

This diff moves the setting of some CPP flags from the main React native pods file to a dedicated file.

It also introduces some tests and it improves the Test Mocks we have

## Changelog
[iOS][Changed] - Move the `modify_flags_for_new_architecture` method to separate ruby file

Reviewed By: cortinico

Differential Revision: D37040927

fbshipit-source-id: 037ddaf123d01f3a2fd622b8a0cd10535da70b92
2022-06-17 17:11:51 -07:00
Alpha Shuro 4a7e4b9ca6 fix (glog script): remove invalid param from sed (#33967)
Summary:
This is what I had to do locally to fix https://github.com/facebook/react-native/issues/33966

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Fix sed error when installing `glog`

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

Test Plan:
After this, `pod install` installed `glog` successfully

<img width="255" alt="image" src="https://user-images.githubusercontent.com/8580352/172226617-6fe8c3df-1629-42e9-95a4-a9c0ebe675a8.png">

Reviewed By: cortinico

Differential Revision: D36943821

Pulled By: charlesbdudley

fbshipit-source-id: 8f6aa64089b22d23f8c4a015ff30a3789e612b4e
2022-06-17 11:58:08 -07:00
Riccardo Cipolleschi 4f732ba9ee Move utilities out of `react_native_pods` - Part 2 (#33982)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33982

This Diff moves another part of the utilities from the `react_native_pods` file to a specific `utils.rb` file.

It adds tests for these utils and improve our test mocks.

The goal is to simplify the `react_native_pods.rb` so it's easier to work with it.

I decided to split this diff in 2 because it was becoming quite big.

## Changelog

[iOS][Changed] - Refactoring part of the react_native_pods.rb script

Reviewed By: cortinico

Differential Revision: D37006265

fbshipit-source-id: ffaac3270cb098fa30b73c97ce7cd350dfb8d7d6
2022-06-10 07:25:52 -07:00
Riccardo Cipolleschi 7a2704455f Move cocoapods utilities to utils.rb - Part 1 (#33978)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33978

This Diff moves part of the utilities from the `react_native_pods` file to a specific `utils.rb` file.

It adds tests for these utils and improve our test mocks.

The goal is to simplify the `react_native_pods.rb` so it's easier to work with it.

I decided to split this diff in 2 because it was becoming quite big.

## Changelog

[iOS][Changed] - Refactoring part of the react_native_pods.rb script

Reviewed By: cortinico

Differential Revision: D37004347

fbshipit-source-id: a5156f7c199d082d5d895a58af80948556c51c2a
2022-06-10 07:25:52 -07:00
Janic Duplessis 780fe80fca Don't validate ENTRY_FILE in react-native-xcode.sh (#32762)
Summary:
Reverts https://github.com/facebook/react-native/pull/29012

It is not really possible to properly validate if ENTRY_FILE exists since it is resolved by metro, and the server is not always running from the app root, like in a monorepo with multiple RN apps running on the same metro server.

In my case I run metro on the repo root and entry file will be something like `apps/app/index.js`. `-f "$ENTRY_FILE"` will fail since the script is run from the project folder (`PROJECT_ROOT`, in my case the `apps/app` folder, so it tries to resolve `apps/app/apps/app/index.js`).

I don't think this check is actually useful since metro will report the error if the entry file is invalid (fixed in https://github.com/facebook/react-native/pull/30150). The error is not as user friendly, but I think it is still fine. Maybe it could be improved in metro.

## Changelog

[iOS] [Fixed] - Don't validate ENTRY_FILE in react-native-xcode.sh

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

Test Plan:
Before

<img width="854" alt="image" src="https://user-images.githubusercontent.com/2677334/146100834-39310c9f-1767-496a-8698-1026726a1120.png">

After if file is actually missing

<img width="987" alt="image" src="https://user-images.githubusercontent.com/2677334/146100893-d01e2247-c787-4174-ac60-2f308c338c8f.png">

After if file exists, builds successfully.

Reviewed By: cortinico

Differential Revision: D37066073

Pulled By: cipolleschi

fbshipit-source-id: 8f6b149099a39d9179996bb965daa6cd9e06feac
2022-06-10 06:56:26 -07:00
Héctor Ramos d592bdcbd3 Hermes: Use pre-built Hermes runtime in iOS Template tests (#33974)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33974

Enable Hermes in iOS Template tests and use pre-built Hermes binaries from Circle CI.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D36989241

fbshipit-source-id: a240713d0bd0383fa218f8fc031e81467ebeb376
2022-06-09 11:18:30 -07:00
Héctor Ramos 6154cb7512 Hermes: Use arbitrary path to hermes-runtime-darwin if ENV set
Summary:
Allow an arbitrary path to hermes-runtime-darwin-vX.Y.Z.tgz to be specified. This can be used in CI or in local e2e tests to test with Hermes enabled without having a matching GitHub release.

Usage:

```
HERMES_ENGINE_TARBALL_PATH=~/Downloads/hermes- runtime-darwin-v0.69.0.tar.gz \
  USE_HERMES=1 \
  pod install
```

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36985477

fbshipit-source-id: 853829c89e6f0ac3f63781c7f290cf3994b8e0cd
2022-06-09 11:18:30 -07:00
Janic Duplessis 77e6bff629 Use `GCC_PREPROCESSOR_DEFINITIONS` to set `FB_SONARKIT_ENABLED` (#33972)
Summary:
`OTHER_CFLAGS` doesn't seem to work when the file is imported from Objc++. This causes flipper to not be included.

## Changelog

[iOS] [Fixed] - Use `GCC_PREPROCESSOR_DEFINITIONS` to set `FB_SONARKIT_ENABLED`

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

Test Plan: Tested the change in an app. Used a breakpoint to see that flipper code is not executed before this change, and is after. Also made sure other `GCC_PREPROCESSOR_DEFINITIONS` set by cocoapods are still properly inherited.

Reviewed By: cipolleschi

Differential Revision: D37001624

Pulled By: dmitryrykun

fbshipit-source-id: 920f3fe368a9fbe2cde9aa1e6d5b3b883c42119d
2022-06-08 05:58:04 -07:00
Nicola Corti d5e0659fcc Backport Changes needed to let Hermes actually download the compiled tarball.
Summary:
I'm backporting PR https://github.com/facebook/react-native/pull/33945 to main
as it was merged on the release branch to unblock 0.69.

Those changes are necessary as Hermes was not being donwloaded at all during `pod install`
on .69 and the app was failing to build with a missing `hermes/hermes.h` import.

Changelog:
[iOS] [Fixed] - Fix Hermes not being properly downloaded during pod install

Reviewed By: hramos

Differential Revision: D36810787

fbshipit-source-id: f898e61b6536dfcfc81feeff740703fbd697b000
2022-06-02 12:34:15 -07:00
Nicola Corti bffad4351c Backports fixes on the 0.69 release branch to main (#33938)
Summary:
This PR includes a set of changes that landed only on the 0.69-stable release branch and need to be backported to main:

- a72d1960ff
- 659b693fcd
- 2a6832a7e3
- 0ca6e41059
- f50936bef2

Most of the fixes are working around the assumption that
`version != 1000.0.0 => Build Hermes From Source`.

That is not true in the release branch as the version is named (e.g. 0.69.0-rc4) and we need to build Hermes there.

## Changelog

[Internal] - Backports fixes on the 0.69 release branch to main

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

Test Plan: Tested that those commits are working fine on the release branch.

Reviewed By: hramos

Differential Revision: D36776291

Pulled By: cortinico

fbshipit-source-id: 66e28232d80054fab4a2a97c8d2de12e3c1cf392
2022-05-31 10:37:12 -07:00
Héctor Ramos 54c346a03a Hermes: Add hermesc unit tests (#33914)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33914

Add test coverage for the new hermesc functions in hermes-utils.js

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36361612

fbshipit-source-id: 270f30917245c8d81baf136d9f58da4d77f7ad55
2022-05-30 02:59:35 -07:00
Tommy Nguyen eb7cc85a91 Fix `pod install --project-directory=ios` failing when Hermes is enabled (#33909)
Summary:
`pod install --project-directory=ios` silently fails to prep Hermes:

```
% pod install --project-directory=ios
[Codegen] Generating ios/build/generated/ios/React-Codegen.podspec.json
[Hermes] Downloading Hermes source code for commit 515e112edc267ad58d3c70991b3d9a721cc66b19
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 9478k    0 9478k    0     0  3939k      0 --:--:--  0:00:02 --:--:-- 5591k
[Hermes] Expanding Hermes tarball for commit 515e112edc267ad58d3c70991b3d9a721cc66b19
[Hermes] Using pre-built HermesC

[!] One or more resources were not found and will not be included in the project. If they are found later and you want to include them, run `pod install` again.
warn Multiple Podfiles were found: ios/Podfile,macos/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
Auto-linking React Native module for target `ReactTestApp`: ReactTestApp-DevSupport
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
[!] No podspec found for `hermes-engine` in `../node_modules/react-native/sdks/hermes/hermes-engine.podspec`

% ls -l node_modules/react-native/sdks
total 0
hermes-engine
hermesc
```

## Changelog

[iOS] [Fixed] - `pod install --project-directory=ios` fails when Hermes is enabled

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

Test Plan: Instead of running `pod install` inside `ios` folder, run `pod install --project-directory=ios`.

Reviewed By: cortinico

Differential Revision: D36693625

Pulled By: hramos

fbshipit-source-id: 8757a9c388348276b07c785c211979ec8f2e2f84
2022-05-26 10:07:57 -07:00
Franco Meloni 9f112af50a Add comment to explain why production flag is used when Flipper is enabled (#33902)
Summary:
Follow up of https://github.com/facebook/react-native/pull/33882

## Changelog

[Internal] - Add comment to explain why production flag is used when Flipper is enabled

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

Reviewed By: cortinico, f-meloni

Differential Revision: D36632238

Pulled By: cipolleschi

fbshipit-source-id: a859006851d9f50a4ad0ae1141006e8dac7aee6e
2022-05-25 07:00:29 -07:00
Héctor Ramos 38b70653b2 Hermes: Use pre-built artifacts in hermes-engine
Summary:
Update `hermes-engine.podspec` to use pre-built Hermes artifacts from the corresponding React Native GitHub Release when targeting a specific React Native release.
Otherwise, fallback to building Hermes from source.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D36609257

fbshipit-source-id: 6179c9e255558c7eaf1417ff46a2e7db120295f0
2022-05-25 03:30:57 -07:00
Héctor Ramos 004b8609d9 Hermes: Add scripts to package, remove shelljs
Summary:
The new Hermes scripts need to be included in the `react-native` npm.

The `shelljs` dependency that was used by the Hermes scripts is a dev dependency, so instead of adding to the `react-native` npm size, we refactored its use out of hermes-utils.js.

Changelog:
[General][Added] - Add Hermes scripts to package

Reviewed By: cortinico

Differential Revision: D36387135

fbshipit-source-id: 12d0bc29d365c4cb18d33a0d390e6e7d34864b7a
2022-05-24 14:08:48 -07:00
Franco Meloni 0bd5239553 Move `use_flipper` logic inside `use_react_native` and simplify the Flipper dependencies logic (#33882)
Summary:
This PR tries to simplify the `use_flipper` logic:
- makes `use_flipper` a configuration inside `use_react_native`'s options
- uses the already present `production` flag in the `use_react_native`'s options to decide if add or not the Flipper pods
- Simplifies the logic to download the flipper dependencies

This PR also adds a workaround for https://github.com/facebook/react-native/issues/33764

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Changed] - Move `use_flipper` logic inside `use_react_native` and simplify the Flipper dependencies logic

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

Test Plan: Executed a pod install with and without flipper and with isProduction true

Reviewed By: cipolleschi

Differential Revision: D36592338

Pulled By: f-meloni

fbshipit-source-id: 3c3f773151513e27e251f18865986e942a96ffd9
2022-05-24 04:37:46 -07:00
Riccardo Cipolleschi 9596bf045d Fix tests for Windows (#33893)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33893

The previous diff was breaking the external CI tests on Windows because of the file separators.

The fix was to use UNIX separator but to apply `path.normalize` to make sure that the path is platform agnostic.

## Changelog
[General][Fixed] - Make tests pass for windows

Reviewed By: cortinico

Differential Revision: D36597593

fbshipit-source-id: 47731f34a08c778268a6cc9674257403985d4599
2022-05-24 01:41:08 -07:00
Héctor Ramos 6e18dda43d Hermes: Use published hermes-engine for tagged RN releases
Summary:
For published RN releases, use a published hermes-engine pod that corresponds to the current React Native version.

For unpublished RN versions, continue consuming the local hermes-engine pod which requires building Hermes from source.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D36533683

fbshipit-source-id: 963a0f0e24baaf73a87c9bae4bc20d83757bbfde
2022-05-23 12:14:29 -07:00
Riccardo Cipolleschi 71692889b0 Cleanup Folders after codegen (#33891)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33891

This diff adds a function to clean up folders and empty files (if any) after the codegen runs in the OSS.
To align how iOS and Android behave in the codegen, we now have to preemptively create folders that we may not need later.
Thanks to this function, we recursively the folders in the codegen and we delete them if they are empty.

## Changelog
[iOS][Added] - Add function to cleanup codegen folders

Reviewed By: cortinico

Differential Revision: D36594999

fbshipit-source-id: 904aa2442c0d9621b7ec77c31f7be9daa4e7b7e1
2022-05-23 08:27:44 -07:00