Summary:
This PR adds the basic `ktfmt` setup in OSS to lint Kotlin files before they're imported into the Meta codebase, making collaboration with external contributors smoother for Android related PRs.
I tried to put together certain rules that mimic the current code style and it seems to work well as I get no errors for properly formatted files but this still might need some input to have the correct configuration.
Added two scripts to the main package.json:
- To check the files format you can run: `yarn lint-kotlin-check`
- To apply formatting fixes, run: `yarn lint-kotlin`
## Changelog:
[INTERNAL] - Kotlin: Set up ktfmt in OSS
Pull Request resolved: https://github.com/facebook/react-native/pull/52064
Test Plan:
Unformat any random Kotlin file inside ReactAndroid and then run:
```sh
yarn lint-kotlin-check
yarn lint-kotlin
```
Reviewed By: cipolleschi
Differential Revision: D78272876
Pulled By: cortinico
fbshipit-source-id: 0cf6b976968dfc5c6c478e88d17eb21c18961a34
Summary:
Resolved a build error [issue https://github.com/facebook/react-native/issues/51297](https://github.com/facebook/react-native/issues/51297) caused by assigning a Boolean to a Property<Boolean>.
Switched from direct assignment to using .set(...) to correctly configure allWarningsAsErrors from project properties.
## Changelog:
- Gradle fix: assign allWarningsAsErrors using .set() for Property<Boolean>
<!-- 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] - [ANDROID] [FIXED]
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: https://github.com/facebook/react-native/pull/51300
Test Plan:
Fixes build failure with React Native v0.79.2 and Gradle v8.0.
```
npm run start
npm run android
```
no more build errors
Reviewed By: cortinico
Differential Revision: D74706741
Pulled By: rshest
fbshipit-source-id: 31ec923f49a6da63fb5abb464bc38b99b1e8650a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50780
This bumps Kotlin to the latest stable: 2.1.20.
I've also fixed several warnings emitted by the new compiler.
Changelog:
[Android] [Changed] - Kotlin to 2.1.20
Reviewed By: rshest
Differential Revision: D73122000
fbshipit-source-id: 019a01d085b2c115a3efcf567056e9990a1ff0ce
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
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
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