diff options
Diffstat (limited to 'android/rule_builder.go')
| -rw-r--r-- | android/rule_builder.go | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/android/rule_builder.go b/android/rule_builder.go index cc0bfa6af..17f211bf3 100644 --- a/android/rule_builder.go +++ b/android/rule_builder.go @@ -409,16 +409,6 @@ func (r *RuleBuilder) Commands() []string { return commands } -// NinjaEscapedCommands returns a slice containing the built command line after ninja escaping for each call to -// RuleBuilder.Command. -func (r *RuleBuilder) NinjaEscapedCommands() []string { - var commands []string - for _, c := range r.commands { - commands = append(commands, c.NinjaEscapedString()) - } - return commands -} - // BuilderContext is a subset of ModuleContext and SingletonContext. type BuilderContext interface { PathContext @@ -473,7 +463,7 @@ func (r *RuleBuilder) Build(name string, desc string) { } tools := r.Tools() - commands := r.NinjaEscapedCommands() + commands := r.Commands() outputs := r.Outputs() inputs := r.Inputs() rspFileInputs := r.RspFileInputs() @@ -547,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, proto.MarshalTextString(&manifest)) + WriteFileRule(r.ctx, r.sboxManifestPath, proptools.NinjaEscape(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 @@ -601,7 +591,7 @@ func (r *RuleBuilder) Build(name string, desc string) { r.ctx.Build(r.pctx, BuildParams{ Rule: r.ctx.Rule(pctx, name, blueprint.RuleParams{ - Command: commandString, + Command: proptools.NinjaEscape(commandString), CommandDeps: proptools.NinjaEscapeList(tools.Strings()), Restat: r.restat, Rspfile: proptools.NinjaEscape(rspFile), @@ -637,9 +627,6 @@ type RuleBuilderCommand struct { packagedTools []PackagingSpec rspFileInputs Paths rspFile WritablePath - - // spans [start,end) of the command that should not be ninja escaped - unescapedSpans [][2]int } func (c *RuleBuilderCommand) addInput(path Path) string { @@ -1069,11 +1056,6 @@ func (c *RuleBuilderCommand) String() string { return c.buf.String() } -// String returns the command line. -func (c *RuleBuilderCommand) NinjaEscapedString() string { - return ninjaEscapeExceptForSpans(c.String(), c.unescapedSpans) -} - // RuleBuilderSboxProtoForTests takes the BuildParams for the manifest passed to RuleBuilder.Sbox() // and returns sbox testproto generated by the RuleBuilder. func RuleBuilderSboxProtoForTests(t *testing.T, params TestingBuildParams) *sbox_proto.Manifest { @@ -1087,25 +1069,6 @@ func RuleBuilderSboxProtoForTests(t *testing.T, params TestingBuildParams) *sbox return &manifest } -func ninjaEscapeExceptForSpans(s string, spans [][2]int) string { - if len(spans) == 0 { - return proptools.NinjaEscape(s) - } - - sb := strings.Builder{} - sb.Grow(len(s) * 11 / 10) - - i := 0 - for _, span := range spans { - sb.WriteString(proptools.NinjaEscape(s[i:span[0]])) - sb.WriteString(s[span[0]:span[1]]) - i = span[1] - } - sb.WriteString(proptools.NinjaEscape(s[i:])) - - return sb.String() -} - func ninjaNameEscape(s string) string { b := []byte(s) escaped := false |