Reimplement AddMissingDependencies
AddMissingDependencies is needed in BaseModuleContext in order to allow PathsForModuleSrc and friends to be called in mutators, It's not a simple move, as it currently writes to a module field that would be lost if any mutators cloned new variants by calling CreateVariations. Reimplement it using a mutated property instead. Test: m checkbuild Change-Id: I851125065e4c5302b552773dae4640426c62965e
This commit is contained in:
@@ -338,6 +338,8 @@ type commonProperties struct {
|
|||||||
SkipInstall bool `blueprint:"mutated"`
|
SkipInstall bool `blueprint:"mutated"`
|
||||||
|
|
||||||
NamespaceExportedToMake bool `blueprint:"mutated"`
|
NamespaceExportedToMake bool `blueprint:"mutated"`
|
||||||
|
|
||||||
|
MissingDeps []string `blueprint:"mutated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type hostAndDeviceProperties struct {
|
type hostAndDeviceProperties struct {
|
||||||
@@ -841,10 +843,14 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
|||||||
baseModuleContext: m.baseModuleContextFactory(blueprintCtx),
|
baseModuleContext: m.baseModuleContextFactory(blueprintCtx),
|
||||||
installDeps: m.computeInstallDeps(blueprintCtx),
|
installDeps: m.computeInstallDeps(blueprintCtx),
|
||||||
installFiles: m.installFiles,
|
installFiles: m.installFiles,
|
||||||
missingDeps: blueprintCtx.GetMissingDependencies(),
|
|
||||||
variables: make(map[string]string),
|
variables: make(map[string]string),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Temporarily continue to call blueprintCtx.GetMissingDependencies() to maintain the previous behavior of never
|
||||||
|
// reporting missing dependency errors in Blueprint when AllowMissingDependencies == true.
|
||||||
|
// TODO: This will be removed once defaults modules handle missing dependency errors
|
||||||
|
blueprintCtx.GetMissingDependencies()
|
||||||
|
|
||||||
if ctx.config.captureBuild {
|
if ctx.config.captureBuild {
|
||||||
ctx.ruleParams = make(map[blueprint.Rule]blueprint.RuleParams)
|
ctx.ruleParams = make(map[blueprint.Rule]blueprint.RuleParams)
|
||||||
}
|
}
|
||||||
@@ -931,7 +937,6 @@ type moduleContext struct {
|
|||||||
installDeps Paths
|
installDeps Paths
|
||||||
installFiles Paths
|
installFiles Paths
|
||||||
checkbuildFiles Paths
|
checkbuildFiles Paths
|
||||||
missingDeps []string
|
|
||||||
module Module
|
module Module
|
||||||
|
|
||||||
// For tests
|
// For tests
|
||||||
@@ -1032,24 +1037,33 @@ func (m *moduleContext) Build(pctx PackageContext, params BuildParams) {
|
|||||||
bparams.Description = "${moduleDesc}" + params.Description + "${moduleDescSuffix}"
|
bparams.Description = "${moduleDesc}" + params.Description + "${moduleDescSuffix}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.missingDeps != nil {
|
if missingDeps := m.GetMissingDependencies(); len(missingDeps) > 0 {
|
||||||
m.ninjaError(bparams.Description, bparams.Outputs,
|
m.ninjaError(bparams.Description, bparams.Outputs,
|
||||||
fmt.Errorf("module %s missing dependencies: %s\n",
|
fmt.Errorf("module %s missing dependencies: %s\n",
|
||||||
m.ModuleName(), strings.Join(m.missingDeps, ", ")))
|
m.ModuleName(), strings.Join(missingDeps, ", ")))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
m.ModuleContext.Build(pctx.PackageContext, bparams)
|
m.ModuleContext.Build(pctx.PackageContext, bparams)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *moduleContext) Module() Module {
|
||||||
|
return m.ModuleContext.Module().(Module)
|
||||||
|
}
|
||||||
|
|
||||||
func (m *moduleContext) GetMissingDependencies() []string {
|
func (m *moduleContext) GetMissingDependencies() []string {
|
||||||
return m.missingDeps
|
var missingDeps []string
|
||||||
|
missingDeps = append(missingDeps, m.Module().base().commonProperties.MissingDeps...)
|
||||||
|
missingDeps = append(missingDeps, m.ModuleContext.GetMissingDependencies()...)
|
||||||
|
missingDeps = FirstUniqueStrings(missingDeps)
|
||||||
|
return missingDeps
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *moduleContext) AddMissingDependencies(deps []string) {
|
func (m *moduleContext) AddMissingDependencies(deps []string) {
|
||||||
if deps != nil {
|
if deps != nil {
|
||||||
m.missingDeps = append(m.missingDeps, deps...)
|
missingDeps := &m.Module().base().commonProperties.MissingDeps
|
||||||
m.missingDeps = FirstUniqueStrings(m.missingDeps)
|
*missingDeps = append(*missingDeps, deps...)
|
||||||
|
*missingDeps = FirstUniqueStrings(*missingDeps)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -758,6 +758,11 @@ func (p *pathForModuleSrcTestModule) GenerateAndroidBuildActions(ctx ModuleConte
|
|||||||
if !p.props.Module_handles_missing_deps {
|
if !p.props.Module_handles_missing_deps {
|
||||||
p.missingDeps = ctx.GetMissingDependencies()
|
p.missingDeps = ctx.GetMissingDependencies()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.Build(pctx, BuildParams{
|
||||||
|
Rule: Touch,
|
||||||
|
Output: PathForModuleOut(ctx, "output"),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
type pathForModuleSrcOutputFileProviderModule struct {
|
type pathForModuleSrcOutputFileProviderModule struct {
|
||||||
|
Reference in New Issue
Block a user