Delay dependency errors to ninja time for unbundled builds
Unbundled builds may use a subset of the tree, which can bring in unused modules but not their dependencies. Delay handling of dependency errors for unbundled builds to ninja time, which will prevent errors if only modules with satisified dependencies are built. Change-Id: Ib93bae93fcfa0b55df500a30d8e35231ffb0987c
This commit is contained in:
2
cc/cc.go
2
cc/cc.go
@@ -740,7 +740,7 @@ func (c *CCBase) depsToPathsFromList(ctx common.AndroidModuleContext,
|
||||
return
|
||||
}
|
||||
})
|
||||
if !found {
|
||||
if !found && !inList(n, ctx.GetMissingDependencies()) {
|
||||
ctx.ModuleErrorf("unsatisified dependency on %q", n)
|
||||
}
|
||||
}
|
||||
|
@@ -44,5 +44,7 @@ func main() {
|
||||
// Temporary hack
|
||||
//ctx.SetIgnoreUnknownModuleTypes(true)
|
||||
|
||||
ctx.SetAllowMissingDependencies(configuration.AllowMissingDependencies())
|
||||
|
||||
bootstrap.Main(ctx, configuration, configuration.ConfigFileName, configuration.ProductVariablesFileName)
|
||||
}
|
||||
|
@@ -22,8 +22,12 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
var Bool = proptools.Bool
|
||||
|
||||
// The configuration file name
|
||||
const configFileName = "soong.config"
|
||||
const productVariablesFileName = "soong.variables"
|
||||
@@ -287,3 +291,7 @@ func (c *config) DefaultAppCertificateDir(ctx PathContext) SourcePath {
|
||||
func (c *config) DefaultAppCertificate(ctx PathContext) SourcePath {
|
||||
return c.DefaultAppCertificateDir(ctx).Join(ctx, "testkey")
|
||||
}
|
||||
|
||||
func (c *config) AllowMissingDependencies() bool {
|
||||
return Bool(c.ProductVariables.Unbundled_build)
|
||||
}
|
||||
|
@@ -59,6 +59,13 @@ var (
|
||||
Description: "symlink $out",
|
||||
},
|
||||
"fromPath")
|
||||
|
||||
ErrorRule = pctx.StaticRule("Error",
|
||||
blueprint.RuleParams{
|
||||
Command: `echo "$error" && false`,
|
||||
Description: "error building $out",
|
||||
},
|
||||
"error")
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@@ -15,7 +15,9 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"android/soong"
|
||||
"android/soong/glob"
|
||||
@@ -363,6 +365,7 @@ func (a *AndroidModuleBase) GenerateBuildActions(ctx blueprint.ModuleContext) {
|
||||
androidBaseContextImpl: a.androidBaseContextFactory(ctx),
|
||||
installDeps: a.computeInstallDeps(ctx),
|
||||
installFiles: a.installFiles,
|
||||
missingDeps: ctx.GetMissingDependencies(),
|
||||
}
|
||||
|
||||
if !a.Enabled() {
|
||||
@@ -397,9 +400,28 @@ type androidModuleContext struct {
|
||||
installDeps Paths
|
||||
installFiles Paths
|
||||
checkbuildFiles Paths
|
||||
missingDeps []string
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) ninjaError(outputs []string, err error) {
|
||||
a.ModuleContext.Build(pctx, blueprint.BuildParams{
|
||||
Rule: ErrorRule,
|
||||
Outputs: outputs,
|
||||
Optional: true,
|
||||
Args: map[string]string{
|
||||
"error": err.Error(),
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) Build(pctx blueprint.PackageContext, params blueprint.BuildParams) {
|
||||
if a.missingDeps != nil {
|
||||
a.ninjaError(params.Outputs, fmt.Errorf("module %s missing dependencies: %s\n",
|
||||
a.ModuleName(), strings.Join(a.missingDeps, ", ")))
|
||||
return
|
||||
}
|
||||
|
||||
params.Optional = true
|
||||
a.ModuleContext.Build(pctx, params)
|
||||
}
|
||||
@@ -425,9 +447,19 @@ func (a *androidModuleContext) ModuleBuild(pctx blueprint.PackageContext, params
|
||||
bparams.Implicits = append(bparams.Implicits, params.Implicit.String())
|
||||
}
|
||||
|
||||
if a.missingDeps != nil {
|
||||
a.ninjaError(bparams.Outputs, fmt.Errorf("module %s missing dependencies: %s\n",
|
||||
a.ModuleName(), strings.Join(a.missingDeps, ", ")))
|
||||
return
|
||||
}
|
||||
|
||||
a.ModuleContext.Build(pctx, bparams)
|
||||
}
|
||||
|
||||
func (a *androidModuleContext) GetMissingDependencies() []string {
|
||||
return a.missingDeps
|
||||
}
|
||||
|
||||
func (a *androidBaseContextImpl) Arch() Arch {
|
||||
return a.arch
|
||||
}
|
||||
|
Reference in New Issue
Block a user