Make java binaries common instead of common-first
Previously, java binaries had both common and the first arch variants.
This was origionally added in aosp/556843. The reasoning there was so
that a java binary could be used as the dependency of a genrule.
However, now with transition mutators, we can make the incoming
transition redirect the arch variant to the common variant if the module
only has a common variant. This allows genrules to depend on the common
arch variant easily. That change is also included in this cl.
Bug: 372091092
Test: m nothing --no-skip-soong-tests
Change-Id: Iea612d050bff608d661f81566884653239015213
diff --git a/java/java_test.go b/java/java_test.go
index 24dabdb..51cfdab 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -569,8 +569,7 @@
bar := ctx.ModuleForTests("bar", buildOS+"_common")
barJar := bar.Output("bar.jar").Output.String()
- barWrapper := ctx.ModuleForTests("bar", buildOS+"_x86_64")
- barWrapperDeps := barWrapper.Output("bar").Implicits.Strings()
+ barWrapperDeps := bar.Output("bar").Implicits.Strings()
libjni := ctx.ModuleForTests("libjni", buildOS+"_x86_64_shared")
libjniSO := libjni.Rule("Cp").Output.String()
@@ -1931,7 +1930,7 @@
main_class: "foo.bar.jb",
}
`)
- wrapperPath := fmt.Sprint(ctx.ModuleForTests("foo", "android_arm64_armv8-a").AllOutputs())
+ wrapperPath := fmt.Sprint(ctx.ModuleForTests("foo", "android_common").AllOutputs())
if !strings.Contains(wrapperPath, "foo.sh") {
t.Errorf("wrapper file foo.sh is not generated")
}
@@ -3125,13 +3124,6 @@
}
`
res, _ := testJava(t, bp)
- // The first variant installs the native library via the common variant, so check the deps of both variants.
- nativeVariantDepsWithDups := findDepsOfModule(res, res.ModuleForTests("myjavabin", "android_arm64_armv8-a").Module(), "mynativelib")
- nativeVariantDepsWithDups = append(nativeVariantDepsWithDups, findDepsOfModule(res, res.ModuleForTests("myjavabin", "android_common").Module(), "mynativelib")...)
-
- nativeVariantDepsUnique := map[blueprint.Module]bool{}
- for _, dep := range nativeVariantDepsWithDups {
- nativeVariantDepsUnique[dep] = true
- }
- android.AssertIntEquals(t, "Create a dep on the first variant", 1, len(nativeVariantDepsUnique))
+ deps := findDepsOfModule(res, res.ModuleForTests("myjavabin", "android_common").Module(), "mynativelib")
+ android.AssertIntEquals(t, "Create a dep on the first variant", 1, len(deps))
}