Merge "Remove obsolete llndk_library"

This commit is contained in:
Colin Cross 2021-04-28 23:25:06 +00:00 committed by Gerrit Code Review
commit 5423a9c513
15 changed files with 72 additions and 398 deletions

View File

@ -1355,12 +1355,9 @@ func TestApexDependsOnLLNDKTransitively(t *testing.T) {
system_shared_libs: [], system_shared_libs: [],
stl: "none", stl: "none",
stubs: { versions: ["29","30"] }, stubs: { versions: ["29","30"] },
llndk_stubs: "libbar.llndk", llndk: {
symbol_file: "libbar.map.txt",
} }
llndk_library {
name: "libbar.llndk",
symbol_file: "",
} }
`, `,
setUseVendorAllowListForTest([]string{"myapex"}), setUseVendorAllowListForTest([]string{"myapex"}),

View File

@ -485,12 +485,6 @@ func (c *stubDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.
}) })
} }
func (c *llndkStubDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
// Don't write anything for an llndk_library module, the vendor variant of the cc_library
// module will write the Android.mk entries.
entries.Disabled = true
}
func (c *vndkPrebuiltLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) { func (c *vndkPrebuiltLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
entries.Class = "SHARED_LIBRARIES" entries.Class = "SHARED_LIBRARIES"

View File

@ -1121,13 +1121,6 @@ func (c *Module) IsLlndkPublic() bool {
return c.VendorProperties.IsLLNDK && !c.VendorProperties.IsVNDKPrivate return c.VendorProperties.IsLLNDK && !c.VendorProperties.IsVNDKPrivate
} }
func (c *Module) IsLlndkLibrary() bool {
if _, ok := c.linker.(*llndkStubDecorator); ok {
return true
}
return false
}
func (m *Module) NeedsLlndkVariants() bool { func (m *Module) NeedsLlndkVariants() bool {
lib := moduleLibraryInterface(m) lib := moduleLibraryInterface(m)
return lib != nil && (lib.hasLLNDKStubs() || lib.hasLLNDKHeaders()) return lib != nil && (lib.hasLLNDKStubs() || lib.hasLLNDKHeaders())

View File

@ -548,14 +548,11 @@ func TestVndk(t *testing.T) {
cc_library { cc_library {
name: "libllndk", name: "libllndk",
llndk_stubs: "libllndk.llndk", llndk: {
} symbol_file: "libllndk.map.txt",
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
export_llndk_headers: ["libllndk_headers"], export_llndk_headers: ["libllndk_headers"],
} }
}
cc_library_headers { cc_library_headers {
name: "libllndk_headers", name: "libllndk_headers",
@ -897,14 +894,11 @@ func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
cc_library { cc_library {
name: "libllndk", name: "libllndk",
llndk_stubs: "libllndk.llndk", llndk: {
} symbol_file: "libllndk.map.txt",
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
export_llndk_headers: ["libllndk_headers"], export_llndk_headers: ["libllndk_headers"],
} }
}
cc_library_headers { cc_library_headers {
name: "libllndk_headers", name: "libllndk_headers",
@ -1170,12 +1164,9 @@ func TestDoubleLoadbleDep(t *testing.T) {
cc_library { cc_library {
name: "libllndk", name: "libllndk",
shared_libs: ["libdoubleloadable"], shared_libs: ["libdoubleloadable"],
llndk_stubs: "libllndk.llndk", llndk: {
symbol_file: "libllndk.map.txt",
} }
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
} }
cc_library { cc_library {
@ -1193,12 +1184,9 @@ func TestDoubleLoadbleDep(t *testing.T) {
cc_library { cc_library {
name: "libllndk", name: "libllndk",
shared_libs: ["libvndksp"], shared_libs: ["libvndksp"],
llndk_stubs: "libllndk.llndk", llndk: {
symbol_file: "libllndk.map.txt",
} }
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
} }
cc_library { cc_library {
@ -1255,12 +1243,9 @@ func TestDoubleLoadbleDep(t *testing.T) {
cc_library { cc_library {
name: "libllndk", name: "libllndk",
shared_libs: ["libcoreonly"], shared_libs: ["libcoreonly"],
llndk_stubs: "libllndk.llndk", llndk: {
symbol_file: "libllndk.map.txt",
} }
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
} }
cc_library { cc_library {
@ -1283,12 +1268,9 @@ func TestDoubleLoadableDepError(t *testing.T) {
cc_library { cc_library {
name: "libllndk", name: "libllndk",
shared_libs: ["libnondoubleloadable"], shared_libs: ["libnondoubleloadable"],
llndk_stubs: "libllndk.llndk", llndk: {
symbol_file: "libllndk.map.txt",
} }
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
} }
cc_library { cc_library {
@ -1307,12 +1289,9 @@ func TestDoubleLoadableDepError(t *testing.T) {
name: "libllndk", name: "libllndk",
no_libcrt: true, no_libcrt: true,
shared_libs: ["libnondoubleloadable"], shared_libs: ["libnondoubleloadable"],
llndk_stubs: "libllndk.llndk", llndk: {
symbol_file: "libllndk.map.txt",
} }
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
} }
cc_library { cc_library {
@ -1326,12 +1305,9 @@ func TestDoubleLoadableDepError(t *testing.T) {
cc_library { cc_library {
name: "libllndk", name: "libllndk",
shared_libs: ["libcoreonly"], shared_libs: ["libcoreonly"],
llndk_stubs: "libllndk.llndk", llndk: {
symbol_file: "libllndk.map.txt",
} }
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
} }
cc_library { cc_library {
@ -1357,11 +1333,9 @@ func TestDoubleLoadableDepError(t *testing.T) {
cc_library { cc_library {
name: "libllndk", name: "libllndk",
shared_libs: ["libnondoubleloadable"], shared_libs: ["libnondoubleloadable"],
llndk_stubs: "libllndk.llndk", llndk: {
symbol_file: "libllndk.map.txt",
} }
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
} }
cc_library { cc_library {
name: "libnondoubleloadable", name: "libnondoubleloadable",
@ -1388,11 +1362,6 @@ func TestCheckVndkMembershipBeforeDoubleLoadable(t *testing.T) {
shared_libs: ["libanothervndksp"], shared_libs: ["libanothervndksp"],
} }
llndk_library {
name: "libllndk",
symbol_file: "",
}
cc_library { cc_library {
name: "libanothervndksp", name: "libanothervndksp",
vendor_available: true, vendor_available: true,
@ -2158,11 +2127,9 @@ func TestEnforceProductVndkVersion(t *testing.T) {
bp := ` bp := `
cc_library { cc_library {
name: "libllndk", name: "libllndk",
llndk_stubs: "libllndk.llndk", llndk: {
symbol_file: "libllndk.map.txt",
} }
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
} }
cc_library { cc_library {
name: "libvndk", name: "libvndk",
@ -2436,20 +2403,16 @@ func TestMakeLinkType(t *testing.T) {
} }
cc_library { cc_library {
name: "libllndk", name: "libllndk",
llndk_stubs: "libllndk.llndk", llndk: {
symbol_file: "libllndk.map.txt",
} }
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
} }
cc_library { cc_library {
name: "libllndkprivate", name: "libllndkprivate",
llndk_stubs: "libllndkprivate.llndk", llndk: {
} symbol_file: "libllndkprivate.map.txt",
llndk_library {
name: "libllndkprivate.llndk",
private: true, private: true,
symbol_file: "", }
} }
llndk_libraries_txt { llndk_libraries_txt {
@ -2769,68 +2732,6 @@ func checkEquals(t *testing.T, message string, expected, actual interface{}) {
} }
func TestLlndkLibrary(t *testing.T) { func TestLlndkLibrary(t *testing.T) {
ctx := testCc(t, `
cc_library {
name: "libllndk",
stubs: { versions: ["1", "2"] },
llndk_stubs: "libllndk.llndk",
}
llndk_library {
name: "libllndk.llndk",
}
cc_prebuilt_library_shared {
name: "libllndkprebuilt",
stubs: { versions: ["1", "2"] },
llndk_stubs: "libllndkprebuilt.llndk",
}
llndk_library {
name: "libllndkprebuilt.llndk",
}
cc_library {
name: "libllndk_with_external_headers",
stubs: { versions: ["1", "2"] },
llndk_stubs: "libllndk_with_external_headers.llndk",
header_libs: ["libexternal_headers"],
export_header_lib_headers: ["libexternal_headers"],
}
llndk_library {
name: "libllndk_with_external_headers.llndk",
}
cc_library_headers {
name: "libexternal_headers",
export_include_dirs: ["include"],
vendor_available: true,
}
`)
actual := ctx.ModuleVariantsForTests("libllndk")
for i := 0; i < len(actual); i++ {
if !strings.HasPrefix(actual[i], "android_vendor.29_") {
actual = append(actual[:i], actual[i+1:]...)
i--
}
}
expected := []string{
"android_vendor.29_arm64_armv8-a_shared_1",
"android_vendor.29_arm64_armv8-a_shared_2",
"android_vendor.29_arm64_armv8-a_shared_current",
"android_vendor.29_arm64_armv8-a_shared",
"android_vendor.29_arm_armv7-a-neon_shared_1",
"android_vendor.29_arm_armv7-a-neon_shared_2",
"android_vendor.29_arm_armv7-a-neon_shared_current",
"android_vendor.29_arm_armv7-a-neon_shared",
}
checkEquals(t, "variants for llndk stubs", expected, actual)
params := ctx.ModuleForTests("libllndk", "android_vendor.29_arm_armv7-a-neon_shared").Description("generate stub")
checkEquals(t, "use VNDK version for default stubs", "current", params.Args["apiLevel"])
params = ctx.ModuleForTests("libllndk", "android_vendor.29_arm_armv7-a-neon_shared_1").Description("generate stub")
checkEquals(t, "override apiLevel for versioned stubs", "1", params.Args["apiLevel"])
}
func TestEmbeddedLlndkLibrary(t *testing.T) {
result := prepareForCcTest.RunTestWithBp(t, ` result := prepareForCcTest.RunTestWithBp(t, `
cc_library { cc_library {
name: "libllndk", name: "libllndk",

View File

@ -437,15 +437,11 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
productVndkVersion = platformVndkVersion productVndkVersion = platformVndkVersion
} }
if m.IsLlndkLibrary() || m.NeedsLlndkVariants() { if m.NeedsLlndkVariants() {
// This is an LLNDK library. The implementation of the library will be on /system, // 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. // and vendor and product variants will be created with LLNDK stubs.
// The LLNDK libraries need vendor variants even if there is no VNDK. // 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 m.NeedsLlndkVariants() {
coreVariantNeeded = true coreVariantNeeded = true
}
if platformVndkVersion != "" { if platformVndkVersion != "" {
vendorVariants = append(vendorVariants, platformVndkVersion) vendorVariants = append(vendorVariants, platformVndkVersion)
productVariants = append(productVariants, platformVndkVersion) productVariants = append(productVariants, platformVndkVersion)

View File

@ -117,9 +117,6 @@ type LibraryProperties struct {
// Inject boringssl hash into the shared library. This is only intended for use by external/boringssl. // Inject boringssl hash into the shared library. This is only intended for use by external/boringssl.
Inject_bssl_hash *bool `android:"arch_variant"` Inject_bssl_hash *bool `android:"arch_variant"`
// If this is an LLNDK library, the name of the equivalent llndk_library module.
Llndk_stubs *string
// If this is an LLNDK library, properties to describe the LLNDK stubs. Will be copied from // If this is an LLNDK library, properties to describe the LLNDK stubs. Will be copied from
// the module pointed to by llndk_stubs if it is set. // the module pointed to by llndk_stubs if it is set.
Llndk llndkLibraryProperties Llndk llndkLibraryProperties
@ -1682,18 +1679,10 @@ func (library *libraryDecorator) HeaderOnly() {
// hasLLNDKStubs returns true if this cc_library module has a variant that will build LLNDK stubs. // hasLLNDKStubs returns true if this cc_library module has a variant that will build LLNDK stubs.
func (library *libraryDecorator) hasLLNDKStubs() bool { func (library *libraryDecorator) hasLLNDKStubs() bool {
return library.hasVestigialLLNDKLibrary() || String(library.Properties.Llndk.Symbol_file) != "" return String(library.Properties.Llndk.Symbol_file) != ""
} }
// hasVestigialLLNDKLibrary returns true if this cc_library module has a corresponding llndk_library // hasLLNDKStubs returns true if this cc_library module has a variant that will build LLNDK stubs.
// module containing properties describing the LLNDK variant.
// TODO(b/170784825): remove this once there are no more llndk_library modules.
func (library *libraryDecorator) hasVestigialLLNDKLibrary() bool {
return String(library.Properties.Llndk_stubs) != ""
}
// hasLLNDKHeaders returns true if this cc_library module has a variant that provides headers
// to a module that sets llndk.symbol_file.
func (library *libraryDecorator) hasLLNDKHeaders() bool { func (library *libraryDecorator) hasLLNDKHeaders() bool {
return Bool(library.Properties.Llndk.Llndk_headers) return Bool(library.Properties.Llndk.Llndk_headers)
} }
@ -1934,9 +1923,7 @@ func LinkageMutator(mctx android.BottomUpMutatorContext) {
isLLNDK := false isLLNDK := false
if m, ok := mctx.Module().(*Module); ok { if m, ok := mctx.Module().(*Module); ok {
// Don't count the vestigial llndk_library module as isLLNDK, it needs a static isLLNDK = m.IsLlndk()
// variant so that a cc_library_prebuilt can depend on it.
isLLNDK = m.IsLlndk() && !isVestigialLLNDKModule(m)
} }
buildStatic := library.BuildStaticVariant() && !isLLNDK buildStatic := library.BuildStaticVariant() && !isLLNDK
buildShared := library.BuildSharedVariant() buildShared := library.BuildSharedVariant()

View File

@ -106,9 +106,6 @@ type LinkableInterface interface {
// IsLlndkPublic returns true only for LLNDK (public) libs. // IsLlndkPublic returns true only for LLNDK (public) libs.
IsLlndkPublic() bool IsLlndkPublic() bool
// IsLlndkLibrary returns true if this module is an LLNDK library module.
IsLlndkLibrary() bool
// NeedsLlndkVariants returns true if this module has LLNDK stubs or provides LLNDK headers. // NeedsLlndkVariants returns true if this module has LLNDK stubs or provides LLNDK headers.
NeedsLlndkVariants() bool NeedsLlndkVariants() bool

View File

@ -14,31 +14,12 @@
package cc package cc
import (
"strings"
"android/soong/android"
)
var ( var (
llndkLibrarySuffix = ".llndk" llndkLibrarySuffix = ".llndk"
llndkHeadersSuffix = ".llndk" llndkHeadersSuffix = ".llndk"
) )
// Holds properties to describe a stub shared library based on the provided version file. // Holds properties to describe a stub shared library based on the provided version file.
// The stub library will actually be built by the cc_library module that points to this
// module with the llndk_stubs property.
// TODO(ccross): move the properties from llndk_library modules directly into the cc_library
// modules and remove the llndk_library modules.
//
// Example:
//
// llndk_library {
// name: "libfoo",
// symbol_file: "libfoo.map.txt",
// export_include_dirs: ["include_vndk"],
// }
//
type llndkLibraryProperties struct { type llndkLibraryProperties struct {
// Relative path to the symbol map. // Relative path to the symbol map.
// An example file can be seen here: TODO(danalbert): Make an example. // An example file can be seen here: TODO(danalbert): Make an example.
@ -74,98 +55,3 @@ type llndkLibraryProperties struct {
// llndk.symbol_file. // llndk.symbol_file.
Llndk_headers *bool Llndk_headers *bool
} }
type llndkStubDecorator struct {
*libraryDecorator
Properties llndkLibraryProperties
}
var _ versionedInterface = (*llndkStubDecorator)(nil)
func (stub *llndkStubDecorator) compilerFlags(ctx ModuleContext, flags Flags, deps PathDeps) Flags {
return flags
}
func (stub *llndkStubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
return Objects{}
}
func (stub *llndkStubDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
return deps
}
func (stub *llndkStubDecorator) Name(name string) string {
if strings.HasSuffix(name, llndkLibrarySuffix) {
return name
}
return name + llndkLibrarySuffix
}
func (stub *llndkStubDecorator) linkerProps() []interface{} {
props := stub.libraryDecorator.linkerProps()
return append(props, &stub.Properties)
}
func (stub *llndkStubDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
stub.libraryDecorator.libName = stub.implementationModuleName(ctx.ModuleName())
return stub.libraryDecorator.linkerFlags(ctx, flags)
}
func (stub *llndkStubDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps,
objs Objects) android.Path {
return nil
}
func (stub *llndkStubDecorator) nativeCoverage() bool {
return false
}
func (stub *llndkStubDecorator) implementationModuleName(name string) string {
return strings.TrimSuffix(name, llndkLibrarySuffix)
}
func (stub *llndkStubDecorator) buildStubs() bool {
return true
}
func NewLLndkStubLibrary() *Module {
module, library := NewLibrary(android.DeviceSupported)
module.stl = nil
module.sanitize = nil
library.disableStripping()
stub := &llndkStubDecorator{
libraryDecorator: library,
}
module.compiler = stub
module.linker = stub
module.installer = nil
module.library = stub
return module
}
// llndk_library creates a stub llndk shared library based on the provided
// version file. Example:
//
// llndk_library {
// name: "libfoo",
// symbol_file: "libfoo.map.txt",
// export_include_dirs: ["include_vndk"],
// }
func LlndkLibraryFactory() android.Module {
module := NewLLndkStubLibrary()
return module.Init()
}
// isVestigialLLNDKModule returns true if m is a vestigial llndk_library module used to provide
// properties to the LLNDK variant of a cc_library.
func isVestigialLLNDKModule(m *Module) bool {
_, ok := m.linker.(*llndkStubDecorator)
return ok
}
func init() {
android.RegisterModuleType("llndk_library", LlndkLibraryFactory)
}

View File

@ -31,20 +31,7 @@ type stubLibraries struct {
// Check if the module defines stub, or itself is stub // Check if the module defines stub, or itself is stub
func IsStubTarget(m *Module) bool { func IsStubTarget(m *Module) bool {
if m.IsStubs() || m.HasStubsVariants() { return m.IsStubs() || m.HasStubsVariants()
return true
}
// Library which defines LLNDK Stub is also Stub target.
// Pure LLNDK Stub target would not contain any packaging
// with target file path.
if library, ok := m.linker.(*libraryDecorator); ok {
if library.Properties.Llndk_stubs != nil {
return true
}
}
return false
} }
// Get target file name to be installed from this module // Get target file name to be installed from this module

View File

@ -27,7 +27,6 @@ func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
RegisterLibraryHeadersBuildComponents(ctx) RegisterLibraryHeadersBuildComponents(ctx)
ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory) ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory)
ctx.RegisterModuleType("cc_benchmark", BenchmarkFactory) ctx.RegisterModuleType("cc_benchmark", BenchmarkFactory)
ctx.RegisterModuleType("cc_object", ObjectFactory) ctx.RegisterModuleType("cc_object", ObjectFactory)
ctx.RegisterModuleType("cc_genrule", genRuleFactory) ctx.RegisterModuleType("cc_genrule", genRuleFactory)
@ -200,12 +199,9 @@ func commonDefaultModules() string {
stubs: { stubs: {
versions: ["27", "28", "29"], versions: ["27", "28", "29"],
}, },
llndk_stubs: "libc.llndk", llndk: {
} symbol_file: "libc.map.txt",
llndk_library { },
name: "libc.llndk",
symbol_file: "",
sdk_version: "current",
} }
cc_library { cc_library {
name: "libm", name: "libm",
@ -222,12 +218,9 @@ func commonDefaultModules() string {
"//apex_available:platform", "//apex_available:platform",
"myapex" "myapex"
], ],
llndk_stubs: "libm.llndk", llndk: {
} symbol_file: "libm.map.txt",
llndk_library { },
name: "libm.llndk",
symbol_file: "",
sdk_version: "current",
} }
// Coverage libraries // Coverage libraries
@ -289,12 +282,9 @@ func commonDefaultModules() string {
"//apex_available:platform", "//apex_available:platform",
"myapex" "myapex"
], ],
llndk_stubs: "libdl.llndk", llndk: {
} symbol_file: "libdl.map.txt",
llndk_library { },
name: "libdl.llndk",
symbol_file: "",
sdk_version: "current",
} }
cc_library { cc_library {
name: "libft2", name: "libft2",
@ -302,13 +292,10 @@ func commonDefaultModules() string {
nocrt: true, nocrt: true,
system_shared_libs: [], system_shared_libs: [],
recovery_available: true, recovery_available: true,
llndk_stubs: "libft2.llndk", llndk: {
} symbol_file: "libft2.map.txt",
llndk_library {
name: "libft2.llndk",
symbol_file: "",
private: true, private: true,
sdk_version: "current", }
} }
cc_library { cc_library {
name: "libc++_static", name: "libc++_static",

View File

@ -184,9 +184,6 @@ func isSnapshotAware(cfg android.DeviceConfig, m *Module, inProprietaryPath bool
if m.IsLlndk() { if m.IsLlndk() {
return false return false
} }
if _, ok := m.linker.(*llndkStubDecorator); ok {
return false
}
// Libraries // Libraries
if l, ok := m.linker.(snapshotLibraryInterface); ok { if l, ok := m.linker.(snapshotLibraryInterface); ok {

View File

@ -78,14 +78,12 @@ func TestVendorSnapshotCapture(t *testing.T) {
cc_library { cc_library {
name: "libllndk", name: "libllndk",
llndk_stubs: "libllndk.llndk", llndk: {
} symbol_file: "libllndk.map.txt",
},
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
} }
` `
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil) config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current") config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
config.TestProductVariables.Platform_vndk_version = StringPtr("29") config.TestProductVariables.Platform_vndk_version = StringPtr("29")

View File

@ -233,11 +233,11 @@ func vndkIsVndkDepAllowed(from *vndkdep, to *vndkdep) error {
type moduleListerFunc func(ctx android.SingletonContext) (moduleNames, fileNames []string) type moduleListerFunc func(ctx android.SingletonContext) (moduleNames, fileNames []string)
var ( var (
llndkLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsLLNDK && !isVestigialLLNDKModule(m) && !m.Header() }) llndkLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsLLNDK && !m.Header() })
llndkLibrariesWithoutHWASAN = vndkModuleListRemover(llndkLibraries, "libclang_rt.hwasan-") llndkLibrariesWithoutHWASAN = vndkModuleListRemover(llndkLibraries, "libclang_rt.hwasan-")
vndkSPLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKSP }) vndkSPLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKSP })
vndkCoreLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKCore }) vndkCoreLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKCore })
vndkPrivateLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKPrivate && !isVestigialLLNDKModule(m) }) vndkPrivateLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKPrivate })
vndkProductLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKProduct }) vndkProductLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKProduct })
vndkUsingCoreVariantLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKUsingCoreVariant }) vndkUsingCoreVariantLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKUsingCoreVariant })
) )
@ -298,15 +298,6 @@ func setVndkMustUseVendorVariantListForTest(config android.Config, mustUseVendor
}) })
} }
func processLlndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
lib := m.linker.(*llndkStubDecorator)
m.VendorProperties.IsLLNDK = true
if Bool(lib.Properties.Private) {
m.VendorProperties.IsVNDKPrivate = true
}
}
func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) { func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
if m.InProduct() { if m.InProduct() {
// We may skip the steps for the product variants because they // We may skip the steps for the product variants because they
@ -402,41 +393,14 @@ func VndkMutator(mctx android.BottomUpMutatorContext) {
return return
} }
if _, ok := m.linker.(*llndkStubDecorator); ok {
processLlndkLibrary(mctx, m)
return
}
// This is a temporary measure to copy the properties from an llndk_library into the cc_library
// that will actually build the stubs. It will be removed once the properties are moved into
// the cc_library in the Android.bp files.
mergeLLNDKToLib := func(llndk *Module, llndkProperties *llndkLibraryProperties, flagExporter *flagExporter) {
if llndkLib := moduleLibraryInterface(llndk); llndkLib != nil {
*llndkProperties = llndkLib.(*llndkStubDecorator).Properties
flagExporter.Properties = llndkLib.(*llndkStubDecorator).flagExporter.Properties
m.VendorProperties.IsLLNDK = llndk.VendorProperties.IsLLNDK
m.VendorProperties.IsVNDKPrivate = llndk.VendorProperties.IsVNDKPrivate
}
}
lib, isLib := m.linker.(*libraryDecorator) lib, isLib := m.linker.(*libraryDecorator)
prebuiltLib, isPrebuiltLib := m.linker.(*prebuiltLibraryLinker) prebuiltLib, isPrebuiltLib := m.linker.(*prebuiltLibraryLinker)
if m.UseVndk() && isLib && lib.hasVestigialLLNDKLibrary() { if m.UseVndk() && isLib && lib.hasLLNDKStubs() {
llndk := mctx.AddVariationDependencies(nil, llndkStubDepTag, String(lib.Properties.Llndk_stubs))
mergeLLNDKToLib(llndk[0].(*Module), &lib.Properties.Llndk, &lib.flagExporter)
}
if m.UseVndk() && isPrebuiltLib && prebuiltLib.hasVestigialLLNDKLibrary() {
llndk := mctx.AddVariationDependencies(nil, llndkStubDepTag, String(prebuiltLib.Properties.Llndk_stubs))
mergeLLNDKToLib(llndk[0].(*Module), &prebuiltLib.Properties.Llndk, &prebuiltLib.flagExporter)
}
if m.UseVndk() && isLib && lib.hasLLNDKStubs() && !lib.hasVestigialLLNDKLibrary() {
m.VendorProperties.IsLLNDK = true m.VendorProperties.IsLLNDK = true
m.VendorProperties.IsVNDKPrivate = Bool(lib.Properties.Llndk.Private) m.VendorProperties.IsVNDKPrivate = Bool(lib.Properties.Llndk.Private)
} }
if m.UseVndk() && isPrebuiltLib && prebuiltLib.hasLLNDKStubs() && !prebuiltLib.hasVestigialLLNDKLibrary() { if m.UseVndk() && isPrebuiltLib && prebuiltLib.hasLLNDKStubs() {
m.VendorProperties.IsLLNDK = true m.VendorProperties.IsLLNDK = true
m.VendorProperties.IsVNDKPrivate = Bool(prebuiltLib.Properties.Llndk.Private) m.VendorProperties.IsVNDKPrivate = Bool(prebuiltLib.Properties.Llndk.Private)
} }
@ -874,9 +838,6 @@ func getVndkFileName(m *Module) (string, error) {
if prebuilt, ok := m.linker.(*prebuiltLibraryLinker); ok { if prebuilt, ok := m.linker.(*prebuiltLibraryLinker); ok {
return prebuilt.libraryDecorator.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil return prebuilt.libraryDecorator.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil
} }
if library, ok := m.linker.(*llndkStubDecorator); ok {
return library.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil
}
return "", fmt.Errorf("VNDK library should have libraryDecorator or prebuiltLibraryLinker as linker: %T", m.linker) return "", fmt.Errorf("VNDK library should have libraryDecorator or prebuiltLibraryLinker as linker: %T", m.linker)
} }

View File

@ -262,10 +262,6 @@ func (c *Module) IsLlndkPublic() bool {
return false return false
} }
func (m *Module) IsLlndkLibrary() bool {
return false
}
func (mod *Module) KernelHeadersDecorator() bool { func (mod *Module) KernelHeadersDecorator() bool {
return false return false
} }

View File

@ -52,12 +52,9 @@ func test(t *testing.T, bp string) *android.TestResult {
system_shared_libs: [], system_shared_libs: [],
recovery_available: true, recovery_available: true,
host_supported: true, host_supported: true,
llndk_stubs: "liblog.llndk", llndk: {
symbol_file: "liblog.map.txt",
} }
llndk_library {
name: "liblog.llndk",
symbol_file: "",
} }
java_library { java_library {