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:
14
apex/key.go
14
apex/key.go
@@ -116,7 +116,7 @@ func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) {
|
||||
partition string
|
||||
}
|
||||
toString := func(e apexKeyEntry) string {
|
||||
format := "name=%q public_key=%q private_key=%q container_certificate=%q container_private_key=%q partition=%q\\n"
|
||||
format := "name=%q public_key=%q private_key=%q container_certificate=%q container_private_key=%q partition=%q\n"
|
||||
if e.presigned {
|
||||
return fmt.Sprintf(format, e.name, "PRESIGNED", "PRESIGNED", "PRESIGNED", "PRESIGNED", e.partition)
|
||||
} else {
|
||||
@@ -173,17 +173,9 @@ func (s *apexKeysText) GenerateBuildActions(ctx android.SingletonContext) {
|
||||
|
||||
var filecontent strings.Builder
|
||||
for _, name := range moduleNames {
|
||||
fmt.Fprintf(&filecontent, "%s", toString(apexKeyMap[name]))
|
||||
filecontent.WriteString(toString(apexKeyMap[name]))
|
||||
}
|
||||
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: android.WriteFile,
|
||||
Description: "apexkeys.txt",
|
||||
Output: s.output,
|
||||
Args: map[string]string{
|
||||
"content": filecontent.String(),
|
||||
},
|
||||
})
|
||||
android.WriteFileRule(ctx, s.output, filecontent.String())
|
||||
}
|
||||
|
||||
func apexKeysTextFactory() android.Singleton {
|
||||
|
Reference in New Issue
Block a user