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

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

Issue 1672783002: Revert of [GN] Don't rewrite files with the same contents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/function_write_file.cc ('k') | tools/gn/visual_studio_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_target_writer.h" 5 #include "tools/gn/ninja_target_writer.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } else if (target->output_type() == Target::GROUP) { 67 } else if (target->output_type() == Target::GROUP) {
68 NinjaGroupTargetWriter writer(target, file); 68 NinjaGroupTargetWriter writer(target, file);
69 writer.Run(); 69 writer.Run();
70 } else if (target->IsBinary()) { 70 } else if (target->IsBinary()) {
71 NinjaBinaryTargetWriter writer(target, file); 71 NinjaBinaryTargetWriter writer(target, file);
72 writer.Run(); 72 writer.Run();
73 } else { 73 } else {
74 CHECK(0) << "Output type of target not handled."; 74 CHECK(0) << "Output type of target not handled.";
75 } 75 }
76 76
77 WriteFileIfChanged(ninja_file, file.str(), nullptr); 77 std::string contents = file.str();
78 base::WriteFile(ninja_file, contents.c_str(),
79 static_cast<int>(contents.size()));
78 } 80 }
79 81
80 void NinjaTargetWriter::WriteEscapedSubstitution(SubstitutionType type) { 82 void NinjaTargetWriter::WriteEscapedSubstitution(SubstitutionType type) {
81 EscapeOptions opts; 83 EscapeOptions opts;
82 opts.mode = ESCAPE_NINJA; 84 opts.mode = ESCAPE_NINJA;
83 85
84 out_ << kSubstitutionNinjaNames[type] << " = "; 86 out_ << kSubstitutionNinjaNames[type] << " = ";
85 EscapeStringToStream(out_, 87 EscapeStringToStream(out_,
86 SubstitutionWriter::GetTargetSubstitution(target_, type), 88 SubstitutionWriter::GetTargetSubstitution(target_, type),
87 opts); 89 opts);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 << GetNinjaRulePrefixForToolchain(settings_) 274 << GetNinjaRulePrefixForToolchain(settings_)
273 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP); 275 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP);
274 path_output_.WriteFiles(out_, files); 276 path_output_.WriteFiles(out_, files);
275 277
276 if (!order_only_deps.empty()) { 278 if (!order_only_deps.empty()) {
277 out_ << " ||"; 279 out_ << " ||";
278 path_output_.WriteFiles(out_, order_only_deps); 280 path_output_.WriteFiles(out_, order_only_deps);
279 } 281 }
280 out_ << std::endl; 282 out_ << std::endl;
281 } 283 }
OLDNEW
« no previous file with comments | « tools/gn/function_write_file.cc ('k') | tools/gn/visual_studio_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698