Add TransitivePackagingSpecs

Add TransitivePackagingSpecs to return the PackagingSpecs for a
module and any of its transitive dependencies that have dependency
tags for which IsInstallDepNeeded returns true.

Bug: 124313442
Test: m checkbuild
Change-Id: I1d6750db830d1601d696349674f0b7071372ca11
This commit is contained in:
Colin Cross
2020-12-01 15:40:06 -08:00
parent 859dfd9240
commit ffe6b9d9ba
2 changed files with 42 additions and 10 deletions

View File

@@ -203,3 +203,23 @@ func (p *PackagingBase) CopyDepsToZip(ctx ModuleContext, zipOut OutputPath) (ent
builder.Build("zip_deps", fmt.Sprintf("Zipping deps for %s", ctx.ModuleName()))
return entries
}
// packagingSpecsDepSet is a thin type-safe wrapper around the generic depSet. It always uses
// topological order.
type packagingSpecsDepSet struct {
depSet
}
// newPackagingSpecsDepSet returns an immutable packagingSpecsDepSet with the given direct and
// transitive contents.
func newPackagingSpecsDepSet(direct []PackagingSpec, transitive []*packagingSpecsDepSet) *packagingSpecsDepSet {
return &packagingSpecsDepSet{*newDepSet(TOPOLOGICAL, direct, transitive)}
}
// ToList returns the packagingSpecsDepSet flattened to a list in topological order.
func (d *packagingSpecsDepSet) ToList() []PackagingSpec {
if d == nil {
return nil
}
return d.depSet.ToList().([]PackagingSpec)
}