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

Unified Diff: tools/gn/ninja_binary_target_writer_unittest.cc

Issue 505353002: Reduce input dependencies in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/ninja_binary_target_writer.cc ('k') | tools/gn/ninja_target_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_binary_target_writer_unittest.cc
diff --git a/tools/gn/ninja_binary_target_writer_unittest.cc b/tools/gn/ninja_binary_target_writer_unittest.cc
index 1d4bd0fc46cf4e724d3fc388322ba4f3a4e3f374..369e6324785c01aeeec587d1d976e66c47f53d5b 100644
--- a/tools/gn/ninja_binary_target_writer_unittest.cc
+++ b/tools/gn/ninja_binary_target_writer_unittest.cc
@@ -125,17 +125,26 @@ TEST(NinjaBinaryTargetWriter, SourceSet) {
}
}
-TEST(NinjaBinaryTargetWriter, ProductExtension) {
+// This tests that output extension overrides apply, and input dependencies
+// are applied.
+TEST(NinjaBinaryTargetWriter, ProductExtensionAndInputDeps) {
TestWithScope setup;
setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
setup.settings()->set_target_os(Settings::LINUX);
+ // An action for our library to depend on.
+ Target action(setup.settings(), Label(SourceDir("//foo/"), "action"));
+ action.set_output_type(Target::ACTION_FOREACH);
+ action.SetToolchain(setup.toolchain());
+ action.OnResolved();
+
// A shared library w/ the product_extension set to a custom value.
Target target(setup.settings(), Label(SourceDir("//foo/"), "shlib"));
target.set_output_type(Target::SHARED_LIBRARY);
target.set_output_extension(std::string("so.6"));
target.sources().push_back(SourceFile("//foo/input1.cc"));
target.sources().push_back(SourceFile("//foo/input2.cc"));
+ target.deps().push_back(LabelTargetPair(&action));
target.SetToolchain(setup.toolchain());
target.OnResolved();
@@ -155,11 +164,17 @@ TEST(NinjaBinaryTargetWriter, ProductExtension) {
"target_out_dir = obj/foo\n"
"target_output_name = libshlib\n"
"\n"
- "build obj/foo/libshlib.input1.o: cxx ../../foo/input1.cc\n"
- "build obj/foo/libshlib.input2.o: cxx ../../foo/input2.cc\n"
+ "build obj/foo/shlib.inputdeps.stamp: stamp obj/foo/action.stamp\n"
+ "build obj/foo/libshlib.input1.o: cxx ../../foo/input1.cc"
+ " || obj/foo/shlib.inputdeps.stamp\n"
+ "build obj/foo/libshlib.input2.o: cxx ../../foo/input2.cc"
+ " || obj/foo/shlib.inputdeps.stamp\n"
"\n"
"build ./libshlib.so.6: solink obj/foo/libshlib.input1.o "
- "obj/foo/libshlib.input2.o\n"
+ // The order-only dependency here is stricly unnecessary since the
+ // sources list this as an order-only dep. See discussion in the code
+ // that writes this.
+ "obj/foo/libshlib.input2.o || obj/foo/action.stamp\n"
" ldflags =\n"
" libs =\n"
" output_extension = .so.6\n";
« no previous file with comments | « tools/gn/ninja_binary_target_writer.cc ('k') | tools/gn/ninja_target_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698