Allow CopyDepsToZip() to work on WritablePath
Makes the method more generally usable as it can work with any WritablePath not just OutputPath. Also, makes it independent of whether PathForModuleOut() returns ModuleOutPath or OutputPath. Bug: 179124768 Test: m nothing Change-Id: I08e61a24722198aa92fa2f8a2d096b1a8bf9c5c2
This commit is contained in:
@@ -61,7 +61,7 @@ type PackageModule interface {
|
|||||||
// returns zip entries in it. This is expected to be called in GenerateAndroidBuildActions,
|
// returns zip entries in it. This is expected to be called in GenerateAndroidBuildActions,
|
||||||
// followed by a build rule that unzips it and creates the final output (img, zip, tar.gz,
|
// followed by a build rule that unzips it and creates the final output (img, zip, tar.gz,
|
||||||
// etc.) from the extracted files
|
// etc.) from the extracted files
|
||||||
CopyDepsToZip(ctx ModuleContext, zipOut OutputPath) []string
|
CopyDepsToZip(ctx ModuleContext, zipOut WritablePath) []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// PackagingBase provides basic functionality for packaging dependencies. A module is expected to
|
// PackagingBase provides basic functionality for packaging dependencies. A module is expected to
|
||||||
@@ -152,7 +152,7 @@ func (p *PackagingBase) AddDeps(ctx BottomUpMutatorContext, depTag blueprint.Dep
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See PackageModule.CopyDepsToZip
|
// See PackageModule.CopyDepsToZip
|
||||||
func (p *PackagingBase) CopyDepsToZip(ctx ModuleContext, zipOut OutputPath) (entries []string) {
|
func (p *PackagingBase) CopyDepsToZip(ctx ModuleContext, zipOut WritablePath) (entries []string) {
|
||||||
m := make(map[string]PackagingSpec)
|
m := make(map[string]PackagingSpec)
|
||||||
ctx.WalkDeps(func(child Module, parent Module) bool {
|
ctx.WalkDeps(func(child Module, parent Module) bool {
|
||||||
if !IsInstallDepNeeded(ctx.OtherModuleDependencyTag(child)) {
|
if !IsInstallDepNeeded(ctx.OtherModuleDependencyTag(child)) {
|
||||||
@@ -168,7 +168,7 @@ func (p *PackagingBase) CopyDepsToZip(ctx ModuleContext, zipOut OutputPath) (ent
|
|||||||
|
|
||||||
builder := NewRuleBuilder(pctx, ctx)
|
builder := NewRuleBuilder(pctx, ctx)
|
||||||
|
|
||||||
dir := PathForModuleOut(ctx, ".zip").OutputPath
|
dir := PathForModuleOut(ctx, ".zip")
|
||||||
builder.Command().Text("rm").Flag("-rf").Text(dir.String())
|
builder.Command().Text("rm").Flag("-rf").Text(dir.String())
|
||||||
builder.Command().Text("mkdir").Flag("-p").Text(dir.String())
|
builder.Command().Text("mkdir").Flag("-p").Text(dir.String())
|
||||||
|
|
||||||
|
@@ -73,7 +73,7 @@ func (m *packageTestModule) DepsMutator(ctx BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *packageTestModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
func (m *packageTestModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||||
zipFile := PathForModuleOut(ctx, "myzip.zip").OutputPath
|
zipFile := PathForModuleOut(ctx, "myzip.zip")
|
||||||
m.entries = m.CopyDepsToZip(ctx, zipFile)
|
m.entries = m.CopyDepsToZip(ctx, zipFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user