aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-03-29 15:32:51 -0700
committerColin Cross <ccross@android.com>2019-03-29 16:35:06 -0700
commit92b7d584c80f2efa8fe38338d7372f2d14db4b48 (patch)
treec85db3bf51c84cfe941cbf0246dd2285a44b0bc7 /android
parent65c95ff1fb3e50927f49e0e95c1f980af850f034 (diff)
downloadbuild_soong-92b7d584c80f2efa8fe38338d7372f2d14db4b48.tar.gz
build_soong-92b7d584c80f2efa8fe38338d7372f2d14db4b48.tar.bz2
build_soong-92b7d584c80f2efa8fe38338d7372f2d14db4b48.zip
Add RuleBuilderCommand.Flags
Test: rule_builder_test.go Change-Id: I7887a67aaef33bc591d83fade9175da3e401529f
Diffstat (limited to 'android')
-rw-r--r--android/rule_builder.go9
-rw-r--r--android/rule_builder_test.go8
2 files changed, 17 insertions, 0 deletions
diff --git a/android/rule_builder.go b/android/rule_builder.go
index a2a53665..ee61b949 100644
--- a/android/rule_builder.go
+++ b/android/rule_builder.go
@@ -284,6 +284,15 @@ func (c *RuleBuilderCommand) Flag(flag string) *RuleBuilderCommand {
return c.Text(flag)
}
+// Flags adds the specified raw text to the command line. The text should not contain input or output paths or the
+// rule will not have them listed in its dependencies or outputs.
+func (c *RuleBuilderCommand) Flags(flags []string) *RuleBuilderCommand {
+ for _, flag := range flags {
+ c.Text(flag)
+ }
+ return c
+}
+
// FlagWithArg adds the specified flag and argument text to the command line, with no separator between them. The flag
// and argument should not contain input or output paths or the rule will not have them listed in its dependencies or
// outputs.
diff --git a/android/rule_builder_test.go b/android/rule_builder_test.go
index 01d23e52..10127680 100644
--- a/android/rule_builder_test.go
+++ b/android/rule_builder_test.go
@@ -171,6 +171,14 @@ func ExampleRuleBuilderCommand_Flag() {
// ls -l
}
+func ExampleRuleBuilderCommand_Flags() {
+ ctx := pathContext()
+ fmt.Println(NewRuleBuilder().Command().
+ Tool(PathForSource(ctx, "ls")).Flags([]string{"-l", "-a"}))
+ // Output:
+ // ls -l -a
+}
+
func ExampleRuleBuilderCommand_FlagWithArg() {
ctx := pathContext()
fmt.Println(NewRuleBuilder().Command().