Move phony_rule module rule generation from make to Soong
So that the module behaves as expected in Soong-only build.
Test: m tradefed-core
Bug: 400043313
Change-Id: I6cfbcc3fb4aeb2edfc526aa345a54619239e1a81
diff --git a/phony/phony.go b/phony/phony.go
index 4f61c45..e75f4c8 100644
--- a/phony/phony.go
+++ b/phony/phony.go
@@ -104,8 +104,7 @@
android.ModuleBase
android.DefaultableModuleBase
- phonyDepsModuleNames []string
- properties PhonyProperties
+ properties PhonyProperties
}
type PhonyProperties struct {
@@ -126,18 +125,8 @@
}
func (p *PhonyRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- p.phonyDepsModuleNames = p.properties.Phony_deps.GetOrDefault(ctx, nil)
-}
-
-func (p *PhonyRule) AndroidMk() android.AndroidMkData {
- return android.AndroidMkData{
- Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
- if len(p.phonyDepsModuleNames) > 0 {
- depModulesStr := strings.Join(p.phonyDepsModuleNames, " ")
- fmt.Fprintln(w, ".PHONY:", name)
- fmt.Fprintln(w, name, ":", depModulesStr)
- }
- },
+ for _, dep := range p.properties.Phony_deps.GetOrDefault(ctx, nil) {
+ ctx.Phony(ctx.ModuleName(), android.PathForPhony(ctx, dep))
}
}