Avoid circular dependency for the aconfig usage in libcore

Bug: 316554963
Test: m droid
Change-Id: I6f45e585b8b656ef7ce1d51bbde0a44898198907
This commit is contained in:
Victor Chang
2023-12-18 17:36:34 +00:00
parent a53330a525
commit bf0175ee6a

View File

@@ -62,10 +62,18 @@ func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) DepsMutator(module *ja
ctx.AddDependency(ctx.Module(), declarationsTag, declarations)
}
// Add aconfig-annotations-lib as a dependency for the optimization / code stripping annotations
module.AddSharedLibrary("aconfig-annotations-lib")
// TODO(b/303773055): Remove the annotation after access issue is resolved.
module.AddSharedLibrary("unsupportedappusage")
// "libcore_aconfig_flags_lib" module has a circular dependency because the shared libraries
// are built on core_current and the module is used to flag the APIs in the core_current.
// http://b/316554963#comment2 has the details of the circular dependency chain.
// If a java_aconfig_library uses "none" sdk_version, it should include and build these
// annotation files as the shared library themselves.
var addLibraries bool = module.Library.Module.SdkVersion(ctx).Kind != android.SdkNone
if addLibraries {
// Add aconfig-annotations-lib as a dependency for the optimization / code stripping annotations
module.AddSharedLibrary("aconfig-annotations-lib")
// TODO(b/303773055): Remove the annotation after access issue is resolved.
module.AddSharedLibrary("unsupportedappusage")
}
}
func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuildActions(module *java.GeneratedJavaLibraryModule, ctx android.ModuleContext) android.Path {