react-native-macos/packages/react-native-gradle-plugin
Geraint White 91adb761cf Add hermesFlagsForVariant and deleteDebugFilesForVariant (#32281)
Summary:
Ref https://github.com/facebook/react-native/issues/25601#issuecomment-510856047.

From https://github.com/facebook/react-native/pull/31040.

The `hermesFlagsRelease` option only works with the release build type, but not with other build types.

This PR allows hermes flags on a per variant basis to be specified using the `hermesFlagsForVariant` lambda.

It also allows the hermes debugger cleanup to be run on a per variant basis using the `deleteDebugFilesForVariant` lambda.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Fix hermesFlags not working with multiple variants

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

Test Plan:
Set the following options in `android/app/build.gradle` and ensure warnings are hidden when running `./gradlew assembleRelease` and `./gradlew assembleLive`.

```
    hermesFlagsForVariant: {
        def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('live') ? ['-w'] : []
    },
    deleteDebugFilesForVariant: {
        def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('live')
    },
```

Reviewed By: cortinico

Differential Revision: D31234241

Pulled By: ShikaSD

fbshipit-source-id: 2cb3dd63adbcd023061076b5a3b262a87b470518
2021-10-13 12:50:25 -07:00
..
gradle/wrapper Bump Kotlin and Gradle versions (#32319) 2021-10-13 06:02:18 -07:00
src Add hermesFlagsForVariant and deleteDebugFilesForVariant (#32281) 2021-10-13 12:50:25 -07:00
README.md Add a README before publishing this package 2021-09-27 09:23:33 -07:00
build.gradle.kts Bump Kotlin and Gradle versions (#32319) 2021-10-13 06:02:18 -07:00
gradlew Setup Gradle Wrapper inside packages/react-native-gradle-plugin/ (#32140) 2021-09-06 02:42:30 -07:00
gradlew.bat Re-sync with internal repository (#32212) 2021-09-15 10:45:06 +01:00
package.json Add a README before publishing this package 2021-09-27 09:23:33 -07:00
settings.gradle.kts Do not use `kotlin-dsl` inside `react-native-gradle-plugin` (#32139) 2021-09-06 02:47:50 -07:00

README.md

react-native-gradle-plugin

Version

A Gradle Plugin used to support development of React Native applications for Android.

Installation

yarn add react-native-gradle-plugin

Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like