Allow configuration of 'allWarningsAsErrors' in gradle (#38930)

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

As we migrate java to kotlin I noticed that we've introduced few warnings here and there.
I'm introducing a way to configure allWarningsAsErrors in gradle

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D48238321

fbshipit-source-id: 745847bc6e6df94decc54afa8c9041552d91dfee
This commit is contained in:
David Vacca
2023-08-10 16:22:40 -07:00
committed by Facebook GitHub Bot
parent 450e00e5ce
commit 75c1422286
@@ -441,6 +441,11 @@ def reactNativeArchitectures() {
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}
def enableWarningsAsErrors() {
def value = project.getProperties().get("enableWarningsAsErrors")
return value != null ? value : false
}
task packageReactNdkLibsForBuck(type: Copy) {
dependsOn("mergeDebugNativeLibs")
// Shared libraries (.so) are copied from the merged_native_libs folder instead
@@ -484,6 +489,8 @@ android {
kotlinOptions {
// Using '-Xjvm-default=all' to generate default java methods for interfaces
freeCompilerArgs = ['-Xjvm-default=all']
// Using -PenableWarningsAsErrors=true prop to enable allWarningsAsErrors
kotlinOptions.allWarningsAsErrors = enableWarningsAsErrors()
}
defaultConfig {