Skip to content

Commit e13ac03

Browse files
Sangamesh1997AgraVator
authored andcommitted
Observe failOnWarnings for android build (#12040)
Fixes: #6868
1 parent 719c221 commit e13ac03

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,25 @@ subprojects {
197197
}
198198
}
199199

200+
plugins.withId("com.android.base") {
201+
android {
202+
lint {
203+
abortOnError true
204+
if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) {
205+
warningsAsErrors true
206+
}
207+
}
208+
}
209+
tasks.withType(JavaCompile).configureEach {
210+
it.options.compilerArgs += [
211+
"-Xlint:all"
212+
]
213+
if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) {
214+
it.options.compilerArgs += ["-Werror"]
215+
}
216+
}
217+
}
218+
200219
plugins.withId("java") {
201220
dependencies {
202221
testImplementation libraries.junit,

0 commit comments

Comments
 (0)