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

Unified Diff: tools/gn/target_unittest.cc

Issue 565283002: GN: Add notion of 'complete' static libraries, akin to GYP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually process new argument. Duh. 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.h » ('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 25e3aabc4578cf4278958d5ebffedf673132ebfb..895d11d147836b2102c9eb62a850c5d71cc327de 100644
--- a/tools/gn/target_unittest.cc
+++ b/tools/gn/target_unittest.cc
@@ -274,6 +274,41 @@ TEST(Target, InheritLibs) {
EXPECT_TRUE(a_inherited.IndexOf(&b) != static_cast<size_t>(-1));
}
+TEST(Target, InheritCompleteStaticLib) {
+ TestWithScope setup;
+ Err err;
+
+ // Create a dependency chain:
+ // A (executable) -> B (complete static lib) -> C (source set)
+ Target a(setup.settings(), Label(SourceDir("//foo/"), "a"));
+ a.set_output_type(Target::EXECUTABLE);
+ a.SetToolchain(setup.toolchain());
+ Target b(setup.settings(), Label(SourceDir("//foo/"), "b"));
+ b.set_output_type(Target::STATIC_LIBRARY);
+ b.set_complete_static_lib(true);
+ b.SetToolchain(setup.toolchain());
+ Target c(setup.settings(), Label(SourceDir("//foo/"), "c"));
+ c.set_output_type(Target::SOURCE_SET);
+ c.SetToolchain(setup.toolchain());
+ a.deps().push_back(LabelTargetPair(&b));
+ b.deps().push_back(LabelTargetPair(&c));
+
+ ASSERT_TRUE(c.OnResolved(&err));
+ ASSERT_TRUE(b.OnResolved(&err));
+ ASSERT_TRUE(a.OnResolved(&err));
+
+ // B should have C in its inherited libs.
+ const UniqueVector<const Target*>& b_inherited = b.inherited_libraries();
+ EXPECT_EQ(1u, b_inherited.size());
+ EXPECT_TRUE(b_inherited.IndexOf(&c) != static_cast<size_t>(-1));
+
+ // A should have B in its inherited libs, but not any others (the complete
+ // static library will include the source set).
+ const UniqueVector<const Target*>& a_inherited = a.inherited_libraries();
+ EXPECT_EQ(1u, a_inherited.size());
+ EXPECT_TRUE(a_inherited.IndexOf(&b) != static_cast<size_t>(-1));
+}
+
TEST(Target, GetComputedOutputName) {
TestWithScope setup;
Err err;
« no previous file with comments | « tools/gn/target.cc ('k') | tools/gn/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698