summaryrefslogtreecommitdiff
path: root/android/module.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2024-07-18 14:31:02 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-07-18 14:31:02 +0000
commita0258d8b3fabaa2a51795dea70360f55aee6eaa9 (patch)
tree2b0e6d7cffd5f9de524499960aaf00385039f5f8 /android/module.go
parent2484be669a7aa84d18190fd53d95a40742c8de83 (diff)
parentc7eafa7a418515ccba41dbb1e9a3c15d9ffcf329 (diff)
Merge "android: Add host_cross_supported prop" into main
Diffstat (limited to 'android/module.go')
-rw-r--r--android/module.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/android/module.go b/android/module.go
index 98cd459d7..91f2056d4 100644
--- a/android/module.go
+++ b/android/module.go
@@ -603,6 +603,11 @@ type hostAndDeviceProperties struct {
Device_supported *bool
}
+type hostCrossProperties struct {
+ // If set to true, build a variant of the module for the host cross. Defaults to true.
+ Host_cross_supported *bool
+}
+
type Multilib string
const (
@@ -718,6 +723,10 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib
m.AddProperties(&base.hostAndDeviceProperties)
}
+ if hod&hostCrossSupported != 0 {
+ m.AddProperties(&base.hostCrossProperties)
+ }
+
initArchModule(m)
}
@@ -803,6 +812,7 @@ type ModuleBase struct {
distProperties distProperties
variableProperties interface{}
hostAndDeviceProperties hostAndDeviceProperties
+ hostCrossProperties hostCrossProperties
// Arch specific versions of structs in GetProperties() prior to
// initialization in InitAndroidArchModule, lets call it `generalProperties`.
@@ -1299,7 +1309,11 @@ func (m *ModuleBase) HostCrossSupported() bool {
// hostEnabled is true if the host_supported property is true or the HostOrDeviceSupported
// value has the hostDefault bit set.
hostEnabled := proptools.BoolDefault(m.hostAndDeviceProperties.Host_supported, hod&hostDefault != 0)
- return hod&hostCrossSupported != 0 && hostEnabled
+
+ // Default true for the Host_cross_supported property
+ hostCrossEnabled := proptools.BoolDefault(m.hostCrossProperties.Host_cross_supported, true)
+
+ return hod&hostCrossSupported != 0 && hostEnabled && hostCrossEnabled
}
func (m *ModuleBase) Platform() bool {