123 Commits
Author SHA1 Message Date
Nivaldo Bondança 63e9c15448 Update ktfmt component on FBS:master
Reviewed By: cortinico

Differential Revision: D112366935

fbshipit-source-id: e0b509473d93d3fb4a465a3007bd0a7b63fa553d
2026-08-02 08:20:26 -07:00
Dawid Malecki 3bfb277fec Download React Native artifacts from the proxy cache server first (#57325)
Summary:
This PR adds pull-through cache support for React Native Maven artifacts by trying `https://repo.reactnative.dev/maven2` before Maven Central for release artifacts.
- Updates the Android Gradle resolution by adding cache repository before `mavenCentral()` scoped to React Native groups via `includeGroupByRegex`.
- Updates iOS CocoaPods prebuilt artifact resolution to try the cache first, then fall back to `https://repo1.maven.org/maven2`.
- Updates SwiftPM/iOS prebuild JS tooling with the same cache-first fallback behavior.
- Preserves `ENTERPRISE_REPOSITORY` behavior as an explicit single custom repository override.
- Avoids duplicate artifact existence probes in Ruby and JS by checking candidate URLs directly and caching JS HEAD results within the process.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[GENERAL][CHANGED] - Add React Native Maven pull-through cache fallback for prebuilt artifacts.

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

Test Plan:
Run:

```sh
react-native % RN_DEP_VERSION=0.81.0 \
HERMES_VERSION=250829098.0.13 \
node scripts/ios-prebuild -s -f Debug
```
The logs confirm that React Native artifacts are cached and pulled from the proxy:

```sh
[ReactNativeDependencies] Using download prebuild Debug tarball
[ReactNativeDependencies] Using release tarball from URL: https://rnmaven.swmtest.xyz/com/facebook/react/react-native-artifacts/0.81.0/react-native-artifacts-0.81.0-reactnative-dependencies-debug.tar.gz
[ReactNativeDependencies] Downloading ReactNativeDependencies tarball from https://rnmaven.swmtest.xyz/com/facebook/react/react-native-artifacts/0.81.0/react-native-artifacts-0.81.0-reactnative-dependencies-debug.tar.gz
```

Added gradle plugin tests which can be run with:
```sh
./gradlew :react-native-gradle-plugin:test --tests com.facebook.react.utils.DependencyUtilsTest
```

Reviewed By: cortinico

Differential Revision: D113902346

Pulled By: coado

fbshipit-source-id: 35b257e86d98b0e378f3a642a40a78c498359290
2026-07-28 09:26:45 -07:00
Nivaldo Bondança b31ba29d2d Update ktfmt component on FBS:master
Reviewed By: cortinico

Differential Revision: D110624565

fbshipit-source-id: c18b2b2fc22a8b060a30ae9bd2bc18af862e08f2
2026-07-12 14:57:47 -07:00
Nicola Corti 2f325e22d7 fix(android): restore namespace fallback for libraries not applying the React plugin (#57290)
Summary:
https://github.com/react/react-native/issues/57038 narrowed configureNamespaceForLibraries from a rootProject-wide sweep to only the project applying `com.facebook.react`. That was necessary because the old code re-ran the sweep from every library, and AGP 9 errors when `finalizeDsl` is registered after a project's DSL has been finalized.

The narrowing has a side effect: third-party Android libraries that do NOT apply `com.facebook.react` and still rely on the manifest `package` attribute (e.g. older react-native-linear-gradient) no longer receive a namespace, so they fail under AGP 9 with "Namespace not specified".

Restore the broad coverage by sweeping all `com.android.library` subprojects once, from the application project (which applies the plugin a single time, avoiding the repeated-traversal finalizeDsl error from https://github.com/react/react-native/issues/57038). Guard configureNamespaceForLibraries so it registers its finalizeDsl callback at most once per project, since libraries that DO apply the React plugin are now reachable from both the per-library hook and the app-level sweep.

## Changelog:

[INTERNAL] - restore namespace fallback for libraries not applying the React plugin

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

Test Plan: CI

Reviewed By: fabriziocucci

Differential Revision: D109271897

Pulled By: cortinico

fbshipit-source-id: 8b9d54d9ed1a729a1588f031bc7e7862b21845c5
2026-06-22 07:03:39 -07:00
Hur Ali abb071b135 feat: adopt AGP v9 (#57038)
Summary:
This PR is part of Android Gradle Plugin v9 adoption. With this PR, we adopt the AGP9 repository wide and address the deprecated APIs with the newer ones.

This is in combination with https://github.com/facebook/react-native/pull/57038

<details>
<summary>
<b>Changes to `configureBuildConfigFieldsForLibraries` and `configureNamespaceForLibraries`</b>
</summary>

<br/>
These helpers are called from `ReactPlugin.apply`, but they currently iterate over `rootProject.allprojects`. Since `com.facebook.react` is applied by multiple Android library projects, each application of the plugin repeats the same traversal and attempts to register `finalizeDsl` callbacks for every Android library project.

The first traversal can register the callbacks successfully. However, a later traversal can reach a project whose Android DSL finalization phase has already completed. Starting with AGP 9, AGP explicitly errors when `finalizeDsl` is called after that phase has passed, which causes the build failure. [see](https://issuetracker.google.com/issues/436595826)

To understand this, consider following modules:

```
:react-native-safe-area-context
:react-native-mmkv
:react-native-skia
```

The current code on main, would result in executing the following block 3 times:

```kt
  fun configureBuildConfigFieldsForLibraries(appProject: Project) {
    appProject.rootProject.allprojects { subproject ->
      println("=== subproject ${subproject.name}")
      subproject.pluginManager.withPlugin("com.android.library") {
        subproject.extensions
            .getByType(LibraryAndroidComponentsExtension::class.java)
            .finalizeDsl { ext -> ext.buildFeatures.buildConfig = true }
      }
   }
}
```

The output would be:

```
> Configure project: react-native-safe-area-context
=== subproject RNProject
=== subproject app
=== subproject react-native-safe-area-context
=== subproject react-native-mmkv
=== subproject react-native-skia

> Configure project: react-native-mmkv
=== subproject RNProject
=== subproject app
=== subproject react-native-safe-area-context
=== subproject react-native-mmkv
=== subproject react-native-skia

> Configure project: react-native-skia
=== subproject RNProject
=== subproject app
=== subproject react-native-safe-area-context
=== subproject react-native-mmkv
=== subproject react-native-skia
```

Now with AGP9, the same code will throw this error:

```
> Configure project: react-native-safe-area-context
=== subproject RNProject
=== subproject app
=== subproject react-native-safe-area-context
=== subproject react-native-mmkv
=== subproject react-native-skia

> Configure project: react-native-mmkv
=== subproject RNProject
=== subproject app
=== subproject react-native-safe-area-context
=== subproject react-native-mmkv

* What went wrong:
A problem occurred evaluating project': react-native-mmkv'.
> Failed to apply plugin
'com. facebook. react'
> It is too late to call
finalizeDst
as the DSL finalization
blocks have already been executed. \n
In particular, you cannot call 'finalizeDsl' within the "beforeVariants' or "onVariants' blocks.
Instead, you must call finalizeDsl' directly within the
"androidComponents' block
```

**Solution:**

Since these helpers are only intended to configure Android library projects that apply the React plugin, we can configure the current project inside `pluginManager.withPlugin("com.android.library")` instead of repeatedly configuring all projects from every plugin application.

```kt
 fun configureBuildConfigFieldsForLibraries(project: Project) {
    project.extensions
      .getByType(LibraryAndroidComponentsExtension::class.java)
      .finalizeDsl { ext ->
        ext.buildFeatures.buildConfig = true
      }
    }
```

```kt
  fun configureNamespaceForLibraries(project: Project) {
    project.extensions
      .getByType(LibraryAndroidComponentsExtension::class.java)
      .finalizeDsl { ext ->
        if (ext.namespace == null) {
          val manifestFile =
            project.layout.projectDirectory.file("src/main/AndroidManifest.xml").asFile
          manifestFile
            .takeIf { it.exists() }
            ?.let { file ->
              getPackageNameFromManifest(file)?.let { packageName ->
                ext.namespace = packageName
              }
            }
        }
      }
    }
```

One important note for `configureNamespaceForLibraries` is that the old `com.android.build.gradle.LibraryExtension` is deprecated in favor of `com.android.build.api.dsl.LibraryExtension` - which does not expose `manifestFile` from the `sourceSets`. So we have to define a path for it. For most libraries, this should be OK but for the ones which define custom path, this will fail.

Hence, I believe, if it's important to have this fallback, we take this tradeoff. Otherwise, since there has been 2 years passed for AGP8 adoption and the time when this fallback was added, we may safely remove this function as almost all libraries now define a `namespace` in `android { }` DSL.

With the above in place, we make one final change and that is to move these two functions inside the `withPlugin("com.android.library")` as these are only intended for libraries and that way, we also ensure that these will only be applied once the `com.android.library` plugin has been applied.

```kt
    project.pluginManager.withPlugin("com.android.library") {
      configureBuildConfigFieldsForLibraries(project)
      configureNamespaceForLibraries(project)
      configureCodegen(project, extension, rootExtension, isLibrary = true)
    }
```

</details>

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[ANDROID] [BREAKING] - Adopt AGP v9

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

Test Plan:
- CI passes
- Verified on RN Tester
- Verified on Local RN App

https://github.com/user-attachments/assets/b424c211-6876-42b0-a5d1-f9ecade39a3a

Reviewed By: cipolleschi

Differential Revision: D107656378

Pulled By: cortinico

fbshipit-source-id: 38fd7191e089ce29ccb84fa25bff6d9e920cf322
2026-06-08 03:32:23 -07:00
Satyajit Sahoo c789880517 Handle autolinking for pure C++ turbo modules without includesGeneratedCode (#56938)
Summary:
Currently, pure C++ modules require `includesGeneratedCode: true`, and the library to be shipping codegen files to work. This is inconsistent with regular turbo modules that work with both setups.

The issue is in 2 places:

1. CLI returns hardcoded default for C++ modules
2. Autolinking logic doesn't run codegen for C++ modules

PR removing hardcoded default from CLI: https://github.com/react-native-community/cli/pull/2799

This change updates the autolinking logic to detect pure C++ libraries without `includesGeneratedCode: true`, run codegen for them and use correct path for CMakeLists based on the codegen output.

## Changelog:

[ANDROID] [FIXED] - Fix pure C++ turbo modules not working without `includesGeneratedCode: true`

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

Test Plan:
- create new cpp library: `npx create-react-native-library@latest awesome-library --yes --description "my library" --type turbo-module --languages cpp`
- run `yarn example android` and notice that the build works
- apply the following patch to remove `includesGeneratedCode: true`:
  ```patch
  diff --git a/package.json b/package.json
  index e3c893a..f41100f 100644
  --- a/package.json
  +++ b/package.json
  @@ -112,22 +112,16 @@
          {
            "project": "tsconfig.build.json"
          }
  -      ],
  -      "codegen"
  +      ]
      ]
    },
    "codegenConfig": {
      "name": "AwesomeLibrarySpec",
      "type": "modules",
      "jsSrcsDir": "src",
  -    "outputDir": {
  -      "ios": "ios/generated",
  -      "android": "android/generated"
  -    },
      "android": {
        "javaPackageName": "com.awesomelibrary"
  -    },
  -    "includesGeneratedCode": true
  +    }
    },
    "prettier": {
      "quoteProps": "consistent",
  diff --git a/react-native.config.js b/react-native.config.js
  index fef2c32..46f9600 100644
  --- a/react-native.config.js
  +++ b/react-native.config.js
  @@ -5,7 +5,6 @@ module.exports = {
    dependency: {
      platforms: {
        android: {
  -        cmakeListsPath: 'generated/jni/CMakeLists.txt',
          cxxModuleCMakeListsModuleName: 'react-native-awesome-library',
          cxxModuleCMakeListsPath: 'CMakeLists.txt',
          cxxModuleHeaderName: 'AwesomeLibraryImpl',
  ```
- run `yarn example android` and notice that the build fails
- apply the patch from this PR and from https://github.com/react-native-community/cli/pull/2799 and notice that the module works correctly

screenshot from the test library:

<img width="360" height="780" alt="Screenshot_1779448311" src="https://github.com/user-attachments/assets/a3f43a3c-bb46-404c-80ff-173ea71a9887" />

Reviewed By: cortinico

Differential Revision: D106094034

Pulled By: fabriziocucci

fbshipit-source-id: 1d0058907e7a274a8b7de2ec69539dda70bb8f67
2026-06-01 03:23:20 -07:00
SJLIM 5b16cdff9d Generated from a GitHub Pull Request. Run 'jf sync' on this diff to load the correct commit data. (#56985)
Summary:
Remove duplicated words from comments in a release script, a dev middleware test helper, the Gradle plugin JDK utility, and the virtual view render state.

## Changelog:
[INTERNAL] [FIXED] - Fix duplicated words in source comments.

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

Test Plan: Comments.

Reviewed By: cortinico

Differential Revision: D106615714

Pulled By: fabriziocucci

fbshipit-source-id: cbb08abc5c0e6fbcfe2299c00aa05e67901b9f4c
2026-05-29 12:47:25 -07:00
Phecda 948835d944 fix(gradle-plugin): guard missing autolinked JNI dirs (#56886)
Summary:
Related to https://github.com/facebook/react-native/issues/56334.

`GenerateAutolinkingNewArchitecturesFileTask` currently emits unconditional `add_subdirectory(...)` calls for autolinked New Architecture JNI/codegen directories.

During `clean`, Android Studio native model configuration, or other native cleanup/configuration flows, some dependency codegen directories may not exist yet. CMake then fails before clean/configuration can complete:

```text
add_subdirectory given source ".../android/build/generated/source/codegen/jni/"
which is not an existing directory
```

This changes the generated `Android-autolinking.cmake` to:

- initialize `AUTOLINKED_LIBRARIES` as an empty list;
- only call `add_subdirectory(...)` when the native directory exists;
- append each autolinked target only after its directory has been added.

That keeps existing generated JNI directories linked as before while allowing native clean/model configuration to skip directories that have not been generated yet.

## Changelog:

[ANDROID] [FIXED] - Guard missing autolinked JNI directories in generated CMake during native clean/model configuration.

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

Test Plan:
```sh
./gradlew -p packages/gradle-plugin :react-native-gradle-plugin:test --tests com.facebook.react.tasks.GenerateAutolinkingNewArchitecturesFileTaskTest
```

Result:

```text
BUILD SUCCESSFUL
```

Reviewed By: christophpurrer

Differential Revision: D105826478

Pulled By: cortinico

fbshipit-source-id: e3a698c2334cc02189eefca21b34a0a0181eb5f3
2026-05-20 11:20:46 -07:00
Nicola Corti ec1e1ae054 Bump Kotlin API version from 1.9 to 2.0 (#56849)
Summary:
Kotlin 2.2.0 deprecated API versions 1.8 and 1.9, which causes a build failure when combined with -Werror. Bump apiVersion to KOTLIN_2_0 in all four gradle-plugin build files.

## Changelog:

[ANDROID] [CHANGED] - Bumped min Kotlin version to 2.0+

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

Test Plan: CI

Differential Revision: D105322296

Pulled By: cortinico

fbshipit-source-id: 729f4475e6f026032d3d0a34f4322eeb29e6a5a8
2026-05-15 08:50:05 -07:00
Nicola Corti cb04956cde Bump Kotlin to 2.2.0 (#56838)
Summary:
Bump to Kotlin 2.2.0 to align with internal builds

## Changelog:

[Android] [Changed] - Bump Kotlin to 2.2.0

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

Test Plan: CI

Differential Revision: D105298435

Pulled By: cortinico

fbshipit-source-id: eae5f9f19a66d15f4451ea369ad032e8acef0aff
2026-05-15 07:22:39 -07:00
Riccardo Cipolleschi b05ab2f8d8 Update stale 'Hermes V1' comments (#56757)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56757

Update comments that still say 'Hermes V1' as if it is an opt-in feature.
Since Hermes (formerly called Hermes V1) is now the only supported engine:
- hermes-engine.podspec: drop 'when using Hermes V1' from hermesc note
- PathUtils.kt: rewrite the hermesc path comment to drop the 'opted in to Hermes V1' phrasing
- hermes-engine/build.gradle.kts: 'Hermes V1 by default...' -> 'Hermes by default...'

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D104649634

fbshipit-source-id: 9b0a05ed013c7ba908c7abe467d5e3c1c3c2f26c
2026-05-11 12:55:12 -07:00
Riccardo Cipolleschi 0a5c8c6b4b Remove hermesV1Enabled Gradle property and simplify Hermes version resolution (#56733)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56733

  - Remove `hermesV1Enabled` / `react.hermesV1Enabled` Gradle property and all branching it controls
  - Rename `HERMES_V1_VERSION_NAME` to `HERMES_VERSION_NAME` in `version.properties`
  - Remove `hermesV1Enabled` from `PrivateReactExtension`, `ProjectUtils`, `PropertyUtils`, `ReactPlugin`
  - Simplify `DependencyUtils.Coordinates` to single Hermes version
  - Make `-DHERMESVM_HEAP_HV_MODE=HEAP_HV_PREFER32` CMake flag unconditional
  - Remove `-DHERMES_V1_ENABLED=1` CMake argument from `ReactAndroid` and Fantom builds
  - Delete `hermesV1Enabled=true` from `gradle.properties`
  - Update all Gradle plugin tests

## Changelog:
[Android][Removed] - Remove hermesV1Enabled and simplify the code

  ## Test plan
  - [x] Gradle plugin: `./gradlew -p packages/gradle-plugin build` — BUILD SUCCESSFUL, all tests pass
  - [x] Android: `./gradlew :packages:rn-tester:android:app:assembleDebug` — BUILD SUCCESSFUL

Reviewed By: cortinico

Differential Revision: D104244582

fbshipit-source-id: 7d12af5b934aac9d431e89d9a2eac41213c997a1
2026-05-11 12:55:12 -07:00
Christoph Purrer 734f5c180d Migrate NativeSampleTurboModule to codegen integration - RFC (#56723)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56723

Replace hand-written spec files for `NativeSampleTurboModule` with proper codegen integration by removing exclusion rules and configuring the module in `package.json`. This eliminates ~1600 lines of manual boilerplate (Java, C++, Objective-C) across Android, iOS, and macOS platforms, allowing the codegen system to generate these files automatically from the JavaScript spec.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D104323543

fbshipit-source-id: 241f256d03a4ff0f914179c5ee2842d29fad5554
2026-05-11 11:24:46 -07:00
Alexander Martinz 6f54846a08 Allow overriding dev server ip via property (#55531)
Summary:
Similiar to how a specific port can be set also allow for setting a specific ip for the dev server.

This allows for easy configuration to aid in generating [reproducible builds](https://izzyondroid.org/docs/reproducibleBuilds/).

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID] [ADDED] - Allow specifying dev server ip via gradle property

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

[ANDROID] [ADDED] - Allow specifying dev server ip via gradle property

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

Test Plan:
1) Add `reactNativeDevServerIp=localhost` to `gradle.properties`
2) Generate an APK
3) Analyze the APK and check that the value of the string resource type `react_native_dev_server_ip` matches the value set in `gradle.properties`.

Reviewed By: cortinico

Differential Revision: D93143296

Pulled By: CalixTang

fbshipit-source-id: d0be23e9495f0ba1a6034dc31b6e725fd94a6a02
2026-02-13 09:55:21 -08:00
Tomasz Żelawski 45896674d1 fix: inability to disable hermesV1 on Android (#55399)
Summary:
Changing the line in `ReactPlugin.kt` that always set `hermesV1Enabled` to `true` even if it was explicitly disabled, accidentally omitted in https://github.com/facebook/react-native/issues/54989.

In recent update of hermes V1 binary a file `RuntimeAdapter.h` was removed.

## Changelog:

[ANDROID] [FIXED] - ReactPlugin.kt always setting `hermesV1Enabled` to `true`

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

Test Plan: Build React Native from source on latest 0.84 RC, disable hermesV1 and see that it compiles now.

Reviewed By: cipolleschi

Differential Revision: D92267385

Pulled By: cortinico

fbshipit-source-id: 58ecae6d3064995ef9e63ddbd67ac04db2a1126b
2026-02-05 03:38:47 -08:00
Sergei Glotov 47c3ebe23f Add Sonatype Central repository for users of nightly builds only (#55305)
Summary:
Even though Sonatype Central repository isn't used by an app, still the React Native Gradle plugin adds the Sonatype Central to repositories.
In some cases it leads to a considerable amount of failed requests on Gradle downloading dependencies.

<img width="1076" height="109" alt="858 failed requests out of 858 requests" src="https://github.com/user-attachments/assets/40d6aeb6-dcc4-4ebb-9f0b-742d26ba6e65" />

I'm introducing a change where Sonatype Central repository is included for users of nightly builds only.

## Changelog:

[ANDROID] [CHANGED] - Add Sonatype Central repository for users of nightly builds only

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

Test Plan:
All of the tests in gradle plugin are green
```
$ ./gradlew test

BUILD SUCCESSFUL in 10s
20 actionable tasks: 20 executed
```

Reviewed By: cipolleschi

Differential Revision: D91887976

Pulled By: cortinico

fbshipit-source-id: 1e61d3b8d97a444e17a02bfe9ed0334e9b0ab0bc
2026-02-03 09:11:00 -08:00
Riccardo Cipolleschi f140c4906b Use Hermes V1 as default engine (#54989)
Summary:
This change makes Hermes V1 the default engine for React Native for both platforms. This change needs to land before the branch cut of react native 0.84

bypass-github-export-checks

## Changelog:
[iOS][Changed] - Make Hermes V1 the default engine for iOS

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

Test Plan:
1. Run `bundle exec pod install` and verified that Hermes V1 is used when building from source
<img height="480" alt="Simulator Screenshot - iPhone 17 Pro - 2025-12-29 at 11 28 44" src="https://github.com/user-attachments/assets/0889f16c-f2ee-4a0e-9a4d-529dd82c8283" />
2. Run `prebuild-ios -s` and verified that the scripts downloads the Hermes V1 tarball
<img width="831" height="324" alt="Screenshot 2025-12-29 at 10 37 53" src="https://github.com/user-attachments/assets/9a60565e-1e13-4967-a4a4-dd079e6b040f" />
3. GHA and nightlies

Reviewed By: vzaidman, cortinico, huntie

Differential Revision: D89881943

Pulled By: cipolleschi

fbshipit-source-id: 958b6d31bd4230ba4a5c7fee2bffc19e03dcbc89
2026-01-07 05:34:12 -08:00
Jakub Piasecki 076e6a1d53 Use prebuilt Hermes by default when building Android (#54707)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54707

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D87929652

fbshipit-source-id: 439eef5eea9b9203cf2a7b5a8eae38d83e192bd5
2025-12-15 08:13:16 -08:00
Tomasz Żelawski dd1f83e616 fix: RNGP CCache compatibility (#54829)
Summary:
Invoking `Runtime.getRuntime().exec()` is not compatible with Gradle Configuration Cache and providers should be used instead.

This error hasn't surfaced yet due to fact that this branch of code is rarely hit as the users usually provide correct path to the CLI in their `app/build.gradle` file. I stumbled upon it accidentally when bumping RN in monorepo and the CLI path was no longer valid.

Re-opened due to failing tests in the previous PR https://github.com/facebook/react-native/issues/54801

## Changelog:

[ANDROID] [FIXED] - RNGP using node invocation non-compatible with Gradle Compilation Cache

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

Test Plan:
I tested it in a rnc-cli app, where I provided an invalid path for `cliFile` - the error was fixed after applying this patch.

`./gradlew -p packages/gradle-plugin/ test` now works properly.

Reviewed By: mdvacca

Differential Revision: D88757054

Pulled By: cortinico

fbshipit-source-id: 07b86f8cf4d242dee30b97b7768602ff9b60ed54
2025-12-10 07:25:29 -08:00
Nicola Corti b1b2cab158 Back out "fix: RNGP using node invocation non-compatible with Gradle Compilation Cache"
Summary:
Original commit changeset: a91e47b90937

Original Phabricator Diff: D88492310

bypass-github-export-checks

Reviewed By: javache

Differential Revision: D88727116

fbshipit-source-id: 847c78776d9628448811158673ac8530e09a8238
2025-12-09 02:57:25 -08:00
Tomasz Żelawski dc73ec438a fix: RNGP using node invocation non-compatible with Gradle Compilation Cache (#54801)
Summary:
Invoking `Runtime.getRuntime().exec()` is not compatible with Gradle Configuration Cache and providers should be used instead.

This error hasn't surfaced yet due to fact that this branch of code is rarely hit as the users usually provide correct path to the CLI in their `app/build.gradle` file. I stumbled upon it accidentally when bumping RN in monorepo and the CLI path was no longer valid.

## Changelog:

[ANDROID] [FIXED] - RNGP using node invocation non-compatible with Gradle Compilation Cache

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

Test Plan: I tested it in a rnc-cli app, where I provided an invalid path for `cliFile` - the error was fixed after applying this patch.

Reviewed By: mdvacca, huntie

Differential Revision: D88492310

Pulled By: cortinico

fbshipit-source-id: a91e47b90937945066bde938bdf16b2550322afb
2025-12-08 03:37:13 -08:00
riteshshukla04 5bb3a6d68d fix: Use FQCN to avoid collisions in PackageList.java (#54736)
Summary:
When two different React Native libraries export a package class with the same name but in different namespaces, the generated PackageList.java causes a compilation error due to ambiguous class references.

The current autolinking generates:
``` kotlin
import com.pikachu.NativeStorage;
import com.snowfox.NativeStorage;  // ❌ Compile error: NativeStorage is already defined

public ArrayList<ReactPackage> getPackages() {
    return new ArrayList<>(Arrays.<ReactPackage>asList(
        new MainReactPackage(mConfig),
        new NativeStorage(),  // ❌ Ambiguous reference
        new NativeStorage()   // ❌ Ambiguous reference
    ));
}
```
Solution:-
Use fully qualified class names (FQCN) instead of imports:
``` kotlin
// No imports needed
public ArrayList<ReactPackage> getPackages() {
    return new ArrayList<>(Arrays.<ReactPackage>asList(
        new MainReactPackage(mConfig),
        // pikachu-storage
        new com.pikachu.NativeStorage(),
        // snowfox-storage
        new com.snowfox.NativeStorage()
    ));
}
```

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[ANDROID][FIXED]- Use FQCN to avoid collisions

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

Test Plan:
Updated test.
Also tested on my app and RN tester
<img width="687" height="223" alt="image" src="https://github.com/user-attachments/assets/fe54d0c3-4ab4-4d74-a98f-97243851e8c4" />

CI will tell if build fails

Reviewed By: mdvacca

Differential Revision: D88157961

Pulled By: cortinico

fbshipit-source-id: 5fe072dcaed177af1036ca88d55870081a3f4205
2025-12-03 09:26:55 -08:00
Jakub Piasecki 27bb34c006 Always use Hermes artifacts published from Hermes repository (#53833)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53833

Changelog: [GENERAL][CHANGED] - Use Hermes artifacts published independently from React Native

Reviewed By: cortinico

Differential Revision: D82626463

fbshipit-source-id: 99a34a34c53b7f8f1c0da3da8a0e750e42a2e9b7
2025-10-22 09:48:13 -07:00
Nicola Corti 50b1bec2d5 RNGP - Move matchingFallbacks to be called inside maybeCreate("debugOptimized") (#54186)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54186

The `marchingFallback` directive is applied directly on the build type.
However here is invoked inside the `externalNativeBuild` making it confusing, because in reality
it has nothing to do with `externalNativeBuild`. So I'm moving it to the correct location
(this has no effect on the build setup, is just to make the code easier to read).

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D84921628

fbshipit-source-id: 064336ad64a8e1de20b747276f6e5ca7ce7cb677
2025-10-20 08:01:26 -07:00
Nicola Corti 69dc655005 RNGP - Fix build failures encounted with AGP 9.0.0-alpha05 - Round 1 (#53778)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53778

I've been looking into the next major bump of AGP to 9:
https://developer.android.com/build/releases/agp-preview#android-gradle-plugin-built-in-kotlin

This change adapts our project so that it keeps on buildign with AGP 8
(as the bump to 9 would be a breaking change), but it addresses some of the build
failures we'll be having with AGP 9:

- Set `resValues` build option to true (default was changed true -> false in AGP 9)
- Opts out our project from `android.builtInKotlin` and `android.newDsl` for the time being.

Changelog:
[Android] [Fixed] - Fix build failures with RNGP due to AGP 9.0.0-alpha05

Reviewed By: alanleedev

Differential Revision: D82452555

fbshipit-source-id: 99561f039bf943f5ce99008ce073ca86431cfaed
2025-10-13 18:16:18 -07:00
Nivaldo Bondança 64d34080af Update ktfmt component on FBS:master (#53956)
Summary:
X-link: https://github.com/facebookexternal/meta-ar-mr-tooling/pull/200

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

Reviewed By: jselbo

Differential Revision: D82570814

fbshipit-source-id: 6eeade55734548d057c5eae77a9188172473a819
2025-09-26 01:00:36 -07:00
Jakub Piasecki 674fb77d93 Update coordinates for remote artifacts of Hermes V1 (#53822)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53822

Changelog: [GENERAL][FIXED] - Fixed coordinates for Hermes V1 artifacts

Reviewed By: cortinico

Differential Revision: D82639319

fbshipit-source-id: becfab3248f2314af97549eb94feb27b19f5d1af
2025-09-18 01:26:08 -07:00
generatedunixname537391475639613 7e85653c18 xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGlogTaskTest.kt (#53750)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53750

Reviewed By: cortinico

Differential Revision: D82293987

fbshipit-source-id: 46bf93c7b8a2bf48a2246d9f5fc4ab8c1163badf
2025-09-15 13:04:17 -07:00
Nicola Corti 29c1f72801 Do not invoke project. inside BundleHermesCTask (#53718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53718

I've just realized we ended up invoking `project.` inside the execution of `BundleHermesCTask`.
This is an anti-pattern and is breaking Gradle Configuration caching.

Instead we should be checking if hermesV1Enabled is set during the Task registration and pass over this information
to the task.

Changelog:
[Internal] [Changed] -

Reviewed By: j-piasecki

Differential Revision: D82130643

fbshipit-source-id: d2026711666867b3767824381cc5be0af3b476cc
2025-09-11 07:20:25 -07:00
Jakub Piasecki ae89022f9a Use artifacts published from Hermes repository when using Hermes V1 (#53725)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53725

Changelog: [GENERAL][CHANGED] - Changed the coordinates of hermes artifacts when using Hermes V1

Adds a new `version.properties` file to keep which hermes versions should be consumed from Maven once the versions of Hermes and React Native are decoupled. This diff only implements changes necessary for consuming Hermes V1, as we don't want to migrate everything quite yet (0.82).

Reviewed By: cortinico

Differential Revision: D82204203

fbshipit-source-id: d712257a73f7ba54612a55c1b312416376f28b56
2025-09-11 06:36:23 -07:00
generatedunixname537391475639613 481fb612a2 xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTaskTest.kt (#53702)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53702

Reviewed By: cortinico

Differential Revision: D82093601

fbshipit-source-id: 133936f59d155fa1d68358abe4015c7b7b1613a6
2025-09-10 04:41:29 -07:00
Jakub Piasecki 813b9441ca Read Hermes V1 opt-in flag from the app's properties (#53665)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53665

Changelog: [ANDROID][FIXED] - Read the Hermes V1 opt-in flag from the apps properties when building from source

Reviewed By: cortinico

Differential Revision: D82018545

fbshipit-source-id: f3c6fdbac190f47b6bf6836105d9e0909d8b86ba
2025-09-10 00:51:41 -07:00
generatedunixname537391475639613 3d4a4caac8 xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt (#53614)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53614

Reviewed By: javache

Differential Revision: D81764947

fbshipit-source-id: de19d7d89f3a7e19285928f9541b0b47b503d160
2025-09-09 11:34:37 -07:00
Jakub Piasecki 1be852781d Add tests for isHermesV1Enabled (#53601)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53601

Changelog: [Internal]

Adds tests covering the `isHermesV1Enabled` utility function.

Reviewed By: cortinico

Differential Revision: D81681635

fbshipit-source-id: c2c50db65f93b8b58ce1730ccfdf4367a024ce7b
2025-09-04 23:31:08 -07:00
Jakub Piasecki 2e0bd13a25 Use hermesc from node_modules when consuming prebuilt hermes (#53581)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53581

Changelog: [General][Changed] - Changed the source of hermesc binary to be an npm package

Reviewed By: cipolleschi, cortinico

Differential Revision: D81224001

fbshipit-source-id: 552d0e66fb891974d7b688bfc0bec95e19345d86
2025-09-04 07:42:12 -07:00
Jakub Piasecki 3e9990f860 Allow to opt-in to use the new Hermes on Android (#53580)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53580

Changelog: [ANDROID][ADDED] Added opt-in to use the new Hermes

Reviewed By: cortinico

Differential Revision: D81035114

fbshipit-source-id: d01e44190941d161cf641ec4e03ed487aff18dd8
2025-09-04 07:42:12 -07:00
generatedunixname537391475639613 7a4d5ad644 xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTaskTest.kt (#53597)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53597

Reviewed By: cortinico

Differential Revision: D81662100

fbshipit-source-id: f41c89a059dd0d8e312e5edc07172e1d8cac6597
2025-09-04 03:49:37 -07:00
generatedunixname537391475639613 c1320eb2e1 xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt (#53559)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53559

Reviewed By: cortinico

Differential Revision: D81476261

fbshipit-source-id: f3f38664a7dc63a11b027ab2b6a5a65ca374ebaa
2025-09-02 14:58:53 -07:00
generatedunixname537391475639613 0e1b1ad469 xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGlogTaskTest.kt (#53506)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53506

Reviewed By: javache

Differential Revision: D81222404

fbshipit-source-id: 514cbe3689a6e71d08266cdab33b8f84f318c118
2025-08-28 10:48:59 -07:00
generatedunixname537391475639613 daecb7a059 xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PreparePrefabHeadersTask.kt (#53497)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53497

Reviewed By: cortinico

Differential Revision: D81219754

fbshipit-source-id: a1798365904da1c94d913017950cd5d0469d11a2
2025-08-28 06:56:39 -07:00
generatedunixname537391475639613 abb310e089 xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt (#53498)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53498

Reviewed By: cortinico

Differential Revision: D81218257

fbshipit-source-id: ccb912733e9d3f393e06aad6d38ac1809aa62218
2025-08-28 04:30:16 -07:00
generatedunixname537391475639613 f215d4c797 xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt (#53479)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53479

Reviewed By: javache

Differential Revision: D81024444

fbshipit-source-id: 6b39f1c915f1340cb985c4a74d3ec1adfd8324d8
2025-08-27 04:45:02 -07:00
generatedunixname537391475639613 b7ac655a11 xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/TaskTestUtils.kt (#53458)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53458

Reviewed By: rshest

Differential Revision: D80931289

fbshipit-source-id: 5da865e62ae5d4ef248d7e7f17357386f0b2b9b4
2025-08-26 05:23:42 -07:00
generatedunixname537391475639613 ec1ee19cda xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt (#53358)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53358

Reviewed By: cortinico, cipolleschi

Differential Revision: D80605883

fbshipit-source-id: cf576ee6e6c941eaef25ebf835c771e9bb3d5669
2025-08-25 18:37:02 -07:00
generatedunixname537391475639613 5848252ee2 xplat/js/react-native-github/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PreparePrefabHeadersTaskTest.kt (#53423)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53423

Reviewed By: rshest

Differential Revision: D80786149

fbshipit-source-id: 81df8592b142df2f9d9178c13a9480a7186c2604
2025-08-22 04:12:06 -07:00
Jakub Piasecki 776fca1e7c Change hermes atrifact names (#53094)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53094

Changelog: [General][Changed] - Changed names of hermes binaries

Reviewed By: cipolleschi, cortinico

Differential Revision: D79163127

fbshipit-source-id: 54be34ba1f6ce90067768394ca9a6e9c4048be90
2025-08-21 04:00:04 -07:00
Nivaldo Bondança d1a1020a4a Codemod format for trailing commas change
Reviewed By: VladimirMakaev

Differential Revision: D80576929

fbshipit-source-id: 1310f77f5d9d489b780b14875454ebda7f7adfc9
2025-08-19 18:15:18 -07:00
Nicola Corti 7f93b664b4 Gradle to 9.0 (#53281)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53281

This is still a of bumping Gradle to the latest Major (9.0)
Full list of changes is here: https://gradle.org/whats-new/gradle-9/

I don't expect any breaking changes for React Native users.

Changelog:
[Android] [Breaking] - **deps:** Gradle to 9.0

Reviewed By: cipolleschi

Differential Revision: D79445941

fbshipit-source-id: 0af495a2cc6bb4cca1e37d5f0693b77e42010df2
2025-08-14 09:42:56 -07:00
Nivaldo Bondança 2ab6f22f26 Codemod format for trailing commas incoming change [5/n] (#53260)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53260

X-link: https://github.com/facebook/yoga/pull/1847

Adding trailing commas.

Reviewed By: cortinico

Differential Revision: D80174965

fbshipit-source-id: 5438fa9ebce13525b1286dd30704138ef99703cb
2025-08-14 07:24:42 -07:00
Nicola Corti ba518bbb30 RNGP - Make sure the newArchEnabled is set to true for all the libs (#53138)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53138

Without this patch, library could break if the user removes the `newArchEnabled=`
property from the `gradle.properties` file.

With this patch instead we hardcode the property to true, so all the libraries can consume
it if they wish.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D79805857

fbshipit-source-id: 88dda707a0d80ac79e96c955ded2ef0823f3d3ff
2025-08-08 03:42:35 -07:00