Fix android.Expand and ninja escaping
RuleBuilder does its own ninja escaping, so values that will be passed to RuleBuilder must not be pre-escaped. Add a new android.ExpandNinjaEscaped method that explicitly handles ninja escaping. Some of the expansion functions return ninja values (like "${in}") that need to stay unescaped, so add a bool return value to the expansion function in android.ExpandNinjaEscaped. Test: expand_test.go Change-Id: Ib03d4db38b5e3e5bffbd87acf14f55e276a53d04
This commit is contained in:
@@ -732,19 +732,19 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
|
||||
}
|
||||
|
||||
var err error
|
||||
j.args, err = android.Expand(String(j.properties.Args), func(name string) (string, error) {
|
||||
j.args, err = android.ExpandNinjaEscaped(String(j.properties.Args), func(name string) (string, bool, error) {
|
||||
if strings.HasPrefix(name, "location ") {
|
||||
label := strings.TrimSpace(strings.TrimPrefix(name, "location "))
|
||||
if paths, ok := argFilesMap[label]; ok {
|
||||
return paths, nil
|
||||
return paths, false, nil
|
||||
} else {
|
||||
return "", fmt.Errorf("unknown location label %q, expecting one of %q",
|
||||
return "", false, fmt.Errorf("unknown location label %q, expecting one of %q",
|
||||
label, strings.Join(argFileLabels, ", "))
|
||||
}
|
||||
} else if name == "genDir" {
|
||||
return android.PathForModuleGen(ctx).String(), nil
|
||||
return android.PathForModuleGen(ctx).String(), false, nil
|
||||
}
|
||||
return "", fmt.Errorf("unknown variable '$(%s)'", name)
|
||||
return "", false, fmt.Errorf("unknown variable '$(%s)'", name)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user