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

Side by Side Diff: trunk/src/tools/gn/ninja_toolchain_writer.cc

Issue 46313006: Revert 232657 "GN: toolchain threading cleanup" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/ninja_toolchain_writer.h" 5 #include "tools/gn/ninja_toolchain_writer.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/strings/stringize_macros.h" 10 #include "base/strings/stringize_macros.h"
11 #include "tools/gn/build_settings.h" 11 #include "tools/gn/build_settings.h"
12 #include "tools/gn/item_node.h" 12 #include "tools/gn/item_node.h"
13 #include "tools/gn/settings.h" 13 #include "tools/gn/settings.h"
14 #include "tools/gn/target.h" 14 #include "tools/gn/target.h"
15 #include "tools/gn/toolchain.h" 15 #include "tools/gn/toolchain.h"
16 #include "tools/gn/toolchain_manager.h"
17 #include "tools/gn/trace.h" 16 #include "tools/gn/trace.h"
18 17
19 NinjaToolchainWriter::NinjaToolchainWriter( 18 NinjaToolchainWriter::NinjaToolchainWriter(
20 const Settings* settings, 19 const Settings* settings,
21 const std::vector<const Target*>& targets, 20 const std::vector<const Target*>& targets,
22 const std::set<std::string>& skip_files, 21 const std::set<std::string>& skip_files,
23 std::ostream& out) 22 std::ostream& out)
24 : settings_(settings), 23 : settings_(settings),
25 targets_(targets), 24 targets_(targets),
26 skip_files_(skip_files), 25 skip_files_(skip_files),
(...skipping 29 matching lines...) Expand all
56 std::ios_base::out | std::ios_base::binary); 55 std::ios_base::out | std::ios_base::binary);
57 if (file.fail()) 56 if (file.fail())
58 return false; 57 return false;
59 58
60 NinjaToolchainWriter gen(settings, targets, skip_files, file); 59 NinjaToolchainWriter gen(settings, targets, skip_files, file);
61 gen.Run(); 60 gen.Run();
62 return true; 61 return true;
63 } 62 }
64 63
65 void NinjaToolchainWriter::WriteRules() { 64 void NinjaToolchainWriter::WriteRules() {
66 const Toolchain* tc = settings_->build_settings()->toolchain_manager() 65 const Toolchain* tc = settings_->toolchain();
67 .GetToolchainDefinitionUnlocked(settings_->toolchain_label());
68 CHECK(tc);
69
70 std::string indent(" "); 66 std::string indent(" ");
71 67
72 NinjaHelper helper(settings_->build_settings()); 68 NinjaHelper helper(settings_->build_settings());
73 std::string rule_prefix = helper.GetRulePrefix(settings_); 69 std::string rule_prefix = helper.GetRulePrefix(tc);
74 70
75 for (int i = Toolchain::TYPE_NONE + 1; i < Toolchain::TYPE_NUMTYPES; i++) { 71 for (int i = Toolchain::TYPE_NONE + 1; i < Toolchain::TYPE_NUMTYPES; i++) {
76 Toolchain::ToolType tool_type = static_cast<Toolchain::ToolType>(i); 72 Toolchain::ToolType tool_type = static_cast<Toolchain::ToolType>(i);
77 const Toolchain::Tool& tool = tc->GetTool(tool_type); 73 const Toolchain::Tool& tool = tc->GetTool(tool_type);
78 if (tool.command.empty()) 74 if (tool.command.empty())
79 continue; 75 continue;
80 76
81 out_ << "rule " << rule_prefix << Toolchain::ToolTypeToName(tool_type) 77 out_ << "rule " << rule_prefix << Toolchain::ToolTypeToName(tool_type)
82 << std::endl; 78 << std::endl;
83 79
(...skipping 24 matching lines...) Expand all
108 OutputFile ninja_file = helper_.GetNinjaFileForTarget(targets_[i]); 104 OutputFile ninja_file = helper_.GetNinjaFileForTarget(targets_[i]);
109 if (skip_files_.find(ninja_file.value()) != skip_files_.end()) 105 if (skip_files_.find(ninja_file.value()) != skip_files_.end())
110 continue; 106 continue;
111 107
112 out_ << "subninja "; 108 out_ << "subninja ";
113 path_output_.WriteFile(out_, ninja_file); 109 path_output_.WriteFile(out_, ninja_file);
114 out_ << std::endl; 110 out_ << std::endl;
115 } 111 }
116 out_ << std::endl; 112 out_ << std::endl;
117 } 113 }
OLDNEW
« no previous file with comments | « trunk/src/tools/gn/ninja_target_writer.cc ('k') | trunk/src/tools/gn/scope_per_file_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698