From adc4ee81443dbfae8584456c04ea1ba383da3d01 Mon Sep 17 00:00:00 2001 From: Evan Martin Date: Fri, 5 Apr 2013 10:27:22 -0700 Subject: make it an error for now to have multiple outputs with depslog --- src/build.cc | 2 +- src/manifest_parser.cc | 8 ++++++++ src/manifest_parser_test.cc | 12 ++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/build.cc b/src/build.cc index 56f2d9b..0caf6e7 100644 --- a/src/build.cc +++ b/src/build.cc @@ -873,7 +873,7 @@ void Builder::FinishCommand(CommandRunner::Result* result) { } if (!deps_type.empty() && scan_.deps_log()) { - // XXX figure out multiple outputs. + assert(edge->outputs_.size() == 1); Node* out = edge->outputs_[0]; // XXX need to restat for restat_mtime. scan_.deps_log()->RecordDeps(out, restat_mtime, deps_nodes); diff --git a/src/manifest_parser.cc b/src/manifest_parser.cc index 14fca73..a581114 100644 --- a/src/manifest_parser.cc +++ b/src/manifest_parser.cc @@ -329,6 +329,14 @@ bool ManifestParser::ParseEdge(string* err) { edge->implicit_deps_ = implicit; edge->order_only_deps_ = order_only; + // Multiple outputs aren't (yet?) supported with depslog. + string deps_type = edge->GetBinding("deps"); + if (!deps_type.empty() && edge->outputs_.size() > 1) { + return lexer_.Error("multiple outputs aren't (yet?) supported by depslog; " + "bring this up on the mailing list if it affects you", + err); + } + return true; } diff --git a/src/manifest_parser_test.cc b/src/manifest_parser_test.cc index 4ac093f..76d235d 100644 --- a/src/manifest_parser_test.cc +++ b/src/manifest_parser_test.cc @@ -71,6 +71,7 @@ TEST_F(ParserTest, RuleAttributes) { "rule cat\n" " command = a\n" " depfile = a\n" +" deps = a\n" " description = a\n" " generator = a\n" " restat = a\n" @@ -599,6 +600,17 @@ TEST_F(ParserTest, MultipleOutputs) { EXPECT_EQ("", err); } +TEST_F(ParserTest, MultipleOutputsWithDeps) { + State state; + ManifestParser parser(&state, NULL); + string err; + EXPECT_FALSE(parser.ParseTest("rule cc\n command = foo\n deps = gcc\n" + "build a.o b.o: cc c.cc\n", + &err)); + EXPECT_EQ("input:5: multiple outputs aren't (yet?) supported by depslog; " + "bring this up on the mailing list if it affects you\n", err); +} + TEST_F(ParserTest, SubNinja) { files_["test.ninja"] = "var = inner\n" -- cgit v0.12