Merge "Only create a command line replacer once" am: 2c3122e90a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2431535 Change-Id: I6df41d70091b4f6ed54ec4e329268845e5e882df Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -671,17 +671,18 @@ func expandTemplateContent(actionEntry action) string {
|
||||
return replacer.Replace(actionEntry.TemplateContent)
|
||||
}
|
||||
|
||||
// \->\\, $->\$, `->\`, "->\", \n->\\n, '->'"'"'
|
||||
var commandLineArgumentReplacer = strings.NewReplacer(
|
||||
`\`, `\\`,
|
||||
`$`, `\$`,
|
||||
"`", "\\`",
|
||||
`"`, `\"`,
|
||||
"\n", "\\n",
|
||||
`'`, `'"'"'`,
|
||||
)
|
||||
|
||||
func escapeCommandlineArgument(str string) string {
|
||||
// \->\\, $->\$, `->\`, "->\", \n->\\n, '->'"'"'
|
||||
replacer := strings.NewReplacer(
|
||||
`\`, `\\`,
|
||||
`$`, `\$`,
|
||||
"`", "\\`",
|
||||
`"`, `\"`,
|
||||
"\n", "\\n",
|
||||
`'`, `'"'"'`,
|
||||
)
|
||||
return replacer.Replace(str)
|
||||
return commandLineArgumentReplacer.Replace(str)
|
||||
}
|
||||
|
||||
func (a action) isSymlinkAction() bool {
|
||||
|
Reference in New Issue
Block a user