Add RuleBuilderCommand.FlagForEachArg()
Add an analog to FlagForEachInput that takes non-path arguments.
Test: rule_builder_test.go
Change-Id: Ifdf5a16079018bfff9b06ce48b13b104a93fddd7
diff --git a/android/rule_builder.go b/android/rule_builder.go
index 38018be..468b617 100644
--- a/android/rule_builder.go
+++ b/android/rule_builder.go
@@ -294,6 +294,15 @@
return c.Text(flag + arg)
}
+// FlagForEachArg adds the specified flag joined with each argument to the command line. The result is identical to
+// calling FlagWithArg for argument.
+func (c *RuleBuilderCommand) FlagForEachArg(flag string, args []string) *RuleBuilderCommand {
+ for _, arg := range args {
+ c.FlagWithArg(flag, arg)
+ }
+ return c
+}
+
// FlagWithArg adds the specified flag and list of arguments to the command line, with the arguments joined by sep
// and no separator between the flag and arguments. The flag and arguments should not contain input or output paths or
// the rule will not have them listed in its dependencies or outputs.