Commit Graph

255 Commits

Author SHA1 Message Date
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
Nicola Corti e9ecd3511e Fix compilation warnings introduced by Gradle 8.4 (#39959)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39959

We're still accessing project.buildDir which will be removed in Gradle 9.0
I'm cleaning it up here.

Changelog:
[Internal] [Changed] - Fix compilation warnings introduced by Gradle 8.4

Reviewed By: yungsters

Differential Revision: D50016573

fbshipit-source-id: de7a725f61b503f08991ebf85b9a002cefab221a
2023-10-06 11:38:59 -07:00
Nicola Corti 81213f6524 Bump Gradle to 8.4 (#39960)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39960

This is our usual round of bumps just after the branch cut.

Changelog:
[Android] [Changed] - Bump Gradle to 8.4

Reviewed By: yungsters

Differential Revision: D50016574

fbshipit-source-id: 781eb906f6b12f76f673e38bdcf099c9b7cefade
2023-10-06 11:38:59 -07:00
Riccardo Cipolleschi bad027c5f5 Add warning when newArchEnabled is set (#39781)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39781

## Changelog
[Internal] - Add warning when newArchEnabled is set

Reviewed By: cortinico

Differential Revision: D49866356

fbshipit-source-id: 0b937b7f37010e5fbfc93b073cc70e293d61052c
2023-10-05 08:26:43 -07:00
Nicola Corti 63ca55bdcc Unblock build-from-source on nightlies (#39634)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39634

Running build from source as suggested here:
https://reactnative.dev/contributing/how-to-build-from-source
is currently broken for nightly versions (and for 0.73).

This fixes it by:
- Fixing the import of the Gradle Version Catalog
- Actually adding the Gradle version catalog to the NPM package
- Fixing how the build Codegen CLI task is invoked for build-from-source
- Updating the search directories for codegenDir/reactNativeDir from build-from-source

Changelog:
[Internal] [Fixed] - Unblock build-from-source on nightlies

Reviewed By: cipolleschi

Differential Revision: D49562595

fbshipit-source-id: 9594b7d947569d41c461a7e8287d3ae68fb87b98
2023-09-26 06:26:55 -07:00
Rob Hogan 0d23ef5bde Gradle distribution type bin -> all (#39619)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39619

https://github.com/facebook/react-native/pull/39603 unintentionally changed our Gradle distribution type in `gradle.properties` to `bin`. This changes it back to `all` while preserving the upgrade to 8.3.

Generated with
```
./gradlew wrapper --gradle-version=8.3 --distribution-type all
```

Changelog:
[Internal][Changed] Revert Gradle distribution type to ‘all’

Reviewed By: NickGerleman

Differential Revision: D49569492

fbshipit-source-id: fc5b2c8a2c2cea455ed5bd0dbd6743d34b527c9b
2023-09-24 06:09:53 -07:00
Rob Hogan 2613e8d9db Bump Gradle to 8.3 (#39603)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39603

Bump Gradle to latest stable: 8.3.

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

Reviewed By: christophpurrer

Differential Revision: D49537003

fbshipit-source-id: 75297f9108cd325a6118a2d416401e306cadd1b8
2023-09-22 09:19:05 -07:00
Riccardo Cipolleschi 29adb8de98 Implement version parsing and connect to RNTester (#39502)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39502

This diff adds the parsing of the package.json to retrieve the version of react native and it matches it against a regex to decide whether to enable or not the New Architecture.

This change depends on [this CLI's PR](https://github.com/react-native-community/cli/pull/2076).

## Changelog:
[Android][Added] - Parse RN Version to decide whether to enable the New Arch or not.

Reviewed By: cortinico

Differential Revision: D49270012

fbshipit-source-id: 5164a1ddd26f1822c0d717a7a9e2416ec38d78a2
2023-09-18 06:12:19 -07:00
Riccardo Cipolleschi 55a0425fb2 Add helper types and function for double publishing (#39501)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39501

This change introduce a new model to parse the React Native package.json.
The objects are not connected but they will be used in the next diff

## Changelog:
[Android][Added] - Add a couple of types in the RNGP for json parsing.

Reviewed By: cortinico

Differential Revision: D49270044

fbshipit-source-id: 42a855bb85a5f8e1b1249ab3ebee974ce3fb93fd
2023-09-18 06:12:19 -07:00
Nate Stedman 88395bb17d Update ktfmt component on FBS:master
Reviewed By: hick209

Differential Revision: D49300079

fbshipit-source-id: 7e704e2366feee3f6f2c25ac25d3daea407e71f9
2023-09-15 07:19:43 -07:00
Nicola Corti 0e5ea28905 Bump AGP to 8.1.1 (#39392)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39392

This fixes a warning that would fire for all the users on 0.73 and is not actionable in any form: https://issuetracker.google.com/issues/295235385

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

Reviewed By: luluwu2032

Differential Revision: D49155866

fbshipit-source-id: 05201b834d00b018f8680d74fe4a40884a8c5eb9
2023-09-12 09:21:08 -07:00
Nicola Corti 54033fd334 Introduce react.internal.useHermesNightly (#38886)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38886

This change introduces a property called `react.internal.useHermesNightly`

This allows users building RN-Tester or just ReactAndroid to fetch Hermes from the latest
nightly, without having to build it from source.

The change could be useful to speedup local development, but it should not be enabled on CI or when doing releases.

Changelog:
[Internal] [Changed] - Introduce react.internal.useHermesNightly

Reviewed By: mdvacca, cipolleschi

Differential Revision: D48188769

fbshipit-source-id: cb4330cb9082e9db0c7ba82e48b2d10030637353
2023-08-14 00:45:07 -07:00
Nicola Corti 1a765b6d08 Cleanup and scope all the Gradle Properties (#38885)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38885

We do have several Gradle Properties that are used to configure the build.

I've refactored them all and moved them inside the PropertyUtils file:
https://github.com/facebook/react-native/blob/main/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt

Specifically properties should be 'scoped' under `react.` if public, and `react.internal.` if for internal usage.

Property that I cleaned up are:
- REACT_NATIVE_MAVEN_LOCAL_REPO becomes react.internal.mavenLocalRepo
- REACT_WINDOWS_BASH becomes react.internal.windowsBashPath
- GROUP becomes react.internal.publishingGroup

I've also added support for scoping for public properties with backward compat (so both the scoped and unscoped properties are accepted):
- react.newArchEnabled
- react.hermesEnabled
- react.nativeArchitectures

Changelog:
[Android] [Changed] - Cleanup and scope all the Gradle Properties

Reviewed By: mdvacca

Differential Revision: D48188310

fbshipit-source-id: 1a92d31105270a4c2f80029b7d36bcb33916d0fb
2023-08-13 23:11:29 -07:00
Nicola Corti 6aed446886 Consolidate Gradle Plugin versions inside the version catalog (#38946)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38946

I'm doing another pass of moving all the various version numbers of the Gradle Plugin inside the `[plugins]` section of the version catalog.

Changelog:
[Internal] [Changed] - Consolidate Gradle Plugin versions inside the version catalog

Reviewed By: mdvacca

Differential Revision: D48233147

fbshipit-source-id: afd12e5377d2d88c53cef4e6913b5c49b3da5bbb
2023-08-11 08:34:37 -07:00
Nicola Corti 41af21b42d Fix warnings for Gradle 9 (#38927)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38927

I've done a pass and fixed most of the warnings for Gradle 9:
- project.buildDir is deprecated in favor of project.layout.buildDirectory
- I've updated 3rd party Gradle Plugins that we depend on

There are still two warnings which are outside of our control:
1. One is inside AGP and will be fixed with AGP 8.2 - Source https://issuetracker.google.com/issues/279306626
2. Another one is inside nexus-publish and should ideally be fixed by 2.0 https://github.com/gradle/gradle/issues/25206 Will bump the release once it's out

Changelog:
[Internal] [Changed] - Fix warnings for Gradle 9

Reviewed By: mdvacca

Differential Revision: D48231760

fbshipit-source-id: 27d704324ea33cfc8aa0164fa437b80aab425960
2023-08-11 04:58:19 -07:00
Nicola Corti 28dd1bbe0f Enable local caching for Gradle (#38882)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38882

This turns on local caching for Gradle builds.
From now on, some of the tasks of the build will be cached inside the `.gradle` folder.

This will benefit 'clean builds' and builds happening after branch/context switch.
CI will also benefit from this improvement as we're storing the cache folder on CircleCI.

After this we'll have to follow-up and enabling `Cacheable` on each of our task as
they're currently all disabled.

Changelog:
[Internal] [Changed] - Enable local caching for Gradle

Reviewed By: mdvacca

Differential Revision: D48187656

fbshipit-source-id: 25734ed692a69874721e86c50498b075af0fda19
2023-08-09 17:32:43 -07:00
Nicola Corti fdab18b0a1 Fix compilation avoidance bug with buildCodegenCLI (#38903)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38903

Currently Android is not rebuilding the CLI if its content changes. This is a bug.
It's resolution is a bit more complicated as we do have various `buildCodegenCLI` tasks, also in user projects.

I've removed the tasks from the user projects, as they're practically not needed (users always consume a prebuilt codegen).

And I've also updated the setup to have only one `buildCodegenCLI` in the ReactAndroid project.
This allows us to ensure the job executes only once and has correct input/outputs.

Changelog:
[Internal] [Changed] -  Fix compilation avoidance bug with buildCodegenCLI

Reviewed By: mdvacca

Differential Revision: D48199157

fbshipit-source-id: ba3be6a0ca959ac4e1240e8feb99b8274e4e2b46
2023-08-09 14:33:00 -07:00
Nicola Corti e563f0f3fc Use version catalog to consolidate versions for JVM dependencies (#38836)
Summary:
As we had version numbers scattered all over the places, I'm consolidating them to use a version catalog: https://docs.gradle.org/current/userguide/platforms.html

## Changelog:

[INTERNAL] - Use version catalog to consolidate versions for JVM dependencies

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

Test Plan: CI

Reviewed By: cipolleschi

Differential Revision: D48150285

Pulled By: cortinico

fbshipit-source-id: 83a1867aace5395d9a10fadd6c6ab11c31fa14b5
2023-08-08 11:37:43 -07:00
Nicola Corti b7b69c589c Enable Kotlin for RN Tester (#38820)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38820

This is needed if we want to allow users to write Kotlin code inside RN Tester

Changelog:
[Internal] [Changed] - Enable Kotlin for RN Tester

Reviewed By: mdvacca, cipolleschi

Differential Revision: D48117203

fbshipit-source-id: c4a69cca95dfed936d85a45dd91f1518cfe1726f
2023-08-07 10:31:04 -07:00
Nicola Corti 2e5483e303 Add missing libreact_utils.so inside RNGP pickFirst (#38818)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38818

When building the template test on CircleCI, I've noticed we fire a warnign for `libreact_utils.so` as we're missing a pickFirst directive.
You can see an example of the warning here:
https://app.circleci.com/pipelines/github/facebook/react-native/28853/workflows/f1808b5e-fb40-4165-8885-694f88037f9f/jobs/904972

This fixes it by adding `libreact_utils.so` to the `pickFirst` list.

Changelog:
[Internal] [Changed] - Add missing `libreact_utils.so` inside RNGP pickFirst

Reviewed By: cipolleschi

Differential Revision: D48115852

fbshipit-source-id: 02e8b3172aea84360d06a1a12400fe7bc99859e5
2023-08-07 09:48:32 -07:00
Nicola Corti 6cd1da94b8 Bump AGP to 8.1.0 (#38638)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38638

A new stable version of Android Gradle Plugin has just been released which I'm bumping over here, and applying all the required changes.

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

Reviewed By: cipolleschi

Differential Revision: D47798273

fbshipit-source-id: 57672b10444ffb6079aa5881ff09d033d2a5e895
2023-07-26 11:02:05 -07:00
Janic Duplessis e21c25eb91 Add missing toolchains plugin in react-native-gradle-plugin (#38292)
Summary:
I was getting the following error when trying to run RN Tester on Android.

```
A problem occurred configuring project ':packages:react-native:ReactAndroid'.
> Could not determine the dependencies of task ':react-native-gradle-plugin:compileKotlin'.
   > No matching toolchains found for requested specification: {languageVersion=17, vendor=any, implementation=vendor-specific} for MAC_OS on aarch64.
      > No locally installed toolchains match and toolchain download repositories have not been configured.
```

This is fixed by adding the `org.gradle.toolchains.foojay-resolver-convention` plugin in settings.gradle, this was done already for the root one, but not in the one in `react-native-gradle-plugin`.

## Changelog:

[INTERNAL] [FIXED] - Add missing toolchains plugin in react-native-gradle-plugin

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

Test Plan: Build RN Tester on android

Reviewed By: mdvacca

Differential Revision: D47371772

Pulled By: cortinico

fbshipit-source-id: 8eaa5de9559720a7b37d11b3ddceb5fb84753a40
2023-07-17 05:09:56 -07:00
Nicola Corti e6f77112a7 Gradle to 8.2.1 (#38271)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38271

This is our usual bump to the latest stable of Gradle

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

Reviewed By: yungsters

Differential Revision: D47335295

fbshipit-source-id: 36bbc1aca19b3b37852e19d3a8536f1a6c4b736a
2023-07-10 15:16:10 -07:00