From 635acc9446c3a8c88b6599d30312c6399419f2b8 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 12 Sep 2017 22:50:46 -0700 Subject: Rearrange manifest file handling in merge_zips and soong_zip Jar always puts default MANIFEST.MF files in if none was specified. Copying that behavior in soong_zip causes problems with merge_zips, because it ends up taking the default manifest from the classes.jar instead of the user's manifest from res.jar. We don't want the user's manifest in the classes.jar, otherwise a change to the manifest will cause all the class files to rebuild. Instead, move the manifest insertion to the final merge_zips stage. Test: m -j checkbuild Change-Id: Id6376961dbaf743c2fb92843f9bdf2e44b963be0 --- java/java.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'java/java.go') diff --git a/java/java.go b/java/java.go index b4ce35ede..d7b5847d5 100644 --- a/java/java.go +++ b/java/java.go @@ -385,11 +385,9 @@ func (j *Module) compile(ctx android.ModuleContext) { } resourceJarSpecs := ResourceDirsToJarSpecs(ctx, j.properties.Resource_dirs, j.properties.Exclude_resource_dirs) - manifest := android.OptionalPathForModuleSrc(ctx, j.properties.Manifest) - - if len(resourceJarSpecs) > 0 || manifest.Valid() { + if len(resourceJarSpecs) > 0 { // Combine classes + resources into classes-full-debug.jar - resourceJar := TransformResourcesToJar(ctx, resourceJarSpecs, manifest, extraJarDeps) + resourceJar := TransformResourcesToJar(ctx, resourceJarSpecs, extraJarDeps) if ctx.Failed() { return } @@ -399,9 +397,11 @@ func (j *Module) compile(ctx android.ModuleContext) { jars = append(jars, deps.staticJars...) + 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. - outputFile := TransformJarsToJar(ctx, "classes-combined.jar", jars) + outputFile := TransformJarsToJar(ctx, "classes.jar", jars, manifest, false) if j.properties.Jarjar_rules != nil { jarjar_rules := android.PathForModuleSrc(ctx, *j.properties.Jarjar_rules) @@ -616,7 +616,7 @@ func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) { func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.classpathFiles = android.PathsForModuleSrc(ctx, j.properties.Jars) - j.combinedClasspathFile = TransformJarsToJar(ctx, "classes.jar", j.classpathFiles) + j.combinedClasspathFile = TransformJarsToJar(ctx, "classes.jar", j.classpathFiles, android.OptionalPath{}, false) } var _ Dependency = (*Import)(nil) -- cgit v1.2.3-59-g8ed1b