Merge "Add config.AndroidFirstDeviceTarget."

This commit is contained in:
Jaewoong Jung 2020-10-12 17:30:18 +00:00 committed by Gerrit Code Review
commit 19bc60abee
4 changed files with 11 additions and 8 deletions

View file

@ -91,10 +91,11 @@ type config struct {
ConfigFileName string
ProductVariablesFileName 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
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
AndroidFirstDeviceTarget Target // the first Target for modules for the Android device
// multilibConflicts for an ArchType is true if there is earlier configured device architecture with the same
// multilib value.
@ -320,6 +321,7 @@ func TestArchConfig(buildDir string, env map[string]string, bp string, fs map[st
config.BuildOSTarget = config.Targets[BuildOs][0]
config.BuildOSCommonTarget = getCommonTargets(config.Targets[BuildOs])[0]
config.AndroidCommonTarget = getCommonTargets(config.Targets[Android])[0]
config.AndroidFirstDeviceTarget = firstTarget(config.Targets[Android], "lib64", "lib32")[0]
config.TestProductVariables.DeviceArch = proptools.StringPtr("arm64")
config.TestProductVariables.DeviceArchVariant = proptools.StringPtr("armv8-a")
config.TestProductVariables.DeviceSecondaryArch = proptools.StringPtr("arm")
@ -429,6 +431,7 @@ func NewConfig(srcDir, buildDir string, moduleListFile string) (Config, error) {
config.BuildOSCommonTarget = getCommonTargets(config.Targets[BuildOs])[0]
if len(config.Targets[Android]) > 0 {
config.AndroidCommonTarget = getCommonTargets(config.Targets[Android])[0]
config.AndroidFirstDeviceTarget = firstTarget(config.Targets[Android], "lib64", "lib32")[0]
}
if err := config.fromEnv(); err != nil {

View file

@ -643,7 +643,7 @@ func (a *AndroidApp) jniBuildActions(jniLibs []jniLib, ctx android.ModuleContext
// Work with the team to come up with a new format that handles multilib modules properly
// and change this.
if len(ctx.Config().Targets[android.Android]) == 1 ||
ctx.Config().Targets[android.Android][0].Arch.ArchType == jni.target.Arch.ArchType {
ctx.Config().AndroidFirstDeviceTarget.Arch.ArchType == jni.target.Arch.ArchType {
a.jniCoverageOutputs = append(a.jniCoverageOutputs, jni.coverageFile.Path())
}
}
@ -1402,7 +1402,7 @@ func (a *AndroidAppImport) processVariants(ctx android.LoadHookContext) {
}
archProps := reflect.ValueOf(a.archVariants).Elem().FieldByName("Arch")
archType := ctx.Config().Targets[android.Android][0].Arch.ArchType
archType := ctx.Config().AndroidFirstDeviceTarget.Arch.ArchType
MergePropertiesFromVariant(ctx, &a.properties, archProps, archType.Name)
}

View file

@ -93,7 +93,7 @@ func librarySource(ctx android.SingletonContext, rModule *Module, rustLib *libra
return "", false
}
default:
if rModule.Target().String() != ctx.Config().Targets[android.Android][0].String() {
if rModule.Target().String() != ctx.Config().AndroidFirstDeviceTarget.String() {
return "", false
}
}

View file

@ -261,7 +261,7 @@ func (s *ShTest) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddFarVariationDependencies(append(ctx.Target().Variations(), sharedLibVariations...),
shTestDataLibsTag, s.testProperties.Data_libs...)
if ctx.Target().Os.Class == android.Host && len(ctx.Config().Targets[android.Android]) > 0 {
deviceVariations := ctx.Config().Targets[android.Android][0].Variations()
deviceVariations := ctx.Config().AndroidFirstDeviceTarget.Variations()
ctx.AddFarVariationDependencies(deviceVariations, shTestDataDeviceBinsTag, s.testProperties.Data_device_bins...)
ctx.AddFarVariationDependencies(append(deviceVariations, sharedLibVariations...),
shTestDataDeviceLibsTag, s.testProperties.Data_device_libs...)