Convert getLibsForLinkerConfig to use ModuleProxy.
Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: Ib8020db0d1cf9e035ace52e2a893bb3df7975127
diff --git a/cc/cc.go b/cc/cc.go
index f9097e4..af1b259 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -78,7 +78,8 @@
// list of modules that should be dynamically linked into this module.
SharedLibs proptools.Configurable[[]string]
// list of modules that should only provide headers for this module.
- HeaderLibs proptools.Configurable[[]string]
+ HeaderLibs proptools.Configurable[[]string]
+ ImplementationModuleName *string
BinaryDecoratorInfo *BinaryDecoratorInfo
LibraryDecoratorInfo *LibraryDecoratorInfo
@@ -115,6 +116,7 @@
type CcInfo struct {
IsPrebuilt bool
CmakeSnapshotSupported bool
+ HasLlndkStubs bool
CompilerInfo *CompilerInfo
LinkerInfo *LinkerInfo
SnapshotInfo *SnapshotInfo
@@ -2237,6 +2239,7 @@
ccInfo := CcInfo{
IsPrebuilt: c.IsPrebuilt(),
CmakeSnapshotSupported: proptools.Bool(c.Properties.Cmake_snapshot_supported),
+ HasLlndkStubs: c.HasLlndkStubs(),
}
if c.compiler != nil {
ccInfo.CompilerInfo = &CompilerInfo{
@@ -2287,6 +2290,10 @@
SnapshotAndroidMkSuffix: s.SnapshotAndroidMkSuffix(),
}
}
+ if v, ok := c.linker.(versionedInterface); ok {
+ name := v.implementationModuleName(ctx.OtherModuleName(c))
+ ccInfo.LinkerInfo.ImplementationModuleName = &name
+ }
}
if c.library != nil {
ccInfo.LibraryInfo = &LibraryInfo{
diff --git a/cc/stub_library.go b/cc/stub_library.go
index 5911be0..75d649f 100644
--- a/cc/stub_library.go
+++ b/cc/stub_library.go
@@ -38,8 +38,8 @@
}
// Check if the module defines stub, or itself is stub
-func IsStubTarget(m *Module) bool {
- return m.IsStubs() || m.HasStubsVariants()
+func IsStubTarget(info *LinkableInfo) bool {
+ return info != nil && (info.IsStubs || info.HasStubsVariants)
}
// Get target file name to be installed from this module
@@ -59,7 +59,7 @@
vendorStubLibraryMap := make(map[string]bool)
ctx.VisitAllModules(func(module android.Module) {
if m, ok := module.(*Module); ok {
- if IsStubTarget(m) {
+ if IsStubTarget(android.OtherModuleProviderOrDefault(ctx, m, LinkableInfoProvider)) {
if name := getInstalledFileName(ctx, m); name != "" {
stubLibraryMap[name] = true
if m.InVendor() {