Merge "Remove build target related fields from ModuleBase." into main am: 97bf07a2ef
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3233882 Change-Id: I33d14eca24d56f163132500f0557388e5ab457e7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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.
|
||||
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
|
||||
|
||||
registerProps []interface{}
|
||||
@@ -1653,18 +1647,20 @@ func (m *ModuleBase) generateModuleTarget(ctx *moduleContext) {
|
||||
namespacePrefix = strings.ReplaceAll(nameSpace, "/", ".") + "-"
|
||||
}
|
||||
|
||||
var info FinalModuleBuildTargetsInfo
|
||||
|
||||
if len(allInstalledFiles) > 0 {
|
||||
name := namespacePrefix + ctx.ModuleName() + "-install"
|
||||
ctx.Phony(name, allInstalledFiles.Paths()...)
|
||||
m.installTarget = PathForPhony(ctx, name)
|
||||
deps = append(deps, m.installTarget)
|
||||
info.InstallTarget = PathForPhony(ctx, name)
|
||||
deps = append(deps, info.InstallTarget)
|
||||
}
|
||||
|
||||
if len(allCheckbuildFiles) > 0 {
|
||||
name := namespacePrefix + ctx.ModuleName() + "-checkbuild"
|
||||
ctx.Phony(name, allCheckbuildFiles...)
|
||||
m.checkbuildTarget = PathForPhony(ctx, name)
|
||||
deps = append(deps, m.checkbuildTarget)
|
||||
info.CheckbuildTarget = PathForPhony(ctx, name)
|
||||
deps = append(deps, info.CheckbuildTarget)
|
||||
}
|
||||
|
||||
if len(deps) > 0 {
|
||||
@@ -1675,7 +1671,8 @@ func (m *ModuleBase) generateModuleTarget(ctx *moduleContext) {
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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]()
|
||||
|
||||
func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) {
|
||||
@@ -2662,17 +2669,15 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx SingletonContext) {
|
||||
modulesInDir := make(map[string]Paths)
|
||||
|
||||
ctx.VisitAllModules(func(module Module) {
|
||||
blueprintDir := module.base().blueprintDir
|
||||
installTarget := module.base().installTarget
|
||||
checkbuildTarget := module.base().checkbuildTarget
|
||||
info := OtherModuleProviderOrDefault(ctx, module, FinalModuleBuildTargetsProvider)
|
||||
|
||||
if checkbuildTarget != nil {
|
||||
checkbuildDeps = append(checkbuildDeps, checkbuildTarget)
|
||||
modulesInDir[blueprintDir] = append(modulesInDir[blueprintDir], checkbuildTarget)
|
||||
if info.CheckbuildTarget != nil {
|
||||
checkbuildDeps = append(checkbuildDeps, info.CheckbuildTarget)
|
||||
modulesInDir[info.BlueprintDir] = append(modulesInDir[info.BlueprintDir], info.CheckbuildTarget)
|
||||
}
|
||||
|
||||
if installTarget != nil {
|
||||
modulesInDir[blueprintDir] = append(modulesInDir[blueprintDir], installTarget)
|
||||
if info.InstallTarget != nil {
|
||||
modulesInDir[info.BlueprintDir] = append(modulesInDir[info.BlueprintDir], info.InstallTarget)
|
||||
}
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user