diff options
author | Colin Cross <ccross@android.com> | 2017-10-18 14:44:18 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-10-19 20:45:11 +0000 |
commit | 1ee2317555954d49086fa58d46690ef933eb1ae9 (patch) | |
tree | e315d48125cf7f96d065bbe796b8340f3fea21ea /java/java.go | |
parent | 702e0f8ab03edf50e55d08f8b78595462f1f564f (diff) |
Move all jar intermediates to subdirs
Make all the jar intermediates called modulename.jar, and put each
in a subdir for the tool that generated it. This will simplify
using the jars as inputs to genrules and resources.
Test: java_test.go
Change-Id: If00e16bd7df5a4ba24ebc4b68c9ccf2cfda49544
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/java/java.go b/java/java.go index 76e574eba..5310bc800 100644 --- a/java/java.go +++ b/java/java.go @@ -502,6 +502,8 @@ func (j *Module) compile(ctx android.ModuleContext) { var jars android.Paths + jarName := ctx.ModuleName() + ".jar" + if srcFiles.HasExt(".kt") { // If there are kotlin files, compile them first but pass all the kotlin and java files // kotlinc will use the java files to resolve types referenced by the kotlin files, but @@ -515,7 +517,7 @@ func (j *Module) compile(ctx android.ModuleContext) { flags.kotlincClasspath = append(flags.kotlincClasspath, deps.kotlinStdlib...) flags.kotlincClasspath = append(flags.kotlincClasspath, deps.classpath...) - kotlinJar := android.PathForModuleOut(ctx, "classes-kt.jar") + kotlinJar := android.PathForModuleOut(ctx, "kotlin", jarName) TransformKotlinToClasses(ctx, kotlinJar, srcFiles, srcJars, flags) if ctx.Failed() { return @@ -536,13 +538,13 @@ func (j *Module) compile(ctx android.ModuleContext) { // 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 := android.PathForModuleOut(ctx, "classes-errorprone.list") + errorprone := android.PathForModuleOut(ctx, "errorprone", jarName) RunErrorProne(ctx, errorprone, javaSrcFiles, srcJars, flags) extraJarDeps = append(extraJarDeps, errorprone) } // Compile java sources into .class files - classes := android.PathForModuleOut(ctx, "classes-compiled.jar") + classes := android.PathForModuleOut(ctx, "javac", jarName) TransformJavaToClasses(ctx, classes, javaSrcFiles, srcJars, flags, extraJarDeps) if ctx.Failed() { return @@ -570,7 +572,7 @@ func (j *Module) compile(ctx android.ModuleContext) { } if len(resArgs) > 0 { - resourceJar := android.PathForModuleOut(ctx, "res.jar") + resourceJar := android.PathForModuleOut(ctx, "res", jarName) TransformResourcesToJar(ctx, resourceJar, resArgs, resDeps) if ctx.Failed() { return @@ -592,7 +594,7 @@ func (j *Module) compile(ctx android.ModuleContext) { // Optimization: skip the combine step if there is nothing to do outputFile = jars[0] } else { - combinedJar := android.PathForModuleOut(ctx, "classes.jar") + combinedJar := android.PathForModuleOut(ctx, "combined", jarName) TransformJarsToJar(ctx, combinedJar, jars, manifest, false) outputFile = combinedJar } @@ -600,7 +602,7 @@ func (j *Module) compile(ctx android.ModuleContext) { if j.properties.Jarjar_rules != nil { jarjar_rules := android.PathForModuleSrc(ctx, *j.properties.Jarjar_rules) // Transform classes.jar into classes-jarjar.jar - jarjarFile := android.PathForModuleOut(ctx, "classes-jarjar.jar") + jarjarFile := android.PathForModuleOut(ctx, "jarjar", jarName) TransformJarJar(ctx, jarjarFile, outputFile, jarjar_rules) outputFile = jarjarFile if ctx.Failed() { @@ -658,17 +660,17 @@ func (j *Module) compile(ctx android.ModuleContext) { flags.desugarFlags = strings.Join(desugarFlags, " ") - desugarJar := android.PathForModuleOut(ctx, "classes-desugar.jar") + desugarJar := android.PathForModuleOut(ctx, "desugar", jarName) TransformDesugar(ctx, desugarJar, outputFile, flags) outputFile = desugarJar if ctx.Failed() { return } - // Compile classes.jar into classes.dex and then javalib.jar - javalibJar := android.PathForModuleOut(ctx, "javalib.jar") - TransformClassesJarToDexJar(ctx, javalibJar, desugarJar, flags) - outputFile = javalibJar + // Compile classes.jar into classes.dex and then a dex jar + dexJar := android.PathForModuleOut(ctx, "dex", jarName) + TransformClassesJarToDexJar(ctx, dexJar, desugarJar, flags) + outputFile = dexJar if ctx.Failed() { return } |