aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/cc.go1
-rw-r--r--genrule/genrule.go40
-rw-r--r--java/java.go1
3 files changed, 32 insertions, 10 deletions
diff --git a/cc/cc.go b/cc/cc.go
index fe9c4a47..f0ba1c60 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -956,6 +956,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
if cc == nil {
switch tag {
case android.DefaultsDepTag, android.SourceDepTag:
+ // Nothing to do
case genSourceDepTag:
if genRule, ok := m.(genrule.SourceFileGenerator); ok {
depPaths.GeneratedSources = append(depPaths.GeneratedSources,
diff --git a/genrule/genrule.go b/genrule/genrule.go
index c5de1fdc..921a64e0 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -48,6 +48,12 @@ type HostToolProvider interface {
HostToolPath() android.OptionalPath
}
+type hostToolDependencyTag struct {
+ blueprint.BaseDependencyTag
+}
+
+var hostToolDepTag hostToolDependencyTag
+
type generatorProperties struct {
// The command to run on one or more input files. Cmd supports substitution of a few variables
// (the actual substitution is implemented in GenerateAndroidBuildActions below)
@@ -123,7 +129,7 @@ func (g *generator) DepsMutator(ctx android.BottomUpMutatorContext) {
if len(g.properties.Tools) > 0 {
ctx.AddFarVariationDependencies([]blueprint.Variation{
{"arch", ctx.AConfig().BuildOsVariant},
- }, nil, g.properties.Tools...)
+ }, hostToolDepTag, g.properties.Tools...)
}
}
}
@@ -147,23 +153,37 @@ func (g *generator) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if len(g.properties.Tools) > 0 {
ctx.VisitDirectDeps(func(module blueprint.Module) {
- if t, ok := module.(HostToolProvider); ok {
- p := t.HostToolPath()
- if p.Valid() {
- g.deps = append(g.deps, p.Path())
- tool := ctx.OtherModuleName(module)
- if _, exists := tools[tool]; !exists {
- tools[tool] = p.Path()
+ switch ctx.OtherModuleDependencyTag(module) {
+ case android.SourceDepTag:
+ // Nothing to do
+ case hostToolDepTag:
+ tool := ctx.OtherModuleName(module)
+
+ if t, ok := module.(HostToolProvider); ok {
+ p := t.HostToolPath()
+ if p.Valid() {
+ g.deps = append(g.deps, p.Path())
+ if _, exists := tools[tool]; !exists {
+ tools[tool] = p.Path()
+ } else {
+ ctx.ModuleErrorf("multiple tools for %q, %q and %q", tool, tools[tool], p.Path().String())
+ }
} else {
- ctx.ModuleErrorf("multiple tools for %q, %q and %q", tool, tools[tool], p.Path().String())
+ ctx.ModuleErrorf("host tool %q missing output file", tool)
}
} else {
- ctx.ModuleErrorf("host tool %q missing output file", ctx.OtherModuleName(module))
+ ctx.ModuleErrorf("%q is not a host tool provider", tool)
}
+ default:
+ ctx.ModuleErrorf("unknown dependency on %q", ctx.OtherModuleName(module))
}
})
}
+ if ctx.Failed() {
+ return
+ }
+
for _, tool := range g.properties.Tool_files {
toolPath := android.PathForModuleSrc(ctx, tool)
g.deps = append(g.deps, toolPath)
diff --git a/java/java.go b/java/java.go
index 2298acc3..b4ce35ed 100644
--- a/java/java.go
+++ b/java/java.go
@@ -249,6 +249,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
if dep == nil {
switch tag {
case android.DefaultsDepTag, android.SourceDepTag:
+ // Nothing to do
default:
ctx.ModuleErrorf("depends on non-java module %q", otherName)
}