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/ninja_binary_target_writer.h" | 5 #include "tools/gn/ninja_binary_target_writer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "tools/gn/config_values_extractors.h" | 10 #include "tools/gn/config_values_extractors.h" |
11 #include "tools/gn/err.h" | 11 #include "tools/gn/err.h" |
12 #include "tools/gn/escape.h" | 12 #include "tools/gn/escape.h" |
13 #include "tools/gn/string_utils.h" | 13 #include "tools/gn/string_utils.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // Returns the proper escape options for writing compiler and linker flags. | 17 // Returns the proper escape options for writing compiler and linker flags. |
18 EscapeOptions GetFlagOptions() { | 18 EscapeOptions GetFlagOptions() { |
19 EscapeOptions opts; | 19 EscapeOptions opts; |
20 opts.mode = ESCAPE_NINJA; | 20 opts.mode = ESCAPE_NINJA_SHELL; |
21 | |
22 // Some flag strings are actually multiple flags that expect to be just | |
23 // added to the command line. We assume that quoting is done by the | |
24 // buildfiles if it wants such things quoted. | |
25 opts.inhibit_quoting = true; | |
26 | |
27 return opts; | 21 return opts; |
28 } | 22 } |
29 | 23 |
30 struct DefineWriter { | 24 struct DefineWriter { |
31 DefineWriter() { | 25 DefineWriter() { |
32 options.mode = ESCAPE_SHELL; | 26 options.mode = ESCAPE_NINJA_SHELL; |
33 } | 27 } |
34 | 28 |
35 void operator()(const std::string& s, std::ostream& out) const { | 29 void operator()(const std::string& s, std::ostream& out) const { |
36 out << " -D"; | 30 out << " -D"; |
37 EscapeStringToStream(out, s, options); | 31 EscapeStringToStream(out, s, options); |
38 } | 32 } |
39 | 33 |
40 EscapeOptions options; | 34 EscapeOptions options; |
41 }; | 35 }; |
42 | 36 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 // Data files. | 329 // Data files. |
336 const std::vector<SourceFile>& data = target_->data(); | 330 const std::vector<SourceFile>& data = target_->data(); |
337 for (size_t i = 0; i < data.size(); i++) { | 331 for (size_t i = 0; i < data.size(); i++) { |
338 out_ << " "; | 332 out_ << " "; |
339 path_output_.WriteFile(out_, data[i]); | 333 path_output_.WriteFile(out_, data[i]); |
340 } | 334 } |
341 } | 335 } |
342 | 336 |
343 out_ << std::endl; | 337 out_ << std::endl; |
344 } | 338 } |
OLD | NEW |