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

Unified Diff: tools/gn/ninja_binary_target_writer_unittest.cc

Issue 2940873002: Implement tracking of BUILD.gn files used to define target, toolchain or (Closed)
Patch Set: Fix compilation after rebase. Created 3 years, 6 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_action_target_writer_unittest.cc ('k') | tools/gn/ninja_build_writer_unittest.cc » ('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 6ac814606f51dadc7c86dbe55b1a6dca96baae47..8f185d747e3e5b8865f0f4742e0a2c91f0c0efd2 100644
--- a/tools/gn/ninja_binary_target_writer_unittest.cc
+++ b/tools/gn/ninja_binary_target_writer_unittest.cc
@@ -16,7 +16,7 @@ TEST(NinjaBinaryTargetWriter, SourceSet) {
Err err;
TestWithScope setup;
- Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"));
+ Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"), {});
target.set_output_type(Target::SOURCE_SET);
target.visibility().SetPublic();
target.sources().push_back(SourceFile("//foo/input1.cc"));
@@ -53,7 +53,8 @@ TEST(NinjaBinaryTargetWriter, SourceSet) {
}
// A shared library that depends on the source set.
- Target shlib_target(setup.settings(), Label(SourceDir("//foo/"), "shlib"));
+ Target shlib_target(setup.settings(), Label(SourceDir("//foo/"), "shlib"),
+ {});
shlib_target.set_output_type(Target::SHARED_LIBRARY);
shlib_target.public_deps().push_back(LabelTargetPair(&target));
shlib_target.SetToolchain(setup.toolchain());
@@ -87,7 +88,8 @@ TEST(NinjaBinaryTargetWriter, SourceSet) {
}
// A static library that depends on the source set (should not link it).
- Target stlib_target(setup.settings(), Label(SourceDir("//foo/"), "stlib"));
+ Target stlib_target(setup.settings(), Label(SourceDir("//foo/"), "stlib"),
+ {});
stlib_target.set_output_type(Target::STATIC_LIBRARY);
stlib_target.public_deps().push_back(LabelTargetPair(&target));
stlib_target.SetToolchain(setup.toolchain());
@@ -259,14 +261,14 @@ TEST(NinjaBinaryTargetWriter, OutputExtensionAndInputDeps) {
TestWithScope setup;
// An action for our library to depend on.
- Target action(setup.settings(), Label(SourceDir("//foo/"), "action"));
+ Target action(setup.settings(), Label(SourceDir("//foo/"), "action"), {});
action.set_output_type(Target::ACTION_FOREACH);
action.visibility().SetPublic();
action.SetToolchain(setup.toolchain());
ASSERT_TRUE(action.OnResolved(&err));
// A shared library w/ the output_extension set to a custom value.
- Target target(setup.settings(), Label(SourceDir("//foo/"), "shlib"));
+ Target target(setup.settings(), Label(SourceDir("//foo/"), "shlib"), {});
target.set_output_type(Target::SHARED_LIBRARY);
target.set_output_extension(std::string("so.6"));
target.set_output_dir(SourceDir("//out/Debug/foo/"));
@@ -314,7 +316,7 @@ TEST(NinjaBinaryTargetWriter, LibsAndLibDirs) {
TestWithScope setup;
// A shared library w/ libs and lib_dirs.
- Target target(setup.settings(), Label(SourceDir("//foo/"), "shlib"));
+ Target target(setup.settings(), Label(SourceDir("//foo/"), "shlib"), {});
target.set_output_type(Target::SHARED_LIBRARY);
target.config_values().libs().push_back(LibFile(SourceFile("//foo/lib1.a")));
target.config_values().libs().push_back(LibFile("foo"));
@@ -351,7 +353,7 @@ TEST(NinjaBinaryTargetWriter, EmptyOutputExtension) {
// This test is the same as OutputExtensionAndInputDeps, except that we call
// set_output_extension("") and ensure that we get an empty one and override
// the output prefix so that the name matches the target exactly.
- Target target(setup.settings(), Label(SourceDir("//foo/"), "shlib"));
+ Target target(setup.settings(), Label(SourceDir("//foo/"), "shlib"), {});
target.set_output_type(Target::SHARED_LIBRARY);
target.set_output_prefix_override(true);
target.set_output_extension(std::string());
@@ -393,14 +395,14 @@ TEST(NinjaBinaryTargetWriter, SourceSetDataDeps) {
TestWithScope setup;
// This target is a data (runtime) dependency of the intermediate target.
- Target data(setup.settings(), Label(SourceDir("//foo/"), "data_target"));
+ Target data(setup.settings(), Label(SourceDir("//foo/"), "data_target"), {});
data.set_output_type(Target::EXECUTABLE);
data.visibility().SetPublic();
data.SetToolchain(setup.toolchain());
ASSERT_TRUE(data.OnResolved(&err));
// Intermediate source set target.
- Target inter(setup.settings(), Label(SourceDir("//foo/"), "inter"));
+ Target inter(setup.settings(), Label(SourceDir("//foo/"), "inter"), {});
inter.set_output_type(Target::SOURCE_SET);
inter.visibility().SetPublic();
inter.data_deps().push_back(LabelTargetPair(&data));
@@ -432,7 +434,7 @@ TEST(NinjaBinaryTargetWriter, SourceSetDataDeps) {
EXPECT_EQ(inter_expected, inter_out.str());
// Final target.
- Target exe(setup.settings(), Label(SourceDir("//foo/"), "exe"));
+ Target exe(setup.settings(), Label(SourceDir("//foo/"), "exe"), {});
exe.set_output_type(Target::EXECUTABLE);
exe.public_deps().push_back(LabelTargetPair(&inter));
exe.SetToolchain(setup.toolchain());
@@ -472,7 +474,7 @@ TEST(NinjaBinaryTargetWriter, SharedLibraryModuleDefinitionFile) {
Err err;
TestWithScope setup;
- Target shared_lib(setup.settings(), Label(SourceDir("//foo/"), "bar"));
+ 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"));
@@ -506,7 +508,8 @@ TEST(NinjaBinaryTargetWriter, LoadableModule) {
Err err;
TestWithScope setup;
- Target loadable_module(setup.settings(), Label(SourceDir("//foo/"), "bar"));
+ Target loadable_module(setup.settings(), Label(SourceDir("//foo/"), "bar"),
+ {});
loadable_module.set_output_type(Target::LOADABLE_MODULE);
loadable_module.visibility().SetPublic();
loadable_module.SetToolchain(setup.toolchain());
@@ -536,7 +539,7 @@ TEST(NinjaBinaryTargetWriter, LoadableModule) {
EXPECT_EQ(loadable_expected, out.str());
// Final target.
- Target exe(setup.settings(), Label(SourceDir("//foo/"), "exe"));
+ Target exe(setup.settings(), Label(SourceDir("//foo/"), "exe"), {});
exe.set_output_type(Target::EXECUTABLE);
exe.public_deps().push_back(LabelTargetPair(&loadable_module));
exe.SetToolchain(setup.toolchain());
@@ -577,7 +580,7 @@ TEST(NinjaBinaryTargetWriter, WinPrecompiledHeaders) {
// A precompiled header toolchain.
Settings pch_settings(setup.build_settings(), "withpch/");
Toolchain pch_toolchain(&pch_settings,
- Label(SourceDir("//toolchain/"), "withpch"));
+ Label(SourceDir("//toolchain/"), "withpch"), {});
pch_settings.set_toolchain_label(pch_toolchain.label());
pch_settings.set_default_toolchain_label(setup.toolchain()->label());
@@ -607,7 +610,7 @@ TEST(NinjaBinaryTargetWriter, WinPrecompiledHeaders) {
// This target doesn't specify precompiled headers.
{
Target no_pch_target(&pch_settings,
- Label(SourceDir("//foo/"), "no_pch_target"));
+ Label(SourceDir("//foo/"), "no_pch_target"), {});
no_pch_target.set_output_type(Target::SOURCE_SET);
no_pch_target.visibility().SetPublic();
no_pch_target.sources().push_back(SourceFile("//foo/input1.cc"));
@@ -641,8 +644,8 @@ TEST(NinjaBinaryTargetWriter, WinPrecompiledHeaders) {
// This target specifies PCH.
{
- Target pch_target(&pch_settings,
- Label(SourceDir("//foo/"), "pch_target"));
+ Target pch_target(&pch_settings, Label(SourceDir("//foo/"), "pch_target"),
+ {});
pch_target.config_values().set_precompiled_header("build/precompile.h");
pch_target.config_values().set_precompiled_source(
SourceFile("//build/precompile.cc"));
@@ -705,7 +708,7 @@ TEST(NinjaBinaryTargetWriter, GCCPrecompiledHeaders) {
// A precompiled header toolchain.
Settings pch_settings(setup.build_settings(), "withpch/");
Toolchain pch_toolchain(&pch_settings,
- Label(SourceDir("//toolchain/"), "withpch"));
+ Label(SourceDir("//toolchain/"), "withpch"), {});
pch_settings.set_toolchain_label(pch_toolchain.label());
pch_settings.set_default_toolchain_label(setup.toolchain()->label());
@@ -736,7 +739,7 @@ TEST(NinjaBinaryTargetWriter, GCCPrecompiledHeaders) {
// This target doesn't specify precompiled headers.
{
Target no_pch_target(&pch_settings,
- Label(SourceDir("//foo/"), "no_pch_target"));
+ Label(SourceDir("//foo/"), "no_pch_target"), {});
no_pch_target.set_output_type(Target::SOURCE_SET);
no_pch_target.visibility().SetPublic();
no_pch_target.sources().push_back(SourceFile("//foo/input1.cc"));
@@ -770,8 +773,8 @@ TEST(NinjaBinaryTargetWriter, GCCPrecompiledHeaders) {
// This target specifies PCH.
{
- Target pch_target(&pch_settings,
- Label(SourceDir("//foo/"), "pch_target"));
+ Target pch_target(&pch_settings, Label(SourceDir("//foo/"), "pch_target"),
+ {});
pch_target.config_values().set_precompiled_source(
SourceFile("//build/precompile.h"));
pch_target.config_values().cflags_c().push_back("-std=c99");
@@ -848,7 +851,7 @@ TEST(NinjaBinaryTargetWriter, InputFiles) {
// This target has one input.
{
- Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"));
+ Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"), {});
target.set_output_type(Target::SOURCE_SET);
target.visibility().SetPublic();
target.sources().push_back(SourceFile("//foo/input1.cc"));
@@ -883,7 +886,7 @@ TEST(NinjaBinaryTargetWriter, InputFiles) {
// This target has multiple inputs.
{
- Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"));
+ Target target(setup.settings(), Label(SourceDir("//foo/"), "bar"), {});
target.set_output_type(Target::SOURCE_SET);
target.visibility().SetPublic();
target.sources().push_back(SourceFile("//foo/input1.cc"));
« no previous file with comments | « tools/gn/ninja_action_target_writer_unittest.cc ('k') | tools/gn/ninja_build_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698