Commit Graph

53 Commits

Author SHA1 Message Date
Vojtech Novak 9147b0753a fix IOException in BuildCodegenCLITask (#48008)
Summary:
building RN tester with 0.77 rc-0 doesn't work now because of `java.io.IOException:  No such file or directory` on line 48.

`buildDirectory` is a Gradle property representing a file

https://github.com/facebook/react-native/pull/47552 removes this file altogether so feel free to close if that one is the "right one"

## Changelog:

[ANDROID] [FIXED] - fix IOException in `BuildCodegenCLITask`

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

Test Plan: After this change, building RN tester works.

Reviewed By: cortinico

Differential Revision: D66650038

Pulled By: robhogan

fbshipit-source-id: 11cd83493fa118c6b79d11c9113228dd3971a803
2024-12-02 05:09:54 -08:00
Nicola Corti 490db92562 Gradle to 8.11.1 (#48026)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48026

This should mitigate this particular issue we're seeing on Windows:
- https://github.com/facebook/react-native/issues/46210

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

Reviewed By: javache

Differential Revision: D66600321

fbshipit-source-id: d58437485222e189d90bcf4d6b41ca956449ed22
2024-12-02 03:22:32 -08:00
Nicola Corti e64513bf4e RNGP - Do not attempt to substring to 1024 while logging. (#47509)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47509

Fixes https://github.com/facebook/react-native/issues/47504

Changelog:
[Android] [Fixed] - RNGP - Do not attempt to substring to 1024 while logging

Reviewed By: javache

Differential Revision: D65659586

fbshipit-source-id: 8fa16131cea96b8b6aa9c0224c7b990a4f51175f
2024-11-08 04:57:15 -08:00
Nicola Corti 1f62529dc4 Properly handle paths with spaces in autolinking (#47388)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47388

Fixes https://github.com/facebook/react-native/issues/47364
Fixes https://github.com/facebook/react-native/issues/47377
Fixes https://github.com/facebook/react-native/issues/37124

We're having problems is a path contains a space ' ' because when autolinking,
the `add_subdirectory()` function of CMake consider the path with space as 2 parameters.

This fixes it by properly quoting the path.

Changelog:
[Android] [Fixed] - Properly handle paths with spaces in autolinking

Reviewed By: cipolleschi

Differential Revision: D65434413

fbshipit-source-id: b9147482f98f7e222405cc8d9e6f3c17a5f4ed02
2024-11-05 03:32:16 -08:00
Nicola Corti e1a1cead43 AGP to 8.7.2 (#47369)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47369

This just bumps the AGP patch version to the latest stable.

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

Reviewed By: tdn120

Differential Revision: D65336357

fbshipit-source-id: 9a7464304ba29f6b752f41b252bde9cb0eca0e9a
2024-11-04 05:57:22 -08:00
Alan Lee 65cdd5b82c Enable 16KB page size binaries for RN libraries + hermes (#47042)
Summary:
X-link: https://github.com/facebook/hermes/pull/1557

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

Add native build flags to support 16KB page size

- https://developer.android.com/guide/practices/page-sizes#compile-r27-higher

Changelog:
[Android][Added] add cmake arguments to support 16KB page size for native libraries

Reviewed By: cortinico

Differential Revision: D64446876

fbshipit-source-id: 5c6b7874a8837c7ebc9b3e9267ce11fb152bf535
2024-10-31 18:45:31 -07:00
Nicola Corti 11392c74d7 AGP to 8.7.1 (#47022)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47022

That's just a patch bump for AGP from 8.7.0 to 8.7.1

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

Reviewed By: cipolleschi

Differential Revision: D64390797

fbshipit-source-id: b48218b5737b8e7379ab4f13dfa57a97c3e30cbd
2024-10-15 06:08:09 -07:00
Nicola Corti 972c2c864c Bump Kotlin 1.9.x to 2.0.x (#46955)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46955

This is a major bump of Kotlin. It comes with no breaking changes for the Kotlin API, but there are several new warnigns that I had to fix.
Most importantly several `override` methods that are overriding Deprecated API, also need to be deprecated as well in Kotlin.

Changelog:
[Android] [Changed] - Bump Kotlin 1.9.x to 2.0.x

Reviewed By: tdn120

Differential Revision: D64179842

fbshipit-source-id: 295ab2636ce9f9bb04e9d8c7ed27d9f8a1a64338
2024-10-11 05:34:02 -07:00
Nicola Corti 2c4567562c RNGP - Pass PROJECT_ROOT_DIR to CMake (#46958)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46958

This will make it easier to link against custom C++ TM which will most likely live inside ./shared or
some other paths outside of ./android.

CMake will have access to `PROJECT_ROOT_DIR` which points to ./android (the folder where the settings.gradle file exists).

Changelog:
[Internal] [Changed] - RNGP - Pass PROJECT_ROOT_DIR to CMake

Reviewed By: cipolleschi

Differential Revision: D64183641

fbshipit-source-id: 347256c04f10e92cf5a13e9c70db16aa29bcb741
2024-10-11 03:34:54 -07:00
Nicola Corti cbc0978bb6 Bump AGP to 8.7.0 (#46886)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46886

This brings AGP to the latest stable version.

Changelog:
[Android] [Changed] - Bump Android Gradle Plugin (AGP) to 8.7.0

Reviewed By: tdn120

Differential Revision: D64038466

fbshipit-source-id: d7ba1c8e5840f6c8658f037fc5846fb640ab3922
2024-10-08 10:59:40 -07:00
Nicola Corti c441de5a47 Fix build warning for prepareGlog (#46756)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46756

prepareGlog was firing a warning due to a duplicate config.h file. Here I'm setting so that the file is always overridden (which is the desired behavior) to suppress this warning.

Changelog:
[Internal] [Changed] - Fix build warning for prepareGlog

Reviewed By: cipolleschi

Differential Revision: D63696664

fbshipit-source-id: 83b78afea09c4a5d39f341dd5b604cec466470ae
2024-10-01 10:04:57 -07:00
Nicola Corti eb3d352761 RNGP - Do not apply java-gradle-plugin on root build (#46755)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46755

There is no need to apply `java-gradle-plugin` to the root build of RNGP as that does not contain any Gradle Plugins (they're in subfolders).

This is actually causing the build to be a bit slower as extra tasks for compilation/bundling will be created which are definitely not needed.

Changelog:
[Internal] [Changed] - RNGP - Do not apply `java-gradle-plugin` on root build

Reviewed By: cipolleschi

Differential Revision: D63695934

fbshipit-source-id: 84268105c73b49afdcd94610fcb7006ef53306a4
2024-10-01 10:04:57 -07:00
Nicola Corti d1f47f7ad5 Silence unnecessary Gradle outputs - Part 1 (#46704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46704

Our build log for Gradle is extremely noisy due to Hermes.
Here I'm suppressing all the build output from Hermes as we can't really do much from that side of the build.

This should make it easier for folks on GitHub Actions to immediately spot where are failures.

Changelog:
[Internal] [Changed] - Silence unnecessary Gradle outputs

Reviewed By: GijsWeterings

Differential Revision: D63541175

fbshipit-source-id: d1a60098c317ff9e8c9575b5b8b2aab639f28f2f
2024-09-30 03:55:54 -07:00
Nicola Corti 6eb21ca1fb RNGP: Read enableWarningsAsErrors property correctly (#46657)
Summary:
I've noticed that some users are reporting build failures due to warnings inside RNGP.
We do have `allWarningsAsErrors` set to true for everyone (also for users).
That's too aggressive, and can cause build failures which are not necessary. Let's keep it enabled only on our CI (when the `enableWarningsAsErrors` property is set).

## Changelog:

[INTERNAL] - RNGP: Read `enableWarningsAsErrors` property correctly

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

Test Plan: CI

Reviewed By: NickGerleman

Differential Revision: D63459601

Pulled By: cortinico

fbshipit-source-id: 0307e8d6771518038a5abe27ca5a993cb0a9f8c0
2024-09-27 08:40:14 -07:00
Nicola Corti ecd660984c Gradle to 8.10.2 (#46656)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46656

This contains the fix for:
- https://github.com/gradle/gradle/issues/30472

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

Reviewed By: tdn120

Differential Revision: D63457979

fbshipit-source-id: 1439a9ce198c1df0dafa8f5088c079c3fb3d1543
2024-09-27 00:43:25 -07:00
Nicola Corti c005609b01 Properly set REACTNATIVE_MERGED_SO for autolinked libraries. (#46606)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46606

This fixes this issue reported here:
https://github.com/react-native-community/discussions-and-proposals/discussions/816#discussioncomment-10673136

reported by both SWM and Expo.

The problem is that `REACTNATIVE_MERGED_SO` is not properly set for autolinked libraries so they can't access it
to understand if the version of ReactNative has merged so libraries or not.
This fixes it, I've tested against
https://github.com/tomekzaw/repro-reactnative-merged-so
reproducer provided by tomekzaw

Changelog:
[Android] [Fixed] - Properly set `REACTNATIVE_MERGED_SO` for autolinked libraries

Reviewed By: rubennorte

Differential Revision: D63262687

fbshipit-source-id: c505dce9036bb4cd0366b7ab99412368963273af
2024-09-24 03:35:15 -07:00
Nicola Corti d7884a6bb8 RNGP - Sanitize the output of the config command (#46482)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46482

Fixes https://github.com/facebook/react-native/issues/46443
Fixes https://github.com/facebook/react-native/issues/46134

I'm sanitizing the output of the `config` command + I've added some more logging in case of failure.

Changelog:
[Android] [Fixed] - RNGP - Sanitize the output of the config command

Reviewed By: cipolleschi

Differential Revision: D62641979

fbshipit-source-id: c13d27a42beeb7a973c1802e7204631d49d3d09b
2024-09-13 10:42:20 -07:00
Riccardo Cipolleschi 120558c0cd Bump main to 0.77
Summary:
This change bumps the React Native version in main to 0.77

bypass-github-export-checks

## Changelog:
[General][Changed] - Bump main to 0.77-main

## Facebook:
generated by running `js1 publish react-native 0.77.0-main`

Reviewed By: cortinico

Differential Revision: D62575939

fbshipit-source-id: 6d239fca2eed6cfe51f8c37f78d8dc8730c18b8c
2024-09-12 09:23:23 -07:00
Thomas Nardone c942469700 Re-enable ktfmt on RN (#46441)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46441

Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D62518893

fbshipit-source-id: ca2ff83018716a4dc1e2dcfb8596138d088ce9f4
2024-09-11 19:06:25 -07:00
Nicola Corti 90f89a830a Gradle to 8.10.1 (#46399)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46399

This is a patch release for Gradle. Let's include it inside main/0.76.

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

Reviewed By: tdn120

Differential Revision: D62377887

fbshipit-source-id: e8a5acaa48c15c9a12a09504c33c2a0d2834d92c
2024-09-09 07:26:53 -07:00
Hampus Sjöberg 833c3a2cf5 fix: RNGP autolink not properly filter out pure C++ TurboModules (#46381)
Summary:
Hey.

The react-native gradle plugin didn't properly filter out [Pure](https://github.com/react-native-community/cli/pull/2387) C++ TurboModules for autolinking, which caused build failures as a non-existing gradle dependency would be emitted.

This makes Pure C++ TurboModules work again for Android.

## 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] Fix autolinking issues for Pure C++ TurboModules

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

Test Plan:
https://github.com/hsjoberg/rn75autolinkregression

Try running this repro project to observe the error:

```
1: Task failed with an exception.
-----------
* Where:
Build file '/Users/coco/Projects/Blixt/rn75autolinkregression/example/android/app/build.gradle' line: 54

* What went wrong:
A problem occurred evaluating project ':app'.
> Project with path ':react-native-cxx-turbomodule' could not be found in project ':app'.
```

Simply add the 1-line code from this PR to make the build succeed.

Cheers.

Reviewed By: cipolleschi

Differential Revision: D62377757

Pulled By: cortinico

fbshipit-source-id: 9e3fa3777b4e6e4d3f2eb0f996ac0ac7676eedbe
2024-09-09 07:22:28 -07:00
Nicola Corti aca31eb610 Bump AGP to 8.6.0 (#46368)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46368

This bumps AGP to the latest stable.
Release notes are here https://developer.android.com/build/releases/gradle-plugin

No relevant changes for React Native, other than the requirement on minimum Gradle version.

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

Reviewed By: tdn120

Differential Revision: D62296897

fbshipit-source-id: c34a18ab15dbacd6e5d69003b9e192d7f76d9f8f
2024-09-06 09:28:13 -07:00
Nicola Corti d0a5f8ff51 Gradle to 8.10 (#46369)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46369

This bumps Gradle to the latest stable ahead of the 0.76 branch cut.

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

Reviewed By: tdn120, Abbondanzo

Differential Revision: D62296898

fbshipit-source-id: 59fc119dd6fad3b6b0ebbfcd8166da4cad9b8633
2024-09-06 09:28:13 -07:00
Blake Friedman 0f66a696b4 rebuild autolinking cache if empty or invalid (#46241)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46241

Our test for rebuilding the `autolinking.json` file currently rebuilds everytime if the cached json file ISN'T empty.  This means users who have an empty entry get stuck there.

I've also added more validation that the contents of the cached config have at a minimum the `.project.android.packageName` entry in it, otherwise it rebuilds.

Changelog: [Internal]

Closes 46134

Reviewed By: cortinico

Differential Revision: D61911114

fbshipit-source-id: 188c7f975ce05802c8ea06eaa48345c2bc96f2b2
2024-08-29 10:11:09 -07:00
Nicola Corti 55d35411ae Finalize AssertJ migration (#46097)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46097

I've noticed we still have some tests here and there that were not migrated to AssertJ. This finishes them all.

Changelog:
[Internal] [Changed] - Finalize AssertJ migration

Reviewed By: javache

Differential Revision: D61473682

fbshipit-source-id: 3d51bfeb0e5ba3fd8cd4f3667dc88de3d88a3dbc
2024-08-19 10:51:24 -07:00
Nicola Corti db80d78d7a Merge all the remaining .so libraries into libreactnative.so (#46059)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46059

This merges all the remaining dynamic libraries into libreactnative.so.
Sadly I couldn't split this in smaller diffs as all the libraries are connected with each other.

I also had to introduce 2 other SOs: `libhermestooling.so` and `libjsctooling.so` which contains
all the necessary libs used when loading either JSC or Hermes. They need to be isolated
as RNGP will remove those libraries based on the library the user decides to pick.

Changelog:
[Android] [Breaking] - Merge all the remaining .so libraries into libreactnative.so

Reviewed By: hezi

Differential Revision: D61376496

fbshipit-source-id: ab9e725b7acbebdfd8fa3ff36ad34d080044bf0e
2024-08-16 05:42:46 -07:00
Gabriel Donadel 5ced5f8363 Add shared-testutil folder to NPM files to be published (#45936)
Summary:
React-native 0.75 RC7 gradle sync is currently broken due to the fact that the `shared-testutil` folder is missing from the `react-native/gradle-plugin` npm package

## Changelog:

[INTERNAL] [ADDED] - Add shared-testutil folder to NPM files to be published

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

Test Plan: N/A

Reviewed By: cipolleschi

Differential Revision: D60969631

Pulled By: cortinico

fbshipit-source-id: 850edfe0cf6b0e8174a1df9ea962d207d2ce0112
2024-08-09 05:50:16 -07:00
Antony M. Kithinzi 491c3e9d76 chore: migrate GenerateCodegenArtifactsTaskTest to assertj (#45845)
Summary:
Issue: https://github.com/facebook/react-native/issues/45596

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

[INTERNAL] [CHANGED] - Migrated `packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt` to assertj.

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

Test Plan: Run `./gradlew -p packages/gradle-plugin test`

Reviewed By: hezi

Differential Revision: D60597025

Pulled By: cortinico

fbshipit-source-id: 4228b958c7b9e1506640b9ff217f098e2626ea81
2024-08-02 04:08:08 -07:00
omer-ayhan 84de32b2d7 chore: ☂️ Migrate BundleHermesCTaskTest.kt to AssertJ (#45806)
Summary:
Issue: https://github.com/facebook/react-native/issues/45596

## Changelog:
[INTERNAL] [CHANGED] - Migrate `BundleHermesCTaskTest.kt` to AssertJ testing library

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

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

Test Plan: Run `./gradlew -p packages/gradle-plugin test`

Reviewed By: mdvacca

Differential Revision: D60522760

Pulled By: cortinico

fbshipit-source-id: f7847143d182b29e1bbbba738a0ddae9bf3ee59c
2024-07-31 11:08:30 -07:00
Bogusz Kaszowski 2b39e6307e chore: migrate PrepareJSCTaskTest to assertj (#45842)
Summary:
Issue: https://github.com/facebook/react-native/issues/45596

## Changelog:

[ANDROID] [CHANGED] - Migrated `packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareJSCTaskTest.kt` to assertj.

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

Test Plan: Run `./gradlew -p packages/gradle-plugin test`

Reviewed By: mdvacca, arushikesarwani94

Differential Revision: D60519806

Pulled By: cortinico

fbshipit-source-id: 04e6a35ecafcb08e6935599d863ab62180383ac4
2024-07-31 11:01:18 -07:00
omer-ayhan 575ab78625 chore: ☂️ Migrate GenerateCodegenSchemaTaskTest.kt to AssertJ (#45807)
Summary:
Issue: https://github.com/facebook/react-native/issues/45596

## Changelog:
[INTERNAL] [CHANGED] - Migrate `GenerateCodegenSchemaTaskTest.kt` to AssertJ testing library

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

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

Test Plan: Run `./gradlew -p packages/gradle-plugin test`

Reviewed By: andrewdacenko

Differential Revision: D60509334

Pulled By: cortinico

fbshipit-source-id: 0702958f0c9d03994b0c9a6a1c743f5db84e5703
2024-07-31 04:53:18 -07:00
omer-ayhan 9cd3c57840 chore: ☂️ Migrate PreparePrefabHeadersTaskTest.kt to AssertJ (#45808)
Summary:
Issue: https://github.com/facebook/react-native/issues/45596

## Changelog:
[INTERNAL] [CHANGED] - Migrate `PreparePrefabHeadersTaskTest.kt` to AssertJ testing library

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

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

Test Plan: Run `./gradlew -p packages/gradle-plugin test`

Reviewed By: andrewdacenko

Differential Revision: D60509282

Pulled By: cortinico

fbshipit-source-id: 1b7d9f0c24bb0e8e573f685582c532a38e6b3b13
2024-07-31 04:45:02 -07:00
omerayhan-shft 6aac1de6bb chore: ☂️ Migrate GeneratePackageListTaskTest.kt to AssertJ (#45790)
Summary:
Issue: https://github.com/facebook/react-native/issues/45596

## Changelog:
[INTERNAL] [CHANGED] - Migrate `GeneratePackageListTaskTest.kt` to AssertJ testing library

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

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

Test Plan: Run `./gradlew -p packages/gradle-plugin test`

Reviewed By: sammy-SC

Differential Revision: D60382287

Pulled By: cortinico

fbshipit-source-id: 338c771db9d407f0d83e1c62a8c13ac26d898926
2024-07-29 08:06:28 -07:00
Gabriel Donadel af2cdcb752 RNGP - Filter out null dependencies from getGradleDependenciesToApply (#45749)
Summary:
`getGradleDependenciesToApply` tries to call `implementation:` in all libraries, including the ones that are not supported on Android.

## Changelog:

[INTERNAL] [FIXED] - Filter out platform-specific libraries from the auto-linking gradle plugin

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

Test Plan: CI should be green

Reviewed By: cipolleschi

Differential Revision: D60374769

Pulled By: cortinico

fbshipit-source-id: 33c83e9cc39d81b0e5c497570a936831ebb345f9
2024-07-29 04:08:15 -07:00
Jakub Urban 9bddcdef85 chore: migrate assertions in all unit tests in PrepareBoostTaskTest from jUnit to AssertJ. (#45718)
Summary:
https://github.com/facebook/react-native/issues/45596

Migrated all the assertions to use `assertThat()` function from AssertJ.
Also updated the `prepareBoostTask_withMissingConfiguration_fails` test to use `assertThatThrownBy` to check if the tested task throws a given exception.

## Changelog:
Migrate tests to assertj in these files:

- `packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt`

[INTERNAL] [CHANGED] - Migrated PrepareBoostTaskTest from junit.Assert to assertj.core.api.Assertions.

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

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

Test Plan:
All tests pass when `./gradlew -p packages/gradle-plugin test` command is ran.

<img width="454" alt="image" src="https://github.com/user-attachments/assets/9e954f7b-2208-48a9-ae15-ab642252e6da">

Reviewed By: GijsWeterings

Differential Revision: D60284566

Pulled By: cortinico

fbshipit-source-id: 11af0a0ca574f935e6aab3a7855b5daaeab1a718
2024-07-26 05:45:26 -07:00
Henrique Cicero f4435115cc chore: Migrate FileUtilsTest.kt, NdkConfiguratorUtilsTest.kt and AgpConfiguratorUtilsTest.kt to AssertJ (#45665)
Summary:
Issue: [https://github.com/facebook/react-native/issues/45596](https://github.com/facebook/react-native/issues/45596)

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

[INTERNAL] [CHANGED] - Migrated to AssertJ within files FileUtilsTest.kt, NdkConfiguratorUtilsTest.kt and AgpConfiguratorUtilsTest.kt

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

Test Plan: Run `./gradlew -p packages/gradle-plugin test`

Reviewed By: GijsWeterings

Differential Revision: D60276163

Pulled By: cortinico

fbshipit-source-id: c730acafc37606f1db8d53a61fc9443d88bccdfc
2024-07-26 05:21:33 -07:00
Miguel Daipré 053865bd80 feat: migrate BuildCodegenCLITaskTest and PrepareGlogTaskTest to AssertJ (#45649)
Summary:
Issue: https://github.com/facebook/react-native/issues/45596

## Changelog:

[ANDROID] [CHANGED] - Migrated `BuildCodegenCLITaskTest`, `PrepareGlogTaskTest` from junit.Assert to assertj.core.api.Assertions.

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

Test Plan: Run `./gradlew -p packages/gradle-plugin test`

Reviewed By: christophpurrer

Differential Revision: D60178114

Pulled By: cortinico

fbshipit-source-id: f0cfe9da945829a2bada8e9807eb1877240d93d6
2024-07-25 01:33:28 -07:00
Oskar Kaczmarzyk 4cc46e3ca6 chore: tests migration to assertj (KotlinStdlibCompatUtilsTest, ModelAutolinkingDependenciesJsonTest, PathUtilsTest, DependencyUtilsTest, ProjectUtilsTest) (#45606)
Summary:
https://github.com/facebook/react-native/issues/45596

## Changelog:

Migrated to AssertJ within files:
- `KotlinStdlibCompatUtilsTest.kt`,
- `ModelAutolinkingDependenciesJsonTest.kt`,
- `PathUtilsTest.kt`,
- `DependencyUtilsTest.kt`,
- `ProjectUtilsTest.kt`.

[INTERNAL] [CHANGED] - Migrated `KotlinStdlibCompatUtilsTest`, `ModelAutolinkingDependenciesJsonTest`, `PathUtilsTest`, `DependencyUtilsTest`, `ProjectUtilsTest` from `junit.Assert` to `assertj.core.api.Assertions`.

## Test Plan

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

Reviewed By: javache

Differential Revision: D60166231

Pulled By: cortinico

fbshipit-source-id: 5092e7d0d4c8d0a8737183962bda62ed1f54ccda
2024-07-24 09:44:45 -07:00
gustavoabel 7829de6221 chore: ☂️ migrate BackwardCompatUtilsTest to AssertJ (#45607)
Summary:
Issue: https://github.com/facebook/react-native/issues/45596

## Changelog:

Migrated to AssertJ within file:
- ```BackwardCompatUtilsTest.kt```

Changelog:
[Internal] [Changed] -  chore: ☂️ migrate BackwardCompatUtilsTest to AssertJ

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

Test Plan: Run ```./gradlew -p packages/gradle-plugin test```

Reviewed By: mdvacca

Differential Revision: D60137770

Pulled By: cortinico

fbshipit-source-id: 883b2abee430ce45018808fa934a7949ae23fcaf
2024-07-24 00:08:49 -07:00
Miguel Daipré e7881c2f45 feat: migrate JsonUtilsTest, OsTest and TaskUtilsTest to AssertJ (#45608)
Summary:
Issue: https://github.com/facebook/react-native/issues/45596

Note:

The formatting changes have been altered by Android Studio. `Code -> Format Code`

## Changelog:

[INTERNAL] [CHANGED] - Migrated `JsonUtilsTest`, `OsTest`, `TaskUtilsTest` from junit.Assert to assertj.core.api.Assertions.

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

Test Plan: Run `./gradlew -p packages/gradle-plugin test`

Reviewed By: mdvacca

Differential Revision: D60137234

Pulled By: cortinico

fbshipit-source-id: 236dc46dd04ad1f62a5e11fd77cf2c63bec99cff
2024-07-23 16:56:59 -07:00
Nicola Corti bd4aec869b RNGP - Do not attempt to load JSC from other repositories (#45598)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45598

I've noticed we attempt to load JSC from the Sonatype Snapshot repository.
That is inefficient as we already know that JSC is available only inside node modules.
This change makes the repository resolution stricter by better specifying which
repo can download which dependency.

Changelog:
[Internal] [Changed] - Do not attempt to load JSC from other repositories

Reviewed By: cipolleschi

Differential Revision: D60116002

fbshipit-source-id: 21a2213708f5b0103860a59f3342f1bc0f59cdb9
2024-07-23 08:12:42 -07:00
Nicola Corti 91ecd7eb53 RNGP - Migrate settings-plugin to AssertJ (#45575)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45575

We should move over to use AssertJ as per our linter.
I'm adding it here to a first test and will use it as a reference for some OSS contributions from outside.

Changelog:
[Internal] [Changed] - Migrate settings-plugin to Assertj

Reviewed By: cipolleschi

Differential Revision: D60037797

fbshipit-source-id: 579ed7bf5fb219e25577af3ab87934503ee7898e
2024-07-23 04:41:54 -07:00
Nicola Corti fedbe2d486 Fix core autolinking not working on Windows (#45572)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45572

0.75-rc.5 is currently broken on Windows.

This is due to us invoking `npx react-native-community/cli config` without
a `cmd /c` prefix.

This fixes it by using our function `windowsAwareCommandLine`.
The problem is that this required a lot of refactoring since that util was not available for the settings plugin.

Fixes #45403

Changelog:
[Internal] [Changed] - Fix core autolinking not working on Windows

Reviewed By: cipolleschi

Differential Revision: D60037587

fbshipit-source-id: eefeda7aafc43b9ce08f0f9225b0847fad2f46b7
2024-07-23 04:41:54 -07:00
Nicola Corti fcd526d6cc Improve tests for GenerateAutolinkingNewArchitecturesFileTask (#45510)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45510

This is just a quality of life improvement, where we test the C++ autolinking
code generation a bit more.

Changelog:
[Internal] [Changed] - Improve tests for GenerateAutolinkingNewArchitecturesFileTask

Reviewed By: blakef

Differential Revision: D59907847

fbshipit-source-id: e6367cc3b1c01700310437b73bc984e3666b3499
2024-07-18 04:15:44 -07:00
Nicola Corti aaeb7af700 Add react-native.config.js to autolinking lockfiles (#45511)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45511

This adds react-native.config.js to autolinking default lockfiles
so autolinking can account for changes in that file.

Changelog:
[Internal] [Changed] - Add react-native.config.js to autolinking lockfiles

Reviewed By: blakef

Differential Revision: D59907268

fbshipit-source-id: d5893a3f7b4d5d9f6c6c13042aa6866ad16b2ea4
2024-07-18 04:15:44 -07:00
Nicola Corti cff0d97017 AGP to 8.5.1 (#45406)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45406

Just keep our Android Gradle Plugin version up to date.

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

Reviewed By: cipolleschi

Differential Revision: D59677574

fbshipit-source-id: 5c80391f8c357f26a9452ac5ac059ee8f5aa569c
2024-07-12 09:00:39 -07:00
Nicola Corti b82d7e100c Gradle to 8.9 (#45407)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45407

This bumps to the latest minor of Gradle

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

Reviewed By: NickGerleman

Differential Revision: D59677575

fbshipit-source-id: 05b9afc6f32a9cd11461bc04522d1e522644867e
2024-07-12 09:00:39 -07:00
Miklós Fazekas 3782511350 fix: android autolinkLibrariesFromCommand should handle timeout or non zero exit code (#45333)
Summary:
Fixes: https://github.com/facebook/react-native/issues/45307

## Changelog:

[Android] [Fixed] - if `npx react-native-community/cli config` fails or timeouts proper error is shown and built is aborted, instead of leaving and empty autolinking.json

During build `npx react-native-community/cli config` is generated into autolinking.json. When command fails, we should error and should not leave and empty `autolinking.json`

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

Test Plan:
Output of the reproducer in https://github.com/facebook/react-native/issues/45307 looks like this:

```log
android % ./gradlew assembleDebug
Starting a Gradle Daemon (subsequent builds will be faster)
ERROR: autolinkLibrariesFromCommand: Failed to create /Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/android/build/generated/autolinking/autolinking.json - process npx react-native-community/cli config  exited with error code: 126

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/android/settings.gradle' line: 3

* What went wrong:
A problem occurred evaluating settings 'android'.
> ERROR: autolinkLibrariesFromCommand: Failed to create /Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/android/build/generated/autolinking/autolinking.json - process npx react-native-community/cli config  exited with error code: 126

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 10s
8 actionable tasks: 4 executed, 4 up-to-date
```

Output if you modify the package.json to be invalid looks like this:

```log
android % ./gradlew assembleDebug
ERROR: autolinkLibrariesFromCommand: process npx react-native-community/cli config  exited with error code: 1
JSONError: JSON Error in /Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/package.json:

  35 |     "node": ">=18"
  36 |   },
> 37 |   SOMETHING_NON_JSON
     |   ^
  38 |   "packageManager": "yarn@3.6.4",
  39 |   "resolutions": {
  40 |     "rtn-centered-text": "portal:../RTNCenteredText"

Unexpected token "S" (0x53) in JSON at position 1019 while parsing near "...ode\": \">=18\"\n  },\n  SOMETHING_NON_JSON\n ..."

  35 |     "node": ">=18"
  36 |   },
> 37 |   SOMETHING_NON_JSON
     |   ^
  38 |   "packageManager": "yarn@3.6.4",
  39 |   "resolutions": {
  40 |     "rtn-centered-text": "portal:../RTNCenteredText"

    at parseJson (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/parse-json/index.js:29:21)
    at loadJson (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/loaders.js:48:16)
    at #loadConfiguration (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/ExplorerSync.js:116:36)
    at #loadConfigFileWithImports (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/ExplorerSync.js:87:54)
    at #readConfiguration (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/ExplorerSync.js:84:82)
    at search (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/ExplorerSync.js:50:63)
    at emplace (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/util.js:36:20)
    at ExplorerSync.search (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/ExplorerSync.js:78:42)
    at getUserDefinedOptionsFromMetaConfig (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/index.js:32:37)
    at mergeOptionsBase (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/index.js:60:31)

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/android/settings.gradle' line: 3

* What went wrong:
A problem occurred evaluating settings 'android'.
> ERROR: autolinkLibrariesFromCommand: process npx react-native-community/cli config  exited with error code: 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2s
8 actionable tasks: 4 executed, 4 up-to-date
```

Reviewed By: cipolleschi

Differential Revision: D59582430

Pulled By: cortinico

fbshipit-source-id: bedb9563175cc5c46f5af80cf309769e56b803cc
2024-07-11 03:43:23 -07:00
Nicola Corti ca17d87ed1 Upstream CLI autolinking changes to RNGP (#45314)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45314

Fixes https://github.com/facebook/react-native/issues/45302

I'm ustreaming two changes that happened inside the CLI/Autolinking logic that are
missing inside core autolinking.

Changelog:
[Internal] [Changed] - Upstream CLI autolinking changes to RNGP

Reviewed By: blakef

Differential Revision: D59460504

fbshipit-source-id: a6e7ab6a46fec26620dc965e77b13fdeba84fae3
2024-07-08 09:38:29 -07:00
Gabriel Donadel 20521cc908 Fix Android autolink plugin for libraries that are platform specific (#45223)
Summary:
Fixes https://github.com/facebook/react-native/issues/45222

## Changelog:

[ANDROID] [FIXED] - Fix autolink plugin for libraries that are platform-specific

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

Test Plan: And a library that does not have Android native code such as react-native-segmented-control/segmented-control and sync gradle

Reviewed By: rshest

Differential Revision: D59221562

Pulled By: cortinico

fbshipit-source-id: 55739d63ded63e46897d0d770281f937668c1f50
2024-07-01 05:05:23 -07:00