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
This commit is contained in:
Colin Cross
2019-02-11 14:11:09 -08:00
parent bd907cb12b
commit deabb94380
5 changed files with 41 additions and 13 deletions

View File

@@ -84,6 +84,19 @@ func ExampleRuleBuilder_DeleteTemporaryFiles() {
// 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()