Skip errorprone on protobuf/aidl-only modules
Some protobuf modules like perfetto_trace-full take a long time
to analyze with errorprone, in that case it took over 10 minutes.
Skip errorprone on protobuf or aidl-only modules because having
warnings on generated source code isn't useful anyways.
Bug: 242630963
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I5e73accd0b56a0a71e75927778c5c04a0d358e67
diff --git a/java/base.go b/java/base.go
index fe92b47..2da7cbd 100644
--- a/java/base.go
+++ b/java/base.go
@@ -1195,12 +1195,21 @@
}
}
if len(uniqueSrcFiles) > 0 || len(srcJars) > 0 {
+ hasErrorproneableFiles := false
+ for _, ext := range j.sourceExtensions {
+ if ext != ".proto" && ext != ".aidl" {
+ // Skip running errorprone on pure proto or pure aidl modules. Some modules take a long time to
+ // compile, and it's not useful to have warnings on these generated sources.
+ hasErrorproneableFiles = true
+ break
+ }
+ }
var extraJarDeps android.Paths
if Bool(j.properties.Errorprone.Enabled) {
// If error-prone is enabled, enable errorprone flags on the regular
// build.
flags = enableErrorproneFlags(flags)
- } else if ctx.Config().RunErrorProne() && j.properties.Errorprone.Enabled == nil {
+ } else if hasErrorproneableFiles && ctx.Config().RunErrorProne() && j.properties.Errorprone.Enabled == nil {
// Otherwise, if the RUN_ERROR_PRONE environment variable is set, create
// a new jar file just for compiling with the errorprone compiler to.
// This is because we don't want to cause the java files to get completely