summaryrefslogtreecommitdiff
path: root/android/module.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/module.go')
-rw-r--r--android/module.go39
1 files changed, 27 insertions, 12 deletions
diff --git a/android/module.go b/android/module.go
index e161959ab..9f06045de 100644
--- a/android/module.go
+++ b/android/module.go
@@ -113,7 +113,6 @@ type Module interface {
TargetRequiredModuleNames() []string
VintfFragmentModuleNames(ctx ConfigAndErrorContext) []string
- FilesToInstall() InstallPaths
PackagingSpecs() []PackagingSpec
// TransitivePackagingSpecs returns the PackagingSpecs for this module and any transitive
@@ -764,6 +763,14 @@ func InitCommonOSAndroidMultiTargetsArchModule(m Module, hod HostOrDeviceSupport
m.base().commonProperties.CreateCommonOSVariant = true
}
+func ModuleFilesToInstall(ctx OtherModuleProviderContext, m blueprint.Module) InstallPaths {
+ var filesToInstall InstallPaths
+ if info, ok := OtherModuleProvider(ctx, m, InstallFilesProvider); ok {
+ filesToInstall = info.InstallFiles
+ }
+ return filesToInstall
+}
+
// A ModuleBase object contains the properties that are common to all Android
// modules. It should be included as an anonymous field in every module
// struct definition. InitAndroidModule should then be called from the module's
@@ -836,7 +843,6 @@ type ModuleBase struct {
primaryLicensesProperty applicableLicensesProperty
noAddressSanitizer bool
- installFiles InstallPaths
installFilesDepSet *DepSet[InstallPath]
checkbuildFiles Paths
packagingSpecs []PackagingSpec
@@ -1491,10 +1497,6 @@ func isInstallDepNeeded(dep Module, tag blueprint.DependencyTag) bool {
return IsInstallDepNeededTag(tag)
}
-func (m *ModuleBase) FilesToInstall() InstallPaths {
- return m.installFiles
-}
-
func (m *ModuleBase) PackagingSpecs() []PackagingSpec {
return m.packagingSpecs
}
@@ -1634,12 +1636,16 @@ func (m *ModuleBase) SetLicenseInstallMap(installMap []string) {
m.licenseInstallMap = append(m.licenseInstallMap, installMap...)
}
-func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) {
+func (m *ModuleBase) generateModuleTarget(ctx *moduleContext) {
var allInstalledFiles InstallPaths
var allCheckbuildFiles Paths
ctx.VisitAllModuleVariants(func(module Module) {
a := module.base()
- allInstalledFiles = append(allInstalledFiles, a.installFiles...)
+ if a == m {
+ allInstalledFiles = append(allInstalledFiles, ctx.installFiles...)
+ } else {
+ allInstalledFiles = append(allInstalledFiles, ModuleFilesToInstall(ctx, module)...)
+ }
// A module's -checkbuild phony targets should
// not be created if the module is not exported to make.
// Those could depend on the build target and fail to compile
@@ -1782,6 +1788,12 @@ func (m *ModuleBase) archModuleContextFactory(ctx archModuleContextFactoryContex
}
+type InstallFilesInfo struct {
+ InstallFiles InstallPaths
+}
+
+var InstallFilesProvider = blueprint.NewProvider[InstallFilesInfo]()
+
func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) {
ctx := &moduleContext{
module: m.module,
@@ -1940,7 +1952,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
restored := false
if incrementalAnalysis && cacheKey != nil {
- restored = ctx.bp.RestoreBuildActions(cacheKey, incrementalModule)
+ restored = ctx.bp.RestoreBuildActions(cacheKey)
}
if !restored {
@@ -1963,12 +1975,15 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
return
}
- m.installFiles = append(m.installFiles, ctx.installFiles...)
m.checkbuildFiles = append(m.checkbuildFiles, ctx.checkbuildFiles...)
m.packagingSpecs = append(m.packagingSpecs, ctx.packagingSpecs...)
m.katiInstalls = append(m.katiInstalls, ctx.katiInstalls...)
m.katiSymlinks = append(m.katiSymlinks, ctx.katiSymlinks...)
m.testData = append(m.testData, ctx.testData...)
+
+ SetProvider(ctx, InstallFilesProvider, InstallFilesInfo{
+ InstallFiles: ctx.installFiles,
+ })
} else if ctx.Config().AllowMissingDependencies() {
// If the module is not enabled it will not create any build rules, nothing will call
// ctx.GetMissingDependencies(), and blueprint will consider the missing dependencies to be unhandled
@@ -1984,7 +1999,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
}
}
- m.installFilesDepSet = NewDepSet[InstallPath](TOPOLOGICAL, m.installFiles, dependencyInstallFiles)
+ m.installFilesDepSet = NewDepSet[InstallPath](TOPOLOGICAL, ctx.installFiles, dependencyInstallFiles)
m.packagingSpecsDepSet = NewDepSet[PackagingSpec](TOPOLOGICAL, m.packagingSpecs, dependencyPackagingSpecs)
buildLicenseMetadata(ctx, m.licenseMetadataFile)
@@ -2538,7 +2553,7 @@ func outputFilesForModuleFromProvider(ctx PathContext, module blueprint.Module,
fromProperty = true
}
} else if cta, isCta := ctx.(*singletonContextAdaptor); isCta {
- providerData, _ := cta.moduleProvider(module, OutputFilesProvider)
+ providerData, _ := cta.otherModuleProvider(module, OutputFilesProvider)
outputFiles, _ = providerData.(OutputFilesInfo)
} else {
return nil, fmt.Errorf("unsupported context %q in method outputFilesForModuleFromProvider", reflect.TypeOf(ctx))