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
This commit is contained in:
Colin Cross
2017-09-12 22:50:46 -07:00
parent 6eebec7414
commit 635acc9446
7 changed files with 246 additions and 105 deletions

View File

@@ -119,8 +119,8 @@ func TestSimple(t *testing.T) {
t.Errorf(`foo inputs %v != ["a.java"]`, javac.Inputs)
}
bar := filepath.Join(buildDir, ".intermediates", "bar", "classes.jar")
baz := filepath.Join(buildDir, ".intermediates", "baz", "classes.jar")
bar := filepath.Join(buildDir, ".intermediates", "bar", "classes-compiled.jar")
baz := filepath.Join(buildDir, ".intermediates", "baz", "classes-compiled.jar")
if !strings.Contains(javac.Args["classpath"], bar) {
t.Errorf("foo classpath %v does not contain %q", javac.Args["classpath"], bar)
@@ -182,7 +182,7 @@ func TestSdk(t *testing.T) {
check := func(module string, depType depType, deps ...string) {
for i := range deps {
deps[i] = filepath.Join(buildDir, ".intermediates", deps[i], "classes.jar")
deps[i] = filepath.Join(buildDir, ".intermediates", deps[i], "classes-compiled.jar")
}
dep := strings.Join(deps, ":")
@@ -279,12 +279,12 @@ func TestDefaults(t *testing.T) {
t.Errorf(`foo inputs %v != ["a.java"]`, javac.Inputs)
}
bar := filepath.Join(buildDir, ".intermediates", "bar", "classes.jar")
bar := filepath.Join(buildDir, ".intermediates", "bar", "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", "classes.jar")
baz := filepath.Join(buildDir, ".intermediates", "baz", "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)
}