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

627 Коммитов

Автор SHA1 Сообщение Дата
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
Franco Meloni ca8174e15f Create script to automatically set CLANG_CXX_LANGUAGE_STANDARD on the client project (#33863)
Summary:
Currently this [section](https://reactnative.dev/docs/next/new-architecture-app-intro#ios-enable-c17-language-feature-support) of the Playbook tells us to set CLANG_CXX_LANGUAGE_STANDARD = "c++17" in the main app target for the new architecture to work.
Would be nice to be able to automate that instead

## 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] [Added] - Cocoapods function to add the `CLANG_CXX_LANGUAGE_STANDARD` to all the targets if needed

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

Test Plan:
I've created some unit tests for the newly added function.
I've executed pod install and the ruby tests locally.

Reviewed By: cipolleschi

Differential Revision: D36484366

Pulled By: f-meloni

fbshipit-source-id: 553b092e747bef11d82195619ae1058985fdc325
2022-05-19 14:57:04 -07:00
Riccardo Cipolleschi 05aaba9514 Align Codegen between iOS and Android (#33864)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33864

This Diff aligns the way in which iOS and Android codegen the modules and components.
Android takes all the JS in the project root folder and creates components starting from there.
iOS used to required to specify a specific path for each component, within a JSON field called `libraries`. This Diff let iOS work in the same way as android does

**Backward compatibility:** This diff still support the old way for iOS, but we are deprecating it.

## Changelog
[iOS][Added] - Support codegen from a single folder

Reviewed By: cortinico

Differential Revision: D36473005

fbshipit-source-id: 1e8cf0f9764f529c02e948984c74d1982a84030b
2022-05-19 05:52:40 -07:00
Nicola Corti 5bb0caf858 Fix `test_windows` by passing the correct platform to the Metro Virtual FS (#33870)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33870

I'm fixing a broken CI on master for `test_windows` as `metro-memory-fs` doesn't
automatically recognize the platform but needs to have it passed in input.
It was currently failing to parse a `C:\...` path. This fixes it.

Changelog:
[Internal] [Changed] - Fix `test_windows` by passing the correct platform to the Metro Virtual FS

Reviewed By: cipolleschi

Differential Revision: D36507564

fbshipit-source-id: 39dfd7e9ce492d126fbb513a70ec5a60965c61fd
2022-05-19 03:29:56 -07:00
Nicola Corti c19bc0b6a2 Do not fail if -javadoc.jar are missing in the final NPM package (#33869)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33869

When I disabled the Javadoc pubblication as it was failing on CI,
I forgot to turn off the verification that the -javadoc artifact is included
inside the NPM package. This caused `build_npm_package-1` to fail on main.
I'm fixing it here.

Changelog:
[Internal] [Fixed] - Do not fail if -javadoc.jar are missing in the final NPM package

Reviewed By: cipolleschi

Differential Revision: D36507320

fbshipit-source-id: 3836de5212de91bb44e0e586564b46114ca346b4
2022-05-19 02:48:39 -07:00
Riccardo Cipolleschi 8a8c33aab9 Move fabric setup to a separate file (#33818)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33818

This Diff moves the fabric setup from the `react_native_pods` script to its own `fabric` file.

It also introduces tests for the file and some test utilities.

## Changelog
[iOS][Changed] - Move fabric setup to its own file

Reviewed By: cortinico, dmitryrykun

Differential Revision: D36344911

fbshipit-source-id: 586186684be2c0080f247390f26145f2defa9e97
2022-05-18 02:57:35 -07:00
Nicola Corti afb0307036 Setup a toplevel downloadAll task (#33852)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33852

Similarly to buildAll and cleanAll, I'm creating a downloadlAll task
which is aligning the behavior of the download task we're doing on CIs.

I've also updated the Offline Cache as we're now storing a bigger set of dependencies.

Changelog:
[Internal] [Changed] - Setup a toplevel downloadAll task

allow-large-files

Reviewed By: cipolleschi

Differential Revision: D36441728

fbshipit-source-id: f847b5e665c64e0b4b93d984bbc1b64c00a3b4f7
2022-05-17 15:31:48 -07:00
Héctor Ramos 644fe430fd iOS: Use pre-built hermesc if available (#33827)
Summary:
Use pre-built hermesc if available by generating a ImportHermesc.cmake file that points to the hermesc binary. Recent `react-native` releases should have hermesc available in sdks/hermesc.

Hermes build scripts have been updated to support a `HERMES_OVERRIDE_HERMESC_PATH` envvar which can point to this generated ImportHermesc.cmake file.

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

Changelog:
[iOS] [Changed] - Use pre-built HermesC if available in current React Native release

Reviewed By: cortinico

Differential Revision: D36024615

fbshipit-source-id: 476569f73309f9bd142f28cb02d1f7d57b6cbc6a
2022-05-13 14:43:14 -07:00
Héctor Ramos 5dae5936fc Hermes: Add tests for hermes-utils.js
Summary:
Add test coverage for the new `scripts/hermes/hermes-utils.js` consolidated Hermes scripts.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D36334652

fbshipit-source-id: e9570d1232c21e36da4e6be8c67d80f4ec224326
2022-05-13 11:29:08 -07:00
Héctor Ramos aaa01f7710 Hermes: Use prepare-hermes-for-build in CocoaPods (#33825)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33825

Updates the CocoaPods build scripts to consume the prepare-hermes-for-build script, replacing the now redundant set of Ruby code that would previously set the filesystem up.

Changelog:

[iOS] [Changed] - When building Hermes from source, the filesystem will now be prepared using the new hermes-utils.js scripts, outside of CocoaPods

Reviewed By: cortinico

Differential Revision: D36336633

fbshipit-source-id: a4506db80c039529b14b0290d2f0b54fae78dcf2
2022-05-12 20:42:16 -07:00
Héctor Ramos 6c2e34be0b Hermes: Create prepare-hermes-for-build.js script
Summary:
Adds a script that uses the new hermes-utils.js functions to prepare the local filesystem for Hermes to be built from source (e.g. download the Hermes source code tarball and extract it into its final location).

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36334624

fbshipit-source-id: 012f758ecda07931bdb0ab1728b87733bf5af16a
2022-05-12 20:11:59 -07:00
Héctor Ramos 3412f067a5 Hermes: Consolidate Hermes build scripts into scripts/hermes/hermes-utils.js
Summary:
Currently, the tasks for downloading, expanding, and preparing Hermes to be built for Apple targets are split across the Circle CI and CocoaPods configs.

This diff sets out to consolidate these tasks into a single hermes-utils.js script that can be reused across CI and build systems.

The release script that is used to assign the Hermes tag for a given React Native version has been moved into `scripts/hermes`.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36329356

fbshipit-source-id: 0222070adf201fa533b607a183471396d45c6caf
2022-05-12 20:11:59 -07:00
Mike Hardy d493f45bd9 fix: bump flipper pods to get arm64 catalyst slice (#33809)
Summary:
Patch release bumps that just change arm64 slice packaging
See https://github.com/facebook/flipper/issues/3117#issuecomment-1123759397

These pods were just released by lblasa and this PR integrates them - I personally confirm success on an arm64 doing a macCatalyst build for the first time since react-native 0.64, and users report intel works fine as well - no regression

## Changelog

[Catalyst][Fix] - use pods with arm64 macCatalyst slices

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

Test Plan:
Run a macCatalyst build on intel machine and m1 machine, I use this harness as part of release-testers facebook group, and it exercises macCatalyst build if you pass in a valid development team (for signing) https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

(the test harness is locally modified to no longer exclude M1 builds and with a patch-package that implements this PR, pending this merge+release...)

Reviewed By: cortinico

Differential Revision: D36339335

Pulled By: cipolleschi

fbshipit-source-id: d4574fc960e6ff345b31a83ff4629e22edfcf2f7
2022-05-12 02:43:41 -07:00
Héctor Ramos ae28880fbc Hermes: Copy build scripts to RN
Summary:
Copy Hermes build scripts to React Native repository for greater control over the build pipeline when used in RN.

Changelog: [Internal]

Reviewed By: neildhar

Differential Revision: D36295406

fbshipit-source-id: 54bf4173b6c75db35de828378e6f5782a248ed2e
2022-05-11 15:49:48 -07:00
Riccardo Cipolleschi c171a6e157 Run script phases tests in CI and Sandcastle (#33802)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33802

We use to have a couple of tests for the script phases script that were not running during the CI.

This diff connect them with the two CI, so that they run together with the other ruby tests.

## Changelog
[iOS][Added] - Run script phases tests in CI

Reviewed By: fkgozali

Differential Revision: D36283211

fbshipit-source-id: 01b257cdc99b0bc196d60d49ac76cf044d61a7e9
2022-05-11 10:00:28 -07:00
Riccardo Cipolleschi 2e720c3610 Remove USE_CODEGEN_DISCOVERY flag (#33791)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33791

This flag is used as a duplication for the `RCT_NEW_ARCH_ENABLED` flag. There is a [spot](d96806bbc6/scripts/react_native_pods.rb (L31)) in the code where, if `RCT_NEW_ARCH_ENABLED`, then the `USE_CODEGEN_DISCOVERY` is set to true as well.

Maintain two different flags for similar reasons is cumbersome and error-prone. This diff removes the `USE_CODEGEN_DISCOVERY` in favor of the `RCT_NEW_ARCH_ENABLED` flag.

## CHANGELOG
[iOS][Removed] - Remove USE_CODEGEN_DISCOVERY flag

Reviewed By: cortinico

Differential Revision: D36244618

fbshipit-source-id: 8e8979268b7aa25b895236b0c3a86fb57c6f2ea6
2022-05-10 04:17:25 -07:00
Riccardo Cipolleschi d96806bbc6 Move Flipper to dedicated flipper.rb
Summary:
This Diff moves all the Flipper.rb related setup in the cocoapods scripts to a dedicated script.

It also removes the not needed dummy files and add tests for flipper.

## Changelog

[iOS][Internal] - Extract Flipper setup in a separate file and add tests

Reviewed By: cortinico

Differential Revision: D36129808

fbshipit-source-id: 5446203a69b527146c893aa9611e98688e20b778
2022-05-09 02:55:30 -07:00
Héctor Ramos 8b8d7324a6 Hermes: Warn user about longer pod install times when Hermes is enabled
Summary:
Adjust logs during `pod install` to warn user about longer install times due to Hermes compilation.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36143766

fbshipit-source-id: 0facb2e295543438dfbc46d11db1c4dc163acff9
2022-05-06 02:17:35 -07:00
fortmarek 709a459b1e Fix using Swift in a native module with Fabric enabled (#33743)
Summary:
Using Fabric with a Swift native module is currently broken. There are currently two issues.

If you try to integrate a native module with Swift code, you will get the following error when running `pod install` with Fabric enabled:
```
[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `MyNativeView` depends upon `React-RCTFabric`, `React-Codegen`, `RCTTypeSafety`, and `ReactCommon`, which do not define modules.
To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries),
you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
```

To resolve this, I have applied the suggestion from the error (set `:modular_headers => true` for the appropriate modules inside `react_native_pods.rb`.

Afterwards, `pod install` succeeds but I still got `Redefinition of module 'React'` during the build due to the conflict inside the generated modulesmaps  `React-Core.modulemap` and `React-RCTFabric.modulemap`. This makes sense since `React-RCTFabric.podspec` has `s.header_dir = "React"` (see [here](https://github.com/facebook/react-native/blob/main/React/React-RCTFabric.podspec#L37)) and the module inherits that. However, we can explicitly specify `module_name` for the podspec which is what I have done. I have named the module `Fabric`, let me know if you think there's a better name.

## 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 using Swift in a native module with Fabric enabled

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

Test Plan:
1. Clone [this](https://github.com/fortmarek/react-native) repo
2. From `main`, apply changes from [this](26958fccf4) commit (adding Swift file to the `MyNativeView` native module in the RN tester app)
3. Try to run `USE_FABRIC=1 RCT_NEW_ARCH_ENABLED=1 USE_CODEGEN_DISCOVERY=1 USE_HERMES=0 bundle exec pod install` inside the `packages/rn-tester`
4. Observe errors
5. Apply [the commit](9772c6209d) from this PR
6. Both pod install and the subsequent build should succeed.

I can also make changes to the current `MyNativeView` module to include Swift as well if it's something that the React Native Core team would be interested in - in case you want the Swift native modules to be always buildable on `main`

Reviewed By: dmitryrykun

Differential Revision: D36097852

Pulled By: cipolleschi

fbshipit-source-id: 2faebcffd1115339f89a406e265a6a040218dc9c
2022-05-04 04:31:23 -07:00
Riccardo Cipolleschi e4d0153a67 Update CodeGen to leverage the `outputDir` as suggested in diff review (#33729)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33729

This PR addresses [this comment](https://www.internalfb.com/diff/D35820848?dst_version_fbid=496290878846487&transaction_fbid=355967423221044).

It makes the CodeGen to the `outputDir` as base directory for the codegen.

Finally, it updates the unit tests accordingly.

## Changelog
[iOS][Changed] - use `outputDir` as base directory for the codegen and remove the possibility to customize the intermediate path. The generated code requires specific paths in the `#include` directive.

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35935282

fbshipit-source-id: a9ad4e296efb042cf34b20db5eebb59614beb5f6
2022-05-04 04:04:10 -07:00
Riccardo Cipolleschi 0465c3fd10 Refactor generate-specs-cli and add tests
Summary:
This Diff splits the `generate-specs-cli.js` script into:
* `generate-specs-cli-executor.js`: which contains the logic to generate the code for iOS.
* `generate-specs-cli.js`: which contains the argument parsing logic and invokes the executor.

Finally it introduces some tests.

## Changelog
[iOS][Changed] - Refactor part of the codegen scripts and add tests.

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35892576

fbshipit-source-id: 6a3205af049bf55aa4ecaf64544ebc4eb7b13f73
2022-05-04 04:04:10 -07:00
Riccardo Cipolleschi 305a054865 Refactor generate-artifacts to improve testability.
Summary:
This Diff splits the `generate-artifacts.js` script into:
* `generate-artifacts-executor.js`: which contains the logic to generate the code for iOS.
* `generate-artifacts.js`: which contains the argument parsing logic and invokes the executor.

Finally, it introduces some tests.

## Changelog
[iOS][Changed] - Refactor part of the codegen scripts and add tests.

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35846674

fbshipit-source-id: 14873c3fe762606e9004a29e4a6b986bf6a8f055
2022-05-04 04:04:10 -07:00
Riccardo Cipolleschi 6718500eaa Support the `type == all` properly
Summary:
This Diff introduces some changes in the CodeGen to properly generate the types in the right folder.

## Issue
The codegen on iOS defines the output folder once, before creating the generated code.
When the code we have to generate is just a TurboModule (TM) or a Fabric Component (FC), this mechanism works properly.

However, if a library has to generate both TM and FC, actually using the library type `all`, all the code is generated using the TurboModules' output folder.
(**Note:** Android only works in this way)

This generates invalid code because all the FC's `#import` directives assumes that the code is generated in the FC output path which, in this case, is not.

## Solution

The adopted solution moves the responsibility to decide where the files has to be generated to the CodeGen step instead of in the preparatory phases.

The two paths are precomputed in the `generate-artifacts.js` script (the entry point for the CodeGen) and they are passed to all the scripts that requires them.

Once they reach the `RNCodegen.js` file, the generators creates the files and save them in the proper paths.

## Changelog
[iOS][Changed] - CodeGen now supports the `"all"` library type.

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35820848

fbshipit-source-id: ce7f5393936e2ae17f8b2c970f6a011d27f641f2
2022-05-04 04:04:10 -07:00
Riccardo Cipolleschi 181d78bd75 Connect Ruby tests with Sandcastle
Summary:
This PR adds a step in the iOS legocastle script to run the ruby tests in the cocoapods folder.

These tests are executed before the pod installation step: this because we would like to fail as fast as possible in case of issues.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36006781

fbshipit-source-id: 8afbc1ccc751d2dc736bdc23ec382ebd7b5c7f4f
2022-05-03 07:11:54 -07:00
Riccardo Cipolleschi 8f15955099 Add dummy test to run ruby test suits
Summary:
This Diff prepares a set of dummy tests to make sure that our infra supports tests in ruby.

It also adds a scripts in the `__tests__` folder which can be invoked to run all the tests. The script performs a discovery of all the tests in the  cocoapods folder.

Next steps will configure Sandcastles and CircleCI.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D35968556

fbshipit-source-id: b8bf23d30dc5358ab603e396cce1c6639dd0f567
2022-05-03 07:11:54 -07:00
Riccardo Cipolleschi fdbe4719e2 fix: Make WebSocketTests work in CI (#33721)
Summary:
This PR reestablish the WebSocketTest in CI which is making the `test_ios_unit` fail.

**Note:** the test_ios_unit is actually running integration tests...

## Changelog

[iOS] [Changed] - Fix the test_ios_unit test

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

Test Plan: The CI of this PR is green. 😬

Reviewed By: cortinico

Differential Revision: D36002823

Pulled By: cipolleschi

fbshipit-source-id: 20eeb08bfd02658ad6579085241f81654f74c1af
2022-04-28 08:53:24 -07:00
Nicola Corti 4ea593b756 Fix release infrastructure failures discovered during .69 release
Summary:
During the release of .69, we (fortmarek and me) discovered a couple of bits that needed
some intervention.
- `sdks/.hermesversion` was gitignored, so we could not commit that.
- `scripts/bump-hermes-version.js` was not executable, so we had to chmod +x to
  make it runnable.

Here I'm fixing it.

Changelog:
[Internal] [Changed] - Fix release infrastructure failures discovered during .69 release

Reviewed By: cipolleschi

Differential Revision: D36003808

fbshipit-source-id: c4d82ed5e2c63988699035ac84b0e87ed8894540
2022-04-28 07:48:40 -07:00
Luna Wei 6958bbb28c Fix up lint errors under react-native-github (#33622)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33622

Changelog: [Internal] Clean up eslint errors

Reviewed By: yungsters

Differential Revision: D35599445

fbshipit-source-id: bbb9061a3cf9df32daacad9a9b44eba94d3ce48c
2022-04-22 16:25:25 -07:00
Héctor Ramos bb01b75637 Make Hermes from source the default
Summary:
If Hermes is enabled, it will be built from source instead of using the CocoaPods hermes-engine pod.

Changelog:
[iOS] [Changed] Build Hermes from source when Hermes is used

Reviewed By: cortinico

Differential Revision: D35693945

fbshipit-source-id: eadc638106180b183fd6d1e2a272dc3df66fa8b6
2022-04-21 17:27:56 -07:00
Riccardo Cipolleschi 323db75c36 Pass node executable to codegen (#33672)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33672

This pr adds a parameter to the `create-artifacts.js` script to accept the path to a node executable, falling back to `node` in case the parameter has not been passed.
Then, it passes the NODE_BINARY to the script in the `script_phases.sh` script.

This PR decouples the `node` environment from the system one and fixes a build issue in the new architecture when the environment has no `node`

## Changelog

[iOS][Changed] - Update CodeGen scripts to accept custom node executable

Reviewed By: cortinico, dmitryrykun

Differential Revision: D35748497

fbshipit-source-id: 41b102de6427d6ef0ba1f8725f4b939d3b8c63db
2022-04-21 06:59:17 -07:00
Riccardo Cipolleschi 705c6f57d6 Export REACT_NATIVE_PATH and fix find-node-for-xcode.sh fallback behavior (#33674)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33674

## Issue
In D35317070 (0480f56c5b) we introduced a way to configuring the Xcode environment via he `.xcode.env`, falling back to the old `find-node-for-xcode.sh` behavior in case of a misconfiguration.

Unfortunately, there were an issue with the new architecture for which the pods were not able to locate the `find-node-for-xcode.sh`, crashing while building the new architecture.

## Solution
This Diff solves the issue in two steps:
1. it exposes to the project the REACT_NATIVE_PATH like Android does here: D35451821 (f8d7e0a968)
2. it leverages this new variables to reach the script

## Changelog
[iOS][Changed] - Fixed the fallback behavior when the `.xcode.env` file is missing, actually using the old `find-node-for-xcode.sh` script

Reviewed By: dmitryrykun

Differential Revision: D35779165

fbshipit-source-id: 393ef9a0b98d32d9cf226f7d109fdefd772e5120
2022-04-21 06:59:17 -07:00
Riccardo Cipolleschi 2c52131f5e Add link to documentation in warning (#33673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33673

This PR solves a TODO in a script that required a link to the documentation on the website.

## Changelog

[iOS][Changed] - Adding a link in a message for the users.

Reviewed By: cortinico

Differential Revision: D35742810

fbshipit-source-id: b7416a5bead5fa525ca69f05391b307195f5c987
2022-04-20 09:07:48 -07:00
Kudo Chien 65abc361bf Fix ios build error when podfile generate_multiple_pod_projects=true and fabric is on (#33381)
Summary:
there are build errors happened when in [`generate_multiple_pod_projects`](https://blog.cocoapods.org/CocoaPods-1.7.0-beta/#multiple-xcodeproj-generation) mode and fabric is on. since we have multiple pod projects, there are something breaks.

### `-DRCT_NEW_ARCH_ENABLED=1` does not pass to `RCTAppSetupUtils.mm`

because `installer.pods_project` is targeting `Pods.xcodeproj` but not `React-Core.xcodeproj`. we should use ` installer.target_installation_results.pod_target_installation_results` to deal with `generate_multiple_pod_projects` mode.

### fatal error: 'CompactValue.h' file not found

```
In file included from /path/to/react-native/packages/rn-tester/build/generated/ios/react/renderer/components/rncore/Props.cpp:11:
In file included from /path/to/react-native/packages/rn-tester/Pods/Headers/Private/React-Codegen/react/renderer/components/rncore/Props.h:13:
In file included from /path/to/react-native/packages/rn-tester/Pods/Headers/Private/React-Fabric/react/renderer/components/view/ViewProps.h:11:
In file included from /path/to/react-native/packages/rn-tester/Pods/Headers/Private/React-Fabric/react/renderer/components/view/YogaStylableProps.h:10:
/path/to/react-native/packages/rn-tester/Pods/Headers/Public/Yoga/yoga/YGStyle.h:16:10: fatal error: 'CompactValue.h' file not found
#include "CompactValue.h"
         ^~~~~~~~~~~~~~~~
1 error generated.
```

`Props.cpp` -> `YogaStylableProps.h` -> `YGStyle.h` -> `CompactValue.h`
[`CompactValue.h` is internal private header for Yoga pod](4eef075a58/ReactCommon/yoga/Yoga.podspec (L54-L56)) where `React-Codegen` project cannot access to.

~there are some solutions toward this problem. one way is to make other yoga headers as public headers. i am not sure whether this solution would introduce any side effects. so i only make necessary projects to search yoga private headers.~

Update: a solution is to expose all yoga headers publicly.  however, CocoaPods will put all public headers to module umbrella header. this will break YogaKit (swift) integration because swift module doesn't support c++. my pr is trying to expose all yoga headers to `$PODS_ROOT/Headers/Public/Yoga/yoga`, but use custom `module_map` to control which headers should be exposed to the swift module. CocoaPods's custom module_map has some limitation where cannot well support for both `use_frameworks!` mode and non use_frameworks! mode. there's a workaround to use `script_phase` copying the umbrella header to right place.

## Changelog

[iOS] [Fixed] - Fix iOS build error when Podfile `generate_multiple_pod_projects=true` and Fabric is on

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

Test Plan:
verify with rn-tester

1. add `generate_multiple_pod_projects`

```diff
 --- a/packages/rn-tester/Podfile
+++ b/packages/rn-tester/Podfile
@@ -5,7 +5,7 @@ platform :ios, '11.0'

 # Temporary solution to suppress duplicated GUID error.
 # Can be removed once we move to generate files outside pod install.
-install! 'cocoapods', :deterministic_uuids => false
+install! 'cocoapods',  :generate_multiple_pod_projects => true, :deterministic_uuids => false

 USE_FRAMEWORKS = ENV['USE_FRAMEWORKS'] == '1'

```

2. pod install and build rn-tester from xcode

Reviewed By: cortinico

Differential Revision: D34844041

Pulled By: dmitryrykun

fbshipit-source-id: 93311b56d8e44491307a911ad58442f267c979eb
2022-04-11 06:04:20 -07:00
Riccardo Cipolleschi 0480f56c5b Introduce .xcode.env configuration file to source `node` (#33546)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33546

This Diff does 2 things:
1. Removes all the remnant of the `find-node.sh` script. This allows React Native to stay agnostic from any other node manager
2. Introduces a way for the developers to specify which `node` executable they want to use, through a simple `.env` file.

## Changelog
[iOS][Changed] - This PR removes the `find-node.sh` scripts and replaces it with an `.xcode.env` file that is sourced by the script phases that needs it. The `.xcode.env` file is versioned: to customize a local environment, an unversioned `.xcode.local.env` can be used.

Reviewed By: cortinico

Differential Revision: D35317070

fbshipit-source-id: 4b400ba56aa2d574db563fa67b2008e1ddde1c59
2022-04-11 02:50:57 -07:00
matinzd 8de1c9ce91 Circle CI: enable BUILD_HERMES_SOURCE for test_ios_rntester job (#33585)
Summary:
Fix CircleCI build for test_ios_rntester.

Broken due to [this commit](fefa7b6ac8) after adding dev tools profiler.

## Changelog

[Internal] [Fixed] - Fix rn tester app CI

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

Test Plan: CI should be green.

Reviewed By: neildhar

Differential Revision: D35462642

Pulled By: cortinico

fbshipit-source-id: dbcb0a7e2e58fac1c77b2dbe4b833812175dc87c
2022-04-07 07:20:15 -07:00
Nicola Corti 1e51ac2b6c Setup multi-variant publishing for React Native Android (#33539)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33539

As we now provide `hermes-executor-debug` OR `hermes-executor-release` based on which version of RN we're building, we need to provide a variant aware AAR.

Changelog:
[Internal] [Changed] - Setup multi-variant publishing for React Native Android

Reviewed By: ShikaSD

Differential Revision: D35289444

fbshipit-source-id: ffccd2089dc2eb50ea8c08ed10d8fd9816f9efb7
2022-04-05 09:38:55 -07:00
Riccardo Cipolleschi 44de392603 Reintroduce `find-node.sh` as mitigation measure (#33538)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33538

This Diff is a revert of this other diff: D34352049 (802b3f778b).

Following a discussion with the Open Source Community, the removal of `find-node.sh` script will break some configurations that leverages different node managers.

The landed diff will block the release of version 0.69, that's the reason why we are reverting it.

However, we still want to abstract RN from knowing which node manager the user is going to use. After discussing with the community, we will deprecate the usage of this script and we will move toward a configurable `.xcode.env` file that developers can configure on their own. The task for this is tracked here: T115868521.

## Changelog
[Internal][Removed] - Reintroduce the old `find-node.sh` script to prevent broken builds for some users

Reviewed By: cortinico

Differential Revision: D35280778

fbshipit-source-id: 7a0b269af207e13998fd85c0c4839e75028cda65
2022-04-04 02:43:07 -07:00
Héctor Ramos ada6c7166b Use arbitrary hermes-engine.podspec during build (#33549)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33549

When building Hermes from source, use arbitrary hermes-engine.podspec to ensure correct Hermes tag is used by CocoaPods.

Without this change, CocoaPods will check out the `v0.11.0` git tag from the `facebook/hermes` git repository.

Ideally, this change should be done in the original `hermes-engine.podspec` in `facebook/hermes`. For now, use the arbitrary copy until the canonical Pod has been updated.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D35300595

fbshipit-source-id: be4b1225eb2c2a88958cd9e5e98cb8efed343bad
2022-04-02 00:02:11 -07:00
Héctor Ramos 72dfc2725c Print logs to differentiate JSC and Hermes builds
Summary:
Print logs during `pod install` to clarify when Hermes is being used with RNTester and/or iOS React Native apps.

This changeset should not result in any change to the behavior of `pod install`, other than adding logs to CocoaPods' stdout.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D35294993

fbshipit-source-id: 55b6115d9f49c311c34ad3cb07346b2f97adcbf9
2022-04-02 00:02:11 -07:00
Héctor Ramos 5ff7f809dc Circle CI: Use curl to download Hermes tarball
Summary:
When downloading Hermes from source on Circle CI, the process will fail because Circle CI macOS machines do not have wget installed.

Since curl can serve the same purpose and it is already part of the installed software on macOS machines, we can use curl in place of wget.

This change ensures Hermes can be built from source on Circle CI jobs.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D35294868

fbshipit-source-id: bb099b603ef64205d45b833882852b2f4d6060ca
2022-04-01 14:42:02 -07:00
Danilo Bürger 96c611b5e8 Added Gemfile.lock to git add files when calling update-ruby.sh (#33484)
Summary:
In https://github.com/facebook/react-native/blob/main/scripts/update-ruby.sh#L61

```bash
bundle lock
```

is called which creates a Gemfile.lock in the rn root. This file should be in the git add files list along with the other files that get updated by that script.

## Changelog

[Internal] [Fixed] - Added Gemfile.lock to git add files when calling update-ruby.sh

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

Test Plan: Call update-ruby.sh with or without this patch. Without this patch, the Gemfile.lock will not be staged, with this patch, the Gemfile.lock will be staged.

Reviewed By: GijsWeterings

Differential Revision: D35118250

Pulled By: cortinico

fbshipit-source-id: 80f2c7fad6fbc3f09697988dcc20f7ac94a21473
2022-03-25 08:01:41 -07:00
Riccardo Cipolleschi b5343a6b0d Enable SonarKit and Flipper in React-Core (#33499)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33499

This DIFF turns on the `FB_SONARKIT_ENABLED` flag when installing Flipper ina RN app. The flag is enabled only in Debug config, given that Flipper is installed only in this configuration.

This PR also fixes this issue: https://github.com/facebook/react-native/issues/33497

This PR is required because release 0.67 has the Flag in the app, while release 0.68 moved it in the React-Core pod.
We can't enable the flag at the `React-Core.podspec` level because we should not make assumptions on whether users want flipper or not.

## Changelog
[iOS][Changed] - Enable SonarKit in React-Core when the configuration is `'Debug'`

Reviewed By: cortinico

Differential Revision: D35141506

fbshipit-source-id: 171b7fa8ea7727c633ef963408e86b332c32e9fa
2022-03-25 05:57:50 -07:00
Héctor Ramos 8237ff2ef3 Use Hermes Engine from CocoaPods and fix Circle CI (#33478)
Summary:
Undoing the recent change that enabled Hermes to be built from source by default.
Building Hermes from source now requires the use of the  BUILD_HERMES_SOURCE envvar, again.

To be re-enabled shortly.

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

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D35100459

fbshipit-source-id: ec83fcdf2432c689b0c02f86fbabcc8625975d51
2022-03-25 03:29:53 -07:00
Héctor Ramos 12ad1fffe8 Build Hermes from source by default on iOS
Summary:
Remove BUILD_HERMES_SOURCE gate and default to building Hermes from source on iOS when Hermes is enabled.

Changelog:
[iOS][Changed] - When Hermes is enabled, the Hermes Engine will be built from source instead of using the pre-built `hermes-engine` CocoaPod.

Reviewed By: cortinico

Differential Revision: D34911987

fbshipit-source-id: 9d6d49498a23f6dae0b97c9f80c689b654db11bd
2022-03-23 16:53:47 -07:00