Merge changes Ibf8af35f,I32edd26b,I981875bb
am: 886d45d8dd
Change-Id: I665abf19e63ffb77c2a431f064ed026f7c13f4d9
This commit is contained in:
commit
6cd3f89e3a
7 changed files with 64 additions and 36 deletions
|
@ -295,46 +295,47 @@ func archMutator(mctx BottomUpMutatorContext) {
|
|||
return
|
||||
}
|
||||
|
||||
if !module.base().ArchSpecific() {
|
||||
base := module.base()
|
||||
|
||||
if !base.ArchSpecific() {
|
||||
return
|
||||
}
|
||||
|
||||
osClasses := module.base().OsClassSupported()
|
||||
osClasses := base.OsClassSupported()
|
||||
|
||||
var moduleTargets []Target
|
||||
primaryModules := make(map[int]bool)
|
||||
|
||||
for _, class := range osClasses {
|
||||
targets := mctx.Config().Targets[class]
|
||||
if len(targets) == 0 {
|
||||
classTargets := mctx.Config().Targets[class]
|
||||
if len(classTargets) == 0 {
|
||||
continue
|
||||
}
|
||||
var multilib string
|
||||
switch class {
|
||||
case Device:
|
||||
multilib = String(module.base().commonProperties.Target.Android.Compile_multilib)
|
||||
case Host, HostCross:
|
||||
multilib = String(module.base().commonProperties.Target.Host.Compile_multilib)
|
||||
}
|
||||
if multilib == "" {
|
||||
multilib = String(module.base().commonProperties.Compile_multilib)
|
||||
}
|
||||
if multilib == "" {
|
||||
multilib = module.base().commonProperties.Default_multilib
|
||||
}
|
||||
var prefer32 bool
|
||||
switch class {
|
||||
case Device:
|
||||
prefer32 = mctx.Config().DevicePrefer32BitExecutables()
|
||||
case HostCross:
|
||||
// Windows builds always prefer 32-bit
|
||||
prefer32 = true
|
||||
}
|
||||
// only the primary arch in the recovery partition
|
||||
if module.InstallInRecovery() {
|
||||
targets = []Target{mctx.Config().Targets[Device][0]}
|
||||
classTargets = []Target{mctx.Config().Targets[Device][0]}
|
||||
}
|
||||
targets, err := decodeMultilib(multilib, targets, prefer32)
|
||||
|
||||
var multilib string
|
||||
switch class {
|
||||
case Device:
|
||||
multilib = String(base.commonProperties.Target.Android.Compile_multilib)
|
||||
case Host, HostCross:
|
||||
multilib = String(base.commonProperties.Target.Host.Compile_multilib)
|
||||
}
|
||||
if multilib == "" {
|
||||
multilib = String(base.commonProperties.Compile_multilib)
|
||||
}
|
||||
if multilib == "" {
|
||||
multilib = base.commonProperties.Default_multilib
|
||||
}
|
||||
|
||||
prefer32 := false
|
||||
if base.prefer32 != nil {
|
||||
prefer32 = base.prefer32(mctx, base, class)
|
||||
}
|
||||
|
||||
targets, err := decodeMultilib(multilib, classTargets, prefer32)
|
||||
if err != nil {
|
||||
mctx.ModuleErrorf("%s", err.Error())
|
||||
}
|
||||
|
@ -345,7 +346,7 @@ func archMutator(mctx BottomUpMutatorContext) {
|
|||
}
|
||||
|
||||
if len(moduleTargets) == 0 {
|
||||
module.base().commonProperties.Enabled = boolPtr(false)
|
||||
base.commonProperties.Enabled = boolPtr(false)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -442,6 +442,8 @@ type ModuleBase struct {
|
|||
|
||||
// For tests
|
||||
buildParams []BuildParams
|
||||
|
||||
prefer32 func(ctx BaseModuleContext, base *ModuleBase, class OsClass) bool
|
||||
}
|
||||
|
||||
func (a *ModuleBase) AddProperties(props ...interface{}) {
|
||||
|
@ -456,6 +458,10 @@ func (a *ModuleBase) BuildParamsForTests() []BuildParams {
|
|||
return a.buildParams
|
||||
}
|
||||
|
||||
func (a *ModuleBase) Prefer32(prefer32 func(ctx BaseModuleContext, base *ModuleBase, class OsClass) bool) {
|
||||
a.prefer32 = prefer32
|
||||
}
|
||||
|
||||
// Name returns the name of the module. It may be overridden by individual module types, for
|
||||
// example prebuilts will prepend prebuilt_ to the name.
|
||||
func (a *ModuleBase) Name() string {
|
||||
|
|
11
cc/cc.go
11
cc/cc.go
|
@ -406,6 +406,17 @@ func (c *Module) Init() android.Module {
|
|||
c.AddProperties(feature.props()...)
|
||||
}
|
||||
|
||||
c.Prefer32(func(ctx android.BaseModuleContext, base *android.ModuleBase, class android.OsClass) bool {
|
||||
switch class {
|
||||
case android.Device:
|
||||
return ctx.Config().DevicePrefer32BitExecutables()
|
||||
case android.HostCross:
|
||||
// Windows builds always prefer 32-bit
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
})
|
||||
android.InitAndroidArchModule(c, c.hod, c.multilib)
|
||||
|
||||
android.InitDefaultableModule(c)
|
||||
|
|
|
@ -359,7 +359,7 @@ func AndroidLibraryFactory() android.Module {
|
|||
|
||||
module.androidLibraryProperties.BuildAAR = true
|
||||
|
||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
InitJavaModule(module, android.DeviceSupported)
|
||||
return module
|
||||
}
|
||||
|
||||
|
@ -382,6 +382,7 @@ type AARImportProperties struct {
|
|||
|
||||
type AARImport struct {
|
||||
android.ModuleBase
|
||||
android.DefaultableModuleBase
|
||||
prebuilt android.Prebuilt
|
||||
|
||||
properties AARImportProperties
|
||||
|
@ -555,6 +556,6 @@ func AARImportFactory() android.Module {
|
|||
module.AddProperties(&module.properties)
|
||||
|
||||
android.InitPrebuiltModule(module, &module.properties.Aars)
|
||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
InitJavaModule(module, android.DeviceSupported)
|
||||
return module
|
||||
}
|
||||
|
|
|
@ -208,6 +208,10 @@ func AndroidAppFactory() android.Module {
|
|||
&module.aaptProperties,
|
||||
&module.appProperties)
|
||||
|
||||
module.Prefer32(func(ctx android.BaseModuleContext, base *android.ModuleBase, class android.OsClass) bool {
|
||||
return class == android.Device && ctx.Config().DevicePrefer32BitApps()
|
||||
})
|
||||
|
||||
InitJavaModule(module, android.DeviceSupported)
|
||||
return module
|
||||
}
|
||||
|
|
14
java/java.go
14
java/java.go
|
@ -1493,7 +1493,6 @@ func TestFactory() android.Module {
|
|||
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||
|
||||
InitJavaModule(module, android.HostAndDeviceSupported)
|
||||
android.InitDefaultableModule(module)
|
||||
return module
|
||||
}
|
||||
|
||||
|
@ -1508,7 +1507,6 @@ func TestHostFactory() android.Module {
|
|||
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||
|
||||
InitJavaModule(module, android.HostSupported)
|
||||
android.InitDefaultableModule(module)
|
||||
return module
|
||||
}
|
||||
|
||||
|
@ -1624,6 +1622,7 @@ type ImportProperties struct {
|
|||
|
||||
type Import struct {
|
||||
android.ModuleBase
|
||||
android.DefaultableModuleBase
|
||||
prebuilt android.Prebuilt
|
||||
|
||||
properties ImportProperties
|
||||
|
@ -1752,7 +1751,7 @@ func ImportFactory() android.Module {
|
|||
module.AddProperties(&module.properties)
|
||||
|
||||
android.InitPrebuiltModule(module, &module.properties.Jars)
|
||||
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
|
||||
InitJavaModule(module, android.HostAndDeviceSupported)
|
||||
return module
|
||||
}
|
||||
|
||||
|
@ -1762,7 +1761,7 @@ func ImportFactoryHost() android.Module {
|
|||
module.AddProperties(&module.properties)
|
||||
|
||||
android.InitPrebuiltModule(module, &module.properties.Jars)
|
||||
android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
|
||||
InitJavaModule(module, android.HostSupported)
|
||||
return module
|
||||
}
|
||||
|
||||
|
@ -1792,6 +1791,13 @@ func DefaultsFactory(props ...interface{}) android.Module {
|
|||
&CompilerProperties{},
|
||||
&CompilerDeviceProperties{},
|
||||
&android.ProtoProperties{},
|
||||
&aaptProperties{},
|
||||
&androidLibraryProperties{},
|
||||
&appProperties{},
|
||||
&appTestProperties{},
|
||||
&ImportProperties{},
|
||||
&AARImportProperties{},
|
||||
&sdkLibraryProperties{},
|
||||
)
|
||||
|
||||
android.InitDefaultsModule(module)
|
||||
|
|
|
@ -691,7 +691,6 @@ func sdkLibraryFactory() android.Module {
|
|||
module := &sdkLibrary{}
|
||||
module.AddProperties(&module.properties)
|
||||
module.AddProperties(&module.deviceProperties)
|
||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
android.InitDefaultableModule(module)
|
||||
InitJavaModule(module, android.DeviceSupported)
|
||||
return module
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue