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

Unified Diff: tools/gn/ninja_binary_target_writer_unittest.cc

Issue 1160773002: Add support for module-definition files to gn (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove conditional compilation and add tests Created 5 years, 7 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/source_file_type.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 df5f5a7168d32989bcce0b1c39bee0b511c84a9e..f4e4065f3a63381a2653bdf9b29ebea22387f2a3 100644
--- a/tools/gn/ninja_binary_target_writer_unittest.cc
+++ b/tools/gn/ninja_binary_target_writer_unittest.cc
@@ -357,3 +357,42 @@ TEST(NinjaBinaryTargetWriter, SourceSetDataDeps) {
" output_extension = \n";
EXPECT_EQ(final_expected, final_out.str());
}
+
+TEST(NinjaBinaryTargetWriter, SharedLibraryModuleDefinitionFile) {
+ TestWithScope setup;
+ setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/"));
+ setup.settings()->set_target_os(Settings::WIN);
+
+ Target shared_lib(setup.settings(), Label(SourceDir("//foo/"), "bar"));
+ shared_lib.set_output_type(Target::SHARED_LIBRARY);
+ shared_lib.SetToolchain(setup.toolchain());
+ shared_lib.sources().push_back(SourceFile("//foo/sources.cc"));
+ shared_lib.sources().push_back(SourceFile("//foo/bar.def"));
+
+ Err err;
+ ASSERT_TRUE(shared_lib.OnResolved(&err));
+
+ std::ostringstream out;
+ NinjaBinaryTargetWriter writer(&shared_lib, out);
+ writer.Run();
+
+ const char expected[] =
+ "defines =\n"
+ "include_dirs =\n"
+ "cflags =\n"
+ "cflags_c =\n"
+ "cflags_cc =\n"
+ "cflags_objc =\n"
+ "cflags_objcc =\n"
+ "root_out_dir = .\n"
+ "target_out_dir = obj/foo\n"
+ "target_output_name = libbar\n"
+ "\n"
+ "build obj/foo/libbar.sources.o: cxx ../../foo/sources.cc\n"
+ "\n"
+ "build ./libbar.so: solink obj/foo/libbar.sources.o | ../../foo/bar.def\n"
+ " ldflags = /DEF:../../foo/bar.def\n"
+ " libs =\n"
+ " output_extension = .so\n";
+ EXPECT_EQ(expected, out.str());
+}
« no previous file with comments | « tools/gn/ninja_binary_target_writer.cc ('k') | tools/gn/source_file_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698