Use pre-desugar classes in classpath

Follow the make change in I87aee34940937dbde33a977f55d1faf2c8054561
to use classes before desugar in the classpath.

Test: java_test.go
Change-Id: I1054f4aea1eb349b6f687e1af0adb92a944fd8c5
This commit is contained in:
Colin Cross 2017-09-27 18:03:17 -07:00
parent 59f1bb66ea
commit 8649b2653c
2 changed files with 7 additions and 11 deletions

View file

@ -449,12 +449,12 @@ func (j *Module) compile(ctx android.ModuleContext) {
manifest := android.OptionalPathForModuleSrc(ctx, j.properties.Manifest)
// Combine the classes built from sources, any manifests, and any static libraries into
// classes-combined.jar. If there is only one input jar this step will be skipped.
// classes.jar. If there is only one input jar this step will be skipped.
outputFile := TransformJarsToJar(ctx, "classes.jar", jars, manifest, false)
if j.properties.Jarjar_rules != nil {
jarjar_rules := android.PathForModuleSrc(ctx, *j.properties.Jarjar_rules)
// Transform classes-combined.jar into classes-jarjar.jar
// Transform classes.jar into classes-jarjar.jar
outputFile = TransformJarJar(ctx, outputFile, jarjar_rules)
if ctx.Failed() {
return
@ -517,10 +517,6 @@ func (j *Module) compile(ctx android.ModuleContext) {
return
}
// TODO(ccross): For now, use the desugared jar as the classpath file. Eventually this
// might cause problems because desugar wants non-desugared jars in its class path.
j.classpathFile = desugarJar
// Compile classes.jar into classes.dex
dexJarFile := TransformClassesJarToDexJar(ctx, desugarJar, flags)
if ctx.Failed() {

View file

@ -111,7 +111,7 @@ func moduleToPath(name string) string {
case strings.HasSuffix(name, ".jar"):
return name
default:
return filepath.Join(buildDir, ".intermediates", name, "android_common", "classes-desugar.jar")
return filepath.Join(buildDir, ".intermediates", name, "android_common", "classes-compiled.jar")
}
}
@ -142,8 +142,8 @@ func TestSimple(t *testing.T) {
t.Errorf(`foo inputs %v != ["a.java"]`, javac.Inputs)
}
bar := filepath.Join(buildDir, ".intermediates", "bar", "android_common", "classes-desugar.jar")
baz := filepath.Join(buildDir, ".intermediates", "baz", "android_common", "classes-desugar.jar")
bar := filepath.Join(buildDir, ".intermediates", "bar", "android_common", "classes-compiled.jar")
baz := filepath.Join(buildDir, ".intermediates", "baz", "android_common", "classes-compiled.jar")
if !strings.Contains(javac.Args["classpath"], bar) {
t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], bar)
@ -349,12 +349,12 @@ func TestDefaults(t *testing.T) {
t.Errorf(`foo inputs %v != ["a.java"]`, javac.Inputs)
}
bar := filepath.Join(buildDir, ".intermediates", "bar", "android_common", "classes-desugar.jar")
bar := filepath.Join(buildDir, ".intermediates", "bar", "android_common", "classes-compiled.jar")
if !strings.Contains(javac.Args["classpath"], bar) {
t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], bar)
}
baz := filepath.Join(buildDir, ".intermediates", "baz", "android_common", "classes-desugar.jar")
baz := filepath.Join(buildDir, ".intermediates", "baz", "android_common", "classes-compiled.jar")
if len(combineJar.Inputs) != 2 || combineJar.Inputs[1].String() != baz {
t.Errorf("foo combineJar inputs %v does not contain %q", combineJar.Inputs, baz)
}