Allow to use error prone
- Set the property with_error_prone on the gradle command line will
enable a build using error prone. Only one check is enable, unused
import will raise an error. If with_error_prone property is not set,
the behavior is unchanged.
- Remove unused imports.
Change-Id: I06a27e5d93fd3102cf3ef8aff597e1d1bca364d9
diff --git a/build.gradle b/build.gradle
index dc36174..2899f58 100644
--- a/build.gradle
+++ b/build.gradle
@@ -8,6 +8,14 @@
apply plugin: 'idea'
apply plugin: 'com.google.protobuf'
apply plugin: 'com.cookpad.android.licensetools'
+if (project.hasProperty('with_error_prone')) {
+ apply plugin: "net.ltgt.errorprone"
+ tasks.withType(JavaCompile) {
+ options.compilerArgs += [
+ '-XepDisableAllChecks',
+ '-Xep:RemoveUnusedImports:ERROR']
+ }
+}
apply from: 'copyAdditionalJctfCommonFiles.gradle'
@@ -25,6 +33,9 @@
repositories {
mavenCentral()
jcenter()
+ maven {
+ url "https://plugins.gradle.org/m2/"
+ }
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.1'
@@ -34,6 +45,9 @@
// support java9.
// classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
classpath files("third_party/shadow/shadow-2.0.1.jar")
+ if (project.hasProperty('with_error_prone')) {
+ classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.13"
+ }
}
}