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:
@@ -449,12 +449,12 @@ func (j *Module) compile(ctx android.ModuleContext) {
|
|||||||
manifest := android.OptionalPathForModuleSrc(ctx, j.properties.Manifest)
|
manifest := android.OptionalPathForModuleSrc(ctx, j.properties.Manifest)
|
||||||
|
|
||||||
// Combine the classes built from sources, any manifests, and any static libraries into
|
// 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)
|
outputFile := TransformJarsToJar(ctx, "classes.jar", jars, manifest, false)
|
||||||
|
|
||||||
if j.properties.Jarjar_rules != nil {
|
if j.properties.Jarjar_rules != nil {
|
||||||
jarjar_rules := android.PathForModuleSrc(ctx, *j.properties.Jarjar_rules)
|
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)
|
outputFile = TransformJarJar(ctx, outputFile, jarjar_rules)
|
||||||
if ctx.Failed() {
|
if ctx.Failed() {
|
||||||
return
|
return
|
||||||
@@ -517,10 +517,6 @@ func (j *Module) compile(ctx android.ModuleContext) {
|
|||||||
return
|
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
|
// Compile classes.jar into classes.dex
|
||||||
dexJarFile := TransformClassesJarToDexJar(ctx, desugarJar, flags)
|
dexJarFile := TransformClassesJarToDexJar(ctx, desugarJar, flags)
|
||||||
if ctx.Failed() {
|
if ctx.Failed() {
|
||||||
|
@@ -111,7 +111,7 @@ func moduleToPath(name string) string {
|
|||||||
case strings.HasSuffix(name, ".jar"):
|
case strings.HasSuffix(name, ".jar"):
|
||||||
return name
|
return name
|
||||||
default:
|
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)
|
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")
|
||||||
baz := filepath.Join(buildDir, ".intermediates", "baz", "android_common", "classes-desugar.jar")
|
baz := filepath.Join(buildDir, ".intermediates", "baz", "android_common", "classes-compiled.jar")
|
||||||
|
|
||||||
if !strings.Contains(javac.Args["classpath"], bar) {
|
if !strings.Contains(javac.Args["classpath"], bar) {
|
||||||
t.Errorf("foo classpath %v does not contain %q", 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)
|
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) {
|
if !strings.Contains(javac.Args["classpath"], bar) {
|
||||||
t.Errorf("foo classpath %v does not contain %q", 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 {
|
if len(combineJar.Inputs) != 2 || combineJar.Inputs[1].String() != baz {
|
||||||
t.Errorf("foo combineJar inputs %v does not contain %q", combineJar.Inputs, baz)
|
t.Errorf("foo combineJar inputs %v does not contain %q", combineJar.Inputs, baz)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user