diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/androidmk.go | 6 | ||||
-rw-r--r-- | android/arch.go | 23 | ||||
-rw-r--r-- | android/config.go | 19 | ||||
-rw-r--r-- | android/proto.go | 5 |
4 files changed, 36 insertions, 17 deletions
diff --git a/android/androidmk.go b/android/androidmk.go index 90713477..b66fd183 100644 --- a/android/androidmk.go +++ b/android/androidmk.go @@ -199,19 +199,19 @@ func (a *AndroidMkEntries) fillInEntries(config Config, bpPath string, mod bluep switch amod.Os().Class { case Host: // Make cannot identify LOCAL_MODULE_HOST_ARCH:= common. - if archStr != "common" { + if amod.Arch().ArchType != Common { a.SetString("LOCAL_MODULE_HOST_ARCH", archStr) } host = true case HostCross: // Make cannot identify LOCAL_MODULE_HOST_CROSS_ARCH:= common. - if archStr != "common" { + if amod.Arch().ArchType != Common { a.SetString("LOCAL_MODULE_HOST_CROSS_ARCH", archStr) } host = true case Device: // Make cannot identify LOCAL_MODULE_TARGET_ARCH:= common. - if archStr != "common" { + if amod.Arch().ArchType != Common { if amod.Target().NativeBridge { hostArchStr := amod.Target().NativeBridgeHostArchName if hostArchStr != "" { diff --git a/android/arch.go b/android/arch.go index 348b0649..5887744e 100644 --- a/android/arch.go +++ b/android/arch.go @@ -22,9 +22,12 @@ import ( "strconv" "strings" + "github.com/google/blueprint" "github.com/google/blueprint/proptools" ) +const COMMON_VARIANT = "common" + var ( archTypeList []ArchType @@ -36,7 +39,7 @@ var ( X86_64 = newArch("x86_64", "lib64") Common = ArchType{ - Name: "common", + Name: COMMON_VARIANT, } ) @@ -702,11 +705,23 @@ type Target struct { } func (target Target) String() string { - variant := "" + return target.ArchVariation() +} + +func (target Target) ArchVariation() string { + var variation string if target.NativeBridge { - variant = "native_bridge_" + variation = "native_bridge_" + } + variation += target.Arch.String() + + return target.Os.String() + "_" + variation +} + +func (target Target) Variations() []blueprint.Variation { + return []blueprint.Variation{ + {Mutator: "arch", Variation: target.ArchVariation()}, } - return target.Os.String() + "_" + variant + target.Arch.String() } // archMutator splits a module into a variant for each Target requested by the module. Target selection diff --git a/android/config.go b/android/config.go index 26c4e6eb..57737f17 100644 --- a/android/config.go +++ b/android/config.go @@ -89,9 +89,10 @@ type config struct { ConfigFileName string ProductVariablesFileName string - Targets map[OsType][]Target - BuildOsVariant string - BuildOsCommonVariant string + Targets map[OsType][]Target + BuildOSTarget Target // the Target for tools run on the build machine + BuildOSCommonTarget Target // the Target for common (java) tools run on the build machine + AndroidCommonTarget Target // the Target for common modules for the Android device // multilibConflicts for an ArchType is true if there is earlier configured device architecture with the same // multilib value. @@ -289,8 +290,9 @@ func TestArchConfig(buildDir string, env map[string]string) Config { config.Targets[BuildOs] = config.Targets[BuildOs][:1] } - config.BuildOsVariant = config.Targets[BuildOs][0].String() - config.BuildOsCommonVariant = getCommonTargets(config.Targets[BuildOs])[0].String() + config.BuildOSTarget = config.Targets[BuildOs][0] + config.BuildOSCommonTarget = getCommonTargets(config.Targets[BuildOs])[0] + config.AndroidCommonTarget = getCommonTargets(config.Targets[Android])[0] config.TestProductVariables.DeviceArch = proptools.StringPtr("arm64") config.TestProductVariables.DeviceArchVariant = proptools.StringPtr("armv8-a") config.TestProductVariables.DeviceSecondaryArch = proptools.StringPtr("arm") @@ -374,8 +376,11 @@ func NewConfig(srcDir, buildDir string) (Config, error) { } config.Targets = targets - config.BuildOsVariant = targets[BuildOs][0].String() - config.BuildOsCommonVariant = getCommonTargets(targets[BuildOs])[0].String() + config.BuildOSTarget = config.Targets[BuildOs][0] + config.BuildOSCommonTarget = getCommonTargets(config.Targets[BuildOs])[0] + if len(config.Targets[Android]) > 0 { + config.AndroidCommonTarget = getCommonTargets(config.Targets[Android])[0] + } if err := config.fromEnv(); err != nil { return Config{}, err diff --git a/android/proto.go b/android/proto.go index c8ade456..b712258e 100644 --- a/android/proto.go +++ b/android/proto.go @@ -52,9 +52,8 @@ func ProtoDeps(ctx BottomUpMutatorContext, p *ProtoProperties) { } if plugin := String(p.Proto.Plugin); plugin != "" { - ctx.AddFarVariationDependencies([]blueprint.Variation{ - {Mutator: "arch", Variation: ctx.Config().BuildOsVariant}, - }, ProtoPluginDepTag, "protoc-gen-"+plugin) + ctx.AddFarVariationDependencies(ctx.Config().BuildOSTarget.Variations(), + ProtoPluginDepTag, "protoc-gen-"+plugin) } } |