Add (host|host-cross|target)[-<OS>] phony targets when not using make

Test: m --skip-make host-linux_bionic
Test: m --skip-make host
Change-Id: I28a15bcc690245f1a544a051868340b1dc818bb3
This commit is contained in:
Dan Willemsen
2017-09-20 17:29:08 -07:00
parent d2e95fb295
commit 61d88b8fca

View File

@@ -1001,6 +1001,54 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx blueprint.SingletonConte
Optional: ctx.Config().(Config).EmbeddedInMake(),
})
}
// Create (host|host-cross|target)-<OS> phony rules to build a reduced checkbuild.
osDeps := map[OsType]Paths{}
ctx.VisitAllModules(func(module blueprint.Module) {
if a, ok := module.(Module); ok {
if a.Enabled() {
os := a.Target().Os
osDeps[os] = append(osDeps[os], a.base().checkbuildFiles...)
}
}
})
osClass := make(map[string][]string)
for os, deps := range osDeps {
var className string
switch os.Class {
case Host:
className = "host"
case HostCross:
className = "host-cross"
case Device:
className = "target"
default:
continue
}
name := className + "-" + os.Name
osClass[className] = append(osClass[className], name)
ctx.Build(pctx, blueprint.BuildParams{
Rule: blueprint.Phony,
Outputs: []string{name},
Implicits: deps.Strings(),
Optional: true,
})
}
// Wrap those into host|host-cross|target phony rules
osClasses := sortedKeys(osClass)
for _, class := range osClasses {
ctx.Build(pctx, blueprint.BuildParams{
Rule: blueprint.Phony,
Outputs: []string{class},
Implicits: osClass[class],
Optional: true,
})
}
}
type AndroidModulesByName struct {