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

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

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/function_write_file.cc ('k') | tools/gn/gyp_target_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 <fstream> 5 #include <fstream>
6 #include <iostream> 6 #include <iostream>
7 7
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 int spread, 75 int spread,
76 int max_depth, 76 int max_depth,
77 int targets_per_level, 77 int targets_per_level,
78 int files_per_target) { 78 int files_per_target) {
79 base::FilePath dirname = RepoPathToPathName(repo_path); 79 base::FilePath dirname = RepoPathToPathName(repo_path);
80 base::FilePath filename = dirname.AppendASCII("BUILD.gn"); 80 base::FilePath filename = dirname.AppendASCII("BUILD.gn");
81 std::cout << "Writing " << FilePathToUTF8(filename) << "\n"; 81 std::cout << "Writing " << FilePathToUTF8(filename) << "\n";
82 82
83 // Don't keep the file open while recursing. 83 // Don't keep the file open while recursing.
84 { 84 {
85 file_util::CreateDirectory(dirname); 85 base::CreateDirectory(dirname);
86 86
87 std::ofstream file; 87 std::ofstream file;
88 file.open(FilePathToUTF8(filename).c_str(), 88 file.open(FilePathToUTF8(filename).c_str(),
89 std::ios_base::out | std::ios_base::binary); 89 std::ios_base::out | std::ios_base::binary);
90 files_written++; 90 files_written++;
91 91
92 for (int i = 0; i < targets_per_level; i++) { 92 for (int i = 0; i < targets_per_level; i++) {
93 targets_written++; 93 targets_written++;
94 file << "executable(\"" << RepoPathToTargetName(repo_path, i) 94 file << "executable(\"" << RepoPathToTargetName(repo_path, i)
95 << "\") {\n"; 95 << "\") {\n";
(...skipping 24 matching lines...) Expand all
120 } 120 }
121 } 121 }
122 122
123 int main() { 123 int main() {
124 WriteLevel(std::vector<int>(), 5, 4, 3, 50); // 781 files, 2343 targets 124 WriteLevel(std::vector<int>(), 5, 4, 3, 50); // 781 files, 2343 targets
125 //WriteLevel(std::vector<int>(), 6, 4, 2, 50); 125 //WriteLevel(std::vector<int>(), 6, 4, 2, 50);
126 std::cout << "Wrote " << files_written << " files and " 126 std::cout << "Wrote " << files_written << " files and "
127 << targets_written << " targets.\n"; 127 << targets_written << " targets.\n";
128 return 0; 128 return 0;
129 } 129 }
OLDNEW
« no previous file with comments | « tools/gn/function_write_file.cc ('k') | tools/gn/gyp_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698