Add InstallForceOS, fix testcases for host

Robolectric tests compile against device modules but are installed
and run as host modules.  Allow a module to override its install
OS.

Test: TestPathForModuleInstall
Change-Id: Icf37bb3d4cc1222a9b079602c6a5fdb8b51c86ed
This commit is contained in:
Colin Cross
2020-02-10 15:29:54 -08:00
parent 387ad5c576
commit 6e3594003b
3 changed files with 95 additions and 38 deletions

View File

@@ -172,6 +172,7 @@ type ModuleContext interface {
InstallInRecovery() bool
InstallInRoot() bool
InstallBypassMake() bool
InstallForceOS() *OsType
RequiredModuleNames() []string
HostRequiredModuleNames() []string
@@ -213,6 +214,7 @@ type Module interface {
InstallInRecovery() bool
InstallInRoot() bool
InstallBypassMake() bool
InstallForceOS() *OsType
SkipInstall()
ExportedToMake() bool
NoticeFile() OptionalPath
@@ -893,6 +895,10 @@ func (m *ModuleBase) InstallBypassMake() bool {
return false
}
func (m *ModuleBase) InstallForceOS() *OsType {
return nil
}
func (m *ModuleBase) Owner() string {
return String(m.commonProperties.Owner)
}
@@ -1683,6 +1689,10 @@ func (m *moduleContext) InstallBypassMake() bool {
return m.module.InstallBypassMake()
}
func (m *moduleContext) InstallForceOS() *OsType {
return m.module.InstallForceOS()
}
func (m *moduleContext) skipInstall(fullInstallPath InstallPath) bool {
if m.module.base().commonProperties.SkipInstall {
return true