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/android/arch.go b/android/arch.go
index e2d0d0d..3cd6e4b 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -567,10 +567,6 @@
// "32": compile for only a single 32-bit Target supported by the OsClass.
// "64": compile for only a single 64-bit Target supported by the OsClass.
// "common": compile a for a single Target that will work on all Targets supported by the OsClass (for example Java).
-// "common_first": compile a for a Target that will work on all Targets supported by the OsClass
-// (same as "common"), plus a second Target for the preferred Target supported by the OsClass
-// (same as "first"). This is used for java_binary that produces a common .jar and a wrapper
-// executable script.
//
// Once the list of Targets is determined, the module is split into a variant for each Target.
//
@@ -702,11 +698,9 @@
return ""
}
- if incomingVariation == "" {
- multilib, _ := decodeMultilib(ctx, base)
- if multilib == "common" {
- return "common"
- }
+ multilib, _ := decodeMultilib(ctx, base)
+ if multilib == "common" {
+ return "common"
}
return incomingVariation
}
@@ -756,8 +750,7 @@
// Create a dependency for Darwin Universal binaries from the primary to secondary
// architecture. The module itself will be responsible for calling lipo to merge the outputs.
if os == Darwin {
- isUniversalBinary := (allArchInfo.Multilib == "darwin_universal" && len(allArchInfo.Targets) == 2) ||
- allArchInfo.Multilib == "darwin_universal_common_first" && len(allArchInfo.Targets) == 3
+ isUniversalBinary := allArchInfo.Multilib == "darwin_universal" && len(allArchInfo.Targets) == 2
isPrimary := variation == ctx.Config().BuildArch.String()
hasSecondaryConfigured := len(ctx.Config().Targets[Darwin]) > 1
if isUniversalBinary && isPrimary && hasSecondaryConfigured {
@@ -825,11 +818,7 @@
// !UseTargetVariants, as the module has opted into handling the arch-specific logic on
// its own.
if os == Darwin && multilib != "common" && multilib != "32" {
- if multilib == "common_first" {
- multilib = "darwin_universal_common_first"
- } else {
- multilib = "darwin_universal"
- }
+ multilib = "darwin_universal"
}
return multilib, ""
@@ -1941,13 +1930,6 @@
switch multilib {
case "common":
buildTargets = getCommonTargets(targets)
- case "common_first":
- buildTargets = getCommonTargets(targets)
- if prefer32 {
- buildTargets = append(buildTargets, FirstTarget(targets, "lib32", "lib64")...)
- } else {
- buildTargets = append(buildTargets, FirstTarget(targets, "lib64", "lib32")...)
- }
case "both":
if prefer32 {
buildTargets = append(buildTargets, filterMultilibTargets(targets, "lib32")...)
@@ -1978,10 +1960,6 @@
// Reverse the targets so that the first architecture can depend on the second
// architecture module in order to merge the outputs.
ReverseSliceInPlace(buildTargets)
- case "darwin_universal_common_first":
- archTargets := filterMultilibTargets(targets, "lib64")
- ReverseSliceInPlace(archTargets)
- buildTargets = append(getCommonTargets(targets), archTargets...)
default:
return nil, fmt.Errorf(`compile_multilib must be "both", "first", "32", "64", "prefer32" or "first_prefer32" found %q`,
multilib)
diff --git a/android/module.go b/android/module.go
index 44f7583..51e7f36 100644
--- a/android/module.go
+++ b/android/module.go
@@ -605,10 +605,9 @@
type Multilib string
const (
- MultilibBoth Multilib = "both"
- MultilibFirst Multilib = "first"
- MultilibCommon Multilib = "common"
- MultilibCommonFirst Multilib = "common_first"
+ MultilibBoth Multilib = "both"
+ MultilibFirst Multilib = "first"
+ MultilibCommon Multilib = "common"
)
type HostOrDeviceSupported int