Get dex jar resources from classpath jar
Dex jars were getting their resources from the res.jar files of
their transitive static dependencies. This accidentally bypassed
jarjar on resources, since the jarjar pass only happened once the
resources jar was combined into the classpath jar. Switch to
getting the resources out of the classpath jar by merging it
with the dex jar while skipping *.class.
Test: m -j checkbuild
Test: compare ext.jar to one generated by make
Change-Id: I5f6f3da738dcb0af56ab9a1bd7174ed5359de2b2
diff --git a/java/java.go b/java/java.go
index 9cde824..3726435 100644
--- a/java/java.go
+++ b/java/java.go
@@ -153,9 +153,6 @@
// output file containing classes.dex
dexJarFile android.Path
- // output files containing resources
- resourceJarFiles android.Paths
-
// output file suitable for installing or running
outputFile android.Path
@@ -173,7 +170,6 @@
type Dependency interface {
ClasspathFiles() android.Paths
- ResourceJarFiles() android.Paths
AidlIncludeDirs() android.Paths
}
@@ -380,7 +376,6 @@
case staticLibTag:
deps.classpath = append(deps.classpath, dep.ClasspathFiles()...)
deps.staticJars = append(deps.staticJars, dep.ClasspathFiles()...)
- deps.staticJarResources = append(deps.staticJarResources, dep.ResourceJarFiles()...)
case frameworkResTag:
if ctx.ModuleName() == "framework" {
// framework.jar has a one-off dependency on the R.java and Manifest.java files
@@ -492,20 +487,14 @@
}
if len(resArgs) > 0 {
- // Combine classes + resources into classes-full-debug.jar
resourceJar := TransformResourcesToJar(ctx, resArgs, resDeps)
if ctx.Failed() {
return
}
- j.resourceJarFiles = append(j.resourceJarFiles, resourceJar)
jars = append(jars, resourceJar)
}
- // Propagate the resources from the transitive closure of static dependencies for copying
- // into dex jars
- j.resourceJarFiles = append(j.resourceJarFiles, deps.staticJarResources...)
-
// static classpath jars have the resources in them, so the resource jars aren't necessary here
jars = append(jars, deps.staticJars...)
@@ -580,17 +569,12 @@
return
}
- // Compile classes.jar into classes.dex
- dexJarFile := TransformClassesJarToDexJar(ctx, desugarJar, flags)
+ // Compile classes.jar into classes.dex and then javalib.jar
+ outputFile = TransformClassesJarToDexJar(ctx, "javalib.jar", desugarJar, flags)
if ctx.Failed() {
return
}
- jars := android.Paths{dexJarFile}
- jars = append(jars, j.resourceJarFiles...)
-
- outputFile = TransformJarsToJar(ctx, "javalib.jar", jars, android.OptionalPath{}, true)
-
j.dexJarFile = outputFile
}
ctx.CheckbuildFile(outputFile)
@@ -607,10 +591,6 @@
return android.Paths{j.classpathFile}
}
-func (j *Module) ResourceJarFiles() android.Paths {
- return j.resourceJarFiles
-}
-
func (j *Module) AidlIncludeDirs() android.Paths {
return j.exportAidlIncludeDirs
}
@@ -777,11 +757,6 @@
return j.classpathFiles
}
-func (j *Import) ResourceJarFiles() android.Paths {
- // resources are in the ClasspathFiles
- return nil
-}
-
func (j *Import) AidlIncludeDirs() android.Paths {
return nil
}