Observe failOnWarnings for android build (#12040)
Fixes: #6868
diff --git a/build.gradle b/build.gradle
index f80b27a..35f7161 100644
--- a/build.gradle
+++ b/build.gradle
@@ -197,6 +197,25 @@
}
}
+ plugins.withId("com.android.base") {
+ android {
+ lint {
+ abortOnError true
+ if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) {
+ warningsAsErrors true
+ }
+ }
+ }
+ tasks.withType(JavaCompile).configureEach {
+ it.options.compilerArgs += [
+ "-Xlint:all"
+ ]
+ if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) {
+ it.options.compilerArgs += ["-Werror"]
+ }
+ }
+ }
+
plugins.withId("java") {
dependencies {
testImplementation libraries.junit,