summaryrefslogtreecommitdiff
path: root/android/module.go
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2025-01-10 11:19:03 -0800
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-01-10 11:19:03 -0800
commit6aca2bb0198b851b1a7bbbfad2f746c4b8ca82f0 (patch)
tree85e90c0833b5fd29f011ad9ddc3a81aaa9d6f3a7 /android/module.go
parent8bf5dd84f87665c85bd0db273ca8d1c434da7b0a (diff)
parent8a8d5b4b1c714707faf2b9456099ac95fad74b7a (diff)
Merge changes Ie3b6d1f8,Id465f293 into main
* changes: Convert CollectAllSharedDependencies to use ModuleProxy. Convert depsToPaths to use ModuleProxy for both cc and rust.
Diffstat (limited to 'android/module.go')
-rw-r--r--android/module.go39
1 files changed, 33 insertions, 6 deletions
diff --git a/android/module.go b/android/module.go
index 2f505aa30..e4a590457 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1867,12 +1867,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
@@ -1884,11 +1886,11 @@ type CommonModuleInfo struct {
var CommonModuleInfoKey = blueprint.NewProvider[CommonModuleInfo]()
-type PrebuiltModuleProviderData struct {
- // Empty for now
+type PrebuiltModuleInfo struct {
+ SourceExists bool
}
-var PrebuiltModuleProviderKey = blueprint.NewProvider[PrebuiltModuleProviderData]()
+var PrebuiltModuleInfoProvider = blueprint.NewProvider[PrebuiltModuleInfo]()
type HostToolProviderData struct {
HostToolPath OptionalPath
@@ -1896,6 +1898,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,
@@ -2146,7 +2162,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,
@@ -2172,10 +2188,13 @@ 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 {
- SetProvider(ctx, PrebuiltModuleProviderKey, PrebuiltModuleProviderData{})
+ SetProvider(ctx, PrebuiltModuleInfoProvider, PrebuiltModuleInfo{
+ SourceExists: p.Prebuilt().SourceExists(),
+ })
}
if h, ok := m.module.(HostToolProvider); ok {
SetProvider(ctx, HostToolProviderKey, HostToolProviderData{
@@ -2185,6 +2204,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)) {