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
Update Gradle, Error Prone plugin, and Android Gradle Plugin #294
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
import com.android.build.gradle.api.BaseVariant | ||
import net.ltgt.gradle.errorprone.CheckSeverity | ||
|
||
plugins { | ||
|
@@ -39,6 +40,29 @@ android { | |
lintOptions { | ||
abortOnError false | ||
} | ||
|
||
DomainObjectSet<BaseVariant> variants = getApplicationVariants() // or getLibraryVariants() in libraries | ||
variants.addAll(getTestVariants()) | ||
variants.addAll(getUnitTestVariants()) | ||
variants.configureEach { variant -> | ||
variant.getJavaCompileProvider().configure { | ||
options.errorprone { | ||
check("NullAway", CheckSeverity.ERROR) | ||
option("NullAway:AnnotatedPackages", "com.uber") | ||
} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have we tried manually injecting a I am not sure we have integration tests for this config, so is worth doing that small manual sanity check :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @ZacSweers, would you mind rebasing and testing this? After that I'd be glad to merge this. Edit: Actually, never mind, testing it now :) |
||
|
||
// If you want to disable NullAway in justs tests, you can do the below | ||
// DomainObjectSet<BaseVariant> testVariants = getTestVariants() | ||
// testVariants.addAll(getUnitTestVariants()) | ||
// testVariants.configureEach { variant -> | ||
// variant.getJavaCompileProvider().configure { | ||
// options.errorprone { | ||
// check("NullAway", CheckSeverity.OFF) | ||
// } | ||
// } | ||
// } | ||
} | ||
|
||
dependencies { | ||
|
@@ -49,14 +73,3 @@ dependencies { | |
testImplementation deps.test.junit4 | ||
|
||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
// remove the if condition if you want to run NullAway on test code | ||
if (!name.toLowerCase().contains("test")) { | ||
options.errorprone { | ||
check("NullAway", CheckSeverity.ERROR) | ||
option("NullAway:AnnotatedPackages", "com.uber") | ||
} | ||
} | ||
} | ||
|
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 seems very very low, but if it works for building NullAway, then all the better, I suppose.