diff options
author | 2025-01-17 22:52:43 +0000 | |
---|---|---|
committer | 2025-01-21 10:13:32 -0800 | |
commit | e98f706c29d7f54c36371ca1b5a3636876dfbf20 (patch) | |
tree | 815cad23176787cf622c6ad52d951f28ae1f6cde /python/binary.go | |
parent | 61445a99174d0ac61d1f5c44e1697f19eb091b35 (diff) |
Convert python modules to use ModuleProxy.
Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: Ide5bdf2bc1bf41efaf694a66769df907888e51cb
Diffstat (limited to 'python/binary.go')
-rw-r--r-- | python/binary.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/python/binary.go b/python/binary.go index 5f60761be..a3acb347d 100644 --- a/python/binary.go +++ b/python/binary.go @@ -22,8 +22,14 @@ import ( "strings" "android/soong/android" + "android/soong/cc" + "github.com/google/blueprint" ) +type PythonBinaryInfo struct{} + +var PythonBinaryInfoProvider = blueprint.NewProvider[PythonBinaryInfo]() + func init() { registerPythonBinaryComponents(android.InitRegistrationContext) } @@ -103,6 +109,9 @@ func (p *PythonBinaryModule) GenerateAndroidBuildActions(ctx android.ModuleConte p.buildBinary(ctx) p.installedDest = ctx.InstallFile(installDir(ctx, "bin", "", ""), p.installSource.Base(), p.installSource) + + android.SetProvider(ctx, PythonBinaryInfoProvider, PythonBinaryInfo{}) + ctx.SetOutputFiles(android.Paths{p.installSource}, "") } @@ -116,13 +125,13 @@ func (p *PythonBinaryModule) buildBinary(ctx android.ModuleContext) { var launcherPath android.OptionalPath if embeddedLauncher { - ctx.VisitDirectDepsWithTag(launcherTag, func(m android.Module) { - if provider, ok := m.(IntermPathProvider); ok { + ctx.VisitDirectDepsProxyWithTag(launcherTag, func(m android.ModuleProxy) { + if provider, ok := android.OtherModuleProvider(ctx, m, cc.LinkableInfoProvider); ok { if launcherPath.Valid() { panic(fmt.Errorf("launcher path was found before: %q", launcherPath)) } - launcherPath = provider.IntermPathForModuleOut() + launcherPath = provider.OutputFile } }) } @@ -140,7 +149,7 @@ func (p *PythonBinaryModule) buildBinary(ctx android.ModuleContext) { var sharedLibs []string // if embedded launcher is enabled, we need to collect the shared library dependencies of the // launcher - for _, dep := range ctx.GetDirectDepsWithTag(launcherSharedLibTag) { + for _, dep := range ctx.GetDirectDepsProxyWithTag(launcherSharedLibTag) { sharedLibs = append(sharedLibs, ctx.OtherModuleName(dep)) } p.androidMkSharedLibs = sharedLibs |