Partial sync of gradle conventions with sdk repo (#4836)

* Sync gradle conventions

* oops
This commit is contained in:
Trask Stalnaker 2021-12-08 03:50:32 -08:00 committed by GitHub
parent f5016109f2
commit d52f62522d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 52 deletions

View File

@ -8,78 +8,82 @@ dependencies {
errorprone("com.google.errorprone:error_prone_core")
}
val disableErrorProne = gradle.startParameter.projectProperties.get("disableErrorProne")?.toBoolean()
?: false
val disableErrorProne = properties["disableErrorProne"]?.toString()?.toBoolean() ?: false
tasks {
withType<JavaCompile>().configureEach {
options.errorprone {
isEnabled.set(!disableErrorProne)
with(options) {
errorprone {
if (disableErrorProne) {
logger.warn("Errorprone has been disabled. Build may not result in a valid PR build.")
isEnabled.set(false)
}
disableWarningsInGeneratedCode.set(true)
allDisabledChecksAsWarnings.set(true)
disableWarningsInGeneratedCode.set(true)
allDisabledChecksAsWarnings.set(true)
excludedPaths.set(".*/build/generated/.*|.*/concurrentlinkedhashmap/.*")
excludedPaths.set(".*/build/generated/.*|.*/concurrentlinkedhashmap/.*")
disable("BooleanParameter")
disable("BooleanParameter")
// Doesn't work well with Java 8
disable("FutureReturnValueIgnored")
// Doesn't work well with Java 8
disable("FutureReturnValueIgnored")
// Require Guava
disable("AutoValueImmutableFields")
disable("StringSplitter")
disable("ImmutableMemberCollection")
// Require Guava
disable("AutoValueImmutableFields")
disable("StringSplitter")
disable("ImmutableMemberCollection")
// Don't currently use this (to indicate a local variable that's mutated) but could
// consider for future.
disable("Var")
// Don't currently use this (to indicate a local variable that's mutated) but could
// consider for future.
disable("Var")
// Don't support Android without desugar
disable("AndroidJdkLibsChecker")
disable("Java7ApiChecker")
disable("StaticOrDefaultInterfaceMethod")
// Don't support Android without desugar
disable("AndroidJdkLibsChecker")
disable("Java7ApiChecker")
disable("StaticOrDefaultInterfaceMethod")
// Great check, but for bytecode manipulation it's too common to separate over
// onEnter / onExit
// TODO(anuraaga): Only disable for auto instrumentation project.
disable("MustBeClosedChecker")
// Great check, but for bytecode manipulation it's too common to separate over
// onEnter / onExit
// TODO(anuraaga): Only disable for auto instrumentation project.
disable("MustBeClosedChecker")
// Common to avoid an allocation. Revisit if it's worth opt-in suppressing instead of
// disabling entirely.
disable("MixedMutabilityReturnType")
// Common to avoid an allocation. Revisit if it's worth opt-in suppressing instead of
// disabling entirely.
disable("MixedMutabilityReturnType")
// We end up using obsolete types if a library we're instrumenting uses them.
disable("JdkObsolete")
disable("JavaUtilDate")
// We end up using obsolete types if a library we're instrumenting uses them.
disable("JdkObsolete")
disable("JavaUtilDate")
// Limits API possibilities
disable("NoFunctionalReturnType")
// Limits API possibilities
disable("NoFunctionalReturnType")
// Storing into a variable in onEnter triggers this unfortunately.
// TODO(anuraaga): Only disable for auto instrumentation project.
disable("UnusedVariable")
// Storing into a variable in onEnter triggers this unfortunately.
// TODO(anuraaga): Only disable for auto instrumentation project.
disable("UnusedVariable")
// TODO(anuraaga): Remove this, we use this pattern in several tests and it will mean
// some moving.
disable("DefaultPackage")
// TODO(anuraaga): Remove this, we use this pattern in several tests and it will mean
// some moving.
disable("DefaultPackage")
// TODO(anuraaga): Remove this, all our advice classes miss constructors but probably should
// address this.
disable("PrivateConstructorForUtilityClass")
// TODO(anuraaga): Remove this, all our advice classes miss constructors but probably should
// address this.
disable("PrivateConstructorForUtilityClass")
// TODO(anuraaga): Remove this, probably after instrumenter API migration instead of dealing
// with older APIs.
disable("InconsistentOverloads")
disable("TypeParameterNaming")
// TODO(anuraaga): Remove this, probably after instrumenter API migration instead of dealing
// with older APIs.
disable("InconsistentOverloads")
disable("TypeParameterNaming")
// We don't use tools that recognize.
disable("InlineMeSuggester")
disable("DoNotCallSuggester")
// We don't use tools that recognize.
disable("InlineMeSuggester")
disable("DoNotCallSuggester")
if (name.contains("Jmh") || name.contains("Test")) {
disable("HashCodeToString")
disable("MemberName")
if (name.contains("Jmh") || name.contains("Test")) {
disable("HashCodeToString")
disable("MemberName")
}
}
}
}

View File

@ -32,5 +32,7 @@ jmhReport {
tasks {
named("jmh") {
finalizedBy(named("jmhReport"))
outputs.cacheIf { false }
}
}