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

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

Issue 1430043002: Support script response files in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment, random build fix Created 5 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
« no previous file with comments | « tools/gn/action_values.h ('k') | tools/gn/functions_target.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 <iostream> 5 #include <iostream>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 "\n" 75 "\n"
76 " write_file(filename, data)\n" 76 " write_file(filename, data)\n"
77 "\n" 77 "\n"
78 " If data is a list, the list will be written one-item-per-line with no\n" 78 " If data is a list, the list will be written one-item-per-line with no\n"
79 " quoting or brackets.\n" 79 " quoting or brackets.\n"
80 "\n" 80 "\n"
81 " If the file exists and the contents are identical to that being\n" 81 " If the file exists and the contents are identical to that being\n"
82 " written, the file will not be updated. This will prevent unnecessary\n" 82 " written, the file will not be updated. This will prevent unnecessary\n"
83 " rebuilds of targets that depend on this file.\n" 83 " rebuilds of targets that depend on this file.\n"
84 "\n" 84 "\n"
85 " One use for write_file is to write a list of inputs to an script\n"
86 " that might be too long for the command line. However, it is\n"
87 " preferrable to use response files for this purpose. See\n"
88 " \"gn help response_file_contents\".\n"
89 "\n"
85 " TODO(brettw) we probably need an optional third argument to control\n" 90 " TODO(brettw) we probably need an optional third argument to control\n"
86 " list formatting.\n" 91 " list formatting.\n"
87 "\n" 92 "\n"
88 "Arguments:\n" 93 "Arguments\n"
89 "\n" 94 "\n"
90 " filename\n" 95 " filename\n"
91 " Filename to write. This must be within the output directory.\n" 96 " Filename to write. This must be within the output directory.\n"
92 "\n" 97 "\n"
93 " data:\n" 98 " data:\n"
94 " The list or string to write.\n"; 99 " The list or string to write.\n";
95 100
96 Value RunWriteFile(Scope* scope, 101 Value RunWriteFile(Scope* scope,
97 const FunctionCallNode* function, 102 const FunctionCallNode* function,
98 const std::vector<Value>& args, 103 const std::vector<Value>& args,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (DoWriteFile(file_path, new_contents.c_str(), int_size) 158 if (DoWriteFile(file_path, new_contents.c_str(), int_size)
154 != int_size) { 159 != int_size) {
155 *err = Err(function->function(), "Unable to write file.", 160 *err = Err(function->function(), "Unable to write file.",
156 "I was writing \"" + FilePathToUTF8(file_path) + "\"."); 161 "I was writing \"" + FilePathToUTF8(file_path) + "\".");
157 return Value(); 162 return Value();
158 } 163 }
159 return Value(); 164 return Value();
160 } 165 }
161 166
162 } // namespace functions 167 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/action_values.h ('k') | tools/gn/functions_target.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698