Don't assume host arch is always x86
This change fixes some places where host arch is assumed to be x86 to
form a path element like linux-x86. In preparation for non-x86 host
targets, the host arch part is derived from the context.
In addition, InstallForceOS() is refactored so that it can override not
only OsType, but also ArchType. Without this, the paths for the
robolectic modules will be changed from linux-x86 to linux-common, which
breaks several other places where the old paths are expected.
Bug: 134795810
Test: m
Change-Id: Ib38c715948ae546e55021ece82bac1d82e9e5da0
diff --git a/android/module.go b/android/module.go
index 3374e1d..046c0a0 100644
--- a/android/module.go
+++ b/android/module.go
@@ -198,7 +198,7 @@
InstallInRecovery() bool
InstallInRoot() bool
InstallBypassMake() bool
- InstallForceOS() *OsType
+ InstallForceOS() (*OsType, *ArchType)
RequiredModuleNames() []string
HostRequiredModuleNames() []string
@@ -254,7 +254,7 @@
InstallInRecovery() bool
InstallInRoot() bool
InstallBypassMake() bool
- InstallForceOS() *OsType
+ InstallForceOS() (*OsType, *ArchType)
SkipInstall()
IsSkipInstall() bool
MakeUninstallable()
@@ -1120,8 +1120,8 @@
return false
}
-func (m *ModuleBase) InstallForceOS() *OsType {
- return nil
+func (m *ModuleBase) InstallForceOS() (*OsType, *ArchType) {
+ return nil, nil
}
func (m *ModuleBase) Owner() string {
@@ -2021,7 +2021,7 @@
return m.module.InstallBypassMake()
}
-func (m *moduleContext) InstallForceOS() *OsType {
+func (m *moduleContext) InstallForceOS() (*OsType, *ArchType) {
return m.module.InstallForceOS()
}