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

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

Issue 1222693002: Add ninja dependency reference to gen written files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned out extraneous changes. Created 5 years, 5 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 | « no previous file | no next file » | 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const SourceDir& cur_dir = scope->GetSourceDir(); 107 const SourceDir& cur_dir = scope->GetSourceDir();
108 SourceFile source_file = cur_dir.ResolveRelativeFile(args[0], err, 108 SourceFile source_file = cur_dir.ResolveRelativeFile(args[0], err,
109 scope->settings()->build_settings()->root_path_utf8()); 109 scope->settings()->build_settings()->root_path_utf8());
110 if (err->has_error()) 110 if (err->has_error())
111 return Value(); 111 return Value();
112 if (!EnsureStringIsInOutputDir( 112 if (!EnsureStringIsInOutputDir(
113 scope->settings()->build_settings()->build_dir(), 113 scope->settings()->build_settings()->build_dir(),
114 source_file.value(), args[0].origin(), err)) 114 source_file.value(), args[0].origin(), err))
115 return Value(); 115 return Value();
116 g_scheduler->AddWrittenFile(source_file); // Track that we wrote this file. 116 g_scheduler->AddWrittenFile(source_file); // Track that we wrote this file.
117 // Track how to recreate this file, since we write it a gen time.
brettw 2015/07/06 21:29:39 Can you put a blank line above this?
Peter Mayo 2015/07/06 22:09:00 Done.
118 // Note this is a hack since the correct output is not a dependency proper,
119 // but an addition of this file to the output of the gn rule that writes it.
brettw 2015/07/06 21:29:39 can you append something like "so if this file is
Peter Mayo 2015/07/06 22:09:00 Done.
120 g_scheduler->AddGenDependency(
121 scope->settings()->build_settings()->GetFullPath(source_file));
117 122
118 // Compute output. 123 // Compute output.
119 std::ostringstream contents; 124 std::ostringstream contents;
120 if (args[1].type() == Value::LIST) { 125 if (args[1].type() == Value::LIST) {
121 const std::vector<Value>& list = args[1].list_value(); 126 const std::vector<Value>& list = args[1].list_value();
122 for (const auto& cur : list) 127 for (const auto& cur : list)
123 contents << cur.ToString(false) << std::endl; 128 contents << cur.ToString(false) << std::endl;
124 } else { 129 } else {
125 contents << args[1].ToString(false); 130 contents << args[1].ToString(false);
126 } 131 }
(...skipping 18 matching lines...) Expand all
145 if (DoWriteFile(file_path, new_contents.c_str(), int_size) 150 if (DoWriteFile(file_path, new_contents.c_str(), int_size)
146 != int_size) { 151 != int_size) {
147 *err = Err(function->function(), "Unable to write file.", 152 *err = Err(function->function(), "Unable to write file.",
148 "I was writing \"" + FilePathToUTF8(file_path) + "\"."); 153 "I was writing \"" + FilePathToUTF8(file_path) + "\".");
149 return Value(); 154 return Value();
150 } 155 }
151 return Value(); 156 return Value();
152 } 157 }
153 158
154 } // namespace functions 159 } // namespace functions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698