Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: tools/gn/target_unittest.cc

Issue 1443663004: Don't propagate deps across actions in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/target.cc ('k') | tools/gn/variables.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/build_settings.h" 6 #include "tools/gn/build_settings.h"
7 #include "tools/gn/config.h" 7 #include "tools/gn/config.h"
8 #include "tools/gn/scheduler.h" 8 #include "tools/gn/scheduler.h"
9 #include "tools/gn/settings.h" 9 #include "tools/gn/settings.h"
10 #include "tools/gn/target.h" 10 #include "tools/gn/target.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 TestTarget c(setup, "//foo:c", Target::STATIC_LIBRARY); 227 TestTarget c(setup, "//foo:c", Target::STATIC_LIBRARY);
228 228
229 a.public_deps().push_back(LabelTargetPair(&b)); 229 a.public_deps().push_back(LabelTargetPair(&b));
230 b.public_deps().push_back(LabelTargetPair(&c)); 230 b.public_deps().push_back(LabelTargetPair(&c));
231 231
232 ASSERT_TRUE(c.OnResolved(&err)); 232 ASSERT_TRUE(c.OnResolved(&err));
233 ASSERT_TRUE(b.OnResolved(&err)); 233 ASSERT_TRUE(b.OnResolved(&err));
234 ASSERT_FALSE(a.OnResolved(&err)); 234 ASSERT_FALSE(a.OnResolved(&err));
235 } 235 }
236 236
237 TEST(Target, NoActionDepPropgation) {
238 TestWithScope setup;
239 Err err;
240
241 // Create a dependency chain:
242 // A (exe) -> B (action) -> C (source_set)
243 {
244 TestTarget a(setup, "//foo:a", Target::EXECUTABLE);
245 TestTarget b(setup, "//foo:b", Target::ACTION);
246 TestTarget c(setup, "//foo:c", Target::SOURCE_SET);
247
248 a.private_deps().push_back(LabelTargetPair(&b));
249 b.private_deps().push_back(LabelTargetPair(&c));
250
251 ASSERT_TRUE(c.OnResolved(&err));
252 ASSERT_TRUE(b.OnResolved(&err));
253 ASSERT_TRUE(a.OnResolved(&err));
254
255 // The executable should not have inherited the source set across the
256 // action.
257 std::vector<const Target*> libs = a.inherited_libraries().GetOrdered();
258 ASSERT_TRUE(libs.empty());
259 }
260 }
261
237 TEST(Target, GetComputedOutputName) { 262 TEST(Target, GetComputedOutputName) {
238 TestWithScope setup; 263 TestWithScope setup;
239 Err err; 264 Err err;
240 265
241 // Basic target with no prefix (executable type tool in the TestWithScope has 266 // Basic target with no prefix (executable type tool in the TestWithScope has
242 // no prefix) or output name. 267 // no prefix) or output name.
243 TestTarget basic(setup, "//foo:bar", Target::EXECUTABLE); 268 TestTarget basic(setup, "//foo:bar", Target::EXECUTABLE);
244 ASSERT_TRUE(basic.OnResolved(&err)); 269 ASSERT_TRUE(basic.OnResolved(&err));
245 EXPECT_EQ("bar", basic.GetComputedOutputName(false)); 270 EXPECT_EQ("bar", basic.GetComputedOutputName(false));
246 EXPECT_EQ("bar", basic.GetComputedOutputName(true)); 271 EXPECT_EQ("bar", basic.GetComputedOutputName(true));
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 "\n" 626 "\n"
602 "From //foo:bar\n" 627 "From //foo:bar\n"
603 " header: pch.h\n" 628 " header: pch.h\n"
604 " source: //pcs.cc\n" 629 " source: //pcs.cc\n"
605 "\n" 630 "\n"
606 "From //foo:c2\n" 631 "From //foo:c2\n"
607 " header: pch2.h\n" 632 " header: pch2.h\n"
608 " source: //pcs2.cc", 633 " source: //pcs2.cc",
609 err.help_text()); 634 err.help_text());
610 } 635 }
OLDNEW
« no previous file with comments | « tools/gn/target.cc ('k') | tools/gn/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698