Define product_available property

To make a module available to product variants, it must define
`product_available: true`. `vendor_available: true` will not create
product variants any more.
However, in this CL, we don't change the behavior of
`vendor_available` property. It still creates both variants. After we
update all Android.bp files that need to provide product variants
with `product_available: true`, we may upload the remaining patches.

Bug: 150902910
Test: lunch aosp_arm64-userdebug && m
Change-Id: I0fd5be7bbae2c45d5cab3c3c2ca49f53a9b6f975
This commit is contained in:
Justin Yun
2020-10-29 16:49:43 +09:00
parent b0a713acf9
commit 63e9ec70bb
16 changed files with 344 additions and 102 deletions

View File

@@ -72,7 +72,7 @@ type LibraryProperties struct {
Suffix *string `android:"arch_variant"`
Target struct {
Vendor struct {
Vendor, Product struct {
// set suffix of the name of the output
Suffix *string `android:"arch_variant"`
}
@@ -172,11 +172,11 @@ type FlagExporterProperties struct {
Export_system_include_dirs []string `android:"arch_variant"`
Target struct {
Vendor struct {
Vendor, Product struct {
// list of exported include directories, like
// export_include_dirs, that will be applied to the
// vendor variant of this library. This will overwrite
// any other declarations.
// export_include_dirs, that will be applied to
// vendor or product variant of this library.
// This will overwrite any other declarations.
Override_export_include_dirs []string
}
}
@@ -253,6 +253,7 @@ type flagExporter struct {
}
func (f *flagExporter) exportedIncludes(ctx ModuleContext) android.Paths {
// TODO(b/150902910): product variant must use Target.Product
if ctx.useVndk() && f.Properties.Target.Vendor.Override_export_include_dirs != nil {
return android.PathsForModuleSrc(ctx, f.Properties.Target.Vendor.Override_export_include_dirs)
} else {
@@ -716,6 +717,7 @@ func (library *libraryDecorator) getLibNameHelper(baseModuleName string, useVndk
suffix := ""
if useVndk {
// TODO(b/150902910): product variant must use Target.Product
suffix = String(library.Properties.Target.Vendor.Suffix)
}
if suffix == "" {
@@ -812,6 +814,7 @@ func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, library.SharedProperties.Shared.Export_shared_lib_headers...)
deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, library.SharedProperties.Shared.Export_static_lib_headers...)
}
// TODO(b/150902910): product variant must use Target.Product
if ctx.useVndk() {
deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, library.baseLinker.Properties.Target.Vendor.Exclude_static_libs)
deps.SharedLibs = removeListFromList(deps.SharedLibs, library.baseLinker.Properties.Target.Vendor.Exclude_shared_libs)