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

Unified Diff: tools/gn/target_unittest.cc

Issue 255603004: Forward dependent configs from groups properly in GN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/target.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/target_unittest.cc
diff --git a/tools/gn/target_unittest.cc b/tools/gn/target_unittest.cc
index ef213b5286fa9d1ab9a064182280e742a057ea79..860dcaf1b0d4e36550c9dae7cd17775f20a8a064 100644
--- a/tools/gn/target_unittest.cc
+++ b/tools/gn/target_unittest.cc
@@ -169,3 +169,33 @@ TEST_F(TargetTest, DependentConfigs) {
ASSERT_EQ(1u, a_fwd.all_dependent_configs().size());
EXPECT_EQ(&all, a_fwd.all_dependent_configs()[0].ptr);
}
+
+// Tests that forward_dependent_configs_from works for groups, forwarding the
+// group's deps' dependent configs.
+TEST_F(TargetTest, ForwardDependentConfigsFromGroups) {
+ Target a(&settings_, Label(SourceDir("//foo/"), "a"));
+ a.set_output_type(Target::EXECUTABLE);
+ Target b(&settings_, Label(SourceDir("//foo/"), "b"));
+ b.set_output_type(Target::GROUP);
+ Target c(&settings_, Label(SourceDir("//foo/"), "c"));
+ c.set_output_type(Target::STATIC_LIBRARY);
+ a.deps().push_back(LabelTargetPair(&b));
+ b.deps().push_back(LabelTargetPair(&c));
+
+ // Direct dependent config on C.
+ Config direct(&settings_, Label(SourceDir("//foo/"), "direct"));
+ c.direct_dependent_configs().push_back(LabelConfigPair(&direct));
+
+ // A forwards the dependent configs from B.
+ a.forward_dependent_configs().push_back(LabelTargetPair(&b));
+
+ c.OnResolved();
+ b.OnResolved();
+ a.OnResolved();
+
+ // The config should now be on A, and in A's direct dependent configs.
+ ASSERT_EQ(1u, a.configs().size());
+ ASSERT_EQ(&direct, a.configs()[0].ptr);
+ ASSERT_EQ(1u, a.direct_dependent_configs().size());
+ ASSERT_EQ(&direct, a.direct_dependent_configs()[0].ptr);
+}
« no previous file with comments | « tools/gn/target.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698