Merge "Assert android.ApexModule interface for types having ApexModuleBase" am: 1a74be780b

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1530138

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie9bbf24d1c15c9b1a96386993b08804413654e6c
This commit is contained in:
Treehugger Robot
2020-12-17 04:31:58 +00:00
committed by Automerger Merge Worker
8 changed files with 39 additions and 0 deletions

View File

@@ -2999,6 +2999,9 @@ func (c *Module) AndroidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Write
} }
} }
var _ android.ApexModule = (*Module)(nil)
// Implements android.ApexModule
func (c *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { func (c *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
depTag := ctx.OtherModuleDependencyTag(dep) depTag := ctx.OtherModuleDependencyTag(dep)
libDepTag, isLibDepTag := depTag.(libraryDependencyTag) libDepTag, isLibDepTag := depTag.(libraryDependencyTag)
@@ -3032,6 +3035,7 @@ func (c *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Modu
return true return true
} }
// Implements android.ApexModule
func (c *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, func (c *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
sdkVersion android.ApiLevel) error { sdkVersion android.ApiLevel) error {
// We ignore libclang_rt.* prebuilt libs since they declare sdk_version: 14(b/121358700) // We ignore libclang_rt.* prebuilt libs since they declare sdk_version: 14(b/121358700)

View File

@@ -547,6 +547,9 @@ func (g *Module) AndroidMk() android.AndroidMkData {
} }
} }
var _ android.ApexModule = (*Module)(nil)
// Implements android.ApexModule
func (g *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, func (g *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
sdkVersion android.ApiLevel) error { sdkVersion android.ApiLevel) error {
// Because generated outputs are checked by client modules(e.g. cc_library, ...) // Because generated outputs are checked by client modules(e.g. cc_library, ...)

View File

@@ -851,10 +851,14 @@ func (a *AARImport) SrcJarArgs() ([]string, android.Paths) {
return nil, nil return nil, nil
} }
var _ android.ApexModule = (*AARImport)(nil)
// Implements android.ApexModule
func (a *AARImport) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { func (a *AARImport) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
return a.depIsInSameApex(ctx, dep) return a.depIsInSameApex(ctx, dep)
} }
// Implements android.ApexModule
func (g *AARImport) ShouldSupportSdkVersion(ctx android.BaseModuleContext, func (g *AARImport) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
sdkVersion android.ApiLevel) error { sdkVersion android.ApiLevel) error {
return nil return nil

View File

@@ -1653,6 +1653,9 @@ func (a *AndroidAppImport) minSdkVersion() sdkSpec {
return sdkSpecFrom("") return sdkSpecFrom("")
} }
var _ android.ApexModule = (*AndroidAppImport)(nil)
// Implements android.ApexModule
func (j *AndroidAppImport) ShouldSupportSdkVersion(ctx android.BaseModuleContext, func (j *AndroidAppImport) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
sdkVersion android.ApiLevel) error { sdkVersion android.ApiLevel) error {
// Do not check for prebuilts against the min_sdk_version of enclosing APEX // Do not check for prebuilts against the min_sdk_version of enclosing APEX

View File

@@ -2021,10 +2021,12 @@ func (j *Module) hasCode(ctx android.ModuleContext) bool {
return len(srcFiles) > 0 || len(ctx.GetDirectDepsWithTag(staticLibTag)) > 0 return len(srcFiles) > 0 || len(ctx.GetDirectDepsWithTag(staticLibTag)) > 0
} }
// Implements android.ApexModule
func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
return j.depIsInSameApex(ctx, dep) return j.depIsInSameApex(ctx, dep)
} }
// Implements android.ApexModule
func (j *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, func (j *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
sdkVersion android.ApiLevel) error { sdkVersion android.ApiLevel) error {
sdkSpec := j.minSdkVersion() sdkSpec := j.minSdkVersion()
@@ -2070,6 +2072,8 @@ type Library struct {
InstallMixin func(ctx android.ModuleContext, installPath android.Path) (extraInstallDeps android.Paths) InstallMixin func(ctx android.ModuleContext, installPath android.Path) (extraInstallDeps android.Paths)
} }
var _ android.ApexModule = (*Library)(nil)
// Provides access to the list of permitted packages from updatable boot jars. // Provides access to the list of permitted packages from updatable boot jars.
type PermittedPackagesForUpdatableBootJars interface { type PermittedPackagesForUpdatableBootJars interface {
PermittedPackagesForUpdatableBootJars() []string PermittedPackagesForUpdatableBootJars() []string
@@ -2934,10 +2938,14 @@ func (j *Import) SrcJarArgs() ([]string, android.Paths) {
return nil, nil return nil, nil
} }
var _ android.ApexModule = (*Import)(nil)
// Implements android.ApexModule
func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
return j.depIsInSameApex(ctx, dep) return j.depIsInSameApex(ctx, dep)
} }
// Implements android.ApexModule
func (j *Import) ShouldSupportSdkVersion(ctx android.BaseModuleContext, func (j *Import) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
sdkVersion android.ApiLevel) error { sdkVersion android.ApiLevel) error {
// Do not check for prebuilts against the min_sdk_version of enclosing APEX // Do not check for prebuilts against the min_sdk_version of enclosing APEX
@@ -3129,6 +3137,9 @@ func (j *DexImport) DexJarBuildPath() android.Path {
return j.dexJarFile return j.dexJarFile
} }
var _ android.ApexModule = (*DexImport)(nil)
// Implements android.ApexModule
func (j *DexImport) ShouldSupportSdkVersion(ctx android.BaseModuleContext, func (j *DexImport) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
sdkVersion android.ApiLevel) error { sdkVersion android.ApiLevel) error {
// we don't check prebuilt modules for sdk_version // we don't check prebuilt modules for sdk_version

View File

@@ -1925,6 +1925,9 @@ func (module *SdkLibraryImport) DepsMutator(ctx android.BottomUpMutatorContext)
} }
} }
var _ android.ApexModule = (*SdkLibraryImport)(nil)
// Implements android.ApexModule
func (module *SdkLibraryImport) DepIsInSameApex(mctx android.BaseModuleContext, dep android.Module) bool { func (module *SdkLibraryImport) DepIsInSameApex(mctx android.BaseModuleContext, dep android.Module) bool {
depTag := mctx.OtherModuleDependencyTag(dep) depTag := mctx.OtherModuleDependencyTag(dep)
if depTag == xmlPermissionsFileTag { if depTag == xmlPermissionsFileTag {
@@ -1936,6 +1939,7 @@ func (module *SdkLibraryImport) DepIsInSameApex(mctx android.BaseModuleContext,
return false return false
} }
// Implements android.ApexModule
func (module *SdkLibraryImport) ShouldSupportSdkVersion(ctx android.BaseModuleContext, func (module *SdkLibraryImport) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
sdkVersion android.ApiLevel) error { sdkVersion android.ApiLevel) error {
// we don't check prebuilt modules for sdk_version // we don't check prebuilt modules for sdk_version
@@ -2141,6 +2145,9 @@ func (module *sdkLibraryXml) DepsMutator(ctx android.BottomUpMutatorContext) {
// do nothing // do nothing
} }
var _ android.ApexModule = (*sdkLibraryXml)(nil)
// Implements android.ApexModule
func (module *sdkLibraryXml) ShouldSupportSdkVersion(ctx android.BaseModuleContext, func (module *sdkLibraryXml) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
sdkVersion android.ApiLevel) error { sdkVersion android.ApiLevel) error {
// sdkLibraryXml doesn't need to be checked separately because java_sdk_library is checked // sdkLibraryXml doesn't need to be checked separately because java_sdk_library is checked

View File

@@ -1065,6 +1065,9 @@ func (mod *Module) minSdkVersion() string {
return String(mod.Properties.Min_sdk_version) return String(mod.Properties.Min_sdk_version)
} }
var _ android.ApexModule = (*Module)(nil)
// Implements android.ApexModule
func (mod *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion android.ApiLevel) error { func (mod *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion android.ApiLevel) error {
minSdkVersion := mod.minSdkVersion() minSdkVersion := mod.minSdkVersion()
if minSdkVersion == "apex_inherit" { if minSdkVersion == "apex_inherit" {
@@ -1087,6 +1090,7 @@ func (mod *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVer
return nil return nil
} }
// Implements android.ApexModule
func (mod *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { func (mod *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
depTag := ctx.OtherModuleDependencyTag(dep) depTag := ctx.OtherModuleDependencyTag(dep)

View File

@@ -322,6 +322,9 @@ func (m *syspropLibrary) AndroidMk() android.AndroidMkData {
}} }}
} }
var _ android.ApexModule = (*syspropLibrary)(nil)
// Implements android.ApexModule
func (m *syspropLibrary) ShouldSupportSdkVersion(ctx android.BaseModuleContext, func (m *syspropLibrary) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
sdkVersion android.ApiLevel) error { sdkVersion android.ApiLevel) error {
return fmt.Errorf("sysprop_library is not supposed to be part of apex modules") return fmt.Errorf("sysprop_library is not supposed to be part of apex modules")