diff options
Diffstat (limited to 'java/app.go')
-rw-r--r-- | java/app.go | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/java/app.go b/java/app.go index fe5eec32d..560129b64 100644 --- a/java/app.go +++ b/java/app.go @@ -425,6 +425,10 @@ func (a *AndroidTestHelperApp) GenerateAndroidBuildActions(ctx android.ModuleCon } else { moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, "null-suite") } + + android.SetProvider(ctx, android.TestSuiteInfoProvider, android.TestSuiteInfo{ + TestSuites: a.appTestHelperAppProperties.Test_suites, + }) } func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) { @@ -531,7 +535,7 @@ func (a *AndroidApp) checkJniLibsSdkVersion(ctx android.ModuleContext, minSdkVer if _, ok := android.OtherModuleProvider(ctx, m, cc.CcInfoProvider); !ok { panic(fmt.Errorf("jni dependency is not a cc module: %v", m)) } - commonInfo, ok := android.OtherModuleProvider(ctx, m, android.CommonModuleInfoKey) + commonInfo, ok := android.OtherModuleProvider(ctx, m, android.CommonModuleInfoProvider) if !ok { panic(fmt.Errorf("jni dependency doesn't have CommonModuleInfo provider: %v", m)) } @@ -1229,7 +1233,7 @@ func collectJniDeps(ctx android.ModuleContext, seenModulePaths := make(map[string]bool) ctx.WalkDepsProxy(func(module, parent android.ModuleProxy) bool { - if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoKey).Enabled { + if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled { return false } otherName := ctx.OtherModuleName(module) @@ -1249,7 +1253,7 @@ func collectJniDeps(ctx android.ModuleContext, } seenModulePaths[path.String()] = true - commonInfo := android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoKey) + commonInfo := android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider) if checkNativeSdkVersion && commonInfo.SdkVersion == "" { ctx.PropertyErrorf("jni_libs", "JNI dependency %q uses platform APIs, but this module does not", otherName) @@ -1287,13 +1291,13 @@ func collectJniDeps(ctx android.ModuleContext, } func (a *AndroidApp) WalkPayloadDeps(ctx android.BaseModuleContext, do android.PayloadDepsCallback) { - ctx.WalkDeps(func(child, parent android.Module) bool { + ctx.WalkDepsProxy(func(child, parent android.ModuleProxy) bool { // TODO(ccross): Should this use android.DepIsInSameApex? Right now it is applying the android app // heuristics to every transitive dependency, when it should probably be using the heuristics of the // immediate parent. isExternal := !a.GetDepInSameApexChecker().OutgoingDepIsInSameApex(ctx.OtherModuleDependencyTag(child)) - if am, ok := child.(android.ApexModule); ok { - if !do(ctx, parent, am, isExternal) { + if am, ok := android.OtherModuleProvider(ctx, child, android.CommonModuleInfoProvider); ok && am.IsApexModule { + if !do(ctx, parent, child, isExternal) { return false } } @@ -1307,12 +1311,12 @@ func (a *AndroidApp) buildAppDependencyInfo(ctx android.ModuleContext) { } depsInfo := android.DepNameToDepInfoMap{} - a.WalkPayloadDeps(ctx, func(ctx android.BaseModuleContext, from android.Module, to android.ApexModule, externalDep bool) bool { + a.WalkPayloadDeps(ctx, func(ctx android.BaseModuleContext, from, to android.ModuleProxy, externalDep bool) bool { depName := to.Name() // Skip dependencies that are only available to APEXes; they are developed with updatability // in mind and don't need manual approval. - if android.OtherModuleProviderOrDefault(ctx, to, android.CommonModuleInfoKey).NotAvailableForPlatform { + if android.OtherModuleProviderOrDefault(ctx, to, android.CommonModuleInfoProvider).NotAvailableForPlatform { return true } @@ -1322,7 +1326,7 @@ func (a *AndroidApp) buildAppDependencyInfo(ctx android.ModuleContext) { depsInfo[depName] = info } else { toMinSdkVersion := "(no version)" - if info, ok := android.OtherModuleProvider(ctx, to, android.CommonModuleInfoKey); ok && + if info, ok := android.OtherModuleProvider(ctx, to, android.CommonModuleInfoProvider); ok && !info.MinSdkVersion.IsPlatform && info.MinSdkVersion.ApiLevel != nil { toMinSdkVersion = info.MinSdkVersion.ApiLevel.String() } @@ -1703,6 +1707,10 @@ func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { moduleInfoJSON.AutoTestConfig = []string{"true"} } moduleInfoJSON.TestMainlineModules = append(moduleInfoJSON.TestMainlineModules, a.testProperties.Test_mainline_modules...) + + android.SetProvider(ctx, android.TestSuiteInfoProvider, android.TestSuiteInfo{ + TestSuites: a.testProperties.Test_suites, + }) } func testcaseRel(paths android.Paths) []string { @@ -2209,3 +2217,7 @@ func setCommonAppInfo(appInfo *AppInfo, m androidApp) { appInfo.Certificate = m.Certificate() appInfo.PrivAppAllowlist = m.PrivAppAllowlist() } + +type AppInfos []AppInfo + +var AppInfosProvider = blueprint.NewProvider[AppInfos]() |