File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,15 @@ android {
2020 versionName " 1.0"
2121 testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
2222 }
23- lintOptions { abortOnError true }
23+
24+ // fail on android lint warnings if failOnWarning is set true
25+ lintOptions {
26+ abortOnError true
27+ if (rootProject. hasProperty(" failOnWarnings" ) && rootProject. failOnWarnings. toBoolean()) {
28+ warningsAsErrors true
29+ }
30+ }
31+
2432 publishing {
2533 singleVariant(' release' ) {
2634 withSourcesJar()
@@ -44,6 +52,14 @@ dependencies {
4452 testImplementation libraries. truth
4553}
4654
55+ // Enforce -Werror on java compiler if failOnWarning is set
56+ tasks. withType(JavaCompile ). configureEach {
57+ it. options. compilerArgs + = [" -Xlint:all" ]
58+ if (rootProject. hasProperty(" failOnWarnings" ) && rootProject. failOnWarnings. toBoolean()) {
59+ it. options. compilerArgs + = [" -Werror" ]
60+ }
61+ }
62+
4763tasks. register(" javadocs" , Javadoc ) {
4864 source = android. sourceSets. main. java. srcDirs
4965 classpath + = files(android. getBootClasspath())
You can’t perform that action at this time.
0 commit comments