summaryrefslogtreecommitdiff
path: root/phony
diff options
context:
space:
mode:
author Nelson Li <nelsonli@google.com> 2024-07-23 15:26:01 +0800
committer Nelson Li <nelsonli@google.com> 2024-07-23 15:26:01 +0800
commit154e05ba51c1b9ec2cbab551e8aeb4087b6ac7bb (patch)
treebb50c5a8fdb7d3b4d40546dc0f50504a401ff7a8 /phony
parent39d3883500fe2fa964a64df2e3225a7811744b5e (diff)
Enable select syntax support for `phony_deps` in phony_rule
Previously, `phony_deps` in `phony_rule` was a simple []string type, so the select syntax was not supported. This change modifies it to a Configurable[[]string] type to enable select syntax support. Bug: 354850153 Test: Add select syntax in the Andorid.bp Change-Id: Ibc5e5ee5d8fb9c19dc45d744a71b625fe94c9d88
Diffstat (limited to 'phony')
-rw-r--r--phony/phony.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/phony/phony.go b/phony/phony.go
index b421176be..5505a3a40 100644
--- a/phony/phony.go
+++ b/phony/phony.go
@@ -20,6 +20,8 @@ import (
"strings"
"android/soong/android"
+
+ "github.com/google/blueprint/proptools"
)
func init() {
@@ -88,14 +90,15 @@ type PhonyRule struct {
android.ModuleBase
android.DefaultableModuleBase
- properties PhonyProperties
+ phonyDepsModuleNames []string
+ properties PhonyProperties
}
type PhonyProperties struct {
// The Phony_deps is the set of all dependencies for this target,
// and it can function similarly to .PHONY in a makefile.
// Additionally, dependencies within it can even include genrule.
- Phony_deps []string
+ Phony_deps proptools.Configurable[[]string]
}
// The phony_rule provides functionality similar to the .PHONY in a makefile.
@@ -109,13 +112,14 @@ func PhonyRuleFactory() android.Module {
}
func (p *PhonyRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ p.phonyDepsModuleNames = p.properties.Phony_deps.GetOrDefault(p.ConfigurableEvaluator(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.properties.Phony_deps) > 0 {
- depModulesStr := strings.Join(p.properties.Phony_deps, " ")
+ if len(p.phonyDepsModuleNames) > 0 {
+ depModulesStr := strings.Join(p.phonyDepsModuleNames, " ")
fmt.Fprintln(w, ".PHONY:", name)
fmt.Fprintln(w, name, ":", depModulesStr)
}