Commit Graph

277 Commits

Author SHA1 Message Date
Nicola Corti 3f3abf5b40 Kotlin to 1.9.24 (#44787)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44787

Another patch bump for our dependencies ahead of branch cut.

Changelog:
[Android] [Changed] - Kotlin to 1.9.24

Reviewed By: cipolleschi

Differential Revision: D58143548

fbshipit-source-id: 70654cb821c220ff0eed37e37ce3e68ff8e7d3a1
2024-06-04 14:51:39 -07:00
Nicola Corti f6a490b036 AGP to 8.4.1 (#44785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44785

Just another patch bump of our dependencies ahead of the branch cut

Changelog:
[Android] [Changed] - AGP to 8.4.1

Reviewed By: cipolleschi

Differential Revision: D58143546

fbshipit-source-id: 6356b444b4a1514cf8dce6eead0c80ba725e555e
2024-06-04 14:51:39 -07:00
Nicola Corti f9b69cdb81 Gradle to 8.8 (#44786)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44786

Just bumping our deps before the 0.75 branch cut.

Changelog:
[Internal] [Changed] - Gradle to 8.8

Reviewed By: cipolleschi

Differential Revision: D58143547

fbshipit-source-id: 0762e36aabecda66ba637be8d02d8147d7e32d27
2024-06-04 14:51:39 -07:00
Nicola Corti 5c798fa2df Bump AGP to 8.4.0 (#44493)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44493

Just keeping our version of AGP up to date.

Changelog:
[Internal] [Changed] - Bump AGP to 8.4.0

Reviewed By: arushikesarwani94

Differential Revision: D57104079

fbshipit-source-id: 4d5c0dec95bf73696a0274f61e0536e53c11adaf
2024-05-10 17:32:23 -07:00
Nicola Corti b163ed8655 RNGP - Fix core Autolinking attemping to link dependencies without a android block (#44385)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44385

The current core autolinking is failing if a dependency doesn't have an `android` block.
Instead we should filter out all the dependencies that don't have an `android` definition when generating code.

Fixes https://github.com/reactwg/react-native-releases/issues/276

Changelog:
[Internal] [Changed] - RNGP - Fix core Autolinking attemping to link dependencies without a `android` block

Reviewed By: blakef

Differential Revision: D56876267

fbshipit-source-id: 900b13bec697fceac50c994f277621a10e281410
2024-05-03 01:51:28 -07:00
Nicola Corti 44e78ff74a Fix accidentally broken build_android job
Summary:
I accidentally broke build_android.
Here the two fixes:
1. Make sure the constructor of PackageList2 are actually called `PackageList2`
2. Make sure the package of `OSSLibraryExamplePackage` is `com.facebook.react.osslibraryexample`

Changelog:
[Internal] [Changed] - Fix accidentally broken build_android job

Reviewed By: dmytrorykun

Differential Revision: D56756601

fbshipit-source-id: 862597ca829d702d880624d29276193f8548715d
2024-04-30 08:02:20 -07:00
Nicola Corti c57ca2c3b4 RNGP - Move the generateAutolinkingNewArchitectureFiles task to core autolinking
Summary:
This diff is part of RFC0759
https://github.com/react-native-community/discussions-and-proposals/pull/759

Here I'm moving the New Architecture C++ Autolinking from the CLI to core.
It follows the same logic as this:
https://github.com/react-native-community/cli/blob/73f880c3d87cdde81204364289f2f488a473c52b/packages/cli-platform-android/native_modules.gradle#L544-L550

Changelog:
[Internal] [Changed] - RNGP - Move the generateAutolinkingNewArchitectureFiles task to core autolinking

Reviewed By: cipolleschi, blakef

Differential Revision: D55475594

fbshipit-source-id: d3768d932032e8e98f992d5f1bc54c439520873d
2024-04-30 04:33:56 -07:00
Nicola Corti 0d37d0a4b7 RNGP - Move generateAutolinkingPackageList to core autolinking
Summary:
This diff is part of RFC0759
https://github.com/react-native-community/discussions-and-proposals/pull/759

Here I'm moving over the task to generate the Package List for Autolinking inside RNGP.
The logic is the same as this one:
https://github.com/react-native-community/cli/blob/73f880c3d87cdde81204364289f2f488a473c52b/packages/cli-platform-android/native_modules.gradle#L217

The class is generated as PackageList2 to avoid a duplicate class build failure with the current Autolinking from CLI.

Changelog:
[Internal] [Changed] - RNGP - Move generateAutolinkingPackageList to core autolinking

Reviewed By: cipolleschi

Differential Revision: D56637394

fbshipit-source-id: 929b42af3a0e1951cb7a0f4ace47bbbb84000780
2024-04-30 04:33:56 -07:00
Nicola Corti 8f1b27001f RNGP - Autolinking - Add model classes for parsing the config output
Summary:
This diff is part of RFC0759
https://github.com/react-native-community/discussions-and-proposals/pull/759

Here I'm creating data classes that will allow us to parse the `config` JSON output.
Code is pretty straightforward and follows the structure as the `config` command output.

Changelog:
[Internal] [Changed] - RNGP - Autolinking - Add model classes for parsing the `config` output

Reviewed By: cipolleschi, blakef

Differential Revision: D55475595

fbshipit-source-id: 3457c008ff0c5bce2b47fd637c7b10a5e7427c01
2024-04-30 02:49:48 -07:00
Nicola Corti 1df1570810 RNGP - Setup the RunAutolinkingConfigTask to run the config command
Summary:
This diff is part of RFC0759
https://github.com/react-native-community/discussions-and-proposals/pull/759

Here I'm creating the `runAutolinkingConfig` task.

This task is responsible of either:
- Invoking the `npx react-native-community/cli config` command (or the one specified by the user)
- Copying the config output file specified by the user (if any).

The task re-executes only if any of the lockfile are actually changed otherwise it just returns as "UP-TO-DATE"

This allows us to

Changelog:
[Internal] [Changed] - RNGP - Setup the RunAutolinkingConfigTask to run the config command

Reviewed By: cipolleschi, blakef

Differential Revision: D55475596

fbshipit-source-id: 3c687f965c59eb82fc447546ebd936ba401f34f2
2024-04-30 02:49:48 -07:00
Nicola Corti 2455eab9df RNGP - Add autolinking fields to ReactExtensions (#44220)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44220

This diff is part of RFC0759
https://github.com/react-native-community/discussions-and-proposals/pull/759

Here we're looking into splitting the autolinking into a component that will live inside core (specifically inside the React Native Gradle Plugin - RNGP) and another component that will live inside the Community CLI.

Here I start by adding 2 fields to RNGP extension, that frameworks and templates can use to provide their autolinking config.

Changelog:
[Internal] [Changed] - RNGP - Add autolinking fields to ReactExtensions

Reviewed By: cipolleschi

Differential Revision: D55475597

fbshipit-source-id: 316d1919a113a94c57426710f487f334c6128345
2024-04-26 10:50:47 -07:00
Nicola Corti 5d538ec105 Clarify documentation for debuggableVariants (#44040)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44040

This is just a clarification for the KDoc of this property.

Changelog:
[Internal] [Changed] - Clarify documentation for debuggableVariants

Reviewed By: andrewdacenko

Differential Revision: D56012825

fbshipit-source-id: 837d2dbc0f7ca5853ba1cedf71a4a5c36661318f
2024-04-15 06:54:33 -07:00
Nicola Corti 20c1cc5e65 Bump AGP from 8.2.1 to 8.3.1 (#43925)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43925

Another diff to keep our dependencies updated.

Changelog:
[Internal] [Changed] - Bump AGP from 8.2.1 to 8.3.1

Reviewed By: cipolleschi

Differential Revision: D55803537

fbshipit-source-id: f94512799f5d32c667520cd11b8db38c93485ab7
2024-04-05 10:14:42 -07:00
Nicola Corti acd6d154e5 Bump Kotlin to 1.9.23 (#43928)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43928

This is a patch version for Kotlin, no practical changes expected.

Changelog:
[Internal] [Changed] - Bump Kotlin to 1.9.23

Reviewed By: cipolleschi

Differential Revision: D55803534

fbshipit-source-id: 99fcf444885cbc7b95baec2983303cfee88874a6
2024-04-05 10:14:42 -07:00
Nicola Corti ca7cc32288 Bump Gradle to 8.7 (#43926)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43926

Just keeping our dependencies up-to-date.

Changelog:
[Internal] [Changed] - Bump Gradle to 8.7

Reviewed By: cipolleschi

Differential Revision: D55803535

fbshipit-source-id: 90bc2902d8692f1fa621a088189f6bae74c3c61f
2024-04-05 10:14:42 -07:00
Riccardo Cipolleschi 627bff2c38 Remove duplicated include when preparing prefabs (#43865)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43865

Some of the includes in the task that prepares prefabs are duplicated. Removing the duplication

## Changelog:
[Internal] - Cleanup android prefabs

Reviewed By: cortinico

Differential Revision: D55751660

fbshipit-source-id: 2ea610937f122f82bc91e09fac1a2c78efa83410
2024-04-05 01:18:05 -07:00
Nick Gerleman 2477fbc600 Back out "fix: prevent error when react extension was already created" (#43753)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43753

New build failures when this was merged seem likely related.

```
FAILURE: Build failed with an exception.

* Where:
Build file '/root/react-native/packages/react-native/ReactAndroid/build.gradle.kts' line: 784

* What went wrong:
Script compilation errors:

  Line 784: react {
            ^ Unresolved reference: react

  Line 787:   libraryName = "rncore"
              ^ Unresolved reference: libraryName

  Line 788:   jsRootDir = file("../src")
              ^ Unresolved reference: jsRootDir
```

Changelog: [Internal]

Reviewed By: arushikesarwani94

Differential Revision: D55618667

fbshipit-source-id: 1a188ba31b013863f3d46a773ff3ebbdd5f696cb
2024-04-01 19:50:33 -07:00
Alexander Eggers b9dad7fc0c fix: prevent error when react extension was already created (#43694)
Summary:
Currently the react-native-gradle-plugin does not allow the "react" plugin extension to already exist when running its apply block. I had a use-case where I wanted to create a new gradle plugin which would take care of applying the react plugin including setting some of its options. Without the change in this PR, this would currently turn into a build failure.

## Changelog:

[ANDROID] [FIXED] - prevent error when the "react" extension was already created by another gradle plugin

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

Reviewed By: rshest

Differential Revision: D55478611

Pulled By: zeyap

fbshipit-source-id: cc743a99cb72ed315d21c52597efd5ee92a3be62
2024-04-01 11:31:53 -07:00
Jakub Piasecki ad9f0b0ab8 Include boost headers needed by rrc_text and rrc_textinput (#43608)
Summary:
Updates `PreparePrefabHeadersTask` to copy more headers from `boost`, specifically those required by `rrc_text` and `rrc_textinput`.

## Changelog:

[ANDROID] [CHANGED] - Copy boost headers needed by `rrc_text` and `rrc_textinput`

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

Reviewed By: rshest

Differential Revision: D55241345

Pulled By: cortinico

fbshipit-source-id: e92164676ba78ee15b3678a55c9098b0c6214b69
2024-03-22 07:58:49 -07:00
Blake Friedman a380ea55fb Summary: minor fix found in nightly logs from Publish NPM job (#43519)
Summary:
Minor fix to package.json which newer version of npm warn about when publishing, after running `npm pkg fix -ws` on the workspace.

{F1470070110}

## Changelog: [Internal] npm pkg fix -ws

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

Test Plan: eyescloseddog

Reviewed By: cortinico

Differential Revision: D55012872

Pulled By: blakef

fbshipit-source-id: ff3c63a3eefaf56d369219a3d4b32d44d6d842c9
2024-03-18 08:29:10 -07:00
Alex Hunt f57be12977 Bump packages for next major release (#43132)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43132

Command run:

```
node scripts/releases/set-version 0.75.0-main --skip-react-native-version
```

Changelog: [Internal]

Reviewed By: lunaleaps, cipolleschi

Differential Revision: D54006327

fbshipit-source-id: 7afe9e7ca3020faf399fdba2221fab8a102c56c7
2024-03-04 07:54:37 -08:00
Nicola Corti 918b75f3f4 Fix typo in unit test (#43091)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43091

Fix typo in unit test

Changelog:
[Internal] [Changed] - Fix typo in unit test

Reviewed By: mdvacca

Differential Revision: D53918471

fbshipit-source-id: 0453c01fab1dc04397058577ea61b50994124cf0
2024-02-19 08:15:12 -08:00
Nicola Corti 906985b097 Back out "Update RNGP to handle cxxModule in codegenConfig" (#43050)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43050

Original commit changeset: 702f09ccf793

Original Phabricator Diff: D53669912

Changelog:
[Internal] [Changed] - Back out "[RN][Android][TmCxxAutolinking] Update RNGP to handle cxxModule in codegenConfig"

Reviewed By: cipolleschi

Differential Revision: D53812110

fbshipit-source-id: a7583c0cb8354bf31723794fbbb4ca5de8f1790a
2024-02-16 09:20:02 -08:00
Nicola Corti 94bfde4424 Update RNGP to handle cxxModule in codegenConfig
Summary:
RNGP now supports parsing the cxxModule field in codegenConfig and passes it over to codegen.

Changelog:
[Internal] [Changed] - Update RNGP to handle cxxModule in codegenConfig

Reviewed By: cipolleschi

Differential Revision: D53669912

fbshipit-source-id: 702f09ccf793f9205f0c8b54346c5d809695c35d
2024-02-13 09:35:39 -08:00
Nicola Corti 3c2b2b181c Kotlin to 1.9.22 (#42927)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42927

This bumps Kotlin to 1.9.22 which is the latest in OSS and closer to the version we use inside fbsource.

Turns out that Explicit API mode was not enabled correctly, so I had to go over all the Kotlin classes
and correctly set them to `public` if they were intended to be for public consumption.

I updated some of them to `private` or `internal` but otherwise I've defaulted to `public` which is the default
we have right now.

Changelog:
[Android] [Changed] - Kotlin to 1.9.22

Reviewed By: cipolleschi

Differential Revision: D53576844

fbshipit-source-id: dd8b08ce9bf87f738159f60fd850e3e3bc490ebc
2024-02-09 10:58:29 -08:00
Nicola Corti 50bd9e367b Bump Gradle to 8.6
Summary:
Let's keep things up to date.

Changelog:
[Internal] [Changed] - Bump Gradle to 8.6

Reviewed By: cipolleschi

Differential Revision: D53566538

fbshipit-source-id: abbb2a53c944cb5eb4232a70b8af7e34b37fb6a2
2024-02-08 06:24:40 -08:00
Nick Gerleman b5267d9436 Enable ANDROIDLINT in React Native (#42675)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42675

`ANDROIDLINT` config now has a base setup for RN. This enables it in arc linter, and fixes automatically fixable issues.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D53115471

fbshipit-source-id: 2556c21770f7c7ca54d1bccfff527d39df20101e
2024-01-26 21:54:37 -08:00
Krzysztof Magiera 0ea16fd3f7 Unify codepath for retrieveing metro location on Android (#42617)
Summary:
With the current ways metro location is determined, when we want to use a different metro port this requires app to be rebuild as the port and location are stored in resource file that gets compiled to R.class. The only way to avoid app rebuild due to a port change is to use shared preferences that can be accessed from dev menu, where metro URL can be specified. However, due to a separate code-paths for retrieving bundle location and for `/inspector/device` calls, the setting only applies to the former. As a consequence, you can change metro URL in the shared preferences, but debugging would only work if you use the default port or you rebuild the app with the correct port number.

This PR removes the separate code-path for retrieving inspector URL including all the dependencies scattered across different files including the gradle plugin. We then replace calls to `PackagerConnectionSettings.getInspectorServerHost` with `PackagerConnectionSettings.getDebugServerHost` which respects the shared preferences and other possible ways of configuring the port.

I decided to remove the separate inspector URL code path, as the resource value for inspector port added in https://github.com/facebook/react-native/issues/23616 was never functioning properly due to a bug. In the said PR introduced a bug in [AndroidInfoHelpers.java](https://github.com/facebook/react-native/blob/a13d51ff1c38ea85e59f4215563c0dd05452f670/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoHelpers.java#L77) where `react_native_dev_server_port` was used instead `react_native_inspector_proxy_port`. As a result the added resource value was never read.

This can be potentially a breaking change as I'm removing some public methods. However I think it is unlikely anyone relied on said methods. As a part of this PR I'm also changing occurences of removed methods from ReactAndroid.api – I don't know how to test those changes since I don't understand how this file is used as it doesn't have any references in public code.

## Changelog:

[ANDROID] [FIXED] - Make Android respect metro location from shared preferences for the debugger workflow

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

Test Plan:
1. Run android app on emulator using default port
2. Check the debugger works when using "Open Debugger" option from dev menu
3. Restart metro with custom port (`--port 9090`) while keeping the app running
4. Open dev menu, click "Settings" then "Debug server host & port", put "10.0.2.2:9090" there
5. Reload the app
6. Before this change things like hot reload would continue to work while "Open Debugger" option would do nothing
7. After this change both reloading and debugging will work

Important: I haven't tested changes made to ReactAndroid.api as I don't know what this files is used for with no references in the codebase.

Reviewed By: cortinico

Differential Revision: D53010023

Pulled By: huntie

fbshipit-source-id: cc8b9c5c7e834ec9ea02b1ed5acf94f04f7b7116
2024-01-25 02:29:13 -08:00
Saad Najmi 6d77d7b895 Format package.json files in the monorepo (#42256)
Summary:
Over in React Native macOS land, I opened https://github.com/microsoft/react-native-macos/pull/2030 to update our mono repo to use Yarn 4. As a side effect, all the `package.json` files are formatted as a side effect of running `yarn install`. So that React Native macOS doesn't maintain this diff (and because they should only be good / no harm), let's upstream the formatting changes.

## Changelog:

[INTERNAL] [CHANGED] - Format package.json files in the monorepo

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

Test Plan: This change should be a no-op, CI should pass.

Reviewed By: cortinico

Differential Revision: D52727623

Pulled By: huntie

fbshipit-source-id: 67862b16d576b0903abd91e016d7add4c19853dc
2024-01-22 07:15:05 -08:00
Nicola Corti a7586947d7 Bump AGP to 8.2.1 (#42585)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42585

Just a minor bump of AGP to 8.2.1

Changelog:
[Internal] [Changed] - Bump AGP to 8.2.1

Reviewed By: NickGerleman

Differential Revision: D52912324

fbshipit-source-id: 2856861f2ccedb3470a0fa548a31dd36252924c3
2024-01-22 01:26:26 -08:00
Dmitry Rykun dae4a11e90 Introduce "headerPrefix" codegen option (#41956)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41956

By default, generated Cxx sources for components all end up in same directory. However the include declarations in them look like this:
```
#include <react/renderer/components/${libraryName}/ShadowNodes.h>
```
And not like this:
```
#include "ShadowNodes.h"
```
This works fine with Buck because it supports header prefixes.
To get this working with CocoaPods we define additional `HEADER_SEARCH_PATHS` for our `React-Codegen` pod.
This approach will not work if we want to generate code at the library level and check in the artifacts. That's because we don't have control over the Podspec there, and can't inject those additional `HEADER_SEARCH_PATHS`.

This diff adds the `headerPrefix` argument to the codegen entry point. It is `react/renderer/components/${libraryName}` by default, but can become empty if we want to generate code at the library level, and don't want to deal with this nested header structure.

*Note:* `RNCodegen` runs all the generators [in a loop](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/generators/RNCodegen.js#L263-L275), assuming that the all have same function signature So I had to add the `headerPrefix` argument to all the generators, even to the ones that don't really need it.

Changelog: [General][Added] - Introduce "headerPrefix" codegen option.

Reviewed By: zeyap

Differential Revision: D51811596

fbshipit-source-id: c5c3e1e571c7c4ea2f5354eb9a7b0df6b917fc0c
2023-12-20 09:25:05 -08:00
Dmitry Rykun 21784e2ce5 Introduce "codegenConfig.includesGeneratedCode" property (#41655)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41655

This diff adds support for checked-in codegen artifacts for libraries.
It introduces a new property to `codegenConfig`, called `includesGeneratedCode`. If codegen sees `includesGeneratedCode: true` in a project's dependency, it assumes that the library has codegen artifacts in it, and will not generate any code.

Changelog: [General][Added] - Introduce "codegenConfig.includesGeneratedCode" property.

Reviewed By: cipolleschi

Differential Revision: D51207265

fbshipit-source-id: 65855fd846e24a53cb18008839121e99eeb59309
2023-12-19 05:28:01 -08:00
Nicola Corti a3f238a44e AGP to 8.2.0 (#41747)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41747

Let's update AGP to the latest minor

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

Reviewed By: cipolleschi

Differential Revision: D51749138

fbshipit-source-id: fe473b6d1613b73e60e65848c20098e3f77d3a61
2023-12-01 08:41:02 -08:00
Nicola Corti 0e9c93c14d Gradle to 8.5 (#41748)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41748

Bumping to the latest stable of Gradle

Changelog:
[Internal] [Changed] - Gradle to 8.5

Reviewed By: cipolleschi

Differential Revision: D51749139

fbshipit-source-id: 2ee0f9a6c910dd5221f7f63c0c599d4ab181e10a
2023-12-01 08:41:02 -08:00
Nicola Corti 4f3094aba4 Kotlin to 1.8.22 (#41661)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41661

This aligns the Kotlin version used inside fbsource to the one used for React Native GitHub

Changelog:
[Internal] [Changed] - Kotlin to 1.8.22

Reviewed By: NickGerleman

Differential Revision: D51587726

fbshipit-source-id: 5f985bd50c7688e4d369184b79dbf1bdc799876e
2023-11-28 03:53:47 -08:00
Nicola Corti e979a456eb AGP to 8.1.4 (#41662)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41662

This bumps AGP to the latest bugfix version

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

Reviewed By: NickGerleman

Differential Revision: D51589071

fbshipit-source-id: cd62c94a75b1718572acd1f45f817b16b7d5ed11
2023-11-27 14:52:15 -08:00
Nicola Corti 5ec2c01697 Fix projects being broken on dependencies starting with a.. (#41621)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41621

Currently, if you have a dependency that is alphabetically smaller than `app`, it's evaluation will happen before `app`.
This means that the namespace auto-discovery and the JVM toolchain configuration won't be working and the project will fail to buid.

This fixes it by introducing a root-project Gradle Plugin that takes care of enforcing the evaluation order on the `app` project.

Fixes #41620

Changelog:
[Android] [Fixed] - Fix projects being broken on dependencies starting with `a..`

Reviewed By: huntie

Differential Revision: D51547294

fbshipit-source-id: 65df7149548b7087dd8928e556fb803b3baf7b79
2023-11-23 06:59:18 -08:00
Ramanpreet Nara 4e92016a09 Remove hard-coded SampleTurboModule exclude (#41574)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41574

The codegen scripts hard-code to exclude NativeSampleTurboModule.

This diff modifies the codegen infra (i.e: combine-js-to-schema-cli.js) to accept an argument: --exclude <regex>.

Auxiliary changes:
- Refactor argument parsing to rely on node's util.parseArgs

Changelog: [Internal]

Reviewed By: javache, dmytrorykun

Differential Revision: D51471526

fbshipit-source-id: 98b88058f8c4b6fa4d776d96a1eb0f15144906a8
2023-11-22 13:52:51 -08:00
Ramanpreet Nara a2558d15ab Introduce CxxReactPackage
Summary:
CxxReactPackage is supposed to be the way apps register C++-only turbo modules with React Native.

Applications are meant to subclass this jni::HybridObject.

Since this is a jni::HybridObject, applications are meant to create this CxxReactPackage in java, and initialize it with java dependencies.

React Native will reach into its c++ part, and use it create C++-only turbo modules.

NOTE: This is a **temporary** abstraction meant to unblock the stable API effort of removing the turbomodulemanagerdelegate builder from ReactHostDelegate:

https://www.internalfb.com/code/fbsource/[e7efced3018f6178b7187a2358f3b76d40e2b43c]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostDelegate.kt?lines=50-51

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D51166523

fbshipit-source-id: 51a22411239fbba32f3a70cc363e59947c2782dc
2023-11-19 18:46:12 -08:00
Riccardo Cipolleschi 7f52791767 Remove dependency on libevent (#41485)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41485

Now that React-Hermes does not depends on folly::Futures anymore, we can safely delete the `libevent` dependency.
This will speedup the pod install step and potentially also the bundle size (to be tested)

## Changelog
[Android][Removed] - Remove libevent dependency

Reviewed By: javache

Differential Revision: D51319583

fbshipit-source-id: 155cc3632b005074c43565e7281c9873ab046f0d
2023-11-15 02:01:23 -08:00
Nicola Corti 1a7a677a90 Do not attempt to query Maven Central if project has react.internal.mavenLocalRepo (#41175)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41175

This will make sure that if you specify a maven local folder with `react.internal.mavenLocalRepo`
you're not attempting to fetch artifacts from Maven Central.

Changelog:
[Internal] [Changed] - Do not attempt to query Maven Central if project has react.internal.mavenLocalRepo

ignored-github-export-checks
bypass-github-export-checks

Reviewed By: mdvacca

Differential Revision: D50600815

fbshipit-source-id: f429c2ae9d7204e4aa2cb29357983c0dc3a1aab6
2023-10-26 07:46:51 -07:00
Gabriel Donadel 13ae11152a Ensure namespace is specified for all the 3rd party libraries (#41085)
Summary:
As stated here https://github.com/react-native-community/discussions-and-proposals/issues/671 React Native 0.73 will depend on Android Gradle Plugin (AGP) 8.x  which requires all libraries to specify a namespace in their build.gradle file, even though this issue was raised many months ago, lots of libraries have not been updated and don't specify a `namespace` inside their build.gradle files

## Changelog:

[ANDROID] [CHANGED] - Ensure namespace is specified for all the 3rd party libraries

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

Test Plan:
Run RNGP tests and test building rn-tester after doing the following procedure

1. Remove `namespace "com.facebook.react"` from react-native/packages/react-native/ReactAndroid/build.gradle
2. Add `package="com.facebook.react"` to react-native/packages/react-native/ReactAndroid/src/main/AndroidManifest.xml
3. Build rn-tester

Also tested this using [BareExpo](https://github.com/expo/expo/tree/main/apps/bare-expo) with AGP 8.1.1 and all libraries that were missing the `namespace` compiled correctly

Reviewed By: cipolleschi

Differential Revision: D50556667

Pulled By: cortinico

fbshipit-source-id: 3d75ec0a8b82427ff0ede89aa7bc58b28b288945
2023-10-25 12:11:21 -07:00
Gijs Weterings d4ad19c969 Revert D49370200: Migrate codegen to shared build setup, remove package build pre-step from RNTester
Differential Revision:
D49370200

Original commit changeset: 992913155169

Original Phabricator Diff: D49370200

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

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

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

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

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

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D49370200

fbshipit-source-id: 992913155169912ea1a3cb24cb26efbd3f783058
2023-10-23 08:32:33 -07:00
UNIDY2002 c7d969f31b Configure Java toolchains only when executing App configuration (#40757)
Summary:
Fix https://github.com/facebook/react-native/issues/40560

## Changelog:

[ANDROID] [FIXED] - Ensure that `configureJavaToolChains` is only executed once during configuration

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

Test Plan:
- Create a fresh `react-native@0.73.0-rc.1` project
- Install `react-native-webview`
- Apply [this patch](https://github.com/react-native-webview/react-native-webview/pull/3175/files) for `react-native-webview` (caused by another issue https://github.com/facebook/react-native/issues/40559)
- Edit `android/gradle.properties` and set `newArchEnabled` to true
- Build application
- (Expected) Application fail to build
- Apply this PR
- (Expected) Application build successfully

**Additional explanation:**

According to the implementation of `configureJavaToolChains`, all the subprojects (both the app and the libraries) will have their toolchains setup in one execution of the method. Therefore, it is okay for the method to be invoked only when configuring the plugin for the app.

On the other hand, invoking the method for more than one time will cause the issue stated in https://github.com/facebook/react-native/issues/40560.

Reviewed By: cipolleschi

Differential Revision: D50361871

Pulled By: cortinico

fbshipit-source-id: bd5e18df97988122788d0482dba954e517a0cb5c
2023-10-17 05:46:53 -07:00
Nicola Corti 171a479150 Remove ReactNative/Flipper Integration (#40935)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40935

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

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

Reviewed By: mdvacca, huntie, cipolleschi

Differential Revision: D50259817

fbshipit-source-id: 28427425340896635607202cd78936f6030e78e0
2023-10-16 05:32:55 -07:00
Nicola Corti ab3506e609 Make sure buildConfig is turned on for all the 3rd party libraries (#40939)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40939

Currently some libs on RN 0.73 are broken as the default for Build Config generation changed
from true to false since AGP 8.x. This reverts the behavior to the old flag.

Closes #40791
Closes #40559

Changelog:
[Internal] [Changed] - Make sure buildConfig is turned on for all the 3rd party libraries

Reviewed By: mdvacca

Differential Revision: D50270382

fbshipit-source-id: 02dcb031c577f65be2f41d9da0334c1b3d89e4c5
2023-10-13 10:07:10 -07:00
Alex Hunt f40bb9331c Bump package versions for next major (#39764)
Summary:
#publish-packages-to-npm

Bump all package versions to `0.74.0` (next major release) for `main`, following instructions at https://reactnative.dev/contributing/release-branch-cut-and-rc0#12-bump-minor-version-of-all-monorepo-packages-in-main.

```sh
yarn bump-all-updated-packages --release-branch-cutoff
```

Changelog: [Internal]

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

Test Plan: —

Reviewed By: robhogan

Differential Revision: D49871039

Pulled By: huntie

fbshipit-source-id: f4df6efeae4d8a9209e7aae7b9e6fea3d15793b5
2023-10-11 08:36:23 -07:00
generatedunixname89002005325672 3859eee961 Daily arc lint --take KTFMT
Reviewed By: 0x1eaf

Differential Revision: D50164739

fbshipit-source-id: a3a03735eaea41d3e7e04a73b210c6347ebd078e
2023-10-11 06:05:17 -07:00
Riccardo Cipolleschi 5c2ec558c1 Fix functions that turn on the New Architecture (#40770)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40770

## Changelog:
[Internal] - Fix functions that turn on the New Architecture

Reviewed By: cortinico

Differential Revision: D50084427

fbshipit-source-id: aae0c77585929eacf8e890321e27e5049e53775e
2023-10-10 10:16:29 -07:00