genrule: expand $$ to $$

An escaped $ sign in an expanded string needs to be re-escaped so it
can pass through to ninja.

Test: m -j libLLVMObject
Change-Id: I2f7890417fd6f534e6e21cace3d86ae9ef708ce5
This commit is contained in:
Colin Cross 2016-11-21 17:22:15 -08:00
parent 124fd9afbd
commit 2ee10a0659
2 changed files with 5 additions and 5 deletions

View file

@ -57,7 +57,7 @@ func getMapping(s string, mapping func(string) (string, error)) (string, int, er
} }
return "", len(s), fmt.Errorf("missing )") return "", len(s), fmt.Errorf("missing )")
case '$': case '$':
return s[0:1], 1, nil return "$$", 1, nil
default: default:
i := strings.IndexFunc(s, unicode.IsSpace) i := strings.IndexFunc(s, unicode.IsSpace)
if i == 0 { if i == 0 {

View file

@ -85,19 +85,19 @@ var expandTestCases = []struct {
}, },
{ {
in: "$$", in: "$$",
out: "$", out: "$$",
}, },
{ {
in: "$$(var1)", in: "$$(var1)",
out: "$(var1)", out: "$$(var1)",
}, },
{ {
in: "$$$(var1)", in: "$$$(var1)",
out: "$abc", out: "$$abc",
}, },
{ {
in: "$(var1)$$", in: "$(var1)$$",
out: "abc$", out: "abc$$",
}, },
{ {
in: "$(💩)", in: "$(💩)",