Skip to content

Commit 0037aff

Browse files
feat(androidNinja): add alias actions
Signed-off-by: Brandon Jones <[email protected]> Change-Id: I8bdfb29ec4f8da9163255b8b0443fd663fd59226
1 parent 154eac1 commit 0037aff

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

core/androidninja_backend.go

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/ARM-software/bob-build/core/backend"
88
"github.com/ARM-software/bob-build/core/file"
9+
"github.com/ARM-software/bob-build/core/tag"
910
"github.com/ARM-software/bob-build/internal/utils"
1011
"github.com/ARM-software/bob-build/internal/warnings"
1112
"github.com/google/blueprint"
@@ -16,8 +17,33 @@ type androidNinjaGenerator struct {
1617
}
1718

1819
// aliasActions implements generatorBackend.
19-
func (*androidNinjaGenerator) aliasActions(m *ModuleAlias, ctx blueprint.ModuleContext) {
20-
GetLogger().Warn(warnings.AndroidOutOfTreeUnsupportedModule, ctx.BlueprintsFile(), ctx.ModuleName())
20+
func (*androidNinjaGenerator) aliasActions(a *ModuleAlias, ctx blueprint.ModuleContext) {
21+
srcs := []string{}
22+
23+
/* Only depend on enabled targets */
24+
ctx.VisitDirectDepsIf(
25+
func(p blueprint.Module) bool { return ctx.OtherModuleDependencyTag(p) == tag.AliasTag },
26+
func(p blueprint.Module) {
27+
if e, ok := p.(enableable); ok {
28+
if !isEnabled(e) {
29+
return
30+
}
31+
}
32+
name := ctx.OtherModuleName(p)
33+
if lib, ok := p.(phonyInterface); ok {
34+
name = lib.shortName()
35+
}
36+
37+
srcs = append(srcs, name)
38+
})
39+
40+
ctx.Build(pctx,
41+
blueprint.BuildParams{
42+
Rule: blueprint.Phony,
43+
Inputs: srcs,
44+
Outputs: []string{a.Name()},
45+
Optional: true,
46+
})
2147
}
2248

2349
// binaryActions implements generatorBackend.

0 commit comments

Comments
 (0)