LLNDK can re-export headers
Added export_llndk_headers properties to llndk_library module. And a new module type llndk_headers is added. This is to enable an LLNDK library to reexport other LLNDK headers. Bug: 65395259 Test: do the following // frameworks/native/libs/arect/Android.bp llndk_headers { name: "libarect_vendor_headers", export_include_dirs: ["include"], } // frameworks/native/libs/nativewindow/Android.bp llndk_library { name: "libnativewindow", .... export_llndk_headers: ["libarect_vendor_headers"], } check that -Iframeworks/native/libs/arect/include is in LOCAL_EXPORT_CFLAGS of libnativewindow.vendor in out/soong/Android-<product>.mk Change-Id: If1650414b2967f2042f4ebe2b593ed3f3ea45d3a
This commit is contained in:
parent
17ae970a92
commit
2a45412445
2 changed files with 40 additions and 1 deletions
3
cc/cc.go
3
cc/cc.go
|
@ -1402,6 +1402,9 @@ func vendorMutator(mctx android.BottomUpMutatorContext) {
|
|||
// LL-NDK stubs only exist in the vendor variant, since the
|
||||
// real libraries will be used in the core variant.
|
||||
mctx.CreateVariations(vendorMode)
|
||||
} else if _, ok := m.linker.(*llndkHeadersDecorator); ok {
|
||||
// ... and LL-NDK headers as well
|
||||
mctx.CreateVariations(vendorMode)
|
||||
} else if m.hasVendorVariant() {
|
||||
// This will be available in both /system and /vendor
|
||||
// or a /system directory that is available to vendor.
|
||||
|
|
|
@ -23,6 +23,7 @@ import (
|
|||
|
||||
var (
|
||||
llndkLibrarySuffix = ".llndk"
|
||||
llndkHeadersSuffix = ".llndk"
|
||||
)
|
||||
|
||||
// Creates a stub shared library based on the provided version file.
|
||||
|
@ -55,6 +56,9 @@ type llndkLibraryProperties struct {
|
|||
// When set to false, this module can only be depended on by VNDK libraries, not vendor
|
||||
// libraries. This effectively hides this module from vendors. Default value is true.
|
||||
Vendor_available bool
|
||||
|
||||
// list of llndk headers to re-export include directories from.
|
||||
Export_llndk_headers []string `android:"arch_variant"`
|
||||
}
|
||||
|
||||
type llndkStubDecorator struct {
|
||||
|
@ -78,7 +82,10 @@ func (stub *llndkStubDecorator) compile(ctx ModuleContext, flags Flags, deps Pat
|
|||
}
|
||||
|
||||
func (stub *llndkStubDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
||||
return Deps{}
|
||||
headers := addSuffix(stub.Properties.Export_llndk_headers, llndkHeadersSuffix)
|
||||
deps.HeaderLibs = append(deps.HeaderLibs, headers...)
|
||||
deps.ReexportHeaderLibHeaders = append(deps.ReexportHeaderLibHeaders, headers...)
|
||||
return deps
|
||||
}
|
||||
|
||||
func (stub *llndkStubDecorator) Name(name string) string {
|
||||
|
@ -173,6 +180,35 @@ func llndkLibraryFactory() android.Module {
|
|||
return module
|
||||
}
|
||||
|
||||
type llndkHeadersDecorator struct {
|
||||
*libraryDecorator
|
||||
}
|
||||
|
||||
func (headers *llndkHeadersDecorator) Name(name string) string {
|
||||
return name + llndkHeadersSuffix
|
||||
}
|
||||
|
||||
func llndkHeadersFactory() android.Module {
|
||||
module, library := NewLibrary(android.DeviceSupported)
|
||||
library.HeaderOnly()
|
||||
library.setStatic()
|
||||
|
||||
decorator := &llndkHeadersDecorator{
|
||||
libraryDecorator: library,
|
||||
}
|
||||
|
||||
module.compiler = nil
|
||||
module.linker = decorator
|
||||
module.installer = nil
|
||||
|
||||
module.AddProperties(&library.MutatedProperties, &library.flagExporter.Properties)
|
||||
|
||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth)
|
||||
|
||||
return module
|
||||
}
|
||||
|
||||
func init() {
|
||||
android.RegisterModuleType("llndk_library", llndkLibraryFactory)
|
||||
android.RegisterModuleType("llndk_headers", llndkHeadersFactory)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue