Export files to install as a depset
Export files to install through a depset instead of a list to reduce the size at each module. Bug: 124313442 Test: m checkbuild Change-Id: I6a51c89acc9f0f3a9c3c792d3ef8a7cfd6b8bef2
This commit is contained in:
@@ -1005,6 +1005,7 @@ type ModuleBase struct {
|
||||
|
||||
noAddressSanitizer bool
|
||||
installFiles InstallPaths
|
||||
installFilesDepSet *installPathsDepSet
|
||||
checkbuildFiles Paths
|
||||
packagingSpecs []PackagingSpec
|
||||
noticeFiles Paths
|
||||
@@ -1338,19 +1339,15 @@ func (m *ModuleBase) ExportedToMake() bool {
|
||||
|
||||
// computeInstallDeps finds the installed paths of all dependencies that have a dependency
|
||||
// tag that is annotated as needing installation via the IsInstallDepNeeded method.
|
||||
func (m *ModuleBase) computeInstallDeps(ctx blueprint.ModuleContext) InstallPaths {
|
||||
var result InstallPaths
|
||||
ctx.WalkDeps(func(child, parent blueprint.Module) bool {
|
||||
if a, ok := child.(Module); ok {
|
||||
if IsInstallDepNeeded(ctx.OtherModuleDependencyTag(child)) {
|
||||
result = append(result, a.FilesToInstall()...)
|
||||
return true
|
||||
}
|
||||
func (m *ModuleBase) computeInstallDeps(ctx ModuleContext) []*installPathsDepSet {
|
||||
var installDeps []*installPathsDepSet
|
||||
ctx.VisitDirectDeps(func(dep Module) {
|
||||
if IsInstallDepNeeded(ctx.OtherModuleDependencyTag(dep)) {
|
||||
installDeps = append(installDeps, dep.base().installFilesDepSet)
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
return result
|
||||
return installDeps
|
||||
}
|
||||
|
||||
func (m *ModuleBase) FilesToInstall() InstallPaths {
|
||||
@@ -1587,11 +1584,15 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
||||
module: m.module,
|
||||
bp: blueprintCtx,
|
||||
baseModuleContext: m.baseModuleContextFactory(blueprintCtx),
|
||||
installDeps: m.computeInstallDeps(blueprintCtx),
|
||||
installFiles: m.installFiles,
|
||||
variables: make(map[string]string),
|
||||
}
|
||||
|
||||
dependencyInstallFiles := m.computeInstallDeps(ctx)
|
||||
// set m.installFilesDepSet to only the transitive dependencies to be used as the dependencies
|
||||
// of installed files of this module. It will be replaced by a depset including the installed
|
||||
// files of this module at the end for use by modules that depend on this one.
|
||||
m.installFilesDepSet = newInstallPathsDepSet(nil, dependencyInstallFiles)
|
||||
|
||||
// Temporarily continue to call blueprintCtx.GetMissingDependencies() to maintain the previous behavior of never
|
||||
// reporting missing dependency errors in Blueprint when AllowMissingDependencies == true.
|
||||
// TODO: This will be removed once defaults modules handle missing dependency errors
|
||||
@@ -1700,6 +1701,8 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
||||
}
|
||||
}
|
||||
|
||||
m.installFilesDepSet = newInstallPathsDepSet(m.installFiles, dependencyInstallFiles)
|
||||
|
||||
m.buildParams = ctx.buildParams
|
||||
m.ruleParams = ctx.ruleParams
|
||||
m.variables = ctx.variables
|
||||
@@ -1874,7 +1877,6 @@ type moduleContext struct {
|
||||
bp blueprint.ModuleContext
|
||||
baseModuleContext
|
||||
packagingSpecs []PackagingSpec
|
||||
installDeps InstallPaths
|
||||
installFiles InstallPaths
|
||||
checkbuildFiles Paths
|
||||
module Module
|
||||
@@ -2420,8 +2422,7 @@ func (m *moduleContext) installFile(installPath InstallPath, name string, srcPat
|
||||
m.module.base().hooks.runInstallHooks(m, srcPath, fullInstallPath, false)
|
||||
|
||||
if !m.skipInstall(fullInstallPath) {
|
||||
|
||||
deps = append(deps, m.installDeps.Paths()...)
|
||||
deps = append(deps, m.module.base().installFilesDepSet.ToList().Paths()...)
|
||||
|
||||
var implicitDeps, orderOnlyDeps Paths
|
||||
|
||||
@@ -2858,3 +2859,23 @@ func CheckBlueprintSyntax(ctx BaseModuleContext, filename string, contents strin
|
||||
bpctx := ctx.blueprintBaseModuleContext()
|
||||
return blueprint.CheckBlueprintSyntax(bpctx.ModuleFactories(), filename, contents)
|
||||
}
|
||||
|
||||
// installPathsDepSet is a thin type-safe wrapper around the generic depSet. It always uses
|
||||
// topological order.
|
||||
type installPathsDepSet struct {
|
||||
depSet
|
||||
}
|
||||
|
||||
// newInstallPathsDepSet returns an immutable packagingSpecsDepSet with the given direct and
|
||||
// transitive contents.
|
||||
func newInstallPathsDepSet(direct InstallPaths, transitive []*installPathsDepSet) *installPathsDepSet {
|
||||
return &installPathsDepSet{*newDepSet(TOPOLOGICAL, direct, transitive)}
|
||||
}
|
||||
|
||||
// ToList returns the installPathsDepSet flattened to a list in topological order.
|
||||
func (d *installPathsDepSet) ToList() InstallPaths {
|
||||
if d == nil {
|
||||
return nil
|
||||
}
|
||||
return d.depSet.ToList().(InstallPaths)
|
||||
}
|
||||
|
Reference in New Issue
Block a user