Skip to content

Commit

Permalink
android-interop-testing: ErrorProne should ignore generated R class
Browse files Browse the repository at this point in the history
This silences many MutablePublicArray warnings that we can't do anything
about.
  • Loading branch information
ejona86 committed Dec 17, 2020
1 parent 9c5427f commit 499694e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions android-interop-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ tasks.withType(JavaCompile) {
options.compilerArgs += [
"-Xlint:-cast"
]
appendToProperty(it.options.errorprone.excludedPaths, ".*/R.java", "|")
// Reuses source code from grpc-interop-testing, which targets Java 7 (no method references)
options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF)
}
Expand Down
15 changes: 13 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ subprojects {
}

tasks.withType(JavaCompile) {
it.options.errorprone.excludedPaths = ".*/src/generated/[^/]+/java/.*" +
"|.*/build/generated/source/proto/[^/]+/java/.*"
appendToProperty(
it.options.errorprone.excludedPaths,
".*/src/generated/[^/]+/java/.*" +
"|.*/build/generated/source/proto/[^/]+/java/.*",
"|")
}
}

Expand Down Expand Up @@ -244,6 +247,14 @@ subprojects {
}
dependencies.runtimeOnly libraries.errorprone
}

appendToProperty = { Property<String> property, String value, String separator ->
if (property.present) {
property.set(property.get() + separator + value)
} else {
property.set(value)
}
}
}

configurations {
Expand Down

0 comments on commit 499694e

Please sign in to comment.