Merge changes Ib29ede45,I1b2bfdfb
* changes: Create LLNDK vendor variants when DeviceVndkVersion is not set Add a new SingletonModule type
This commit is contained in:
@@ -738,12 +738,29 @@ func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
|
||||
},
|
||||
nocrt: true,
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "libllndk",
|
||||
llndk_stubs: "libllndk.llndk",
|
||||
}
|
||||
|
||||
llndk_library {
|
||||
name: "libllndk.llndk",
|
||||
symbol_file: "",
|
||||
export_llndk_headers: ["libllndk_headers"],
|
||||
}
|
||||
|
||||
llndk_headers {
|
||||
name: "libllndk_headers",
|
||||
export_include_dirs: ["include"],
|
||||
}
|
||||
`)
|
||||
|
||||
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
|
||||
"LLNDK: libc.so",
|
||||
"LLNDK: libdl.so",
|
||||
"LLNDK: libft2.so",
|
||||
"LLNDK: libllndk.so",
|
||||
"LLNDK: libm.so",
|
||||
"VNDK-SP: libc++.so",
|
||||
"VNDK-core: libvndk-private.so",
|
||||
|
59
cc/image.go
59
cc/image.go
@@ -264,31 +264,34 @@ func (m *Module) ImageMutatorBegin(mctx android.BaseModuleContext) {
|
||||
productVndkVersion = platformVndkVersion
|
||||
}
|
||||
|
||||
if boardVndkVersion == "" {
|
||||
_, isLLNDKLibrary := m.linker.(*llndkStubDecorator)
|
||||
_, isLLNDKHeaders := m.linker.(*llndkHeadersDecorator)
|
||||
lib := moduleLibraryInterface(m)
|
||||
hasLLNDKStubs := lib != nil && lib.hasLLNDKStubs()
|
||||
|
||||
if isLLNDKLibrary || isLLNDKHeaders || hasLLNDKStubs {
|
||||
// This is an LLNDK library. The implementation of the library will be on /system,
|
||||
// and vendor and product variants will be created with LLNDK stubs.
|
||||
// The LLNDK libraries need vendor variants even if there is no VNDK.
|
||||
// The obsolete llndk_library and llndk_headers modules also need the vendor variants
|
||||
// so the cc_library LLNDK stubs can depend on them.
|
||||
if hasLLNDKStubs {
|
||||
coreVariantNeeded = true
|
||||
}
|
||||
if platformVndkVersion != "" {
|
||||
vendorVariants = append(vendorVariants, platformVndkVersion)
|
||||
productVariants = append(productVariants, platformVndkVersion)
|
||||
}
|
||||
if boardVndkVersion != "" {
|
||||
vendorVariants = append(vendorVariants, boardVndkVersion)
|
||||
}
|
||||
if productVndkVersion != "" {
|
||||
productVariants = append(productVariants, productVndkVersion)
|
||||
}
|
||||
} else if boardVndkVersion == "" {
|
||||
// If the device isn't compiling against the VNDK, we always
|
||||
// use the core mode.
|
||||
coreVariantNeeded = true
|
||||
} else if _, ok := m.linker.(*llndkStubDecorator); ok {
|
||||
// LL-NDK stubs only exist in the vendor and product variants,
|
||||
// since the real libraries will be used in the core variant.
|
||||
vendorVariants = append(vendorVariants,
|
||||
platformVndkVersion,
|
||||
boardVndkVersion,
|
||||
)
|
||||
productVariants = append(productVariants,
|
||||
platformVndkVersion,
|
||||
productVndkVersion,
|
||||
)
|
||||
} else if _, ok := m.linker.(*llndkHeadersDecorator); ok {
|
||||
// ... and LL-NDK headers as well
|
||||
vendorVariants = append(vendorVariants,
|
||||
platformVndkVersion,
|
||||
boardVndkVersion,
|
||||
)
|
||||
productVariants = append(productVariants,
|
||||
platformVndkVersion,
|
||||
productVndkVersion,
|
||||
)
|
||||
} else if m.isSnapshotPrebuilt() {
|
||||
// Make vendor variants only for the versions in BOARD_VNDK_VERSION and
|
||||
// PRODUCT_EXTRA_VNDK_VERSIONS.
|
||||
@@ -346,18 +349,6 @@ func (m *Module) ImageMutatorBegin(mctx android.BaseModuleContext) {
|
||||
} else {
|
||||
vendorVariants = append(vendorVariants, platformVndkVersion)
|
||||
}
|
||||
} else if lib := moduleLibraryInterface(m); lib != nil && lib.hasLLNDKStubs() {
|
||||
// This is an LLNDK library. The implementation of the library will be on /system,
|
||||
// and vendor and product variants will be created with LLNDK stubs.
|
||||
coreVariantNeeded = true
|
||||
vendorVariants = append(vendorVariants,
|
||||
platformVndkVersion,
|
||||
boardVndkVersion,
|
||||
)
|
||||
productVariants = append(productVariants,
|
||||
platformVndkVersion,
|
||||
productVndkVersion,
|
||||
)
|
||||
} else {
|
||||
// This is either in /system (or similar: /data), or is a
|
||||
// modules built with the NDK. Modules built with the NDK
|
||||
|
@@ -161,6 +161,13 @@ type llndkHeadersDecorator struct {
|
||||
*libraryDecorator
|
||||
}
|
||||
|
||||
func (llndk *llndkHeadersDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
||||
deps.HeaderLibs = append(deps.HeaderLibs, llndk.Properties.Llndk.Export_llndk_headers...)
|
||||
deps.ReexportHeaderLibHeaders = append(deps.ReexportHeaderLibHeaders,
|
||||
llndk.Properties.Llndk.Export_llndk_headers...)
|
||||
return deps
|
||||
}
|
||||
|
||||
// llndk_headers contains a set of c/c++ llndk headers files which are imported
|
||||
// by other soongs cc modules.
|
||||
func llndkHeadersFactory() android.Module {
|
||||
@@ -178,11 +185,6 @@ func llndkHeadersFactory() android.Module {
|
||||
module.installer = nil
|
||||
module.library = decorator
|
||||
|
||||
module.AddProperties(
|
||||
&module.Properties,
|
||||
&library.MutatedProperties,
|
||||
&library.flagExporter.Properties)
|
||||
|
||||
module.Init()
|
||||
|
||||
return module
|
||||
|
Reference in New Issue
Block a user