Merge "Make the java static_libs property configurable" into main

This commit is contained in:
Cole Faust
2024-09-06 18:36:35 +00:00
committed by Gerrit Code Review
9 changed files with 68 additions and 54 deletions

View File

@@ -973,7 +973,7 @@ type AARImportProperties struct {
// Defaults to sdk_version if not set. See sdk_version for possible values. // Defaults to sdk_version if not set. See sdk_version for possible values.
Min_sdk_version *string Min_sdk_version *string
// List of java static libraries that the included ARR (android library prebuilts) has dependencies to. // List of java static libraries that the included ARR (android library prebuilts) has dependencies to.
Static_libs []string Static_libs proptools.Configurable[[]string]
// List of java libraries that the included ARR (android library prebuilts) has dependencies to. // List of java libraries that the included ARR (android library prebuilts) has dependencies to.
Libs []string Libs []string
// If set to true, run Jetifier against .aar file. Defaults to false. // If set to true, run Jetifier against .aar file. Defaults to false.
@@ -1103,7 +1103,7 @@ func (a *AARImport) DepsMutator(ctx android.BottomUpMutatorContext) {
} }
ctx.AddVariationDependencies(nil, libTag, a.properties.Libs...) ctx.AddVariationDependencies(nil, libTag, a.properties.Libs...)
ctx.AddVariationDependencies(nil, staticLibTag, a.properties.Static_libs...) ctx.AddVariationDependencies(nil, staticLibTag, a.properties.Static_libs.GetOrDefault(ctx, nil)...)
a.usesLibrary.deps(ctx, false) a.usesLibrary.deps(ctx, false)
} }

View File

@@ -81,7 +81,7 @@ type CommonProperties struct {
Libs []string `android:"arch_variant"` Libs []string `android:"arch_variant"`
// list of java libraries that will be compiled into the resulting jar // list of java libraries that will be compiled into the resulting jar
Static_libs []string `android:"arch_variant"` Static_libs proptools.Configurable[[]string] `android:"arch_variant"`
// list of java libraries that should not be used to build this module // list of java libraries that should not be used to build this module
Exclude_static_libs []string `android:"arch_variant"` Exclude_static_libs []string `android:"arch_variant"`
@@ -831,6 +831,10 @@ func (j *Module) AvailableFor(what string) bool {
return j.ApexModuleBase.AvailableFor(what) return j.ApexModuleBase.AvailableFor(what)
} }
func (j *Module) staticLibs(ctx android.BaseModuleContext) []string {
return android.RemoveListFromList(j.properties.Static_libs.GetOrDefault(ctx, nil), j.properties.Exclude_static_libs)
}
func (j *Module) deps(ctx android.BottomUpMutatorContext) { func (j *Module) deps(ctx android.BottomUpMutatorContext) {
if ctx.Device() { if ctx.Device() {
j.linter.deps(ctx) j.linter.deps(ctx)
@@ -847,8 +851,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
libDeps := ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...) libDeps := ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...)
j.properties.Static_libs = android.RemoveListFromList(j.properties.Static_libs, j.properties.Exclude_static_libs) ctx.AddVariationDependencies(nil, staticLibTag, j.staticLibs(ctx)...)
ctx.AddVariationDependencies(nil, staticLibTag, j.properties.Static_libs...)
// Add dependency on libraries that provide additional hidden api annotations. // Add dependency on libraries that provide additional hidden api annotations.
ctx.AddVariationDependencies(nil, hiddenApiAnnotationsTag, j.properties.Hiddenapi_additional_annotations...) ctx.AddVariationDependencies(nil, hiddenApiAnnotationsTag, j.properties.Hiddenapi_additional_annotations...)
@@ -930,7 +933,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
ctx.AddVariationDependencies(nil, staticLibTag, "jacocoagent") ctx.AddVariationDependencies(nil, staticLibTag, "jacocoagent")
} }
if j.useCompose() { if j.useCompose(ctx) {
ctx.AddVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), kotlinPluginTag, ctx.AddVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), kotlinPluginTag,
"androidx.compose.compiler_compiler-hosted") "androidx.compose.compiler_compiler-hosted")
} }
@@ -1935,8 +1938,8 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
j.outputFile = outputFile.WithoutRel() j.outputFile = outputFile.WithoutRel()
} }
func (j *Module) useCompose() bool { func (j *Module) useCompose(ctx android.BaseModuleContext) bool {
return android.InList("androidx.compose.runtime_runtime", j.properties.Static_libs) return android.InList("androidx.compose.runtime_runtime", j.staticLibs(ctx))
} }
func collectDepProguardSpecInfo(ctx android.ModuleContext) (transitiveProguardFlags, transitiveUnconditionalExportedFlags []*android.DepSet[android.Path]) { func collectDepProguardSpecInfo(ctx android.ModuleContext) (transitiveProguardFlags, transitiveUnconditionalExportedFlags []*android.DepSet[android.Path]) {
@@ -2196,7 +2199,7 @@ func (j *Module) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo)
} }
dpInfo.Deps = append(dpInfo.Deps, j.CompilerDeps()...) dpInfo.Deps = append(dpInfo.Deps, j.CompilerDeps()...)
dpInfo.Aidl_include_dirs = append(dpInfo.Aidl_include_dirs, j.deviceProperties.Aidl.Include_dirs...) dpInfo.Aidl_include_dirs = append(dpInfo.Aidl_include_dirs, j.deviceProperties.Aidl.Include_dirs...)
dpInfo.Static_libs = append(dpInfo.Static_libs, j.properties.Static_libs...) dpInfo.Static_libs = append(dpInfo.Static_libs, j.staticLibs(ctx)...)
dpInfo.Libs = append(dpInfo.Libs, j.properties.Libs...) dpInfo.Libs = append(dpInfo.Libs, j.properties.Libs...)
} }

