diff options
author | 2025-02-10 15:06:43 +0900 | |
---|---|---|
committer | 2025-02-11 12:36:43 +0900 | |
commit | 0bc5384d2ad379db13ef7ccc5c3eb30c35113d87 (patch) | |
tree | a31f6d7458ce40a5882d9de31fa80d4e9cd7d354 /phony | |
parent | d5a846331c73817b78abdf8e3a7f3b5b857ee42f (diff) |
Allow phony modules to depend on outputs
Phony modules can't depend uninstallable modules like genrule modules.
This adds additional dependencies to output files so that phony modules
can directly use such modules as deps.
Bug: 386305058
Test: m selinux_policy
Change-Id: I8a36c18ecc31d7022c470d37bb681159d74c3e28
Diffstat (limited to 'phony')
-rw-r--r-- | phony/phony.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/phony/phony.go b/phony/phony.go index 807b95b32..4f61c4583 100644 --- a/phony/phony.go +++ b/phony/phony.go @@ -38,9 +38,11 @@ var PrepareForTestWithPhony = android.FixtureRegisterWithContext(registerPhonyMo type phony struct { android.ModuleBase + requiredModuleNames []string hostRequiredModuleNames []string targetRequiredModuleNames []string + outputDeps android.Paths } func PhonyFactory() android.Module { @@ -54,6 +56,14 @@ func (p *phony) GenerateAndroidBuildActions(ctx android.ModuleContext) { p.requiredModuleNames = ctx.RequiredModuleNames(ctx) p.hostRequiredModuleNames = ctx.HostRequiredModuleNames() p.targetRequiredModuleNames = ctx.TargetRequiredModuleNames() + + ctx.VisitDirectDepsWithTag(android.RequiredDepTag, func(dep android.Module) { + if o, ok := android.OtherModuleProvider(ctx, dep, android.OutputFilesProvider); ok { + p.outputDeps = append(p.outputDeps, o.DefaultOutputFiles...) + } + }) + + ctx.Phony(p.Name(), p.outputDeps...) } func (p *phony) AndroidMk() android.AndroidMkData { @@ -77,6 +87,10 @@ func (p *phony) AndroidMk() android.AndroidMkData { fmt.Fprintln(w, "LOCAL_TARGET_REQUIRED_MODULES :=", strings.Join(p.targetRequiredModuleNames, " ")) } + if len(p.outputDeps) > 0 { + fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES :=", + strings.Join(p.outputDeps.Strings(), " ")) + } // AconfigUpdateAndroidMkData may have added elements to Extra. Process them here. for _, extra := range data.Extra { extra(w, nil) |