Commit Graph

200 Commits

Author SHA1 Message Date
Tommy Nguyen 260bcf7f1b fix: limit diagnostics width output by hermesc (#37531)
Summary:
Limit diagnostics width output by `hermesc` as they may cause slowdowns or even crashes in Gradle/Xcode when a minified bundle is used as input. This occurs because Hermes is unable to determine the terminal width when executed by Gradle/Xcode, and falls back to "unlimited". If the input is a minified bundle, Hermes will output the whole bundle for each warning.

See issues filed:
- https://github.com/microsoft/rnx-kit/issues/2416
- https://github.com/microsoft/rnx-kit/issues/2419
- https://github.com/microsoft/rnx-kit/issues/2424

## Changelog:

[GENERAL] [FIXED] - Limit diagnostics width output by `hermesc`

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

Test Plan: See listed issues for repros.

Reviewed By: cipolleschi

Differential Revision: D46102686

Pulled By: cortinico

fbshipit-source-id: 1b821cad7ef0d561a5e1c13a7aedf9b10164620a
2023-05-23 07:51:25 -07:00
Nicola Corti b6d9217077 Add tests for getDependencySubstitutions (#37494)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37494

I'm adding some unit tests to this function that got recently added to support TvOS

Changelog:
[Internal] [Changed] - Add tests for getDependencySubstitutions

Reviewed By: cipolleschi

Differential Revision: D46029402

fbshipit-source-id: 6099242fe9e18f1a612124bc784f90047b4ee286
2023-05-22 07:13:25 -07:00
Douglas Lowder 012e4bd654 fix: [gradle-plugin] 3rd party lib dependency substitution (#37445)
Summary:
For 3rd party libraries to work with a React Native fork (such as the TV repo) that uses a different Maven group for `react-android` and `hermes-android` artifacts, an additional dependency substitution is required.

## Changelog:

[Android][fixed] RNGP dependency substitutions for fork with different Maven group

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

Test Plan:
- Manual tested with an existing project
- Unit tests pass

Reviewed By: rshest, dmytrorykun

Differential Revision: D45948901

Pulled By: cortinico

fbshipit-source-id: 4151a1d3616172a92c68812c3a0034c98b330d67
2023-05-17 11:11:30 -07:00
Nicola Corti 3a321ae2bb Make sure the -DANDROID compilation flag is always included. (#37451)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37451

It seems like starting from AGP 7.4, Android is not including the `-DANDROID` flag
anymore from the NDK toolchain.

As we do have several `#ifdef` logic that takes care of having this macro set,
I'm going to make sure it's always set for both ReactAndroid, hermes-engine
and the template.

Changelog:
[Android] [Fixed] - Make sure the -DANDROID compilation flag is always included

Reviewed By: javache

Differential Revision: D45908787

fbshipit-source-id: 07284712d7bcce73dc8ea0dffd4a9d00af4de1d2
2023-05-17 09:13:38 -07:00
Tommy Nguyen cceef57be1 fix(gradle-plugin): fix nightly build regression (#37332)
Summary:
Nightly builds of Android no longer build due to a recent version format change.

## Changelog:

[ANDROID] [FIXED] - Fixed nightly builds of Android no longer building due to a recent version format change

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

Test Plan:
```
git clone https://github.com/microsoft/react-native-test-app.git
cd react-native-test-app
npm run set-react-version nightly
cd example
yarn android
```

Reviewed By: jacdebug

Differential Revision: D45690926

Pulled By: cortinico

fbshipit-source-id: dc935733607c2b33ba296b507a98f43ba483e348
2023-05-09 06:05:46 -07:00
Douglas Lowder 615d9aefc4 Read Maven group from GROUP property (#37204)
Summary:
The [React Native TV repo](https://github.com/react-native-tvos/react-native-tvos) shares most of the same Android code as the core repo. Beginning in 0.71, it needs to also publish Android Maven artifacts for the `react-android` and `hermes-android` libraries.

In order to avoid conflicts, it needs to publish the artifacts to a different group name. However, `react-native-gradle-plugin` uses a hardcoded group name (`com.facebook.react`).

Solution: read the group name from the existing `GROUP` property in `ReactAndroid/gradle.properties`.

## Changelog:

[Android] [Fixed] - read GROUP name in gradle-plugin dependency code

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

Test Plan:
- Android unit tests have been added for the new code and new method in `DependencyUtils.kt`.
- Existing tests should pass
- The new code defaults to the correct group (`com.facebook.react`) so no functional change is expected in the core repo.

Reviewed By: luluwu2032

Differential Revision: D45576700

Pulled By: cortinico

fbshipit-source-id: 6297ab515b4bdbb17024989c7d3035b0a2ded0ae
2023-05-05 03:12:33 -07:00
Nicola Corti 74987b6fca Kotlin to 1.8.0 and JDK Toolchain to 11 (#37220)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37220

I'm bumping Kotlin to 1.8.0 to align to the version used internally.

On top of this, I had to configure the JDK toolchain to 11 as Kotlin 1.8
was changing the default version of the stdlib it ships with by default.

This also shields us against problems once we'll bump to AGP 8 which requires
JDK 17 but still allows to produce libraries that are JDK 11 compatible.

Changelog:
[Android] [Changed] - Kotlin to 1.8.0 and JDK Toolchain to 11

Reviewed By: cipolleschi

Differential Revision: D45524689

fbshipit-source-id: 2558b5b6727b5d6e0e1e3cc58f0c6a85ddcefc4d
2023-05-04 11:12:00 -07:00
Pranav Yadav 14316bd635 Add missing READMEs & Update package.json in all RN packages (#37090)
Summary:
This diff adds _missing_ README files for all public RN packages.

#### Changes:
For all public RN packages:
- Add _Missing_ READMEs

Update package.json in all RN packages to add:
- Issues, Bugs urls
- Keywords and Homepage urls to respective pkgs

## Changelog:

[GENERAL][ADDED] - Add missing README files for all public RN packages.
[GENERAL][CHANGED] - Update package.json in all RN packages to add required fields.

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

Test Plan: - `yarn lint && yarn flow && yarn test-ci` --> _should be green_

Reviewed By: cortinico

Differential Revision: D45390861

Pulled By: hoxyq

fbshipit-source-id: 524a92de56a7cb553573d9f54ccf40a998dfd35f
2023-04-28 04:26:20 -07:00
Pranav Yadav a58dea1e9e Update Node.js to v16 in all RN packages (#37073)
Summary:
**NOTE**: This is a **BREAKING** change.
TLDR; Enforce minimum Node.js v16 in all RN packages.

This diff **Updates Node.js to v16** across all RN packages.

#### Context:

- For RN development and new project created; bump to node 16 was in https://github.com/facebook/react-native/pull/36217
- Recently `react-native-windows` also; updated node to v16, https://github.com/microsoft/react-native-windows/pull/11500

#### Changes:

- [BREAKING] Update Node.js to v16 across all RN packages under 'packages/' dir

## Changelog:

[GENERAL][BREAKING] - Update Node.js to v16 in all RN packages

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

Test Plan: - `yarn lint && yarn flow && yarn test-ci` --> _should be green_

Reviewed By: cipolleschi

Differential Revision: D45306108

Pulled By: jacdebug

fbshipit-source-id: e3ba7d0151b86a6a0a3d63fb29c2bd887e1ac1e7
2023-04-26 08:24:06 -07:00
Nicola Corti 74f256b6f0 Gradle to 8.1 (#37018)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37018

Just bumping Gradle version to the latest stable.
This brings configuration caching as stable, which is quite of a big deal.

Changelog:
[Android] [Changed] - Gradle to 8.1

Reviewed By: yungsters

Differential Revision: D45177537

fbshipit-source-id: 6a47208b69d5591d299451e5a610cc3f5e9afe66
2023-04-21 04:52:54 -07:00
Nicola Corti 50553f4e81 Re-sync repo after ShipIt change - Removal of BUCK files (#36955) 2023-04-19 12:12:04 +01:00
Ruslan Lesiutin 8a18b53bcd bump packages for 0.73 (#36556)
Summary:
Changelog: [Internal]

Publishing to check CI if bumping and aligning in the same commit will work, since these new versions are not available on npm yet, but maybe our new monorepo setup will resolve this

**Adding back `react-native/virtualized-lists` as a workspace to `xplat/js` so that it won't be resolved from npm**

#publish-packages-to-npm

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

Reviewed By: cipolleschi

Differential Revision: D44255353

Pulled By: hoxyq

fbshipit-source-id: 21372487d6e9c0b2382b7cd9af835beed46b8ce1
2023-03-30 15:55:58 -07:00
Ruslan Lesiutin 714b502b0c | RN Monorepo | Migrate to package (#36434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36434

Changelog: [Internal]

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

allow-large-files

Reviewed By: cortinico

Differential Revision: D43977381

fbshipit-source-id: 0da552ddb85f2f61a0be0ef071915b35f3f8555c
2023-03-17 05:03:25 -07:00
Nicola Corti 5ac7c7f9a5 RNGP - Add librrc_legacyviewmanagerinterop to pickfirst config block
Summary:
This adds `librrc_legacyviewmanagerinterop.so` to the pickFirst block inside RNGP.
While testing the Fabric Interop layer, I realized that I forgot to add it here and now the build
fires a warning as follows:

```
> Task :app:mergeDebugNativeLibs
2 files found for path 'lib/arm64-v8a/librrc_legacyviewmanagerinterop.so'. This version of the Android Gradle Plugin chooses the file from the app or dynamic-feature module, but this can cause unexpected behavior or errors at runtime. Future versions of the Android Gradle Plugin may throw an error in this case.
Inputs:
 - /private/tmp/RNNightly/android/app/build/intermediates/cxx/Debug/194810a4/obj/arm64-v8a/librrc_legacyviewmanagerinterop.so
 - /Users/ncor/.gradle/caches/transforms-3/ba1c1d3560a64e70d8218910c5a43605/transformed/jetified-react-android-0.0.0-20230302-2110-caf80d442-SNAPSHOT-debug/jni/arm64-v8a/librrc_legacyviewmanagerinterop.so
```

Changelog:
[Internal] [Changed] - RNGP - Add librrc_legacyviewmanagerinterop to pickfirst config block

Reviewed By: cipolleschi

Differential Revision: D43772845

fbshipit-source-id: cf34bb128b76f18e802a94c41c773f7cb2b7ec4a
2023-03-08 15:08:15 -08:00
Nicola Corti b0863e1239 Bumping all the changes we have on main (#36355)
Summary:
This will publish several changes we have pending on main, specifically changes to React Native Gradle Plugin which are needed to unblock nightlies.

#publish-packages-to-npm

## Changelog

[INTERNAL] - Bumping all the changes we have on main

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

Test Plan: n/a

Reviewed By: hoxyq

Differential Revision: D43733634

Pulled By: cortinico

fbshipit-source-id: 9c041f7557cd8e494dfc942ae89e13e55353bb48
2023-03-02 07:11:43 -08:00
Nicola Corti 4b8b9cc838 AGP to 7.4.2
Summary:
This is just a minor bump before 0.72 and it brings AGP up to date
with the latest stable.

allow-large-files

Changelog:
[Internal] [Changed] - AGP to 7.4.2

Reviewed By: cipolleschi

Differential Revision: D43659180

fbshipit-source-id: d57ea8fb6ae902412b542e0125d3b15168d0e123
2023-02-28 08:39:21 -08:00
Nicola Corti 81dd3afe0b Bump Gradle to 8.x (#36269)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36269

This bumps our project to build on Gradle 8.x
All the necessary issues have already been resolved so everything should be green.
Gradle version has been bumped also inside the template and RNGP.

Changelog:
[Android] [Changed] - Bump Gradle to 8.x

allow-large-files

Reviewed By: cipolleschi

Differential Revision: D43534184

fbshipit-source-id: ca1fd6799ff6d776743de2b2d809fc54bc533440
2023-02-27 13:47:09 -08:00
Nicola Corti b360109e05 RNGP - Add apiVersion/languageVersion to 1.5 (#36311)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36311

Currently, we get the apiVersion/languageVersion for Kotlin that Gradle carries over.
So what happens is that on older version of Gradle, we try to compile RNGP with older versions of Kotlin.

There we have some functions missing (like `.uppercase()`) and the user will fail to build because of this.

Here I'm setting `apiVersion` and `languageVersion` to Kotlin 1.5. Even if we compile with Kotlin 1.7,
the compiler will make sure our code is compatible to be executed in a Kotlin 1.5 environment.

Fixes #36246

Changelog:
[Internal] [Changed] - RNGP - Add apiVersion/languageVersion to 1.5

Reviewed By: cipolleschi

Differential Revision: D43621083

fbshipit-source-id: d74700ff7ef7ac9691965626c2bd0128459fec9b
2023-02-27 11:01:08 -08:00
Nicola Corti 323d8b1432 RNGP - GenerateCodegenSchemaTask should exclude all of **/build/[generated|intermediate]**
Summary:
I'm widening the exclude for GenerateCodegenSchemaTask input files.

This is needed before we can migrate to Gradle 8.x as one of the build warning we have is
now converted to a build failure.

The reason why this is needed is because GenerateCodegenSchemaTask ends up picking up a file that
gets generated by `react-native bundle`. While the file is ignored by the Codegen, Gradle
detects a clash between the two tasks.

This solves the issue completely.

Changelog:
[Internal] [Changed] - RNGP - GenerateCodegenSchemaTask should exclude all of `**/build/[generated|intermediate]**`

Reviewed By: cipolleschi

Differential Revision: D43501129

fbshipit-source-id: 49311b833d6b59d4e67e87c535a424a1db1321e6
2023-02-22 10:06:05 -08:00
Nicola Corti 270584ac79 Kotlin to 1.7.22 for Gradle (#36227)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36227

This is needed for the next Gradle major (8.x) and re-aligns us with the
Kotlin version in fbsource

Changelog:
[Android] [Changed] - Kotlin to 1.7.22 for Gradle

allow-large-files

Reviewed By: rybalkinsd

Differential Revision: D43445999

fbshipit-source-id: 85be1bbb4b5ac1664b5090688b688a4e50c3d80a
2023-02-22 07:13:47 -08:00
Nicola Corti 39e1a3c3a6 RNGP - Fix RNTester crashing for JSC and safeguard against fetching JSC from Maven Central (#36232)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36232

Seems like RN Tester is crashing for JSC debug/release.

This happens because RN Tester ends up fetching JSC from Maven Central which contains older versions
of the artifacts (r17) which are not compatible with our setup AND are missing `libjsc.so`.

This is happening as our file layout is a bit different than a regular NPM project so
the repository declaration for JSC, being `../jsc-android/dist` from React Native root ends
in the wrong folder.

In this specifically I:
- Add an excludeModule for "org.webkit:android-jsc" on Maven Central inside RNGP
- Remove the allproject{repositories{}} block which was overriding RNGP configuration
- Add a specific repository declaration inside RN Tester to point to where JSC effectively lives

Changelog:
[Internal] [Changed] - RNGP - Fix RNTester crashing for JSC and safeguard against fetching JSC from Maven Central

Reviewed By: sshic

Differential Revision: D43462015

fbshipit-source-id: db830d7567bbf7dd91412df417418aa61a0ca8fe
2023-02-21 09:22:09 -08:00
Nicola Corti 1cb46ea6c1 bump package versions (#36218)
Summary:
Bumping RNGP as build from source on nightlies is broken

## Changelog

[INTERNAL] - bump package versions

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

Test Plan: n/a

Reviewed By: hoxyq

Differential Revision: D43438374

Pulled By: cortinico

fbshipit-source-id: 871b56eaba5bc35286882e459136703778dea514
2023-02-20 09:53:56 -08:00
Nicola Corti f8d8764e8f RNGP - Fix defaults for PrivateReactExtension
Summary:
When building from source, the PrivateReactExtension is getting no defaults (or missing defaults).
Specifically root should point to ../../ (as the build from source will originate
from `./node_modules/react-native`).

Without that root specified, all the subsequent paths are broken,
specifically, the default being `../` causes the codegen to be searched inside:
```
project/node_modules/node_modules/react-native/codegen
```
which is broken

Changelog:
[Internal] [Changed] - RNGP - Fix defaults for PrivateReactExtension

Reviewed By: cipolleschi

Differential Revision: D43435590

fbshipit-source-id: 2ed5e26c1d63fd808fc2d559ea83d6d39d106ff6
2023-02-20 05:52:20 -08:00
Nicola Corti 6dde1dc7cb RNGP - ENTRY_FILE should resolve relative paths from root (#36193)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36193

Fixes #36186

Changelog:
[Android] [Fixed] - ENTRY_FILE should resolve relative paths from root

Reviewed By: cipolleschi

Differential Revision: D43392121

fbshipit-source-id: ddf302d333c5fc5f822e0635a73e5b52470140ee
2023-02-17 07:40:09 -08:00
Nicola Corti e42dd1593d bump package versions (#36184)
Summary:
We do have a lot of changes on `main` to ship to nightlies. This change bump all the packages with pending changes.

## Changelog

[INTERNAL] [CHANGED] - [ci][monorepo] bump package versions

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

Test Plan: Will rely on CI run.

Reviewed By: hoxyq

Differential Revision: D43363981

Pulled By: cortinico

fbshipit-source-id: eba5152dbe007eb3fad43f9088d145b3741fd94e
2023-02-17 06:19:37 -08:00
Nicola Corti 0487108461 RNGP - Monorepo: Make sure libraries are honoring codegenDir provided by app (#36128)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36128

This commit fixes a problem which is making harder to use the New Architecture in monorepos.
Specifically if a user specifies a `codegenDir` in their app, libraries should honor it.
This is not the case today.

The fix is to register an extension on the root project which will "pass" values from app
to libraries.

I've also cleaned up some of the logic in `readPackageJsonFile` function restricting
the access to those functions only to `.root` which is the only field they're accessing.

Fixes #35495

Changelog:
[Android] [Fixed] - Better Monorepo support for New Architecture

Reviewed By: cipolleschi

Differential Revision: D43186767

fbshipit-source-id: 5c5ca39397306120b6b6622cb728633bd331e021
2023-02-10 10:04:55 -08:00
Nicola Corti 96df8c0ac8 Remove unused variable in a test in RNGP
Summary:
Changelog:
[Internal] [Changed] - Remove unused variable in a test in RNGP

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: cipolleschi

Differential Revision: D43185910

fbshipit-source-id: b1f328592e0b38654fd2e0a36304ce8f1d433b44
2023-02-10 06:57:54 -08:00
shivenmian bb02ccf13f RNGP - fix: use relative paths for gradle exec invocations (#36080)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36080

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

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

## Changelog

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

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

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

Reviewed By: cipolleschi

Differential Revision: D43080177

Pulled By: cortinico

fbshipit-source-id: 7625f3502af47e9b28c6fc7dfe1459d7c7f1362d
2023-02-07 07:29:17 -08:00
Nicola Corti 5647d79dc9 RNGP - Bump AGP to 7.4.1 (#36039)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36039

This change bumps AGP to 7.4.1 so we can remove a lot of the unnecessary changes
we had to do to support AGP 7.3.x

I've also removed the explicit version in the template as now the AGP version
is provided by RNGP. That means that the user will get the correct version they need.

This also bumps the default CMake version in user space to 3.22 which resolves a lot
of warning when users are building with the New Architecture enabled.

Changelog:
[Android] [Changed] - Bump AGP to 7.4.1

allow-large-files

Reviewed By: cipolleschi

Differential Revision: D42960353

fbshipit-source-id: 9065f975c1694d266a86b2d3fe805e6e2b1c4aa1
2023-02-02 07:07:45 -08:00
Nicola Corti c0004092f9 RNGP - Properly set the jsRootDir default value (#35992)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35992

Fixes https://github.com/software-mansion/react-native-gesture-handler/issues/2382

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

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

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

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

Reviewed By: cipolleschi

Differential Revision: D42806411

fbshipit-source-id: ffe45f9684a22494cc2e4d0a19de9077cb341365
2023-01-30 06:50:24 -08:00
Elias Nahum 4cdc2c48e8 fix: ReactRootView checkForKeyboardEvents to check if rootInsets are set (#35869)
Summary:
react-native-navigation allows to register React components to be included in the navigation top bar as buttons, the way this work is by using the AppRegistry. When the ViewTreeObserver executes the `CustomGlobalLayout` we are checking for the RootWindowInsets in the `checkKeyboardEvents` which in the case for the top bar component it returns null and the **WindowInsetsCompat.toWindowInsetsCompat** function throws if the insets are null causing the app to crash.

Interestingly in the function `checkForKeyboardEventsLegacy` the null value is being checked, so I guess it was overlooked in the newer function.

## Changelog

[ANDROID] [FIXED] - Fix ReactRootView crash when root view window insets are null

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

Test Plan:
The following videos show how the app crashes as soon as we attempt to pop a screen that contains a react component as a button in the navigation top bar and how it correctly pops to the previous screen after applying the fix

| Crash | Fix |
| -- | -- |
| https://user-images.githubusercontent.com/6757047/213116971-fe693989-f978-438c-b8f9-fc56f2a477c8.mp4 | https://user-images.githubusercontent.com/6757047/213118352-fe258f28-07aa-4d17-98d2-97136464ffd5.mp4 |

Reviewed By: cipolleschi

Differential Revision: D42580156

Pulled By: cortinico

fbshipit-source-id: 4dbd656d7c8148df67668a2a50913206bc35c07f
2023-01-19 03:47:58 -08:00
Nicola Corti 60b9d8c2b9 Fix for resources not correctly bundlded on release appbundles (#35872)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35872

When downgrading from AGP 7.4 to 7.3 we were forced to resort to older APIs
to bundle resources. It seems like we haven't properly wired the task to make sure
resources generated by Metro are correctly accounted before the generation of
release app bundles/apks.

This fixes it. This fix can also be removed once we are on AGP 7.4
Fixes #35865

Changelog:
[Android] [Fixed] - Fix for resources not correctly bundlded on release appbundles

Reviewed By: cipolleschi

Differential Revision: D42573450

fbshipit-source-id: a810924315f72e02e4c988ae86112bf0a06a9ce5
2023-01-18 07:12:38 -08:00
Nicola Corti 470f79b617 RNGP - Honor the --active-arch-only when configuring the NDK (#35860)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35860

I've just realized that the `--active-arch-only` is not correctly passed down
to RNGP to set up an abiFilter so users on 0.71 on New Architecture end up
building all the architectures even if `--active-arch-only` is set.

This fix makes sure the `abiFilters` is applied if the user specified
either the `--active-arch-only`, the `reactNativeArchitectures` property
and is not using the Split ABI feature.

Changelog:
[Android] [Fixed] - RNGP - Honor the --active-arch-only when configuring the NDK

Reviewed By: cipolleschi

Differential Revision: D42547987

fbshipit-source-id: 5a34e7087bb4f89de74cc52f9c505e36896fbf03
2023-01-18 07:10:49 -08:00
Nicola Corti 46ffeca3b0 De-bump AGP to 7.3.1 and do not use addGeneratedSourceDirectory (#35631)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35631

Fixes #35592
I'm de-bumping AGP from 7.4 to 7.3 as per #35592. There is no stable release
of AGP that is working fine with the `addGeneratedSourceDirectory` API for resources.
Here I'm reverting to use the older APIs.

Changelog:
[Internal] [Changed] - De-bump AGP to 7.3.1 and do not use `addGeneratedSourceDirectory`

allow-large-files

Reviewed By: cipolleschi

Differential Revision: D42004813

fbshipit-source-id: f1a2b0f7c2233402749a3e4f3828be80111ad3a7
2022-12-14 03:33:58 -08:00
generatedunixname89002005325672 0f089ea2db Daily arc lint --take KTFMT
Reviewed By: adamjernst

Differential Revision: D41833756

fbshipit-source-id: 0ecc95aff3bdadadb0769dec55d27fb84fe50e95
2022-12-12 07:51:03 -08:00
Nicola Corti 177f30a323 Bump all the @react-native/ packages to publish on main
Summary:
Nightlies are currently broken on main. That's because nightlies rely on packages that got
re-scoped under `react-native`. We need to publish them to NPM.
In order to do so, I'm bumping versions for the one that have changes on main so that they
can be published to NPM to unblock nightlies.

Changelog:
[Internal] [Changed] - Bump all the react-native/ packages to publish on main

Reviewed By: hoxyq

Differential Revision: D41840985

fbshipit-source-id: 45b691611e33668df0922d4ff753738a773f162c
2022-12-09 02:10:17 -08:00
Tommy Nguyen 913ebd207c RNGP - findPackageJsonFile should return null if package.json does not exist (#35566)
Summary:
`findPackageJsonFile` always returns a path even though `package.json` does not exist. This causes issues in libraries whose repo setups look like:

```
react-native-webview
├── android
│   └── build.gradle
├── example  <-- Note the lack of `package.json` here
│   └── App.tsx
├── ios
│   └── RNCWebView.xcodeproj
├── macos
│   └── RNCWebView.xcodeproj
├── package.json
└── src
```

When `newArchEnabled=true`, running `yarn android` will fail with the following:

```
FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:generateCodegenArtifactsFromSchema'.
> Could not create task ':app:generateCodegenSchemaFromJavaScript'.
   > /~/react-native-webview/example/package.json (No such file or directory)
```

## Changelog

[Android] [Fixed] - `findPackageJsonFile` should return `null` if `package.json` does not exist

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

Test Plan:
```
git clone https://github.com/react-native-webview/react-native-webview.git
cd react-native-webview
git checkout new-arch-ios
yarn
cd example/android
./gradlew clean assembleDebug
```

Reviewed By: NickGerleman

Differential Revision: D41739176

Pulled By: cortinico

fbshipit-source-id: cab0f1f717db160df244c9bb2769e345d6e19917
2022-12-06 02:16:42 -08:00
Nicola Corti 43027b6d42 RNGP - Fix DependencyUtils for Windows support (#35508)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35508

It turns out that my previous diff hasn't really solved the Windows support.
The problem is that we're not escaping the URI of the Maven Local repository
properly on Windows.

To overcome this, I'll instead use the `toURI()` Api of File to properly
create a valid URI for a given folder.

Changelog:
[Internal] [Changed] - RNGP - Fix DependencyUtils for Windows support

Reviewed By: cipolleschi

Differential Revision: D41581849

fbshipit-source-id: 7905073c6daaf7c6a97405b3e6fb94b8f382234a
2022-11-29 11:21:12 -08:00
Nicola Corti ca9ef9f769 Rename hermes-* target to don't use dashes (#35506)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35506

In our build we had a mixture of `_` and `-` to separate targets.
Dashes don't play well with Gradle + as we expose them now via Prefab,
let's stick to use only underscores

Changelog:
[Internal] [Changed] - Rename target to don't use dashes

Reviewed By: cipolleschi

Differential Revision: D41578938

fbshipit-source-id: 8aa44aa2dc7bf4822b45e5044532837b989817d2
2022-11-29 10:43:54 -08:00
Nicola Corti f0972cb101 RNGP - Various improvements needed for 3rd party libs (#35496)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35496

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

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

Reviewed By: cipolleschi

Differential Revision: D41549489

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

## Changelog

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

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

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

Reviewed By: cortinico

Differential Revision: D39883584

Pulled By: hoxyq

fbshipit-source-id: 0ef384b75c6edd248b31e37b8f05f64b4d39ca6f
2022-11-28 08:28:51 -08:00
Ruslan Lesiutin 6f11b10a88 refactor(react-native-gradle-plugin): rename react-native-gradle-plugin to @react-native/gradle-plugin (#35480)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35480

Changelog:
[General][Changed] - rename react-native-gradle-plugin to react-native/gradle-plugin

Reviewed By: cipolleschi

Differential Revision: D41532746

fbshipit-source-id: 67b936a211ec8b91a2a96ca22145cbea94ba3e8c
2022-11-25 10:29:36 -08:00
Nicola Corti 4c5eb8dd2a Bump AGP to 7.4.x (#35456)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35456

Fixes #35439

There is a bug in AGP 7.3.x which is causing assets to don't be copied properly inside the
final artifact: issuetracker.google.com/issues/237421684
As AGP 7.4.x is really close to release (is in Beta5, should be released stable in the next weeks)
we should be fine by bumping to beta5.

This also requires a bump of RNGP

Changelog:
[Android] [Changed] - Bump AGP to 7.4.x

allow-large-files

Reviewed By: cipolleschi

Differential Revision: D41519549

fbshipit-source-id: 60d568a3e49798a23f1d7bf4839ab58bd5549aba
2022-11-24 09:18:36 -08:00
Nicola Corti fe2716b8ae Consolidate hermes-executor-debug and -release inside a single target (#35454)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35454

Historically, we used to have hermes-executor debug and release as separate dynamic libraries.
This makes it impossible to prefab this library, so I have to reconcile it into a single library.

This will also help keep the setup consistent with the internal (BUCK) where we have a single target.

Changelog:
[Internal] [Changed] - Consolidate hermes-executor-debug and -release inside a single target

Reviewed By: cipolleschi

Differential Revision: D41519119

fbshipit-source-id: d9ddc30b72164daa29c735836ea433fd4d917fc8
2022-11-24 08:45:15 -08:00
Nicola Corti 25c97bbb22 RNGP - Correctly Support Gradle Configuration Cache (#35455)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35455

This little change allows to support Gradle Configuration cache in user projects:
https://docs.gradle.org/current/userguide/configuration_cache.html

It allows to save several seconds on the build time.
We'll keep it disabled for now, but Gradle plans to enable it by default for everyone
in the future, so this changes makes us ready for it.

Changelog:
[Internal] [Changed] - RNGP - Correctly Support Gradle Configuration Cache

Reviewed By: cipolleschi

Differential Revision: D41519506

fbshipit-source-id: 6252546e811deb0777c0aab5332291368be7fa8f
2022-11-24 07:45:17 -08:00
Nicola Corti 95c5e181ad Bump RNGP to 0.72.1 (#35389)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35389

As the title says, just bumping RNGP

Changelog:
[Internal] [Changed] - Bump RNGP to 0.72.1

Reviewed By: cipolleschi

Differential Revision: D41398920

fbshipit-source-id: 39baadc54c604ababe7f558cc1c1291c08aae983
2022-11-18 04:46:16 -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
Dmitry Rykun d62b0b463b Bump dependency versions to 0.72.0 after the branch cut
Summary:
Changelog
[General][Changed] - Bump dependency versions to 0.72.0 after the branch cut.

Reviewed By: cipolleschi

Differential Revision: D41079762

fbshipit-source-id: 83e912c4eaf969c1673ccc5fa854646efa99fa4a
2022-11-07 06:57:35 -08:00
Nicola Corti e8d3fb87f1 Bump RNGP to 0.71.8
Summary:
Just bumping RNGP to make the new sources avialable to the template.

Changelog:
[Internal] [Changed] - Bump RNGP to 0.71.8

Reviewed By: robhogan

Differential Revision: D40948246

fbshipit-source-id: c6a193fcdc0675be9ef7f1320d63e884b8b65daa
2022-11-02 18:57:10 -07:00
Nicola Corti b5405b2954 Make sure nightly versions are using the -SNAPSHOT artifacts (#35178)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35178

I forgot to add the logic to fetch the -SNAPSHOT version when on nightlies.
This code takes care of it.

Changelog:
[Internal] [Changed] - Make sure nightly versions are using the -SNAPSHOT artifacts

Reviewed By: cipolleschi

Differential Revision: D40939367

fbshipit-source-id: 29d60cf281d30b3dbd05d7ea1c766541a8fab90a
2022-11-02 10:55:23 -07:00