parsers.cpp: allow depfile used at build command with multiple outputs.
graph.cpp: allow depfile used at build command with multiple outputs.
parsers_test.cpp: make the test pass.
As before, the depfile itself can only mention one target, which must
be the first of a build command with multiple outpus.
[There is really no need to mention all the output in the depfile,
because all targets should depend on exactly the same files anyway,
because these targets are built by a single build command.]
}
// Check that this depfile matches our output.
- if (outputs_.size() != 1) {
- *err = "expected only one output";
- return false;
- }
if (outputs_[0]->file_->path_ != makefile.out_) {
*err = "expected makefile to mention '" + outputs_[0]->file_->path_ + "', "
"got '" + makefile.out_ + "'";
if (!rule)
return tokenizer_.Error("unknown build rule '" + rule_name + "'", err);
- if (!rule->depfile_.empty()) {
- if (outs.size() > 1) {
- return tokenizer_.Error("dependency files only work with single-output "
- "rules", err);
- }
- }
-
for (;;) {
string in;
if (!tokenizer_.ReadIdent(&in))
State state;
ManifestParser parser(&state, NULL);
string err;
- EXPECT_FALSE(parser.Parse("rule cc\n command = foo\n depfile = bar\n"
+ EXPECT_TRUE(parser.Parse("rule cc\n command = foo\n depfile = bar\n"
"build a.o b.o: cc c.cc\n",
&err));
- EXPECT_EQ("line 4, col 16: dependency files only work with "
- "single-output rules", err);
+ EXPECT_EQ("", err);
}
{