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

775 Коммитов

Автор SHA1 Сообщение Дата
Lorenzo Sciandra f238f15317 fix(scripts): add logic for version scripts to account for local E2E test versioning (#35846)
Summary:
While working on 0.71 branch I encountered a problem in testing locally. Basically, I was getting hit by a silent error caused by recent work https://github.com/facebook/react-native/pull/35296 that didn't account for the shape of E2E local script for the release, `0.71.0-20230116-1649`.

This scripts fixes both aspects: the error now gets thrown "better" and the logic accounts for the E2E shape.

## Changelog

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

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [FIXED] - add logic for version scripts to account for local E2E test versioning

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

Test Plan: Tested via the other PR: https://github.com/facebook/react-native/pull/35847

Reviewed By: cortinico

Differential Revision: D42543200

Pulled By: cipolleschi

fbshipit-source-id: 727eb887fcbd183ec56d8a9b7e98241eaacb1d98
2023-01-18 08:27:11 -08:00
Ruslan Lesiutin 91397d4247 refactor(bump-all-updated-packages): support force-bump to next minor version of the package (#35810)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35810

Changelog: [Internal]

`bump-all-updated-packages` script now supports `release-branch-cutoff` argument

If this argument is provided, the script will bump each public package to next minor version

Updated [wiki](https://github.com/facebook/react-native/wiki/Release-and-its-automated-processes) with relevant information about how to use it

Reviewed By: cortinico

Differential Revision: D42455329

fbshipit-source-id: a40d2f5dc356f22d3182da3a118c6383b634817d
2023-01-12 03:35:41 -08:00
Ruslan Lesiutin 4d8ba7b9fd refactor(scripts/monorepo/tests): moved related tests to scripts/monorepo/__tests__
Summary:
Changelog: [Internal]
just a small cleanup, moved all tests related to monorepo scripts under `/scripts/monorepo`

Reviewed By: cortinico

Differential Revision: D42308455

fbshipit-source-id: 7743a2af1381ff748556c15b89cf980f8f907674
2023-01-10 13:23:06 -08:00
Ruslan Lesiutin ec28c5bbaa feat(react-native-github): a script to automate patch version bumping of packages (#35767)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35767

Changelog: [Internal]

Introducing a script, which can be used to identify all packages inside `/packages`, which contain any changes after the last time its version was changed

How it works step by step:

```
check that no git changes are present

for each package:
    if package is private -> skip

    grep id of the last commit that changed package
    grep id of the last commit that changed version of the package

    if these ids are different:
        bump package patch version

commit changes if required
```

Can be executed only in git environment and by running: `node ./scripts/bump-all-updated-packages`

 ---

Also adding a separate script `align-package-versions.js`, which can be used to update versions of packages inside consumer packages

```
check that no git changes are present

for each package x:
   for each package y:
       if y has x as dependency:
           validate that y uses the latest version of x

if some changes were made:
   run yarn
```

 ---

Q: Why `run_yarn` step was removed from CircleCI flow?
A: For *-stable branches, there are no yarn workspaces and all packages are specified as direct dependencies, so if we update `react-native/assets-registry` to the next version, we won't be able to run `yarn` for react-native root package, because updated version is not yet published to npm

To avoid this, we first need publish new versions and then update them in consumer packages

 ---
The final flow:
1. Developer uses `node ./scripts/bump-all-updated-packages` to bump versions of all updated packages.
2. Commit created from step 1 being merged or directly pushed to `main` or `*-stable` branches
3. A workflow from CircleCI publishes all updated versions to npm
4. Developer can use `align-package-versions.js` script to create required changes to align all packages versions

Reviewed By: cortinico

Differential Revision: D42295344

fbshipit-source-id: 54b667adb3ee5f28d19ee9c7991570451549aac2
2023-01-10 13:23:06 -08:00
Riccardo Cipolleschi 88a1b8e18d Use FileMock and DirMock instead of Monkey Patching (#35792)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35792

This Diff fixes a problem we have when running Ruby tests.

The previous approach was monkey-patching the Ruby File and Dir classes to override some behaviours we needed during tests. However, these classes are also used by the test runners to properly read and run the tests, therefore when the tests were failing, the stream weren't closed properly and we received the wrong errors.

This problem was also preventing us from adopting other Ruby tools like SimpleCov to compute code coverage.

## Changelog:
[internal] - refactor Ruby tests not to monkey patch Dir and File

Reviewed By: dmytrorykun

Differential Revision: D42414717

fbshipit-source-id: 879b9928da1a083ebf9c81b1f510eaa039376042
2023-01-10 06:43:39 -08:00
Lorenzo Blasa 66927ec3aa Bump Flipper to 0.174.0 (#35777)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35777

As Flipper version is a bit old, let's bump it to the latest stable: 0.174.0.

This is a follow-up from D41492705 (db3ac93001).

At the time, it wasn't possible to update to the latest stable Flipper as crashes were observed due to NDK mismatch.

allow-large-files

Changelog:
[iOS] [Changed] - Bump Flipper to 0.174.0

Reviewed By: cortinico, cipolleschi

Differential Revision: D42345736

fbshipit-source-id: 501e068aebfc25f6a50332391a7940aa9eec6fd6
2023-01-06 02:28:27 -08:00
David Angulo efd39eea6f fix: pod install with --project-directory (#35754)
Summary:
The variable `version` is previously used but in 234486068e (diff-adcf572f001c2b710d14f409c14763f1a50b08369b3034548f1602685d21f67f), its usage have been removed the but the variable is kept.

It also raises an error when using `bundle exec pod install --project-directory=ios` which works on `0.70.X` and below.

```txt
No such file or directory @ rb_sysopen - ../node_modules/react-native/package.json

/Users/davidangulo/Desktop/mobile/myapp/node_modules/react-native/scripts/react_native_pods.rb:212:in `read'
/Users/davidangulo/Desktop/mobile/myapp/node_modules/react-native/scripts/react_native_pods.rb:212:in `react_native_post_install'
```

## Changelog
[IOS] [FIXED] - pod install with --project-directory

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

Test Plan: `bundle exec pod install --project-directory=ios` should not raise an error.

Reviewed By: christophpurrer

Differential Revision: D42298517

Pulled By: rshest

fbshipit-source-id: bef0b03312d2029188ae5437e3baf3ffce5cb73f
2022-12-31 02:42:55 -08:00
Riccardo Cipolleschi e71b094b24 Fix cleanup not working on template app (#35679)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35679

The Codegen cleanup step was not always working due to an issue with the codegen folder path. It was working for RNTester, but not for apps created from the Template.

## Changelog:
[iOS][Fixed] - Fix path issue to properly run the codegen cleanup step

Reviewed By: jacdebug

Differential Revision: D42137600

fbshipit-source-id: ba4cb03d4c6eb17fda70a4aff383908d2e468429
2022-12-19 04:09:55 -08:00
Riccardo Cipolleschi ef11e15ca3 Add compiler flag for the new Arch when enabled. (#35672)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35672

While working on some example, I discovered that the helper function `install_module_dependencies` was not adding the proper `-DRCT_NEW_ARCH_ENABLED=1` flag to the compiler flags.

## Changelog:
[iOS][Fixed] - Make sure to add the New Arch flag to libraries

Reviewed By: jacdebug

Differential Revision: D42131287

fbshipit-source-id: 68c492150ba4e4a2ec726b3e8b8a9c7842b543bc
2022-12-19 03:57:45 -08:00
Riccardo Cipolleschi 1b7127bb05 Improve Codegen Cleanup (#35642)
Summary:
This PR adds a safety check in case the Cocoapod build script is not able to clean the build folder.
We had evidences where this process failed, and in this way the user has a clear and actionable message to fix its situation.

## Changelog

[iOS][Added] - Add message with instructions about what to do if the cleanup of the build folder fails.

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

Test Plan:
I was not able to reproduce the issue locally.
The fix is not destructive, let's see if the amount of issues decreases.

Reviewed By: dmytrorykun

Differential Revision: D42067939

Pulled By: cipolleschi

fbshipit-source-id: 433dbfaec42a1bf460dc9a48051aa51ec6e12d16
2022-12-16 04:47:01 -08:00
Riccardo Cipolleschi f249bee171 Automatically detect when use frameworks is used (#35636)
Summary:
This PR introduce an automatic way to detect whether the user sets its podfile to use frameworks.
In this way, users don't have to install pods with a specific environment flag but they can rely on the standard Cocoapods usage

## Changelog

[IOS][ADDED] - Automatically detect whether use_frameworks! is used

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

Test Plan:
- CircleCI is Green
- Added unit tests
- Tested locally with an app

Reviewed By: dmytrorykun

Differential Revision: D42029355

Pulled By: cipolleschi

fbshipit-source-id: 76c92133deabbda59603b043a4d542737f10f044
2022-12-16 04:36:29 -08:00
Nick Gerleman c4862a2322 Fix Errors with TypeScript Tests
Summary:
This fixes some style errors found by dtslint, along with some test cases for StyleSheet.compose() where the recent change made it slightly too permissive when explicit return types are given. I also added runs of the TS tests to a script which runs in sandcastle so we can catch this at diff-submission time in the future.

Changelog:
[General][Fixed] - Fix Errors with TypeScript Tests

Reviewed By: lunaleaps

Differential Revision: D42085257

fbshipit-source-id: 7e6ca49d3c3aef822c61c97ecc07b55b0a949d51
2022-12-15 19:17:58 -08:00
Ruslan Lesiutin 7f29357c7c refactor(scripts): use forEachPackage instead of `yarn workspaces info` (#35633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35633

Changelog: [Internal]

These changes add usage of `forEachPackage` as a replacement for `yarn --json workspaces info`.

This is because at some point in release cycle there is a script which removed `workspaces` block from react-native's `package.json`, so `yarn --info workspaces info` produces an error

Reviewed By: cortinico

Differential Revision: D41996732

fbshipit-source-id: 2c62c1a5eb41d711c563f9f7b0de3d67fc11823d
2022-12-14 03:04:06 -08:00
Ruslan Lesiutin 83afdafae4 feat(react-native-github): automate publishing bumped packages via circleci (#35621)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35621

Changelog: [Internal]

1. Added `for-each-package.js` script. This can be used to iterate through all of the packages inside `/packages` with the access to package manifest. This soon can be used as a replacement for `yarn workspaces --info`
2. Added `find-and-publish-all-bumped-packages.js` script. This script iterates through all the packages and detects if the version was changed via `git log -p` (same as `git diff`). If so, it tries to publish it to npm.
3. Added corresponding job and workflow to CircleCI config, which will use this script

Reviewed By: cortinico

Differential Revision: D41972733

fbshipit-source-id: c5d0ed5b852b744a699ecb88861ea3e82200e1f3
2022-12-14 02:17:16 -08:00
Dmitry Rykun 234486068e Prepare dummy hermes.xcframework before pod install
Summary:
This diff adds prepare command to hermes-engine.podspec. That command creates dummy `universal/hermes.xcframework` and `maocosx/hermes.framework`. This allow us to utilise CocoaPods auto-linking, and remove manual linking/cleanup code.
Also we now do not pollute user project with "Copy Hermes Framework" script phase. Which was quite bad on its own, and also caused annoying bugs on the CI.
allow-large-files

Changelog:
[iOS][Changed] - Prepare dummy hermes.xcframework before pod install.

Reviewed By: cipolleschi

Differential Revision: D41533994

fbshipit-source-id: d7d098ba5e882ac2d036335c23d7cda447d75b8d
2022-12-13 08:42:09 -08:00
Matin Zadeh Dolatabad 48966ebce1 fix: script phases warning (#35594)
Summary:
Running pod install result in some warninigs on ruby v3:
```
script_phases.rb:51: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.
script_phases.rb:51: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.
```

## Changelog

[INTERNAL] [FIXED] - warnings while running `pod-install` inside script phase script

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

Test Plan:
- Install ruby v3 (I haven't tested on ruby v2, most m1 users need to upgrade to v3)
- Run `pod install` in ios folder

Reviewed By: christophpurrer

Differential Revision: D41839668

Pulled By: cortinico

fbshipit-source-id: f3d328573179ddfd307011f0701f0befa0b111f8
2022-12-08 09:05:56 -08:00
Lorenzo Sciandra 7e17d26060 fix(scripts): remove leftover code for tmpPublishingFolder (#35528)
Summary:
When this was done ad43deca23 (most likely because the scripts folder is not type-checked) some references to this script were left lying around.

This PR takes care of it.

## Changelog

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

[Internal] [Fixed] - remove leftover code for tmpPublishingFolder

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

Test Plan: Running  `yarn test-e2e-local` doesn't insta-fail.

Reviewed By: cortinico

Differential Revision: D41656151

Pulled By: GijsWeterings

fbshipit-source-id: 5fcf7fabce30076f90d92087a4f1e429903dfc0b
2022-12-01 16:38:42 -08:00
Riccardo Cipolleschi 3d7b53d456 Bring back JSIDynamic and JSI together
Summary:
In 0.71.0-RC.2, we had a regression in `use_frameworks!`.

This brings back JSIDynamic and JSI together because the current setup is not compatible with iOS frameworks

## Changelog
[iOS][Added] - Bring back JSIDynamic and JSI

Reviewed By: cortinico

Differential Revision: D41557823

fbshipit-source-id: 95eb2fe7df69992861396e41d11cd5182193e1a3
2022-11-29 08:53:50 -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
Riccardo Cipolleschi f3bf4d02ab Move JSCRuntime into its own folder (#35482)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35482

This change moves the JSCRuntime.h/cpp into a `jsc` folder.

This change is required for several reasons:
1. on iOS, the new `jsi`, `jsidynamic` and `jsc` setup is breaking the `use_frameworks!` with  `:linkage => :static` option with the old architecture. So it is a regression.
2. JSCRuntime is required by some libraries and needs to be exposed as a prefab and the current setup makes it hard to achieve.

allow-large-files

## Changelog:
[General][Changed] - Move JSCRuntime into a separate pod/prefab

Reviewed By: cortinico

Differential Revision: D41533778

fbshipit-source-id: 642240c93a6c124280430d4f196049cb67cb130b
2022-11-28 04:13:55 -08:00
Riccardo Cipolleschi a67286913c Fix version validation for nightlies
Summary:
The nightly version is bumped after the check is performed, therefore it fails.

With this diff, we become slightly more accepting with nightlies, allowing both `0.0.0` and `0.0.0-xxxx` as valid version for nightlies.

## Changelog
[JS][Fixed] - Accept 0.0.0 with and without prelrelease for nightlies' versions

Reviewed By: cortinico

Differential Revision: D41534995

fbshipit-source-id: 2d0417441ca7d3d3f7660c9317133ac3c6de2eb9
2022-11-25 13:46:45 -08:00
Riccardo 8b8f4f3efd Bypass tag check in dry run (#35428) (#35470)
Summary:
When dry-run in stable branch, the tag already exists. We are bypassing the tag-existence check when in a dry-run to have the CI pass

## Changelog

[General] [Fixed] - Bypass tag version check when dry-run

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

Test Plan:
CircleCI
It worked for RC1 and RC2

Reviewed By: cortinico

Differential Revision: D41529648

Pulled By: cipolleschi

fbshipit-source-id: d4d7f5534f86c2cf10b05e0d4cab950e4902d8df
2022-11-25 10:53:14 -08:00
Steve Shreeve f5e5274e6a Allow react-native and expo to build when using GNU coreutils (#35382)
Summary:
See the issue at https://github.com/facebook/react-native/issues/32432#issuecomment-1242234121

This fixes a bizarre issue when using the GNU coreutils tools. There are very minor differences in the standard command-line tools on macOS and the GNU coreutils. The `cp` command has slightly different semantics across these operating systems, so this commit normalizes those differences and allows GNU coreutils to be used or the system native version of `cp`.

Fixes #32432

## Changelog

[General] [Fixed] - Allow GNU coreutils to be used to build projects

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

Test Plan: This change allows the use of the system or GNU coreutils verson of `cp`.

Reviewed By: cipolleschi

Differential Revision: D41532472

Pulled By: cortinico

fbshipit-source-id: f0fe5274d3828bf6099deceee797a82a6adfdcab
2022-11-25 08:42:05 -08:00
Riccardo Cipolleschi 67d02640ba Use the right logic to decide when we build Hermes from source (#35469)
Summary:
This PR backports the changes in 0.71 to apply the same logic to decide when we have to build Hermes from source in both the `hermes-engine.podspec`
and in the `react_native_pods.rb` script.

## Changelog

[iOS] [Fixed] - Use the right logic to decide when we have to build from source

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

Test Plan: Working on RC2

Reviewed By: cortinico

Differential Revision: D41529539

Pulled By: cipolleschi

fbshipit-source-id: 879522c2187df28f40f6bc699057e9ecfb7e25fb
2022-11-25 05:12:39 -08:00
Lorenzo Sciandra c4959b9806 fix(e2e script): backport from 71 fixes to the E2E script (#35477)
Summary:
Because the /scripts folder for some reason is not typechecked at all, some changes broke the script and went undetected until we tried running it. This is a backport of those fixes:
* 67c373ff3a
* 6107793fda
* 6107793fda

Also, it's backporting an improvement to the e2e local script clean to remove the hermes-engine pod cache which has been proven annoyingly in the way while testing:
* 9979e38c70

## Changelog

[Internal] [Fixed] - Fix e2e script not working and augment clean script

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

Test Plan: Works on 0.71 ;)

Reviewed By: dmytrorykun

Differential Revision: D41530272

Pulled By: jacdebug

fbshipit-source-id: d45650d919ad5ef08438b307f122817d72771f46
2022-11-25 03:26:20 -08:00
Ruslan Lesiutin e680018109 fix(ci/template): fixed unresolved variable in script
Summary:
Changelog:
[Internal] [Changed] - fixed unresolved variable in template initialization script

Reviewed By: cipolleschi

Differential Revision: D41527165

fbshipit-source-id: acdd8d4cf9fb6153022b0395d3715ca9ca6363c9
2022-11-25 01:07:42 -08:00
Ruslan Lesiutin 6a45f2ce79 refactor(circleci/template): publish all packages to Verdaccio before template initialization (#35459)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35459

Changelog:
[Internal] [Changed] - now bootstrapping Verdaccio before template app initialization, this is required because react-native migh depend on some package which version is not yet published to npm

Reviewed By: cipolleschi

Differential Revision: D41521496

fbshipit-source-id: 6183ab02c697d9d08e9dca5b323bd7a11a749c3a
2022-11-24 13:56:09 -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
Cedric van Putten 4a4cceef25 Fix hardcoded path to codegen cli for monorepos (#35430)
Summary:
Fixes https://github.com/facebook/react-native/issues/35429

This fix is fairly straightforward. Instead of hardcoding two separate paths for this repo or a simple user's project, we ask Node to resolve `react-native-codegen`.

Because `react-native-codegen` is moved [into the `/packages/*` folder](https://github.com/facebook/react-native/blob/main/package.json#L104), it's part of a workspace in this repository. That means that this fix works not only for monorepos in general but also resolves the right path within the react native repository.

You can test this out yourself when running this command in either the root, or any other workspace in this repository:
```bash
node --print "require('path').dirname(require.resolve('react-native-codegen/package.json'))"
```

I've tested this on Node 16 and 18, and seems to work nicely. Note that you _**have to specify `react-native-codegen/package.json`**_. That's because the `react-native-codegen` package itself is technically invalid; it's missing an entry point within the package (no `main`). When running `node --print "require.resolve('react-native-codegen')"` Node can't resolve the main entry point, and will fail during this process.

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

[iOS] [Fixed] - Fix incorrect codegen CLI paths in monorepo projects

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

Test Plan: See PR https://github.com/facebook/react-native/issues/35429

Reviewed By: cortinico

Differential Revision: D41475878

Pulled By: cipolleschi

fbshipit-source-id: f0c362b64cf9c3543a3a031d7eaf302c1314e3f0
2022-11-24 10:15:43 -08:00
Ruslan Lesiutin e11cfe98e9 feat(react-native/template): use verdaccio to publish local packages before testing template app (#35444)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35444

Changelog:
[Internal][Changed] - now using Verdaccio to publish necessary packages for template app

- Adds script `/scripts/template/install-dependencies.js`, which incapsulates the logic of installing dependencies of template app
- The idea of the script is to run verdaccio and publish all necessary packages to node_modules, since these packages might not yet be present on npm
- This should also potentially resolve some template app test failures on CircleCI related to package-ifying Animated, VirtualizedList, FlatList modules

Reviewed By: cortinico

Differential Revision: D41498086

fbshipit-source-id: 48fbbb1c9334e7a9e7657e6275b7b04f9ce290b5
2022-11-23 13:20:00 -08:00
Riccardo Cipolleschi f12b12c999 Improve version checks to avoid mistakes in the versioning (#35296)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35296

This change adds some version checks and enforces that every version matches some specific format based on the build type we are trying to run.

## Changelog
[General][Changed] - Improve version checks

Reviewed By: cortinico

Differential Revision: D41161756

fbshipit-source-id: 4172195c5e031c1eaf7b33bb74f381c04e9adaf5
2022-11-21 10:52:17 -08:00
Riccardo Cipolleschi 850f855eb6 chore: fail prepare package for release if tag exists (#35305)
Summary:
This PR makes sure that the `preapre_package_for_release` script fail fast if there is already a tag for the desired version
on github.

## Changelog

[General] [Added] - Make the `prepare_package_for_release` fail if there is already a git tag with that version

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

Test Plan:
Tested manually. The script is currently only invoked during the release process.
<img width="1238" alt="Screenshot 2022-11-10 at 12 24 03" src="https://user-images.githubusercontent.com/11162307/201090947-274c1b1c-0b6a-4619-bc85-fa60e5eaeee1.png">

Reviewed By: cortinico

Differential Revision: D41403159

Pulled By: cipolleschi

fbshipit-source-id: fb87df345b14568c750482e5c68be53551a9acbb
2022-11-21 07:12:56 -08:00
David Angulo cb7f1b1f0b Read `.ruby-version` file in `Gemfile` (#35410)
Summary:
When updating the Ruby version, 2 files are always needed to be updated (`.ruby-version` and `Gemfile`). When not in sync it can lead to an error like `Your Ruby version is 2.7.6, but your Gemfile specified 2.7.5`.

This lessens the files that need to be updated when upgrading the Ruby version and makes it in sync always. It makes the `.ruby-version` the source of truth.

### Example 1:

<img width="481" alt="Screenshot 2022-11-20 at 13 56 08" src="https://user-images.githubusercontent.com/36528176/202888191-450ab6d0-32a4-4d37-ad82-0beb2b22fa82.png">

When upgrading from `0.70.0` to `0.71.0-rc.0`. 2 files needs to be updated when it could have been just 1.

Source: https://react-native-community.github.io/upgrade-helper/?from=0.70.0&to=0.71.0-rc.0

### Example 2:

21c8837c12 updates 4 files (`.ruby-version`, `Gemfile`, `template/Gemfile`, `template/_ruby-version`) when it could have been just 2.

### Other Sources:
* https://andycroll.com/ruby/read-ruby-version-in-your-gemfile/
* https://render.com/docs/ruby-version (Heroku alternative)
* https://stackoverflow.com/a/35823132/9375533

## Changelog

[General] [Changed] - Read `.ruby-version` file in `Gemfile`

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

Test Plan: Only `.ruby-version` and `template/_ruby-version` needs to be updated when upgrading Ruby version.

Reviewed By: christophpurrer, cipolleschi

Differential Revision: D41429147

Pulled By: rshest

fbshipit-source-id: 9e541a1d84aed5dca1e6f465c61bb0ba15574211
2022-11-21 05:59:19 -08:00
Riccardo Cipolleschi 138af74e3f Remove `HERMES_BUILD_FROM_SOURCE` flag (#35397)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35397

This Diff removes the `HERMES_BUILD_FROM_SOURCE` that was not always propagated to the original script. This lead to some cases where hermesC was built during `pod install` and then removed by the `react_native_post_install`'s `else` branch.

Basically, when the Pods are installed the first time, everything run smoothly. Subsequent invocations of `pod install`, to install other dependencies, for example, will incur in this problem because:
1. Cocoapods will see that hermes-engine is already installed
2. the podspec is not executed, given that the pod has been fetched from the cache
3. The env var is not set (given that the podspec is not executed)
4. the main script sees the env var as not set, `ENV['HERMES_BUILD_FROM_SOURCE'] == "1"` return false
5. The `else` branch is executed, and it removes the `hermesc_build_dir` and the `copy Hermes framework` script phase.

## Changelog:
[iOS][Changed] - Remove `HERMES_BUILD_FROM_SOURCE` flag

Reviewed By: cortinico, dmytrorykun

Differential Revision: D41373439

fbshipit-source-id: ea4aafd187c0ca3ff5c0d79f8aeaaa46ad50f499
2022-11-21 05:21:39 -08:00
Nicola Corti 55b1670aa6 Void the Maven coordinates for react-native and hermes-engine (#35379)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35379

This diff moves the publishing coordinates from:
```
com.facebook.react:react-native
com.facebook.react:hermes-engine
```

to

```
com.facebook.react:react-android
com.facebook.react:hermes-android
```

I've picked those they are the most layout friendly when building from source, but we can discuss if we want others.
I've updated the Gradle plugin to have a dependencySubstitution rule + update the template with those changes.

It should now be possible to still use `implementation("com.facebook.react:react-native:+")` inside libraries
on 0.71+ and RNGP will resolve dependencies correctly.

Changelog:
[Android] [Changed] - Void the Maven coordinates for react-native and hermes-engine

Reviewed By: cipolleschi

Differential Revision: D41380525

fbshipit-source-id: 91e059fa261acb89bee7ca0c79c30c3d856a2c80
2022-11-18 04:46:16 -08:00
Connor Tumbleson 4d7ddd445c build: allow packager override for PROJECT_ROOT (#35354)
Summary:
This allows folks with a monorepo setup for React Native to set a simple configuration on the "Bundle React Native code and images" phase. This is because the bundler was configured to look for node_modules in a specific place, but in a monorepo your node_modules may be at the root one layer lower than a default configuration.

This same pattern of overriding this variable exists in the [react-native-xcode](https://github.com/facebook/react-native/blob/main/scripts/react-native-xcode.sh#L63) file.

Fixes: https://github.com/facebook/react-native/issues/33636 - "Unable to resolve module index"

```
Error: Unable to resolve module ./index from /Volumes/Nexus/Projects/xxx/.:

None of these files exist:
  * index(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
  * index/index(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
```

## Changelog

[General] [Added] - Add support for overriding `PROJECT_ROOT` during bundle steps for monorepos.

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

Test Plan: Working CI build via CircleCI.

Reviewed By: cipolleschi

Differential Revision: D41319439

Pulled By: ryancat

fbshipit-source-id: 8516e54436b0a9d4b9df1efeee8e62c95d4d35b2
2022-11-17 14:18:09 -08:00
Nick Gerleman 418e95799f Fixup template devDependencies (#35372)
Summary:
Fixes missing/incorrect devDependencies in a newly built app. The previous set did not pull in prettier, causing linting to fail.  There was a peerDependency warning on yarn install. We also saw a separate lint warning at runtime specific to TS 4.9 being pulled in now, so we constrain in that version a bit.

Prettier and preset-env versions match the constraints and lockfiles of other RN packages.

## Changelog

[General] [Fixed] - Fixup template devDependencies

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

Test Plan:
Created a new app targeting 0.71 via `react-native init`.

1. `yarn install --force` no longer shows warnings
2. `prettier` is installed, `yarn lint` no longer fails, and shows no warnings or errors
3. ~Tentatively a test step to add tests against linting in new app, but last time doing that in CircleCI led to timeouts with no output  that I didn't have time to debug, so maybe that's fixed now? �‍♀️.~ (edit: still hangs)

Reviewed By: NickGerleman

Differential Revision: D41363021

Pulled By: lunaleaps

fbshipit-source-id: d6163b01e8934d75a231fa0fd849d7bde7b3500c
2022-11-16 18:47:42 -08:00
Riccardo Cipolleschi e36c492ace Remove version from the tarball (#35285)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35285

While doing the release 0f 0.71.0-RC0, we noticed that having the RN version in the hermes tarball was causing more harm than good.

With the version in the name, we ended up with multiple tarballs for debug and release and we were not able to explicitly pick the right tarball given a build.

This change remove the version from the tarball name.

## Changelog
[General][Changed] - Remove React Native version from Hermes tarball name

Reviewed By: lunaleaps

Differential Revision: D41156353

fbshipit-source-id: 8899d5e1e1555bc728d923f3b78d1261e6ff09c7
2022-11-14 08:31:30 -08:00
Riccardo Cipolleschi bc074a300d Fix avoid forcing podspec versions (#35274)
Summary:
This is a backport of [this](becb47ccb6) local fix we made on
0.71-stable.

All our podspecs delegates to the main React Native pods script to set up the dependencies properly. The React-Codegen.podspec, which is generated by
the script itself, was generated with hardcoded dependencies. This PR aligns the versioning with the other podspec.

On a side note, this could create issues in CI and when releaseing, because we are changing the versions to prepare the new release and it breaks some
steps.

## Changelog

[iOS] [Fixed] - Make sure that the React-Codegen.podspec does not enforce specific versions of its dependencies.

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

Test Plan:
1. Ruby tests are passing
2. Manually tested that pods are correctly installed in the following configurations
  - RNTester - Hermes - Old Architecture
  - RNTester - Hermes - New Architecture
  - RNTester - JSC - Old Architecture
  - RNTester - JSC - New Architecture

Reviewed By: christophpurrer

Differential Revision: D41153859

Pulled By: cipolleschi

fbshipit-source-id: 043513866a66ecca3e326f8671bea3ec576422de
2022-11-14 08:31:30 -08:00
Nicola Corti 90b6735c3b Invoke closeAndReleaseSonatypeStagingRepository in the publish gradle invocation (#35272)
Summary:
This PR ports back into main the changes required to properly close the SonaType repository on Maven

## Changelog

[General] [Fixed] - Close the Maven repository properly

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

Test Plan: We tested these changed in 0.71-stable branch when releasing 0.71.0-RC.0

Reviewed By: christophpurrer

Differential Revision: D41154965

Pulled By: cipolleschi

fbshipit-source-id: 74dd46e8fabf3baef544342282829c70d92f671f
2022-11-10 08:57:07 -08:00
Oleksandr Melnykov 394486eec5 Bump OSS Android build to SDK 33 (#35196)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35196

Changelog:
[Android][Changed] - Bump Android compile and target SDK to 33

Reviewed By: cortinico

Differential Revision: D41007003

fbshipit-source-id: e7866107fdcfafa778faa6c7f31835b8dd15647a
2022-11-08 19:12:02 -08:00
Lorenzo Sciandra cfa25e0a4a fix(release scripts): backport fixes from 0.71 into main (#35258)
Summary:
This PR backport two fixes we did in 0.71 to unblock the release process:
* the change in `publish-npm` is needed because of the introduction of .strict() from 4f3ca8facf
* the removal of the other script (added originally here e4b5d3eec9) is because:
  1) that step is not needed anymore (we don't publish/upload hermes artifacts to the GH release)
  2) by the time this job gets run the release crew has already setup the GH release
  3) the logic for the versioning was broken and even on the 0.71-rc pipeline it was tagging stuff as 1000.0.0

## Changelog

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

[Internal] [Fixed] - Fix release scripts for "release" pipeline scenario

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

Test Plan: The fact that 0.71-rc0 was released is the  for this.

Reviewed By: jacdebug

Differential Revision: D41120888

Pulled By: cipolleschi

fbshipit-source-id: 06d108f0659ad1db53c6324fe1d735f52c34a3c5
2022-11-08 10:03:29 -08:00
Christoph Purrer 7203187c80 TurboModules: Simplify React-bridging usage (#35212)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35212

A previous change - https://github.com/facebook/react-native/pull/34011 - already fixed basic usage of <react/bridging/.../ imports.
However that change was only tailored towards the usage of: <react/bridging/CallbackWrapper.h>
Any other header besides <react/bridging/CallbackWrapper.h> from <react/bridging/... can't be imported at this time in Xcode ... ... which is bad.

For C++ TurboModules we need to be able to access *any* <react/bridging/...> header via the React-Codegen CocoaPod.
Hence adding bridging now as a sub-spec to the ReactCommon CocoaPod

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D41057878

fbshipit-source-id: 83c117bc5252d84dd419cdb72f145f65547d23b2
2022-11-07 07:24:11 -08:00
Christoph Purrer 35b2150adb react-native-codegen: Enable C++ TurboModule generation in OpenSource builds (#35211)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35211

This enables the generation of C++ TurboModule specs in addition to existing Java/ObjC ones.

An example is shown in https://github.com/facebook/react-native/pull/35138

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D41057630

fbshipit-source-id: 303881a63eb82f0fe8dfe10e533043a6eedb3d11
2022-11-07 04:22:35 -08:00
Dmitry Rykun c05e6c47df Remove hermesc build dir for non-Hermes build
Summary: Changelog: [iOS][Fixed] - Remove hermesc build dir for non-Hermes build.

Reviewed By: christophpurrer

Differential Revision: D41052884

fbshipit-source-id: c9e85ca06cef79fa35e81972181558d44ca93d90
2022-11-07 01:06:38 -08:00
Dmitry Rykun 7f60bcceac Fix removing Copy Hermes Framework script phase
Summary: Changelog: [iOS][Fixed] - Remove `Copy Hermes Framework` script phase for non-Hermes build.

Reviewed By: hramos

Differential Revision: D41051076

fbshipit-source-id: b4b92330934e950ec3156f39f3807b90f803c1ba
2022-11-07 01:06:38 -08:00
Héctor Ramos ad43deca23 Remove unused saveFilesToRestore function
Summary:
The method that would restore these files was removed in https://github.com/facebook/react-native/pull/34846. The action performed by `saveFilesToRestore` is no longer necessary (thanks kelset for pointing this out).

Changelog: [internal]

Reviewed By: cortinico

Differential Revision: D41003911

fbshipit-source-id: bbc057ac450e7f134c4664173291ca56c18f1b17
2022-11-03 23:37:45 -07:00
Pranav Yadav e73b615f14 fix lint warn -> rm unused import `rm` (#35186)
Summary:
- Fixed lint warning -> rm unused import `rm` in `scripts/run-ci-e2e-tests.js` file
- Hence, removed unused import `rm` in `scripts/run-ci-e2e-tests.js` file

## 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] [FIXED] - Fixed lint warning -> rm unused import `rm` in `scripts/run-ci-e2e-tests.js` file

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

Test Plan:
`yarn test-ci`
![image](https://user-images.githubusercontent.com/55224033/199700838-c8a6d2d6-0634-4e0a-b50d-5ca89957cf38.png)

Reviewed By: sshic

Differential Revision: D40978104

Pulled By: NickGerleman

fbshipit-source-id: 5a99cd33d25015325133aee1442980b218104e86
2022-11-03 16:23:45 -07:00
Nick Gerleman aaf1990287 Use TypeScript by default for new applications (#35165)
Summary:
This change moves the default new application template in OSS from Flow to TypeScript. This better aligns with the communities usage, and aligns to the great work that has been happening for TS codegen and built-in types. This used [`react-native-community/react-native-template-typescript`](https://github.com/react-native-community/react-native-template-typescript) as a main reference, maintained by radko93. A few things are different:
1. Updated `types/*` devDependencies to match bumped libraries (e.g. Jest 26 to 20).
2. Removed `types/react-native`
3. Removed explicit `moduleFileExtensions` to Jest config in package.json (TS and TSX and added by default in current versions)
4. Removed overrides to eslint config to disable `no-shadow` and `no-undef`, since this was fixed in the underlying eslint config with https://github.com/facebook/react-native/pull/32644 and https://github.com/facebook/react-native/pull/32655
5. Re-translated `App.js` to be a direct translation (e.g. still a raw function instead of React.FC which is sometimes discouraged)
6. Aligns completely to `tsconfig/react-native` maintained configuration (We no longer have the opinionated override of `skipLibCheck`). The important settings are that `strict` is enabled for, but `allowJS` is also enabled to let users import JS modules without anything unexpected. `esModuleInterop` is enabled, which is needed for consistency with Babel import transformations used by Metro. Consistent with our [current documentation](https://reactnative.dev/docs/typescript) built against the community template, `tsc` will typecheck your code without emitting(building) anything.

[Documentation](https://reactnative.dev/docs/typescript) will need to be updated as a followup.

Changelog:
[General][Changed] - Use TypeScript by default for new applications

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

Test Plan: Added usage of `tsc` and `jest` when validating a newly built app. Passes in CircleCI `test_js` job. This also meant removing some cases of copying packages into the users app to pull in the root Metro config (we seem to be able to use the template Metro config consistent with what real apps would get).

Reviewed By: cortinico

Differential Revision: D40911951

Pulled By: NickGerleman

fbshipit-source-id: 15994534235695e91cf994ad06ba2183dfc89a50
2022-11-02 21:40:58 -07:00
Héctor Ramos 4f3ca8facf cleanup publish-npm.js: --include-hermes is not used anywhere (#35166)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35166

The Hermes source code is not included in the RN npm package. This piece of code is a remnant from an early experimentation into integrating Hermes more tightly with React Native. We ended up using a combination of the scripts in `scripts/hermes` to fetch the source code from GitHub and relying on prebuilts for stable releases.

Added `strict()` flag to ensure the script fails immediately if an unrecognized flag is passed.

Avoid logging temp publishing folder value to console when `--help` is used.

Changelog: [internal]

Reviewed By: cortinico

Differential Revision: D40918939

fbshipit-source-id: 2e62ab16467c4c67f03efdf5211a156cb70e0b11
2022-11-02 20:59:03 -07:00