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

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

Issue 1386783003: [GN]: Support for loadable modules (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/stringize_macros.h" 10 #include "base/strings/stringize_macros.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 WriteRulePattern("depfile", tool->depfile(), options); 102 WriteRulePattern("depfile", tool->depfile(), options);
103 out_ << kIndent << "deps = gcc" << std::endl; 103 out_ << kIndent << "deps = gcc" << std::endl;
104 } 104 }
105 } else if (tool->depsformat() == Tool::DEPS_MSVC) { 105 } else if (tool->depsformat() == Tool::DEPS_MSVC) {
106 // MSVC deps don't have a depfile. 106 // MSVC deps don't have a depfile.
107 out_ << kIndent << "deps = msvc" << std::endl; 107 out_ << kIndent << "deps = msvc" << std::endl;
108 } 108 }
109 109
110 // The link pool applies to linker tools. Don't count TYPE_ALINK since 110 // The link pool applies to linker tools. Don't count TYPE_ALINK since
111 // static libraries are not generally intensive to write. 111 // static libraries are not generally intensive to write.
112 if (type == Toolchain::TYPE_SOLINK || type == Toolchain::TYPE_LINK) 112 if (type == Toolchain::TYPE_SOLINK ||
113 type == Toolchain::TYPE_SOLINK_MODULE ||
114 type == Toolchain::TYPE_LINK) {
113 out_ << kIndent << "pool = link_pool\n"; 115 out_ << kIndent << "pool = link_pool\n";
116 }
114 117
115 if (tool->restat()) 118 if (tool->restat())
116 out_ << kIndent << "restat = 1" << std::endl; 119 out_ << kIndent << "restat = 1" << std::endl;
117 } 120 }
118 121
119 void NinjaToolchainWriter::WriteRulePattern(const char* name, 122 void NinjaToolchainWriter::WriteRulePattern(const char* name,
120 const SubstitutionPattern& pattern, 123 const SubstitutionPattern& pattern,
121 const EscapeOptions& options) { 124 const EscapeOptions& options) {
122 if (pattern.empty()) 125 if (pattern.empty())
123 return; 126 return;
124 out_ << kIndent << name << " = "; 127 out_ << kIndent << name << " = ";
125 SubstitutionWriter::WriteWithNinjaVariables(pattern, options, out_); 128 SubstitutionWriter::WriteWithNinjaVariables(pattern, options, out_);
126 out_ << std::endl; 129 out_ << std::endl;
127 } 130 }
128 131
129 void NinjaToolchainWriter::WriteSubninjas() { 132 void NinjaToolchainWriter::WriteSubninjas() {
130 // Write subninja commands for each generated target. 133 // Write subninja commands for each generated target.
131 for (const auto& target : targets_) { 134 for (const auto& target : targets_) {
132 OutputFile ninja_file(target->settings()->build_settings(), 135 OutputFile ninja_file(target->settings()->build_settings(),
133 GetNinjaFileForTarget(target)); 136 GetNinjaFileForTarget(target));
134 out_ << "subninja "; 137 out_ << "subninja ";
135 path_output_.WriteFile(out_, ninja_file); 138 path_output_.WriteFile(out_, ninja_file);
136 out_ << std::endl; 139 out_ << std::endl;
137 } 140 }
138 out_ << std::endl; 141 out_ << std::endl;
139 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698