diff options
Diffstat (limited to 'android/module.go')
-rw-r--r-- | android/module.go | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/android/module.go b/android/module.go index 39a165463..0ffb6cb53 100644 --- a/android/module.go +++ b/android/module.go @@ -1091,6 +1091,10 @@ var vintfDepTag = struct { InstallAlwaysNeededDependencyTag }{} +func IsVintfDepTag(depTag blueprint.DependencyTag) bool { + return depTag == vintfDepTag +} + func addVintfFragmentDeps(ctx BottomUpMutatorContext) { // Vintf manifests in the recovery partition will be ignored. if !ctx.Device() || ctx.Module().InstallInRecovery() { @@ -1109,7 +1113,7 @@ func addVintfFragmentDeps(ctx BottomUpMutatorContext) { // of nil pointer dereference errors, but we should resolve the missing dependencies. continue } - if vintfModule, ok := vintf.(*vintfFragmentModule); ok { + if vintfModule, ok := vintf.(*VintfFragmentModule); ok { vintfPartition := vintfModule.PartitionTag(deviceConfig) if modPartition != vintfPartition { ctx.ModuleErrorf("Module %q(%q) and Vintf_fragment %q(%q) are installed to different partitions.", @@ -1894,7 +1898,7 @@ type CommonModuleInfo struct { SkipAndroidMkProcessing bool BaseModuleName string CanHaveApexVariants bool - MinSdkVersion string + MinSdkVersion ApiLevelOrPlatform SdkVersion string NotAvailableForPlatform bool // There some subtle differences between this one and the one above. @@ -1908,6 +1912,13 @@ type CommonModuleInfo struct { SkipInstall bool IsStubsModule bool Host bool + MinSdkVersionSupported ApiLevel + ModuleWithMinSdkVersionCheck bool +} + +type ApiLevelOrPlatform struct { + ApiLevel *ApiLevel + IsPlatform bool } var CommonModuleInfoKey = blueprint.NewProvider[CommonModuleInfo]() @@ -1925,6 +1936,12 @@ type HostToolProviderInfo struct { var HostToolProviderInfoProvider = blueprint.NewProvider[HostToolProviderInfo]() +type DistInfo struct { + Dists []dist +} + +var DistProvider = blueprint.NewProvider[DistInfo]() + type SourceFileGenerator interface { GeneratedSourceFiles() Paths GeneratedHeaderDirs() Paths @@ -2222,6 +2239,13 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) Phonies: ctx.phonies, }) } + + if len(ctx.dists) > 0 { + SetProvider(ctx, DistProvider, DistInfo{ + Dists: ctx.dists, + }) + } + buildComplianceMetadataProvider(ctx, m) commonData := CommonModuleInfo{ @@ -2238,11 +2262,16 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) MinSdkVersion(ctx EarlyModuleContext) ApiLevel }); ok { ver := mm.MinSdkVersion(ctx) - if !ver.IsNone() { - commonData.MinSdkVersion = ver.String() - } + commonData.MinSdkVersion.ApiLevel = &ver } else if mm, ok := m.module.(interface{ MinSdkVersion() string }); ok { - commonData.MinSdkVersion = mm.MinSdkVersion() + ver := mm.MinSdkVersion() + // Compile against the current platform + if ver == "" { + commonData.MinSdkVersion.IsPlatform = true + } else { + api := ApiLevelFrom(ctx, ver) + commonData.MinSdkVersion.ApiLevel = &api + } } if mm, ok := m.module.(interface { @@ -2265,7 +2294,13 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) commonData.CanHaveApexVariants = am.CanHaveApexVariants() commonData.NotAvailableForPlatform = am.NotAvailableForPlatform() commonData.NotInPlatform = am.NotInPlatform() + commonData.MinSdkVersionSupported = am.MinSdkVersionSupported(ctx) } + + if _, ok := m.module.(ModuleWithMinSdkVersionCheck); ok { + commonData.ModuleWithMinSdkVersionCheck = true + } + if st, ok := m.module.(StubsAvailableModule); ok { commonData.IsStubsModule = st.IsStubsModule() } @@ -2984,6 +3019,9 @@ func AddAncestors(ctx SingletonContext, dirMap map[string]Paths, mmName func(str func (c *buildTargetSingleton) GenerateBuildActions(ctx SingletonContext) { var checkbuildDeps Paths + // Create a top level partialcompileclean target for modules to add dependencies to. + ctx.Phony("partialcompileclean") + mmTarget := func(dir string) string { return "MODULES-IN-" + strings.Replace(filepath.Clean(dir), "/", "-", -1) } |