Fix WriteFileRule escaping

WriteFileRule shouldn't force the caller to ninja escape the input,
and should shell escape spaces.

Bug: 182612695
Test: manual
Change-Id: Ide2f1ed92783eef7883279238de209d992d8f735
This commit is contained in:
Colin Cross
2021-03-12 17:24:18 -08:00
parent b70a1a900a
commit 1c217fdc96
2 changed files with 2 additions and 2 deletions

View File

@@ -145,7 +145,7 @@ var (
func buildWriteFileRule(ctx BuilderContext, outputFile WritablePath, content string) {
content = echoEscaper.Replace(content)
content = proptools.ShellEscape(content)
content = proptools.NinjaEscape(proptools.ShellEscapeIncludingSpaces(content))
if content == "" {
content = "''"
}

View File

@@ -537,7 +537,7 @@ func (r *RuleBuilder) Build(name string, desc string) {
}
// Create a rule to write the manifest as a the textproto.
WriteFileRule(r.ctx, r.sboxManifestPath, proptools.NinjaEscape(proto.MarshalTextString(&manifest)))
WriteFileRule(r.ctx, r.sboxManifestPath, proto.MarshalTextString(&manifest))
// Generate a new string to use as the command line of the sbox rule. This uses
// a RuleBuilderCommand as a convenience method of building the command line, then