View File

@@ -54,7 +54,7 @@ type JavadocProperties struct {
Filter_packages []string Filter_packages []string
// list of java libraries that will be in the classpath. // list of java libraries that will be in the classpath.
Libs []string `android:"arch_variant"` Libs proptools.Configurable[[]string] `android:"arch_variant"`
// If set to false, don't allow this module(-docs.zip) to be exported. Defaults to true. // If set to false, don't allow this module(-docs.zip) to be exported. Defaults to true.
Installable *bool Installable *bool
@@ -274,7 +274,7 @@ func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) {
} }
} }
ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...) ctx.AddVariationDependencies(nil, libTag, j.properties.Libs.GetOrDefault(ctx, nil)...)
} }
func (j *Javadoc) collectAidlFlags(ctx android.ModuleContext, deps deps) droiddocBuilderFlags { func (j *Javadoc) collectAidlFlags(ctx android.ModuleContext, deps deps) droiddocBuilderFlags {

View File

@@ -70,14 +70,6 @@ func (module *GeneratedJavaLibraryModule) AddSharedLibrary(name string) {
module.Library.properties.Libs = append(module.Library.properties.Libs, name) module.Library.properties.Libs = append(module.Library.properties.Libs, name)
} }
// Add a java shared library as a dependency, as if they had said `libs: [ "name" ]`
func (module *GeneratedJavaLibraryModule) AddStaticLibrary(name string) {
if module.depsMutatorDone {
panic("GeneratedJavaLibraryModule.AddStaticLibrary called after DepsMutator")
}
module.Library.properties.Static_libs = append(module.Library.properties.Static_libs, name)
}
func (module *GeneratedJavaLibraryModule) DepsMutator(ctx android.BottomUpMutatorContext) { func (module *GeneratedJavaLibraryModule) DepsMutator(ctx android.BottomUpMutatorContext) {
module.callbacks.DepsMutator(module, ctx) module.callbacks.DepsMutator(module, ctx)
module.depsMutatorDone = true module.depsMutatorDone = true

View File

@@ -2011,11 +2011,11 @@ type JavaApiLibraryProperties struct {
// List of shared java libs that this module has dependencies to and // List of shared java libs that this module has dependencies to and
// should be passed as classpath in javac invocation // should be passed as classpath in javac invocation
Libs []string Libs proptools.Configurable[[]string]
// List of java libs that this module has static dependencies to and will be // List of java libs that this module has static dependencies to and will be
// merge zipped after metalava invocation // merge zipped after metalava invocation
Static_libs []string Static_libs proptools.Configurable[[]string]
// Version of previously released API file for compatibility check. // Version of previously released API file for compatibility check.
Previous_api *string `android:"path"` Previous_api *string `android:"path"`
@@ -2191,8 +2191,8 @@ func (al *ApiLibrary) DepsMutator(ctx android.BottomUpMutatorContext) {
} }
} }
ctx.AddVariationDependencies(nil, libTag, al.properties.Libs...) ctx.AddVariationDependencies(nil, libTag, al.properties.Libs.GetOrDefault(ctx, nil)...)
ctx.AddVariationDependencies(nil, staticLibTag, al.properties.Static_libs...) ctx.AddVariationDependencies(nil, staticLibTag, al.properties.Static_libs.GetOrDefault(ctx, nil)...)
for _, aconfigDeclarationsName := range al.properties.Aconfig_declarations { for _, aconfigDeclarationsName := range al.properties.Aconfig_declarations {
ctx.AddDependency(ctx.Module(), aconfigDeclarationTag, aconfigDeclarationsName) ctx.AddDependency(ctx.Module(), aconfigDeclarationTag, aconfigDeclarationsName)
@@ -2426,16 +2426,16 @@ func (al *ApiLibrary) TargetSdkVersion(ctx android.EarlyModuleContext) android.A
func (al *ApiLibrary) IDEInfo(ctx android.BaseModuleContext, i *android.IdeInfo) { func (al *ApiLibrary) IDEInfo(ctx android.BaseModuleContext, i *android.IdeInfo) {
i.Deps = append(i.Deps, al.ideDeps(ctx)...) i.Deps = append(i.Deps, al.ideDeps(ctx)...)
i.Libs = append(i.Libs, al.properties.Libs...) i.Libs = append(i.Libs, al.properties.Libs.GetOrDefault(ctx, nil)...)
i.Static_libs = append(i.Static_libs, al.properties.Static_libs...) i.Static_libs = append(i.Static_libs, al.properties.Static_libs.GetOrDefault(ctx, nil)...)
i.SrcJars = append(i.SrcJars, al.stubsSrcJar.String()) i.SrcJars = append(i.SrcJars, al.stubsSrcJar.String())
} }
// deps of java_api_library for module_bp_java_deps.json // deps of java_api_library for module_bp_java_deps.json
func (al *ApiLibrary) ideDeps(ctx android.BaseModuleContext) []string { func (al *ApiLibrary) ideDeps(ctx android.BaseModuleContext) []string {
ret := []string{} ret := []string{}
ret = append(ret, al.properties.Libs...) ret = append(ret, al.properties.Libs.GetOrDefault(ctx, nil)...)
ret = append(ret, al.properties.Static_libs...) ret = append(ret, al.properties.Static_libs.GetOrDefault(ctx, nil)...)
if al.properties.System_modules != nil { if al.properties.System_modules != nil {
ret = append(ret, proptools.String(al.properties.System_modules)) ret = append(ret, proptools.String(al.properties.System_modules))
} }
@@ -2479,7 +2479,7 @@ type ImportProperties struct {
Libs []string Libs []string
// List of static java libs that this module has dependencies to // List of static java libs that this module has dependencies to
Static_libs []string Static_libs proptools.Configurable[[]string]
// List of files to remove from the jar file(s) // List of files to remove from the jar file(s)
Exclude_files []string Exclude_files []string
@@ -2620,7 +2620,7 @@ func (j *Import) setStrictUpdatabilityLinting(bool) {
func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) { func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...) ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...)
ctx.AddVariationDependencies(nil, staticLibTag, j.properties.Static_libs...) ctx.AddVariationDependencies(nil, staticLibTag, j.properties.Static_libs.GetOrDefault(ctx, nil)...)
if ctx.Device() && Bool(j.dexProperties.Compile_dex) { if ctx.Device() && Bool(j.dexProperties.Compile_dex) {
sdkDeps(ctx, android.SdkContext(j), j.dexer) sdkDeps(ctx, android.SdkContext(j), j.dexer)

View File

@@ -17,7 +17,11 @@ package java
// This file contains the module implementations for runtime_resource_overlay and // This file contains the module implementations for runtime_resource_overlay and
// override_runtime_resource_overlay. // override_runtime_resource_overlay.
import "android/soong/android" import (
"android/soong/android"
"github.com/google/blueprint/proptools"
)
func init() { func init() {
RegisterRuntimeResourceOverlayBuildComponents(android.InitRegistrationContext) RegisterRuntimeResourceOverlayBuildComponents(android.InitRegistrationContext)
@@ -71,7 +75,7 @@ type RuntimeResourceOverlayProperties struct {
Min_sdk_version *string Min_sdk_version *string
// list of android_library modules whose resources are extracted and linked against statically // list of android_library modules whose resources are extracted and linked against statically
Static_libs []string Static_libs proptools.Configurable[[]string]
// list of android_app modules whose resources are extracted and linked against // list of android_app modules whose resources are extracted and linked against
Resource_libs []string Resource_libs []string
@@ -120,7 +124,7 @@ func (r *RuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext)
ctx.AddDependency(ctx.Module(), certificateTag, cert) ctx.AddDependency(ctx.Module(), certificateTag, cert)
} }
ctx.AddVariationDependencies(nil, staticLibTag, r.properties.Static_libs...) ctx.AddVariationDependencies(nil, staticLibTag, r.properties.Static_libs.GetOrDefault(ctx, nil)...)
ctx.AddVariationDependencies(nil, libTag, r.properties.Resource_libs...) ctx.AddVariationDependencies(nil, libTag, r.properties.Resource_libs...)
for _, aconfig_declaration := range r.aaptProperties.Flags_packages { for _, aconfig_declaration := range r.aaptProperties.Flags_packages {

View File

@@ -1744,11 +1744,13 @@ func childModuleVisibility(childVisibility []string) []string {
func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext) { func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext) {
visibility := childModuleVisibility(module.sdkLibraryProperties.Impl_library_visibility) visibility := childModuleVisibility(module.sdkLibraryProperties.Impl_library_visibility)
staticLibs := module.properties.Static_libs.Clone()
staticLibs.AppendSimpleValue(module.sdkLibraryProperties.Impl_only_static_libs)
props := struct { props := struct {
Name *string Name *string
Visibility []string Visibility []string
Libs []string Libs []string
Static_libs []string Static_libs proptools.Configurable[[]string]
Apex_available []string Apex_available []string
Stem *string Stem *string
}{ }{
@@ -1757,7 +1759,7 @@ func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext)
Libs: append(module.properties.Libs, module.sdkLibraryProperties.Impl_only_libs...), Libs: append(module.properties.Libs, module.sdkLibraryProperties.Impl_only_libs...),
Static_libs: append(module.properties.Static_libs, module.sdkLibraryProperties.Impl_only_static_libs...), Static_libs: staticLibs,
// Pass the apex_available settings down so that the impl library can be statically // Pass the apex_available settings down so that the impl library can be statically
// embedded within a library that is added to an APEX. Needed for updatable-media. // embedded within a library that is added to an APEX. Needed for updatable-media.
Apex_available: module.ApexAvailable(), Apex_available: module.ApexAvailable(),
@@ -1863,7 +1865,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
Sdk_version *string Sdk_version *string
Api_surface *string Api_surface *string
System_modules *string System_modules *string
Libs []string Libs proptools.Configurable[[]string]
Output_javadoc_comments *bool Output_javadoc_comments *bool
Arg_files []string Arg_files []string
Args *string Args *string
@@ -1907,10 +1909,11 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
props.Installable = proptools.BoolPtr(false) props.Installable = proptools.BoolPtr(false)
// A droiddoc module has only one Libs property and doesn't distinguish between // A droiddoc module has only one Libs property and doesn't distinguish between
// shared libs and static libs. So we need to add both of these libs to Libs property. // shared libs and static libs. So we need to add both of these libs to Libs property.
props.Libs = module.properties.Libs props.Libs = proptools.NewConfigurable[[]string](nil, nil)
props.Libs = append(props.Libs, module.properties.Static_libs...) props.Libs.AppendSimpleValue(module.properties.Libs)
props.Libs = append(props.Libs, module.sdkLibraryProperties.Stub_only_libs...) props.Libs.Append(module.properties.Static_libs)
props.Libs = append(props.Libs, module.scopeToProperties[apiScope].Libs...) props.Libs.AppendSimpleValue(module.sdkLibraryProperties.Stub_only_libs)
props.Libs.AppendSimpleValue(module.scopeToProperties[apiScope].Libs)
props.Aidl.Include_dirs = module.deviceProperties.Aidl.Include_dirs props.Aidl.Include_dirs = module.deviceProperties.Aidl.Include_dirs
props.Aidl.Local_include_dirs = module.deviceProperties.Aidl.Local_include_dirs props.Aidl.Local_include_dirs = module.deviceProperties.Aidl.Local_include_dirs
props.Java_version = module.properties.Java_version props.Java_version = module.properties.Java_version
@@ -2024,7 +2027,7 @@ func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext,
Name *string Name *string
Visibility []string Visibility []string
Api_contributions []string Api_contributions []string
Libs []string Libs proptools.Configurable[[]string]
Static_libs []string Static_libs []string
System_modules *string System_modules *string
Enable_validation *bool Enable_validation *bool
@@ -2056,11 +2059,12 @@ func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext,
props.Api_contributions = apiContributions props.Api_contributions = apiContributions
// Ensure that stub-annotations is added to the classpath before any other libs // Ensure that stub-annotations is added to the classpath before any other libs
props.Libs = []string{"stub-annotations"} props.Libs = proptools.NewConfigurable[[]string](nil, nil)
props.Libs = append(props.Libs, module.properties.Libs...) props.Libs.AppendSimpleValue([]string{"stub-annotations"})
props.Libs = append(props.Libs, module.properties.Static_libs...) props.Libs.AppendSimpleValue(module.properties.Libs)
props.Libs = append(props.Libs, module.sdkLibraryProperties.Stub_only_libs...) props.Libs.Append(module.properties.Static_libs)
props.Libs = append(props.Libs, module.scopeToProperties[apiScope].Libs...) props.Libs.AppendSimpleValue(module.sdkLibraryProperties.Stub_only_libs)
props.Libs.AppendSimpleValue(module.scopeToProperties[apiScope].Libs)
props.Static_libs = module.sdkLibraryProperties.Stub_only_static_libs props.Static_libs = module.sdkLibraryProperties.Stub_only_static_libs
props.System_modules = module.deviceProperties.System_modules props.System_modules = module.deviceProperties.System_modules
@@ -2370,7 +2374,7 @@ func (module *SdkLibrary) CreateInternalModules(mctx android.DefaultableHookCont
// Add the impl_only_libs and impl_only_static_libs *after* we're done using them in submodules. // Add the impl_only_libs and impl_only_static_libs *after* we're done using them in submodules.
module.properties.Libs = append(module.properties.Libs, module.sdkLibraryProperties.Impl_only_libs...) module.properties.Libs = append(module.properties.Libs, module.sdkLibraryProperties.Impl_only_libs...)
module.properties.Static_libs = append(module.properties.Static_libs, module.sdkLibraryProperties.Impl_only_static_libs...) module.properties.Static_libs.AppendSimpleValue(module.sdkLibraryProperties.Impl_only_static_libs)
} }
func (module *SdkLibrary) InitSdkLibraryProperties() { func (module *SdkLibrary) InitSdkLibraryProperties() {

View File

@@ -1528,7 +1528,8 @@ func TestJavaSdkLibrary_StubOnlyLibs_PassedToDroidstubs(t *testing.T) {
// The foo.stubs.source should depend on bar-lib // The foo.stubs.source should depend on bar-lib
fooStubsSources := result.ModuleForTests("foo.stubs.source", "android_common").Module().(*Droidstubs) fooStubsSources := result.ModuleForTests("foo.stubs.source", "android_common").Module().(*Droidstubs)
android.AssertStringListContains(t, "foo stubs should depend on bar-lib", fooStubsSources.Javadoc.properties.Libs, "bar-lib") eval := fooStubsSources.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
android.AssertStringListContains(t, "foo stubs should depend on bar-lib", fooStubsSources.Javadoc.properties.Libs.GetOrDefault(eval, nil), "bar-lib")
} }
func TestJavaSdkLibrary_Scope_Libs_PassedToDroidstubs(t *testing.T) { func TestJavaSdkLibrary_Scope_Libs_PassedToDroidstubs(t *testing.T) {
@@ -1554,7 +1555,8 @@ func TestJavaSdkLibrary_Scope_Libs_PassedToDroidstubs(t *testing.T) {
// The foo.stubs.source should depend on bar-lib // The foo.stubs.source should depend on bar-lib
fooStubsSources := result.ModuleForTests("foo.stubs.source", "android_common").Module().(*Droidstubs) fooStubsSources := result.ModuleForTests("foo.stubs.source", "android_common").Module().(*Droidstubs)
android.AssertStringListContains(t, "foo stubs should depend on bar-lib", fooStubsSources.Javadoc.properties.Libs, "bar-lib") eval := fooStubsSources.ConfigurableEvaluator(android.PanickingConfigAndErrorContext(result.TestContext))
android.AssertStringListContains(t, "foo stubs should depend on bar-lib", fooStubsSources.Javadoc.properties.Libs.GetOrDefault(eval, nil), "bar-lib")
} }
func TestJavaSdkLibrary_ApiLibrary(t *testing.T) { func TestJavaSdkLibrary_ApiLibrary(t *testing.T) {
@@ -1705,18 +1707,15 @@ func TestSdkLibraryExportableStubsLibrary(t *testing.T) {
exportableSourceStubsLibraryModuleName := apiScopePublic.exportableSourceStubsLibraryModuleName("foo") exportableSourceStubsLibraryModuleName := apiScopePublic.exportableSourceStubsLibraryModuleName("foo")
// Check modules generation // Check modules generation
topLevelModule := result.ModuleForTests(exportableStubsLibraryModuleName, "android_common") result.ModuleForTests(exportableStubsLibraryModuleName, "android_common")
result.ModuleForTests(exportableSourceStubsLibraryModuleName, "android_common") result.ModuleForTests(exportableSourceStubsLibraryModuleName, "android_common")
// Check static lib dependency // Check static lib dependency
android.AssertBoolEquals(t, "exportable top level stubs library module depends on the"+ android.AssertBoolEquals(t, "exportable top level stubs library module depends on the"+
"exportable source stubs library module", true, "exportable source stubs library module", true,
CheckModuleHasDependency(t, result.TestContext, exportableStubsLibraryModuleName, CheckModuleHasDependencyWithTag(t, result.TestContext, exportableStubsLibraryModuleName,
"android_common", exportableSourceStubsLibraryModuleName), "android_common", staticLibTag, exportableSourceStubsLibraryModuleName),
) )
android.AssertArrayString(t, "exportable source stub library is a static lib of the"+
"top level exportable stubs library", []string{exportableSourceStubsLibraryModuleName},
topLevelModule.Module().(*Library).properties.Static_libs)
} }
// For java libraries depending on java_sdk_library(_import) via libs, assert that // For java libraries depending on java_sdk_library(_import) via libs, assert that

View File

@@ -633,6 +633,18 @@ func CheckModuleHasDependency(t *testing.T, ctx *android.TestContext, name, vari
return false return false
} }
// CheckModuleHasDependency returns true if the module depends on the expected dependency.
func CheckModuleHasDependencyWithTag(t *testing.T, ctx *android.TestContext, name, variant string, desiredTag blueprint.DependencyTag, expected string) bool {
module := ctx.ModuleForTests(name, variant).Module()
found := false
ctx.VisitDirectDepsWithTags(module, func(m blueprint.Module, tag blueprint.DependencyTag) {
if tag == desiredTag && m.Name() == expected {
found = true
}
})
return found
}
// CheckPlatformBootclasspathModules returns the apex:module pair for the modules depended upon by // CheckPlatformBootclasspathModules returns the apex:module pair for the modules depended upon by
// the platform-bootclasspath module. // the platform-bootclasspath module.
func CheckPlatformBootclasspathModules(t *testing.T, result *android.TestResult, name string, expected []string) { func CheckPlatformBootclasspathModules(t *testing.T, result *android.TestResult, name string, expected []string) {