OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
| 5 #include "tools/gn/target.h" |
| 6 |
| 7 #include <utility> |
| 8 |
5 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
6 #include "tools/gn/build_settings.h" | 10 #include "tools/gn/build_settings.h" |
7 #include "tools/gn/config.h" | 11 #include "tools/gn/config.h" |
8 #include "tools/gn/scheduler.h" | 12 #include "tools/gn/scheduler.h" |
9 #include "tools/gn/settings.h" | 13 #include "tools/gn/settings.h" |
10 #include "tools/gn/target.h" | |
11 #include "tools/gn/test_with_scope.h" | 14 #include "tools/gn/test_with_scope.h" |
12 #include "tools/gn/toolchain.h" | 15 #include "tools/gn/toolchain.h" |
13 | 16 |
14 namespace { | 17 namespace { |
15 | 18 |
16 // Asserts that the current global scheduler has a single unknown generated | 19 // Asserts that the current global scheduler has a single unknown generated |
17 // file with the given name from the given target. | 20 // file with the given name from the given target. |
18 void AssertSchedulerHasOneUnknownFileMatching(const Target* target, | 21 void AssertSchedulerHasOneUnknownFileMatching(const Target* target, |
19 const SourceFile& file) { | 22 const SourceFile& file) { |
20 auto unknown = g_scheduler->GetUnknownGeneratedInputs(); | 23 auto unknown = g_scheduler->GetUnknownGeneratedInputs(); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 441 |
439 const char kDependPattern[] = | 442 const char kDependPattern[] = |
440 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.TOC"; | 443 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.TOC"; |
441 SubstitutionPattern depend_output = SubstitutionPattern::MakeForTest( | 444 SubstitutionPattern depend_output = SubstitutionPattern::MakeForTest( |
442 kDependPattern); | 445 kDependPattern); |
443 solink_tool->set_depend_output(depend_output); | 446 solink_tool->set_depend_output(depend_output); |
444 | 447 |
445 solink_tool->set_outputs(SubstitutionList::MakeForTest( | 448 solink_tool->set_outputs(SubstitutionList::MakeForTest( |
446 kLinkPattern, kDependPattern)); | 449 kLinkPattern, kDependPattern)); |
447 | 450 |
448 toolchain.SetTool(Toolchain::TYPE_SOLINK, solink_tool.Pass()); | 451 toolchain.SetTool(Toolchain::TYPE_SOLINK, std::move(solink_tool)); |
449 | 452 |
450 Target target(setup.settings(), Label(SourceDir("//a/"), "a")); | 453 Target target(setup.settings(), Label(SourceDir("//a/"), "a")); |
451 target.set_output_type(Target::SHARED_LIBRARY); | 454 target.set_output_type(Target::SHARED_LIBRARY); |
452 target.SetToolchain(&toolchain); | 455 target.SetToolchain(&toolchain); |
453 ASSERT_TRUE(target.OnResolved(&err)); | 456 ASSERT_TRUE(target.OnResolved(&err)); |
454 | 457 |
455 EXPECT_EQ("./liba.so", target.link_output_file().value()); | 458 EXPECT_EQ("./liba.so", target.link_output_file().value()); |
456 EXPECT_EQ("./liba.so.TOC", target.dependency_output_file().value()); | 459 EXPECT_EQ("./liba.so.TOC", target.dependency_output_file().value()); |
457 } | 460 } |
458 | 461 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 "\n" | 636 "\n" |
634 "From //foo:bar\n" | 637 "From //foo:bar\n" |
635 " header: pch.h\n" | 638 " header: pch.h\n" |
636 " source: //pcs.cc\n" | 639 " source: //pcs.cc\n" |
637 "\n" | 640 "\n" |
638 "From //foo:c2\n" | 641 "From //foo:c2\n" |
639 " header: pch2.h\n" | 642 " header: pch2.h\n" |
640 " source: //pcs2.cc", | 643 " source: //pcs2.cc", |
641 err.help_text()); | 644 err.help_text()); |
642 } | 645 } |
OLD | NEW |