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

Unified Diff: tools/gn/target_unittest.cc

Issue 582863002: GN: Complete static libs can't depend on static libs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add check for inherited static libraries as well Created 6 years, 3 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') | tools/gn/variables.cc » ('j') | 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 151cb31f5549f57bc9fe663303626d5e1fc3310b..6f1a5cfa07d82fb2b005591cae94f431ee9c6aed 100644
--- a/tools/gn/target_unittest.cc
+++ b/tools/gn/target_unittest.cc
@@ -225,6 +225,55 @@ TEST(Target, InheritCompleteStaticLib) {
EXPECT_TRUE(a_inherited.IndexOf(&b) != static_cast<size_t>(-1));
}
+TEST(Target, InheritCompleteStaticLibNoDirectStaticLibDeps) {
+ TestWithScope setup;
+ Err err;
+
+ // Create a dependency chain:
+ // A (complete static lib) -> B (static lib)
+ Target a(setup.settings(), Label(SourceDir("//foo/"), "a"));
+ a.set_output_type(Target::STATIC_LIBRARY);
+ a.visibility().SetPublic();
+ a.set_complete_static_lib(true);
+ a.SetToolchain(setup.toolchain());
+ Target b(setup.settings(), Label(SourceDir("//foo/"), "b"));
+ b.set_output_type(Target::STATIC_LIBRARY);
+ b.visibility().SetPublic();
+ b.SetToolchain(setup.toolchain());
+
+ a.public_deps().push_back(LabelTargetPair(&b));
+ ASSERT_TRUE(b.OnResolved(&err));
+ ASSERT_FALSE(a.OnResolved(&err));
+}
+
+TEST(Target, InheritCompleteStaticLibNoIheritedStaticLibDeps) {
+ TestWithScope setup;
+ Err err;
+
+ // Create a dependency chain:
+ // A (complete static lib) -> B (source set) -> C (static lib)
+ Target a(setup.settings(), Label(SourceDir("//foo/"), "a"));
+ a.set_output_type(Target::STATIC_LIBRARY);
+ a.visibility().SetPublic();
+ a.set_complete_static_lib(true);
+ a.SetToolchain(setup.toolchain());
+ Target b(setup.settings(), Label(SourceDir("//foo/"), "b"));
+ b.set_output_type(Target::SOURCE_SET);
+ b.visibility().SetPublic();
+ b.SetToolchain(setup.toolchain());
+ Target c(setup.settings(), Label(SourceDir("//foo/"), "c"));
+ c.set_output_type(Target::STATIC_LIBRARY);
+ c.visibility().SetPublic();
+ c.SetToolchain(setup.toolchain());
+
+ a.public_deps().push_back(LabelTargetPair(&b));
+ b.public_deps().push_back(LabelTargetPair(&c));
+
+ ASSERT_TRUE(c.OnResolved(&err));
+ ASSERT_TRUE(b.OnResolved(&err));
+ ASSERT_FALSE(a.OnResolved(&err));
+}
+
TEST(Target, GetComputedOutputName) {
TestWithScope setup;
Err err;
« 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