-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Android: Add failOnWarnings check to android build.gradle and configure lint as warnings as error #12040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…re lint as warnings as error
@vinodhabib Please review and share feedback on any changes or improvements needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've done both (linter warnings and enabling -Werror) the mentioned issues in this PR. That's fine for me. @ejona86 should be able to tell us if we shouldn't be doing like this.
android/build.gradle
Outdated
lintOptions { abortOnError true } | ||
|
||
// fail on android lint warnings if failOnWarning is set true | ||
lintOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are doing this anyway, lintOptions is deprecated. Use lint instead. (Wait for Eric's comment on this before working)
android/build.gradle
Outdated
@@ -44,6 +52,14 @@ dependencies { | |||
testImplementation libraries.truth | |||
} | |||
|
|||
// Enforce -Werror on java compiler if failOnWarning is set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may remove the comments as they are self explanatory.
android/build.gradle
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is adding it to grpc-android only. We actually want this on all android-related builds, which would include android-interop-testing, binder, and cronet as well. For that, the configuration should go in build.gradle and activate when the plugins com.android.application or com.android.library are used. You would use plugins.withId()
for that, similar to the existing plugins.withId("java")
and similar blocks. The easiest way may be to use plugins.withId("com.android.base")
, which is the base plugin for both library and application.
Android: Add failOnWarnings check to android build.gradle and configure lint as warnings as error.
Fixes: #6868