diff options
author | Colin Cross <ccross@android.com> | 2017-12-08 18:23:13 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-12-08 18:23:57 -0800 |
commit | ac87c992bee5c4034fdd5ced05e3328f081a7132 (patch) | |
tree | f5a90267fb00653032235d28c27b243cdbdee8fd /genrule | |
parent | e304cc45755939cec9b0b62b87f26fa539aaade1 (diff) | |
download | build_soong-ac87c992bee5c4034fdd5ced05e3328f081a7132.tar.gz build_soong-ac87c992bee5c4034fdd5ced05e3328f081a7132.tar.bz2 build_soong-ac87c992bee5c4034fdd5ced05e3328f081a7132.zip |
Allow globs in tool_files
tool_files can be used to add dependencies on files used by tools,
so let it support globs.
Test: m checkbuild
Change-Id: I1c1cb098190e1bb1c81292f6eb0c4ed0e240c1e1
Diffstat (limited to 'genrule')
-rw-r--r-- | genrule/genrule.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/genrule/genrule.go b/genrule/genrule.go index 651ec15d..98394100 100644 --- a/genrule/genrule.go +++ b/genrule/genrule.go @@ -131,6 +131,7 @@ func (g *Module) GeneratedHeaderDirs() android.Paths { func (g *Module) DepsMutator(ctx android.BottomUpMutatorContext) { android.ExtractSourcesDeps(ctx, g.properties.Srcs) + android.ExtractSourcesDeps(ctx, g.properties.Tool_files) if g, ok := ctx.Module().(*Module); ok { if len(g.properties.Tools) > 0 { ctx.AddFarVariationDependencies([]blueprint.Variation{ @@ -141,7 +142,8 @@ func (g *Module) DepsMutator(ctx android.BottomUpMutatorContext) { } func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) { - if len(g.properties.Tools) == 0 && len(g.properties.Tool_files) == 0 { + toolFiles := ctx.ExpandSources(g.properties.Tool_files, nil) + if len(g.properties.Tools) == 0 && len(toolFiles) == 0 { ctx.ModuleErrorf("at least one `tools` or `tool_files` is required") return } @@ -208,13 +210,12 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) { return } - for _, tool := range g.properties.Tool_files { - toolPath := android.PathForModuleSrc(ctx, tool) - g.deps = append(g.deps, toolPath) - if _, exists := tools[tool]; !exists { - tools[tool] = toolPath + for _, tool := range toolFiles { + g.deps = append(g.deps, tool) + if _, exists := tools[tool.Rel()]; !exists { + tools[tool.Rel()] = tool } else { - ctx.ModuleErrorf("multiple tools for %q, %q and %q", tool, tools[tool], toolPath.String()) + ctx.ModuleErrorf("multiple tools for %q, %q and %q", tool, tools[tool.Rel()], tool.Rel()) } } @@ -229,7 +230,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) { if len(g.properties.Tools) > 0 { return tools[g.properties.Tools[0]].String(), nil } else { - return tools[g.properties.Tool_files[0]].String(), nil + return tools[toolFiles[0].Rel()].String(), nil } case "in": return "${in}", nil |