Fix droiddoc handling of $(location ...)

Bug: 124218911
Test: make checkbuild
Change-Id: I4d9c52b40ce4e8b9ae07f557e079e4f101fbbe87
This commit is contained in:
Paul Duffin
2019-02-11 15:38:42 +00:00
parent 40e26a2a99
commit 99e4a50202

View File

@@ -695,14 +695,17 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
j.sourcepaths = android.PathsForModuleSrc(ctx, j.properties.Local_sourcepaths) j.sourcepaths = android.PathsForModuleSrc(ctx, j.properties.Local_sourcepaths)
j.argFiles = ctx.ExpandSources(j.properties.Arg_files, nil) j.argFiles = ctx.ExpandSources(j.properties.Arg_files, nil)
argFilesMap := map[string]android.Path{} argFilesMap := map[string]string{}
argFileLabels := []string{}
for _, f := range j.argFiles { for _, label := range j.properties.Arg_files {
if _, exists := argFilesMap[f.Rel()]; !exists { var paths = ctx.ExpandSources([]string{label}, nil)
argFilesMap[f.Rel()] = f if _, exists := argFilesMap[label]; !exists {
argFilesMap[label] = strings.Join(paths.Strings(), " ")
argFileLabels = append(argFileLabels, label)
} else { } else {
ctx.ModuleErrorf("multiple arg_files for %q, %q and %q", ctx.ModuleErrorf("multiple arg_files for %q, %q and %q",
f, argFilesMap[f.Rel()], f.Rel()) label, argFilesMap[label], paths)
} }
} }
@@ -710,10 +713,11 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
j.args, err = android.Expand(String(j.properties.Args), func(name string) (string, error) { j.args, err = android.Expand(String(j.properties.Args), func(name string) (string, error) {
if strings.HasPrefix(name, "location ") { if strings.HasPrefix(name, "location ") {
label := strings.TrimSpace(strings.TrimPrefix(name, "location ")) label := strings.TrimSpace(strings.TrimPrefix(name, "location "))
if f, ok := argFilesMap[label]; ok { if paths, ok := argFilesMap[label]; ok {
return f.String(), nil return paths, nil
} else { } else {
return "", fmt.Errorf("unknown location label %q", label) return "", fmt.Errorf("unknown location label %q, expecting one of %q",
label, strings.Join(argFileLabels, ", "))
} }
} else if name == "genDir" { } else if name == "genDir" {
return android.PathForModuleGen(ctx).String(), nil return android.PathForModuleGen(ctx).String(), nil