summaryrefslogtreecommitdiff
path: root/android/module.go
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2024-12-20 23:31:32 +0000
committer Yu Liu <yudiliu@google.com> 2025-01-08 23:28:12 +0000
commit8024b92aa2edf9a2c0dcab4dc40a081b002146da (patch)
treef564bb72582ea466cebc57054465d820a1ac6e95 /android/module.go
parent63ee59d96214105d5a0b134ab06671745c5ed8ea (diff)
Convert depsToPaths to use ModuleProxy for both cc and rust.
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: Id465f293c3615fc803b34c990f19b4386ebece1c
Diffstat (limited to 'android/module.go')
-rw-r--r--android/module.go29
1 files changed, 27 insertions, 2 deletions
diff --git a/android/module.go b/android/module.go
index b8f2cae2e..287ac599e 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1868,12 +1868,14 @@ type CommonModuleInfo struct {
// Whether the module has been replaced by a prebuilt
ReplacedByPrebuilt bool
// The Target of artifacts that this module variant is responsible for creating.
- CompileTarget Target
+ Target Target
SkipAndroidMkProcessing bool
BaseModuleName string
CanHaveApexVariants bool
MinSdkVersion string
NotAvailableForPlatform bool
+ // There some subtle differences between this one and the one above.
+ NotInPlatform bool
// UninstallableApexPlatformVariant is set by MakeUninstallable called by the apex
// mutator. MakeUninstallable also sets HideFromMake. UninstallableApexPlatformVariant
// is used to avoid adding install or packaging dependencies into libraries provided
@@ -1897,6 +1899,20 @@ type HostToolProviderData struct {
var HostToolProviderKey = blueprint.NewProvider[HostToolProviderData]()
+type SourceFileGenerator interface {
+ GeneratedSourceFiles() Paths
+ GeneratedHeaderDirs() Paths
+ GeneratedDeps() Paths
+}
+
+type GeneratedSourceInfo struct {
+ GeneratedSourceFiles Paths
+ GeneratedHeaderDirs Paths
+ GeneratedDeps Paths
+}
+
+var GeneratedSourceInfoProvider = blueprint.NewProvider[GeneratedSourceInfo]()
+
func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) {
ctx := &moduleContext{
module: m.module,
@@ -2147,7 +2163,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
commonData := CommonModuleInfo{
ReplacedByPrebuilt: m.commonProperties.ReplacedByPrebuilt,
- CompileTarget: m.commonProperties.CompileTarget,
+ Target: m.commonProperties.CompileTarget,
SkipAndroidMkProcessing: shouldSkipAndroidMkProcessing(ctx, m),
BaseModuleName: m.BaseModuleName(),
UninstallableApexPlatformVariant: m.commonProperties.UninstallableApexPlatformVariant,
@@ -2173,6 +2189,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
if am, ok := m.module.(ApexModule); ok {
commonData.CanHaveApexVariants = am.CanHaveApexVariants()
commonData.NotAvailableForPlatform = am.NotAvailableForPlatform()
+ commonData.NotInPlatform = am.NotInPlatform()
}
SetProvider(ctx, CommonModuleInfoKey, commonData)
if p, ok := m.module.(PrebuiltInterface); ok && p.Prebuilt() != nil {
@@ -2186,6 +2203,14 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
if p, ok := m.module.(AndroidMkProviderInfoProducer); ok && !commonData.SkipAndroidMkProcessing {
SetProvider(ctx, AndroidMkInfoProvider, p.PrepareAndroidMKProviderInfo(ctx.Config()))
}
+
+ if s, ok := m.module.(SourceFileGenerator); ok {
+ SetProvider(ctx, GeneratedSourceInfoProvider, GeneratedSourceInfo{
+ GeneratedSourceFiles: s.GeneratedSourceFiles(),
+ GeneratedHeaderDirs: s.GeneratedHeaderDirs(),
+ GeneratedDeps: s.GeneratedDeps(),
+ })
+ }
}
func SetJarJarPrefixHandler(handler func(ModuleContext)) {