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

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

Issue 508763002: Hook up link pools in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: default to 0 Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « tools/gn/ninja_build_writer.cc ('k') | tools/gn/ninja_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // GCC-style deps require a depfile. 98 // GCC-style deps require a depfile.
99 if (!tool->depfile().empty()) { 99 if (!tool->depfile().empty()) {
100 WriteRulePattern("depfile", tool->depfile(), options); 100 WriteRulePattern("depfile", tool->depfile(), options);
101 out_ << kIndent << "deps = gcc" << std::endl; 101 out_ << kIndent << "deps = gcc" << std::endl;
102 } 102 }
103 } else if (tool->depsformat() == Tool::DEPS_MSVC) { 103 } else if (tool->depsformat() == Tool::DEPS_MSVC) {
104 // MSVC deps don't have a depfile. 104 // MSVC deps don't have a depfile.
105 out_ << kIndent << "deps = msvc" << std::endl; 105 out_ << kIndent << "deps = msvc" << std::endl;
106 } 106 }
107 107
108 if (!tool->pool().empty()) 108 // The link pool applies to linker tools. Don't count TYPE_ALINK since
109 out_ << kIndent << "pool = " << tool->pool() << std::endl; 109 // static libraries are not generally intensive to write.
110 if (type == Toolchain::TYPE_SOLINK || type == Toolchain::TYPE_LINK)
111 out_ << kIndent << "pool = link_pool\n";
112
110 if (tool->restat()) 113 if (tool->restat())
111 out_ << kIndent << "restat = 1" << std::endl; 114 out_ << kIndent << "restat = 1" << std::endl;
112 } 115 }
113 116
114 void NinjaToolchainWriter::WriteRulePattern(const char* name, 117 void NinjaToolchainWriter::WriteRulePattern(const char* name,
115 const SubstitutionPattern& pattern, 118 const SubstitutionPattern& pattern,
116 const EscapeOptions& options) { 119 const EscapeOptions& options) {
117 if (pattern.empty()) 120 if (pattern.empty())
118 return; 121 return;
119 out_ << kIndent << name << " = "; 122 out_ << kIndent << name << " = ";
120 SubstitutionWriter::WriteWithNinjaVariables(pattern, options, out_); 123 SubstitutionWriter::WriteWithNinjaVariables(pattern, options, out_);
121 out_ << std::endl; 124 out_ << std::endl;
122 } 125 }
123 126
124 void NinjaToolchainWriter::WriteSubninjas() { 127 void NinjaToolchainWriter::WriteSubninjas() {
125 // Write subninja commands for each generated target. 128 // Write subninja commands for each generated target.
126 for (size_t i = 0; i < targets_.size(); i++) { 129 for (size_t i = 0; i < targets_.size(); i++) {
127 OutputFile ninja_file(targets_[i]->settings()->build_settings(), 130 OutputFile ninja_file(targets_[i]->settings()->build_settings(),
128 GetNinjaFileForTarget(targets_[i])); 131 GetNinjaFileForTarget(targets_[i]));
129 out_ << "subninja "; 132 out_ << "subninja ";
130 path_output_.WriteFile(out_, ninja_file); 133 path_output_.WriteFile(out_, ninja_file);
131 out_ << std::endl; 134 out_ << std::endl;
132 } 135 }
133 out_ << std::endl; 136 out_ << std::endl;
134 } 137 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_build_writer.cc ('k') | tools/gn/ninja_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698