Add RuleBuilder.Installs().String()
Add a RuleBuilderInstalls type for a slice of RuleBuilderInstalls,
and give it a String() method that returns the list of installs
in the format that is convenient for passing to Make.
Test: rule_builder_test.go
Change-Id: I2e9cd9abf4dfb0ad312d0a6662f1567baf9cd222
diff --git a/android/rule_builder_test.go b/android/rule_builder_test.go
index 53a5b48..f947348 100644
--- a/android/rule_builder_test.go
+++ b/android/rule_builder_test.go
@@ -84,6 +84,19 @@
// outputs: ["c"]
}
+func ExampleRuleBuilder_Installs() {
+ rule := NewRuleBuilder()
+
+ rule.Command().Tool("ld").Inputs([]string{"a.o", "b.o"}).FlagWithOutput("-o ", "linked")
+ rule.Install("linked", "/bin/linked")
+ rule.Install("linked", "/sbin/linked")
+
+ fmt.Printf("rule.Installs().String() = %q\n", rule.Installs().String())
+
+ // Output:
+ // rule.Installs().String() = "linked:/bin/linked linked:/sbin/linked"
+}
+
func ExampleRuleBuilderCommand() {
rule := NewRuleBuilder()