Reland: Add more target-specific properties

Following properties are added:

* vendor.header_libs
* platform.cflags
* platform.header_libs
* platform.exclude_shared_libs

These are used in the *-ndk libraries generated from the aidl_interface
modules, so that we can build the platform variants of the libraries
just like the *-ndk_platform libraries. Eventually, we will remove the
*-ndk_platform libraries.

Bug: 161456198
Test: m
Merged-In: I126e272cd29eb1e03662c54bfa8bd64e704adc74
Change-Id: I126e272cd29eb1e03662c54bfa8bd64e704adc74
(cherry picked from commit bb14481408)
This commit is contained in:
Jiyong Park
2021-07-16 16:05:50 +09:00
parent 04f3f07752
commit a592b6f8e0
2 changed files with 24 additions and 0 deletions

View File

@@ -189,6 +189,11 @@ type BaseCompilerProperties struct {
// variant of the C/C++ module. // variant of the C/C++ module.
Cflags []string Cflags []string
} }
Platform struct {
// List of additional cflags that should be used to build the platform
// variant of the C/C++ module.
Cflags []string
}
} }
Proto struct { Proto struct {
@@ -310,6 +315,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
CheckBadCompilerFlags(ctx, "product.cflags", compiler.Properties.Target.Product.Cflags) CheckBadCompilerFlags(ctx, "product.cflags", compiler.Properties.Target.Product.Cflags)
CheckBadCompilerFlags(ctx, "recovery.cflags", compiler.Properties.Target.Recovery.Cflags) CheckBadCompilerFlags(ctx, "recovery.cflags", compiler.Properties.Target.Recovery.Cflags)
CheckBadCompilerFlags(ctx, "vendor_ramdisk.cflags", compiler.Properties.Target.Vendor_ramdisk.Cflags) CheckBadCompilerFlags(ctx, "vendor_ramdisk.cflags", compiler.Properties.Target.Vendor_ramdisk.Cflags)
CheckBadCompilerFlags(ctx, "platform.cflags", compiler.Properties.Target.Platform.Cflags)
esc := proptools.NinjaAndShellEscapeList esc := proptools.NinjaAndShellEscapeList
@@ -502,6 +508,9 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
if ctx.inVendorRamdisk() { if ctx.inVendorRamdisk() {
flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Target.Vendor_ramdisk.Cflags)...) flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Target.Vendor_ramdisk.Cflags)...)
} }
if !ctx.useSdk() {
flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Target.Platform.Cflags)...)
}
// We can enforce some rules more strictly in the code we own. strict // We can enforce some rules more strictly in the code we own. strict
// indicates if this is code that we can be stricter with. If we have // indicates if this is code that we can be stricter with. If we have

View File

@@ -105,6 +105,10 @@ type BaseLinkerProperties struct {
// product variant of the C/C++ module. // product variant of the C/C++ module.
Static_libs []string Static_libs []string
// list of ehader libs that only should be used to build vendor or product
// variant of the C/C++ module.
Header_libs []string
// list of shared libs that should not be used to build vendor or // list of shared libs that should not be used to build vendor or
// product variant of the C/C++ module. // product variant of the C/C++ module.
Exclude_shared_libs []string Exclude_shared_libs []string
@@ -173,6 +177,14 @@ type BaseLinkerProperties struct {
// in most cases the same libraries are available for the SDK and platform // in most cases the same libraries are available for the SDK and platform
// variants. // variants.
Shared_libs []string Shared_libs []string
// list of ehader libs that only should be used to build platform variant of
// the C/C++ module.
Header_libs []string
// list of shared libs that should not be used to build the platform variant
// of the C/C++ module.
Exclude_shared_libs []string
} }
Apex struct { Apex struct {
// list of shared libs that should not be used to build the apex variant of // list of shared libs that should not be used to build the apex variant of
@@ -284,6 +296,7 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
deps.ReexportSharedLibHeaders = removeListFromList(deps.ReexportSharedLibHeaders, linker.Properties.Target.Vendor.Exclude_shared_libs) deps.ReexportSharedLibHeaders = removeListFromList(deps.ReexportSharedLibHeaders, linker.Properties.Target.Vendor.Exclude_shared_libs)
deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Target.Vendor.Static_libs...) deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Target.Vendor.Static_libs...)
deps.StaticLibs = removeListFromList(deps.StaticLibs, linker.Properties.Target.Vendor.Exclude_static_libs) deps.StaticLibs = removeListFromList(deps.StaticLibs, linker.Properties.Target.Vendor.Exclude_static_libs)
deps.HeaderLibs = append(deps.HeaderLibs, linker.Properties.Target.Vendor.Header_libs...)
deps.HeaderLibs = removeListFromList(deps.HeaderLibs, linker.Properties.Target.Vendor.Exclude_header_libs) deps.HeaderLibs = removeListFromList(deps.HeaderLibs, linker.Properties.Target.Vendor.Exclude_header_libs)
deps.ReexportStaticLibHeaders = removeListFromList(deps.ReexportStaticLibHeaders, linker.Properties.Target.Vendor.Exclude_static_libs) deps.ReexportStaticLibHeaders = removeListFromList(deps.ReexportStaticLibHeaders, linker.Properties.Target.Vendor.Exclude_static_libs)
deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, linker.Properties.Target.Vendor.Exclude_static_libs) deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, linker.Properties.Target.Vendor.Exclude_static_libs)
@@ -333,6 +346,8 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
if !ctx.useSdk() { if !ctx.useSdk() {
deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Target.Platform.Shared_libs...) deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Target.Platform.Shared_libs...)
deps.SharedLibs = removeListFromList(deps.SharedLibs, linker.Properties.Target.Platform.Exclude_shared_libs)
deps.HeaderLibs = append(deps.HeaderLibs, linker.Properties.Target.Platform.Header_libs...)
} }
deps.SystemSharedLibs = linker.Properties.System_shared_libs deps.SystemSharedLibs = linker.Properties.System_shared_libs