Update prebuilt_etc available for snapshot

Make prebuilt_etc module available for the snapshot. This change
includes implementing snapshot interface for the prebuilt_etc module so
it can be added to the snapshot from the fake snapshot, or when the
module is specified in the list.

Bug: 192430376
Test: m nothing passed
Test: Checked if the module is included in the snapshot properly
Change-Id: I3574d2a1b8f8f4e5f083f3913e8768f5088d0c46
This commit is contained in:
Kiyoung Kim
2021-07-19 11:38:04 +09:00
parent 48f3778cb4
commit ae11c233b5
9 changed files with 339 additions and 33 deletions

View File

@@ -21,6 +21,7 @@ import (
"strings"
"android/soong/android"
"android/soong/snapshot"
)
// Efficiently converts a list of include directories to a single string
@@ -126,20 +127,6 @@ func makeSymlinkCmd(linkDirOnDevice string, linkName string, target string) stri
"ln -sf " + target + " " + filepath.Join(dir, linkName)
}
func copyFileRule(ctx android.SingletonContext, path android.Path, out string) android.OutputPath {
outPath := android.PathForOutput(ctx, out)
ctx.Build(pctx, android.BuildParams{
Rule: android.Cp,
Input: path,
Output: outPath,
Description: "copy " + path.String() + " -> " + out,
Args: map[string]string{
"cpFlags": "-f -L",
},
})
return outPath
}
func combineNoticesRule(ctx android.SingletonContext, paths android.Paths, out string) android.OutputPath {
outPath := android.PathForOutput(ctx, out)
ctx.Build(pctx, android.BuildParams{
@@ -151,12 +138,6 @@ func combineNoticesRule(ctx android.SingletonContext, paths android.Paths, out s
return outPath
}
func writeStringToFileRule(ctx android.SingletonContext, content, out string) android.OutputPath {
outPath := android.PathForOutput(ctx, out)
android.WriteFileRule(ctx, outPath, content)
return outPath
}
// Dump a map to a list file as:
//
// {key1} {value1}
@@ -172,5 +153,5 @@ func installMapListFileRule(ctx android.SingletonContext, m map[string]string, p
txtBuilder.WriteString(" ")
txtBuilder.WriteString(m[k])
}
return writeStringToFileRule(ctx, txtBuilder.String(), path)
return snapshot.WriteStringToFileRule(ctx, txtBuilder.String(), path)
}