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

Side by Side Diff: tools/gn/filesystem_utils.h

Issue 1704383002: [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 | « no previous file | tools/gn/filesystem_utils.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 #ifndef TOOLS_GN_FILESYSTEM_UTILS_H_ 5 #ifndef TOOLS_GN_FILESYSTEM_UTILS_H_
6 #define TOOLS_GN_FILESYSTEM_UTILS_H_ 6 #define TOOLS_GN_FILESYSTEM_UTILS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Like SourceDirForPath but returns the SourceDir representing the current 156 // Like SourceDirForPath but returns the SourceDir representing the current
157 // directory. 157 // directory.
158 SourceDir SourceDirForCurrentDirectory(const base::FilePath& source_root); 158 SourceDir SourceDirForCurrentDirectory(const base::FilePath& source_root);
159 159
160 // Given the label of a toolchain and whether that toolchain is the default 160 // Given the label of a toolchain and whether that toolchain is the default
161 // toolchain, returns the name of the subdirectory for that toolchain's 161 // toolchain, returns the name of the subdirectory for that toolchain's
162 // output. This will be the empty string to indicate that the toolchain outputs 162 // output. This will be the empty string to indicate that the toolchain outputs
163 // go in the root build directory. Otherwise, the result will end in a slash. 163 // go in the root build directory. Otherwise, the result will end in a slash.
164 std::string GetOutputSubdirName(const Label& toolchain_label, bool is_default); 164 std::string GetOutputSubdirName(const Label& toolchain_label, bool is_default);
165 165
166 // Returns true if the contents of the file and stream given are equal, false
167 // otherwise.
168 bool ContentsEqual(const base::FilePath& file_path, const std::string& data);
169
170 // Writes given stream contents to the given file if it differs from existing
171 // file contents. Returns true if new contents was successfully written or
172 // existing file contents doesn't need updating, false on write error. |err| is
173 // set on write error if not nullptr.
174 bool WriteFileIfChanged(const base::FilePath& file_path,
175 const std::string& data,
176 Err* err);
177
166 // ----------------------------------------------------------------------------- 178 // -----------------------------------------------------------------------------
167 179
168 // These functions return the various flavors of output and gen directories. 180 // These functions return the various flavors of output and gen directories.
169 SourceDir GetToolchainOutputDir(const Settings* settings); 181 SourceDir GetToolchainOutputDir(const Settings* settings);
170 SourceDir GetToolchainOutputDir(const BuildSettings* build_settings, 182 SourceDir GetToolchainOutputDir(const BuildSettings* build_settings,
171 const Label& label, bool is_default); 183 const Label& label, bool is_default);
172 184
173 SourceDir GetToolchainGenDir(const Settings* settings); 185 SourceDir GetToolchainGenDir(const Settings* settings);
174 OutputFile GetToolchainGenDirAsOutputFile(const Settings* settings); 186 OutputFile GetToolchainGenDirAsOutputFile(const Settings* settings);
175 SourceDir GetToolchainGenDir(const BuildSettings* build_settings, 187 SourceDir GetToolchainGenDir(const BuildSettings* build_settings,
(...skipping 21 matching lines...) Expand all
197 209
198 SourceDir GetTargetOutputDir(const Target* target); 210 SourceDir GetTargetOutputDir(const Target* target);
199 OutputFile GetTargetOutputDirAsOutputFile(const Target* target); 211 OutputFile GetTargetOutputDirAsOutputFile(const Target* target);
200 SourceDir GetTargetGenDir(const Target* target); 212 SourceDir GetTargetGenDir(const Target* target);
201 OutputFile GetTargetGenDirAsOutputFile(const Target* target); 213 OutputFile GetTargetGenDirAsOutputFile(const Target* target);
202 214
203 SourceDir GetCurrentOutputDir(const Scope* scope); 215 SourceDir GetCurrentOutputDir(const Scope* scope);
204 SourceDir GetCurrentGenDir(const Scope* scope); 216 SourceDir GetCurrentGenDir(const Scope* scope);
205 217
206 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ 218 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | tools/gn/filesystem_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698