Move errorprone dependency to compiled classes jar

The resources jar and the combined jar are not always used, so
add the errorprone dependency to the compiled jar.

Test: m -j checkbuild
Change-Id: Iaa10a04347758c676bb704969b86f9442e6c3175
This commit is contained in:
Colin Cross 2017-09-27 17:39:56 -07:00
parent 86a63ff366
commit d689143f1d
1 changed files with 9 additions and 13 deletions

View File

@ -377,8 +377,6 @@ func (j *Module) compile(ctx android.ModuleContext) {
flags.javaVersion = "${config.DefaultJavaVersion}"
}
var extraDeps android.Paths
flags.bootClasspath.AddPaths(deps.bootClasspath)
flags.classpath.AddPaths(deps.classpath)
@ -405,28 +403,26 @@ func (j *Module) compile(ctx android.ModuleContext) {
deps.srcFileLists = append(deps.srcFileLists, j.ExtraSrcLists...)
var extraJarDeps android.Paths
var jars android.Paths
if len(srcFiles) > 0 {
// Compile java sources into .class files
classes := TransformJavaToClasses(ctx, srcFiles, deps.srcFileLists, flags, extraDeps)
if ctx.Failed() {
return
}
var extraJarDeps android.Paths
if ctx.AConfig().IsEnvTrue("RUN_ERROR_PRONE") {
// If error-prone is enabled, add an additional rule to compile the java files into
// a separate set of classes (so that they don't overwrite the normal ones and require
// a rebuild when error-prone is turned off). Add the classes as a dependency to
// the jar command so the two compiles can run in parallel.
// a rebuild when error-prone is turned off).
// TODO(ccross): Once we always compile with javac9 we may be able to conditionally
// enable error-prone without affecting the output class files.
errorprone := RunErrorProne(ctx, srcFiles, deps.srcFileLists, flags, extraDeps)
errorprone := RunErrorProne(ctx, srcFiles, deps.srcFileLists, flags, nil)
extraJarDeps = append(extraJarDeps, errorprone)
}
// Compile java sources into .class files
classes := TransformJavaToClasses(ctx, srcFiles, deps.srcFileLists, flags, extraJarDeps)
if ctx.Failed() {
return
}
jars = append(jars, classes)
}