Merge "List of installed files for each APEX is dist'ed"

This commit is contained in:
Treehugger Robot 2020-01-16 06:38:11 +00:00 committed by Gerrit Code Review
commit 8122cf6d09
3 changed files with 29 additions and 2 deletions

View File

@ -245,6 +245,14 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
if apexType == imageApex {
fmt.Fprintln(w, "ALL_MODULES.$(LOCAL_MODULE).BUNDLE :=", a.bundleModuleFile.String())
}
if a.installedFilesFile != nil {
goal := "droidcore"
distFile := name + "-installed-files.txt"
fmt.Fprintln(w, ".PHONY:", goal)
fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s)\n",
goal, a.installedFilesFile.String(), distFile)
}
}
}}
}

View File

@ -547,6 +547,8 @@ type apexBundle struct {
// Suffix of module name in Android.mk
// ".flattened", ".apex", ".zipapex", or ""
suffix string
installedFilesFile android.WritablePath
}
func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext,

View File

@ -233,6 +233,19 @@ func (a *apexBundle) buildNoticeFile(ctx android.ModuleContext, apexFileName str
return android.BuildNoticeOutput(ctx, a.installDir, apexFileName, android.FirstUniquePaths(noticeFiles)).HtmlGzOutput
}
func (a *apexBundle) buildInstalledFilesFile(ctx android.ModuleContext, builtApex android.Path, imageDir android.Path) android.OutputPath {
output := android.PathForModuleOut(ctx, "installed-files.txt")
rule := android.NewRuleBuilder()
rule.Command().
Implicit(builtApex).
Text("(cd " + imageDir.String() + " ; ").
Text("find . -type f -printf \"%s %p\\n\") ").
Text(" | sort -nr > ").
Output(output)
rule.Build(pctx, ctx, "installed-files."+a.Name(), "Installed files")
return output.OutputPath
}
func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
var abis []string
for _, target := range ctx.MultiTargets() {
@ -307,6 +320,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
outHostBinDir := android.PathForOutput(ctx, "host", ctx.Config().PrebuiltOS(), "bin").String()
prebuiltSdkToolsBinDir := filepath.Join("prebuilts", "sdk", "tools", runtime.GOOS, "bin")
imageDir := android.PathForModuleOut(ctx, "image"+suffix)
if apexType == imageApex {
// files and dirs that will be created in APEX
var readOnlyPaths = []string{"apex_manifest.json", "apex_manifest.pb"}
@ -408,7 +422,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
Description: "apex (" + apexType.name() + ")",
Args: map[string]string{
"tool_path": outHostBinDir + ":" + prebuiltSdkToolsBinDir,
"image_dir": android.PathForModuleOut(ctx, "image"+suffix).String(),
"image_dir": imageDir.String(),
"copy_commands": strings.Join(copyCommands, " && "),
"manifest": a.manifestPbOut.String(),
"file_contexts": a.fileContexts.String(),
@ -446,7 +460,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
Description: "apex (" + apexType.name() + ")",
Args: map[string]string{
"tool_path": outHostBinDir + ":" + prebuiltSdkToolsBinDir,
"image_dir": android.PathForModuleOut(ctx, "image"+suffix).String(),
"image_dir": imageDir.String(),
"copy_commands": strings.Join(copyCommands, " && "),
"manifest": a.manifestPbOut.String(),
},
@ -474,6 +488,9 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
ctx.InstallFile(a.installDir, a.Name()+suffix, a.outputFile)
}
a.buildFilesInfo(ctx)
// installed-files.txt is dist'ed
a.installedFilesFile = a.buildInstalledFilesFile(ctx, a.outputFile, imageDir)
}
func (a *apexBundle) buildFlattenedApex(ctx android.ModuleContext) {