HostCross is an attribute of a Target, not OsType
A host target is considered as being cross-compiled when the target can't run natively on the build machine. For example, linux_glibc/x86_64 is a non-cross target on a standard x86/Linux machine, but is a cross host on Mac. Previously, whether cross or not was a static attribute of an OsType. For example, Windows was always considered as cross host, while linux_bionic was not. This becomes a problem when we support more host targets like linux_bionic/arm64 which should be cross-host on standard x86/Linux machines. This change removes HostCross from the OsClass type and instead adds a property HostCross to the Target type. When a target is being added, it is initialized to true when the target can't run natively on the current build machine. Bug: 168086242 Test: m Change-Id: Ic37c8db918873ddf324c86b12b5412952b0f2be2
This commit is contained in:
@@ -371,8 +371,7 @@ func (s *sdk) buildSnapshot(ctx android.ModuleContext, sdkVariants []*sdk) andro
|
||||
osPropertySet := targetPropertySet.AddPropertySet(sdkVariant.Target().Os.Name)
|
||||
|
||||
// Enable the variant explicitly when we've disabled it by default on host.
|
||||
if hasHostOsDependentMember &&
|
||||
(osType.Class == android.Host || osType.Class == android.HostCross) {
|
||||
if hasHostOsDependentMember && osType.Class == android.Host {
|
||||
osPropertySet.AddProperty("enabled", true)
|
||||
}
|
||||
|
||||
@@ -731,7 +730,7 @@ func (s *snapshotBuilder) AddPrebuiltModule(member android.SdkMember, moduleType
|
||||
|
||||
for _, variant := range member.Variants() {
|
||||
osClass := variant.Target().Os.Class
|
||||
if osClass == android.Host || osClass == android.HostCross {
|
||||
if osClass == android.Host {
|
||||
hostSupported = true
|
||||
} else if osClass == android.Device {
|
||||
deviceSupported = true
|
||||
@@ -1061,8 +1060,7 @@ func (osInfo *osTypeSpecificInfo) addToPropertySet(ctx *memberContext, bpModule
|
||||
archPropertySet = targetPropertySet
|
||||
|
||||
// Enable the variant explicitly when we've disabled it by default on host.
|
||||
if ctx.memberType.IsHostOsDependent() &&
|
||||
(osType.Class == android.Host || osType.Class == android.HostCross) {
|
||||
if ctx.memberType.IsHostOsDependent() && osType.Class == android.Host {
|
||||
osPropertySet.AddProperty("enabled", true)
|
||||
}
|
||||
|
||||
@@ -1086,7 +1084,7 @@ func (osInfo *osTypeSpecificInfo) addToPropertySet(ctx *memberContext, bpModule
|
||||
|
||||
func (osInfo *osTypeSpecificInfo) isHostVariant() bool {
|
||||
osClass := osInfo.osType.Class
|
||||
return osClass == android.Host || osClass == android.HostCross
|
||||
return osClass == android.Host
|
||||
}
|
||||
|
||||
var _ isHostVariant = (*osTypeSpecificInfo)(nil)
|
||||
@@ -1323,7 +1321,7 @@ func (s *sdk) getPossibleOsTypes() []android.OsType {
|
||||
}
|
||||
}
|
||||
if s.HostSupported() {
|
||||
if osType.Class == android.Host || osType.Class == android.HostCross {
|
||||
if osType.Class == android.Host {
|
||||
osTypes = append(osTypes, osType)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user