diff options
Diffstat (limited to 'cc/llndk_library.go')
-rw-r--r-- | cc/llndk_library.go | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/cc/llndk_library.go b/cc/llndk_library.go index 8ca3ca184..b119fdac1 100644 --- a/cc/llndk_library.go +++ b/cc/llndk_library.go @@ -82,11 +82,10 @@ type movedToApexLlndkLibraries struct { func (s *movedToApexLlndkLibraries) GenerateBuildActions(ctx android.SingletonContext) { // Make uses LLNDK_MOVED_TO_APEX_LIBRARIES to generate the linker config. movedToApexLlndkLibrariesMap := make(map[string]bool) - ctx.VisitAllModules(func(module android.Module) { - if library := moduleVersionedInterface(module); library != nil && library.HasLLNDKStubs() { - if library.IsLLNDKMovedToApex() { - name := library.ImplementationModuleName(module.(*Module).BaseModuleName()) - movedToApexLlndkLibrariesMap[name] = true + ctx.VisitAllModuleProxies(func(module android.ModuleProxy) { + if library, ok := android.OtherModuleProvider(ctx, module, LinkableInfoProvider); ok { + if library.HasLLNDKStubs && library.IsLLNDKMovedToApex { + movedToApexLlndkLibrariesMap[library.ImplementationModuleName] = true } } }) @@ -151,14 +150,16 @@ func (txt *llndkLibrariesTxtModule) GenerateAndroidBuildActions(ctx android.Modu etc.SetCommonPrebuiltEtcInfo(ctx, txt) } -func getVndkFileName(m *Module) (string, error) { - if library, ok := m.linker.(*libraryDecorator); ok { - return library.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil - } - if prebuilt, ok := m.linker.(*prebuiltLibraryLinker); ok { - return prebuilt.libraryDecorator.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil +func getVndkFileName(info *LinkerInfo) (string, error) { + if info != nil { + if info.LibraryDecoratorInfo != nil { + return info.LibraryDecoratorInfo.VndkFileName, nil + } + if info.PrebuiltLibraryLinkerInfo != nil { + return info.PrebuiltLibraryLinkerInfo.VndkFileName, 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", info) } func (txt *llndkLibrariesTxtModule) GenerateSingletonBuildActions(ctx android.SingletonContext) { @@ -167,9 +168,17 @@ func (txt *llndkLibrariesTxtModule) GenerateSingletonBuildActions(ctx android.Si return } - ctx.VisitAllModules(func(m android.Module) { - if c, ok := m.(*Module); ok && c.VendorProperties.IsLLNDK && !c.Header() && !c.IsVndkPrebuiltLibrary() { - filename, err := getVndkFileName(c) + ctx.VisitAllModuleProxies(func(m android.ModuleProxy) { + ccInfo, ok := android.OtherModuleProvider(ctx, m, CcInfoProvider) + if !ok { + return + } + linkableInfo, ok := android.OtherModuleProvider(ctx, m, LinkableInfoProvider) + if !ok { + return + } + if linkableInfo.IsLlndk && !linkableInfo.Header && !linkableInfo.IsVndkPrebuiltLibrary { + filename, err := getVndkFileName(ccInfo.LinkerInfo) if err != nil { ctx.ModuleErrorf(m, "%s", err) } |