Replace android.WriteFile rule with android.WriteFileRule
The android.WriteFile rule takes careful escaping to produce the right contents. Wrap it in an android.WriteFileRule that handles the escaping. Test: compare all android.WriteFile outputs Change-Id: If71a5843af47a37ca61714e1a1ebb32d08536c31
This commit is contained in:
@@ -598,36 +598,22 @@ func (d *ApexBundleDepsInfo) BuildDepsInfoLists(ctx ModuleContext, minSdkVersion
|
||||
var fullContent strings.Builder
|
||||
var flatContent strings.Builder
|
||||
|
||||
fmt.Fprintf(&fullContent, "%s(minSdkVersion:%s):\\n", ctx.ModuleName(), minSdkVersion)
|
||||
fmt.Fprintf(&fullContent, "%s(minSdkVersion:%s):\n", ctx.ModuleName(), minSdkVersion)
|
||||
for _, key := range FirstUniqueStrings(SortedStringKeys(depInfos)) {
|
||||
info := depInfos[key]
|
||||
toName := fmt.Sprintf("%s(minSdkVersion:%s)", info.To, info.MinSdkVersion)
|
||||
if info.IsExternal {
|
||||
toName = toName + " (external)"
|
||||
}
|
||||
fmt.Fprintf(&fullContent, " %s <- %s\\n", toName, strings.Join(SortedUniqueStrings(info.From), ", "))
|
||||
fmt.Fprintf(&flatContent, "%s\\n", toName)
|
||||
fmt.Fprintf(&fullContent, " %s <- %s\n", toName, strings.Join(SortedUniqueStrings(info.From), ", "))
|
||||
fmt.Fprintf(&flatContent, "%s\n", toName)
|
||||
}
|
||||
|
||||
d.fullListPath = PathForModuleOut(ctx, "depsinfo", "fulllist.txt").OutputPath
|
||||
ctx.Build(pctx, BuildParams{
|
||||
Rule: WriteFile,
|
||||
Description: "Full Dependency Info",
|
||||
Output: d.fullListPath,
|
||||
Args: map[string]string{
|
||||
"content": fullContent.String(),
|
||||
},
|
||||
})
|
||||
WriteFileRule(ctx, d.fullListPath, fullContent.String())
|
||||
|
||||
d.flatListPath = PathForModuleOut(ctx, "depsinfo", "flatlist.txt").OutputPath
|
||||
ctx.Build(pctx, BuildParams{
|
||||
Rule: WriteFile,
|
||||
Description: "Flat Dependency Info",
|
||||
Output: d.flatListPath,
|
||||
Args: map[string]string{
|
||||
"content": flatContent.String(),
|
||||
},
|
||||
})
|
||||
WriteFileRule(ctx, d.flatListPath, flatContent.String())
|
||||
}
|
||||
|
||||
// TODO(b/158059172): remove minSdkVersion allowlist
|
||||
|
Reference in New Issue
Block a user