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 #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 Loading... |
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 | |
178 // ----------------------------------------------------------------------------- | 166 // ----------------------------------------------------------------------------- |
179 | 167 |
180 // These functions return the various flavors of output and gen directories. | 168 // These functions return the various flavors of output and gen directories. |
181 SourceDir GetToolchainOutputDir(const Settings* settings); | 169 SourceDir GetToolchainOutputDir(const Settings* settings); |
182 SourceDir GetToolchainOutputDir(const BuildSettings* build_settings, | 170 SourceDir GetToolchainOutputDir(const BuildSettings* build_settings, |
183 const Label& label, bool is_default); | 171 const Label& label, bool is_default); |
184 | 172 |
185 SourceDir GetToolchainGenDir(const Settings* settings); | 173 SourceDir GetToolchainGenDir(const Settings* settings); |
186 OutputFile GetToolchainGenDirAsOutputFile(const Settings* settings); | 174 OutputFile GetToolchainGenDirAsOutputFile(const Settings* settings); |
187 SourceDir GetToolchainGenDir(const BuildSettings* build_settings, | 175 SourceDir GetToolchainGenDir(const BuildSettings* build_settings, |
(...skipping 21 matching lines...) Expand all Loading... |
209 | 197 |
210 SourceDir GetTargetOutputDir(const Target* target); | 198 SourceDir GetTargetOutputDir(const Target* target); |
211 OutputFile GetTargetOutputDirAsOutputFile(const Target* target); | 199 OutputFile GetTargetOutputDirAsOutputFile(const Target* target); |
212 SourceDir GetTargetGenDir(const Target* target); | 200 SourceDir GetTargetGenDir(const Target* target); |
213 OutputFile GetTargetGenDirAsOutputFile(const Target* target); | 201 OutputFile GetTargetGenDirAsOutputFile(const Target* target); |
214 | 202 |
215 SourceDir GetCurrentOutputDir(const Scope* scope); | 203 SourceDir GetCurrentOutputDir(const Scope* scope); |
216 SourceDir GetCurrentGenDir(const Scope* scope); | 204 SourceDir GetCurrentGenDir(const Scope* scope); |
217 | 205 |
218 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ | 206 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ |
OLD | NEW |