diff options
author | 2025-02-25 12:55:33 -0800 | |
---|---|---|
committer | 2025-02-25 12:55:33 -0800 | |
commit | d272a622e908736b01bf731dc653aadc47c64971 (patch) | |
tree | 35ddbe0592ca3f0a703c2d39b8747729590e809d /cc | |
parent | 89dab88cc55d9ab0ff85d0a30780ad182cdaf214 (diff) | |
parent | 2a815b6d8ea8f29b54f780b1219c28b0c8c977aa (diff) |
Merge "Convert the following singletons to use ModuleProxy:" into main
Diffstat (limited to 'cc')
-rw-r--r-- | cc/cc.go | 21 | ||||
-rw-r--r-- | cc/ndk_abi.go | 22 |
2 files changed, 31 insertions, 12 deletions
@@ -104,7 +104,11 @@ type TestBinaryInfo struct { } type BenchmarkDecoratorInfo struct{} -type StubDecoratorInfo struct{} +type StubDecoratorInfo struct { + AbiDumpPath android.OutputPath + HasAbiDump bool + AbiDiffPaths android.Paths +} type ObjectLinkerInfo struct{} @@ -112,6 +116,10 @@ type LibraryInfo struct { BuildStubs bool } +type InstallerInfo struct { + StubDecoratorInfo *StubDecoratorInfo +} + // Common info about the cc module. type CcInfo struct { IsPrebuilt bool @@ -122,6 +130,7 @@ type CcInfo struct { LinkerInfo *LinkerInfo SnapshotInfo *SnapshotInfo LibraryInfo *LibraryInfo + InstallerInfo *InstallerInfo } var CcInfoProvider = blueprint.NewProvider[*CcInfo]() @@ -2366,6 +2375,16 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { BuildStubs: c.library.BuildStubs(), } } + if c.installer != nil { + ccInfo.InstallerInfo = &InstallerInfo{} + if installer, ok := c.installer.(*stubDecorator); ok { + ccInfo.InstallerInfo.StubDecoratorInfo = &StubDecoratorInfo{ + HasAbiDump: installer.hasAbiDump, + AbiDumpPath: installer.abiDumpPath, + AbiDiffPaths: installer.abiDiffPaths, + } + } + } android.SetProvider(ctx, CcInfoProvider, &ccInfo) c.setOutputFiles(ctx) diff --git a/cc/ndk_abi.go b/cc/ndk_abi.go index 2706261a8..a9f26a40e 100644 --- a/cc/ndk_abi.go +++ b/cc/ndk_abi.go @@ -39,15 +39,15 @@ type ndkAbiDumpSingleton struct{} func (n *ndkAbiDumpSingleton) GenerateBuildActions(ctx android.SingletonContext) { var depPaths android.Paths - ctx.VisitAllModules(func(module android.Module) { - if !module.Enabled(ctx) { + ctx.VisitAllModuleProxies(func(module android.ModuleProxy) { + if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoKey).Enabled { return } - if m, ok := module.(*Module); ok { - if installer, ok := m.installer.(*stubDecorator); ok { - if installer.hasAbiDump { - depPaths = append(depPaths, installer.abiDumpPath) + if ccInfo, ok := android.OtherModuleProvider(ctx, module, CcInfoProvider); ok { + if ccInfo.InstallerInfo != nil && ccInfo.InstallerInfo.StubDecoratorInfo != nil { + if ccInfo.InstallerInfo.StubDecoratorInfo.HasAbiDump { + depPaths = append(depPaths, ccInfo.InstallerInfo.StubDecoratorInfo.AbiDumpPath) } } } @@ -77,14 +77,14 @@ type ndkAbiDiffSingleton struct{} func (n *ndkAbiDiffSingleton) GenerateBuildActions(ctx android.SingletonContext) { var depPaths android.Paths - ctx.VisitAllModules(func(module android.Module) { - if m, ok := module.(android.Module); ok && !m.Enabled(ctx) { + ctx.VisitAllModuleProxies(func(module android.ModuleProxy) { + if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoKey).Enabled { return } - if m, ok := module.(*Module); ok { - if installer, ok := m.installer.(*stubDecorator); ok { - depPaths = append(depPaths, installer.abiDiffPaths...) + if ccInfo, ok := android.OtherModuleProvider(ctx, module, CcInfoProvider); ok { + if ccInfo.InstallerInfo != nil && ccInfo.InstallerInfo.StubDecoratorInfo != nil { + depPaths = append(depPaths, ccInfo.InstallerInfo.StubDecoratorInfo.AbiDiffPaths...) } } }) |