diff options
author | 2025-02-15 00:18:33 +0000 | |
---|---|---|
committer | 2025-02-19 18:29:46 +0000 | |
commit | 367827f1d32a0e6ab2ce749cfe0c412474e7b030 (patch) | |
tree | 15c1247b2c81de9e80223433f28430e271d98bb1 /cc | |
parent | 14b8145bc8a89881a85497e27f12983361bd3bb9 (diff) |
Convert stubLibraries, soongMetricsSingleton, sdkSingleton,
complianceMetadataSingleton, freezeApiSingleton and testSuiteFiles to
use ModuleProxy.
Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: I91789633ff0d4e0ab170717caf0a6b4f63c38593
Diffstat (limited to 'cc')
-rw-r--r-- | cc/cc.go | 19 | ||||
-rw-r--r-- | cc/stub_library.go | 18 |
2 files changed, 19 insertions, 18 deletions
@@ -162,6 +162,7 @@ type LinkableInfo struct { OnlyInVendorRamdisk bool InRecovery bool OnlyInRecovery bool + InVendor bool Installable *bool // RelativeInstallPath returns the relative install path for this module. RelativeInstallPath string @@ -173,7 +174,8 @@ type LinkableInfo struct { ImplementationModuleNameForMake string IsStubsImplementationRequired bool // Symlinks returns a list of symlinks that should be created for this module. - Symlinks []string + Symlinks []string + APIListCoverageXMLPath android.ModuleOutPath } var LinkableInfoProvider = blueprint.NewProvider[*LinkableInfo]() @@ -2392,6 +2394,7 @@ func CreateCommonLinkableInfo(ctx android.ModuleContext, mod VersionedLinkableIn OnlyInVendorRamdisk: mod.OnlyInVendorRamdisk(), InRecovery: mod.InRecovery(), OnlyInRecovery: mod.OnlyInRecovery(), + InVendor: mod.InVendor(), Installable: mod.Installable(), RelativeInstallPath: mod.RelativeInstallPath(), // TODO(b/362509506): remove this once all apex_exclude uses are switched to stubs. @@ -2401,16 +2404,14 @@ func CreateCommonLinkableInfo(ctx android.ModuleContext, mod VersionedLinkableIn ImplementationModuleNameForMake: mod.ImplementationModuleNameForMake(), Symlinks: mod.Symlinks(), } - if mod.VersionedInterface() != nil { - info.IsStubsImplementationRequired = mod.VersionedInterface().IsStubsImplementationRequired() - } - return info -} -func setOutputFilesIfNotEmpty(ctx ModuleContext, files android.Paths, tag string) { - if len(files) > 0 { - ctx.SetOutputFiles(files, tag) + vi := mod.VersionedInterface() + if vi != nil { + info.IsStubsImplementationRequired = vi.IsStubsImplementationRequired() + info.APIListCoverageXMLPath = vi.GetAPIListCoverageXMLPath() } + + return info } func (c *Module) setOutputFiles(ctx ModuleContext) { diff --git a/cc/stub_library.go b/cc/stub_library.go index 9d7b5bc1a..21ef13915 100644 --- a/cc/stub_library.go +++ b/cc/stub_library.go @@ -43,9 +43,9 @@ func IsStubTarget(info *LinkableInfo) bool { } // Get target file name to be installed from this module -func getInstalledFileName(ctx android.SingletonContext, m LinkableInterface) string { +func getInstalledFileName(ctx android.SingletonContext, m android.ModuleProxy) string { for _, ps := range android.OtherModuleProviderOrDefault( - ctx, m.Module(), android.InstallFilesProvider).PackagingSpecs { + ctx, m, android.InstallFilesProvider).PackagingSpecs { if name := ps.FileName(); name != "" { return name } @@ -57,18 +57,18 @@ func (s *stubLibraries) GenerateBuildActions(ctx android.SingletonContext) { // Visit all generated soong modules and store stub library file names. stubLibraryMap := make(map[string]bool) vendorStubLibraryMap := make(map[string]bool) - ctx.VisitAllModules(func(module android.Module) { - if m, ok := module.(VersionedLinkableInterface); ok { - if IsStubTarget(android.OtherModuleProviderOrDefault(ctx, m, LinkableInfoProvider)) { - if name := getInstalledFileName(ctx, m); name != "" { + ctx.VisitAllModuleProxies(func(module android.ModuleProxy) { + if linkableInfo, ok := android.OtherModuleProvider(ctx, module, LinkableInfoProvider); ok { + if IsStubTarget(linkableInfo) { + if name := getInstalledFileName(ctx, module); name != "" { stubLibraryMap[name] = true - if m.InVendor() { + if linkableInfo.InVendor { vendorStubLibraryMap[name] = true } } } - if m.CcLibraryInterface() && android.IsModulePreferred(m) { - if p := m.VersionedInterface().GetAPIListCoverageXMLPath().String(); p != "" { + if linkableInfo.CcLibraryInterface && android.IsModulePreferredProxy(ctx, module) { + if p := linkableInfo.APIListCoverageXMLPath.String(); p != "" { s.apiListCoverageXmlPaths = append(s.apiListCoverageXmlPaths, p) } } |