From 0800ef7007c16e19b772d14eb53b58e10c17069f Mon Sep 17 00:00:00 2001 From: Rob Seymour Date: Mon, 31 Jan 2022 20:33:52 +0000 Subject: [PATCH] Fix host snapshot dependency cycle Test: m host-snapshot Bug: 216351382 Change-Id: Iaa8b7e8373fab0db931cbe7a6328c2adca27d95b --- snapshot/host_snapshot.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/snapshot/host_snapshot.go b/snapshot/host_snapshot.go index 252cef816..09a382e6e 100644 --- a/snapshot/host_snapshot.go +++ b/snapshot/host_snapshot.go @@ -58,7 +58,7 @@ type hostSnapshot struct { android.ModuleBase android.PackagingBase - zipFile android.OptionalPath + outputFile android.OutputPath installDir android.InstallPath } @@ -141,7 +141,7 @@ func (f *hostSnapshot) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Create a zip file for the binaries, and a zip of the meta data, then merge zips depsZipFile := android.PathForModuleOut(ctx, f.Name()+"_deps.zip").OutputPath modsZipFile := android.PathForModuleOut(ctx, f.Name()+"_mods.zip").OutputPath - outputFile := android.PathForModuleOut(ctx, f.installFileName()).OutputPath + f.outputFile = android.PathForModuleOut(ctx, f.installFileName()).OutputPath f.installDir = android.PathForModuleInstall(ctx) @@ -158,26 +158,21 @@ func (f *hostSnapshot) GenerateAndroidBuildActions(ctx android.ModuleContext) { builder.Command(). BuiltTool("merge_zips"). - Output(outputFile). + Output(f.outputFile). Input(metaZipFile). Input(modsZipFile) builder.Build("manifest", fmt.Sprintf("Adding manifest %s", f.installFileName())) - zip := ctx.InstallFile(f.installDir, f.installFileName(), outputFile) - f.zipFile = android.OptionalPathForPath(zip) + ctx.InstallFile(f.installDir, f.installFileName(), f.outputFile) } // Implements android.AndroidMkEntriesProvider func (f *hostSnapshot) AndroidMkEntries() []android.AndroidMkEntries { - if !f.zipFile.Valid() { - return []android.AndroidMkEntries{} - } - return []android.AndroidMkEntries{android.AndroidMkEntries{ Class: "ETC", - OutputFile: f.zipFile, - DistFiles: android.MakeDefaultDistFiles(f.zipFile.Path()), + OutputFile: android.OptionalPathForPath(f.outputFile), + DistFiles: android.MakeDefaultDistFiles(f.outputFile), ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { entries.SetString("LOCAL_MODULE_PATH", f.installDir.String())