Merge changes I9170c7e2,I058201b2,Icf37bb3d
* changes: Make filesToInstall return InstallPaths and add it to Module Add pathForInstall and InstallPaths Add InstallForceOS, fix testcases for host
This commit is contained in:
@@ -172,6 +172,7 @@ type ModuleContext interface {
|
||||
InstallInRecovery() bool
|
||||
InstallInRoot() bool
|
||||
InstallBypassMake() bool
|
||||
InstallForceOS() *OsType
|
||||
|
||||
RequiredModuleNames() []string
|
||||
HostRequiredModuleNames() []string
|
||||
@@ -214,6 +215,7 @@ type Module interface {
|
||||
InstallInRecovery() bool
|
||||
InstallInRoot() bool
|
||||
InstallBypassMake() bool
|
||||
InstallForceOS() *OsType
|
||||
SkipInstall()
|
||||
ExportedToMake() bool
|
||||
InitRc() Paths
|
||||
@@ -242,6 +244,8 @@ type Module interface {
|
||||
RequiredModuleNames() []string
|
||||
HostRequiredModuleNames() []string
|
||||
TargetRequiredModuleNames() []string
|
||||
|
||||
filesToInstall() InstallPaths
|
||||
}
|
||||
|
||||
// Qualified id for a module
|
||||
@@ -643,7 +647,7 @@ type ModuleBase struct {
|
||||
primaryVisibilityProperty visibilityProperty
|
||||
|
||||
noAddressSanitizer bool
|
||||
installFiles Paths
|
||||
installFiles InstallPaths
|
||||
checkbuildFiles Paths
|
||||
noticeFiles Paths
|
||||
|
||||
@@ -849,22 +853,20 @@ func (m *ModuleBase) ExportedToMake() bool {
|
||||
return m.commonProperties.NamespaceExportedToMake
|
||||
}
|
||||
|
||||
func (m *ModuleBase) computeInstallDeps(
|
||||
ctx blueprint.ModuleContext) Paths {
|
||||
func (m *ModuleBase) computeInstallDeps(ctx blueprint.ModuleContext) InstallPaths {
|
||||
|
||||
result := Paths{}
|
||||
var result InstallPaths
|
||||
// TODO(ccross): we need to use WalkDeps and have some way to know which dependencies require installation
|
||||
ctx.VisitDepsDepthFirstIf(isFileInstaller,
|
||||
func(m blueprint.Module) {
|
||||
fileInstaller := m.(fileInstaller)
|
||||
files := fileInstaller.filesToInstall()
|
||||
result = append(result, files...)
|
||||
})
|
||||
ctx.VisitDepsDepthFirst(func(m blueprint.Module) {
|
||||
if a, ok := m.(Module); ok {
|
||||
result = append(result, a.filesToInstall()...)
|
||||
}
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func (m *ModuleBase) filesToInstall() Paths {
|
||||
func (m *ModuleBase) filesToInstall() InstallPaths {
|
||||
return m.installFiles
|
||||
}
|
||||
|
||||
@@ -900,6 +902,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)
|
||||
}
|
||||
@@ -948,8 +954,8 @@ func (m *ModuleBase) VintfFragments() Paths {
|
||||
}
|
||||
|
||||
func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) {
|
||||
allInstalledFiles := Paths{}
|
||||
allCheckbuildFiles := Paths{}
|
||||
var allInstalledFiles InstallPaths
|
||||
var allCheckbuildFiles Paths
|
||||
ctx.VisitAllModuleVariants(func(module Module) {
|
||||
a := module.base()
|
||||
allInstalledFiles = append(allInstalledFiles, a.installFiles...)
|
||||
@@ -968,7 +974,7 @@ func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) {
|
||||
ctx.Build(pctx, BuildParams{
|
||||
Rule: blueprint.Phony,
|
||||
Output: name,
|
||||
Implicits: allInstalledFiles,
|
||||
Implicits: allInstalledFiles.Paths(),
|
||||
Default: !ctx.Config().EmbeddedInMake(),
|
||||
})
|
||||
deps = append(deps, name)
|
||||
@@ -1309,8 +1315,8 @@ func (b *baseModuleContext) GetDirectDepWithTag(name string, tag blueprint.Depen
|
||||
type moduleContext struct {
|
||||
bp blueprint.ModuleContext
|
||||
baseModuleContext
|
||||
installDeps Paths
|
||||
installFiles Paths
|
||||
installDeps InstallPaths
|
||||
installFiles InstallPaths
|
||||
checkbuildFiles Paths
|
||||
module Module
|
||||
|
||||
@@ -1716,6 +1722,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
|
||||
@@ -1759,7 +1769,7 @@ func (m *moduleContext) installFile(installPath InstallPath, name string, srcPat
|
||||
|
||||
if !m.skipInstall(fullInstallPath) {
|
||||
|
||||
deps = append(deps, m.installDeps...)
|
||||
deps = append(deps, m.installDeps.Paths()...)
|
||||
|
||||
var implicitDeps, orderOnlyDeps Paths
|
||||
|
||||
@@ -1840,20 +1850,6 @@ func (m *moduleContext) CheckbuildFile(srcPath Path) {
|
||||
m.checkbuildFiles = append(m.checkbuildFiles, srcPath)
|
||||
}
|
||||
|
||||
type fileInstaller interface {
|
||||
filesToInstall() Paths
|
||||
}
|
||||
|
||||
func isFileInstaller(m blueprint.Module) bool {
|
||||
_, ok := m.(fileInstaller)
|
||||
return ok
|
||||
}
|
||||
|
||||
func isAndroidModule(m blueprint.Module) bool {
|
||||
_, ok := m.(Module)
|
||||
return ok
|
||||
}
|
||||
|
||||
func findStringInSlice(str string, slice []string) int {
|
||||
for i, s := range slice {
|
||||
if s == str {
|
||||
|
Reference in New Issue
Block a user