Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d516dfa authored by Cole Faust's avatar Cole Faust
Browse files

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
parent 5e7c4756
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -1195,12 +1195,21 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
		}
	}
	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