Remove build target related fields from ModuleBase.
Bug: 358425833 Test: CI Change-Id: I2af6d0d2fd3be70594860a0e6d86179d5850eb07
This commit is contained in:
@@ -846,12 +846,6 @@ type ModuleBase struct {
|
|||||||
// The files to copy to the dist as explicitly specified in the .bp file.
|
// The files to copy to the dist as explicitly specified in the .bp file.
|
||||||
distFiles TaggedDistFiles
|
distFiles TaggedDistFiles
|
||||||
|
|
||||||
// Used by buildTargetSingleton to create checkbuild and per-directory build targets
|
|
||||||
// Only set on the final variant of each module
|
|
||||||
installTarget WritablePath
|
|
||||||
checkbuildTarget WritablePath
|
|
||||||
blueprintDir string
|
|
||||||
|
|
||||||
hooks hooks
|
hooks hooks
|
||||||
|
|
||||||
registerProps []interface{}
|
registerProps []interface{}
|
||||||
@@ -1653,18 +1647,20 @@ func (m *ModuleBase) generateModuleTarget(ctx *moduleContext) {
|
|||||||
namespacePrefix = strings.ReplaceAll(nameSpace, "/", ".") + "-"
|
namespacePrefix = strings.ReplaceAll(nameSpace, "/", ".") + "-"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var info FinalModuleBuildTargetsInfo
|
||||||
|
|
||||||
if len(allInstalledFiles) > 0 {
|
if len(allInstalledFiles) > 0 {
|
||||||
name := namespacePrefix + ctx.ModuleName() + "-install"
|
name := namespacePrefix + ctx.ModuleName() + "-install"
|
||||||
ctx.Phony(name, allInstalledFiles.Paths()...)
|
ctx.Phony(name, allInstalledFiles.Paths()...)
|
||||||
m.installTarget = PathForPhony(ctx, name)
|
info.InstallTarget = PathForPhony(ctx, name)
|
||||||
deps = append(deps, m.installTarget)
|
deps = append(deps, info.InstallTarget)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(allCheckbuildFiles) > 0 {
|
if len(allCheckbuildFiles) > 0 {
|
||||||
name := namespacePrefix + ctx.ModuleName() + "-checkbuild"
|
name := namespacePrefix + ctx.ModuleName() + "-checkbuild"
|
||||||
ctx.Phony(name, allCheckbuildFiles...)
|
ctx.Phony(name, allCheckbuildFiles...)
|
||||||
m.checkbuildTarget = PathForPhony(ctx, name)
|
info.CheckbuildTarget = PathForPhony(ctx, name)
|
||||||
deps = append(deps, m.checkbuildTarget)
|
deps = append(deps, info.CheckbuildTarget)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(deps) > 0 {
|
if len(deps) > 0 {
|
||||||
@@ -1675,7 +1671,8 @@ func (m *ModuleBase) generateModuleTarget(ctx *moduleContext) {
|
|||||||
|
|
||||||
ctx.Phony(namespacePrefix+ctx.ModuleName()+suffix, deps...)
|
ctx.Phony(namespacePrefix+ctx.ModuleName()+suffix, deps...)
|
||||||
|
|
||||||
m.blueprintDir = ctx.ModuleDir()
|
info.BlueprintDir = ctx.ModuleDir()
|
||||||
|
SetProvider(ctx, FinalModuleBuildTargetsProvider, info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1790,6 +1787,16 @@ type InstallFilesInfo struct {
|
|||||||
TestData []DataPath
|
TestData []DataPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var FinalModuleBuildTargetsProvider = blueprint.NewProvider[FinalModuleBuildTargetsInfo]()
|
||||||
|
|
||||||
|
type FinalModuleBuildTargetsInfo struct {
|
||||||
|
// Used by buildTargetSingleton to create checkbuild and per-directory build targets
|
||||||
|
// Only set on the final variant of each module
|
||||||
|
InstallTarget WritablePath
|
||||||
|
CheckbuildTarget WritablePath
|
||||||
|
BlueprintDir string
|
||||||
|
}
|
||||||
|
|
||||||
var InstallFilesProvider = blueprint.NewProvider[InstallFilesInfo]()
|
var InstallFilesProvider = blueprint.NewProvider[InstallFilesInfo]()
|
||||||
|
|
||||||
func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) {
|
func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) {
|
||||||
@@ -2662,17 +2669,15 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx SingletonContext) {
|
|||||||
modulesInDir := make(map[string]Paths)
|
modulesInDir := make(map[string]Paths)
|
||||||
|
|
||||||
ctx.VisitAllModules(func(module Module) {
|
ctx.VisitAllModules(func(module Module) {
|
||||||
blueprintDir := module.base().blueprintDir
|
info := OtherModuleProviderOrDefault(ctx, module, FinalModuleBuildTargetsProvider)
|
||||||
installTarget := module.base().installTarget
|
|
||||||
checkbuildTarget := module.base().checkbuildTarget
|
|
||||||
|
|
||||||
if checkbuildTarget != nil {
|
if info.CheckbuildTarget != nil {
|
||||||
checkbuildDeps = append(checkbuildDeps, checkbuildTarget)
|
checkbuildDeps = append(checkbuildDeps, info.CheckbuildTarget)
|
||||||
modulesInDir[blueprintDir] = append(modulesInDir[blueprintDir], checkbuildTarget)
|
modulesInDir[info.BlueprintDir] = append(modulesInDir[info.BlueprintDir], info.CheckbuildTarget)
|
||||||
}
|
}
|
||||||
|
|
||||||
if installTarget != nil {
|
if info.InstallTarget != nil {
|
||||||
modulesInDir[blueprintDir] = append(modulesInDir[blueprintDir], installTarget)
|
modulesInDir[info.BlueprintDir] = append(modulesInDir[info.BlueprintDir], info.InstallTarget)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user