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 #include "tools/gn/gyp_target_writer.h" | 5 #include "tools/gn/gyp_target_writer.h" |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 void GypTargetWriter::WriteFile(const SourceFile& gyp_file, | 35 void GypTargetWriter::WriteFile(const SourceFile& gyp_file, |
36 const std::vector<TargetGroup>& targets, | 36 const std::vector<TargetGroup>& targets, |
37 Err* err) { | 37 Err* err) { |
38 if (targets.empty()) | 38 if (targets.empty()) |
39 return; | 39 return; |
40 const Settings* debug_settings = | 40 const Settings* debug_settings = |
41 targets[0].debug->item()->AsTarget()->settings(); | 41 targets[0].debug->item()->AsTarget()->settings(); |
42 const BuildSettings* debug_build_settings = debug_settings->build_settings(); | 42 const BuildSettings* debug_build_settings = debug_settings->build_settings(); |
43 | 43 |
44 base::FilePath gyp_file_path = debug_build_settings->GetFullPath(gyp_file); | 44 base::FilePath gyp_file_path = debug_build_settings->GetFullPath(gyp_file); |
45 file_util::CreateDirectory(gyp_file_path.DirName()); | 45 base::CreateDirectory(gyp_file_path.DirName()); |
46 | 46 |
47 std::stringstream file; | 47 std::stringstream file; |
48 file << "# Generated by GN. Do not edit.\n\n"; | 48 file << "# Generated by GN. Do not edit.\n\n"; |
49 file << "{\n"; | 49 file << "{\n"; |
50 file << " 'skip_includes': 1,\n"; | 50 file << " 'skip_includes': 1,\n"; |
51 | 51 |
52 if (debug_settings->IsMac()) { | 52 if (debug_settings->IsMac()) { |
53 // Global settings for make/ninja. This must match common.gypi :( | 53 // Global settings for make/ninja. This must match common.gypi :( |
54 file << " 'make_global_settings': [\n"; | 54 file << " 'make_global_settings': [\n"; |
55 file << " ['CC', 'third_party/llvm-build/Release+Asserts/bin/clang'],\n"; | 55 file << " ['CC', 'third_party/llvm-build/Release+Asserts/bin/clang'],\n"; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 // static | 102 // static |
103 std::ostream& GypTargetWriter::Indent(std::ostream& out, int spaces) { | 103 std::ostream& GypTargetWriter::Indent(std::ostream& out, int spaces) { |
104 const char kSpaces[81] = | 104 const char kSpaces[81] = |
105 " " | 105 " " |
106 " "; | 106 " "; |
107 CHECK(static_cast<size_t>(spaces) <= arraysize(kSpaces) - 1); | 107 CHECK(static_cast<size_t>(spaces) <= arraysize(kSpaces) - 1); |
108 out.write(kSpaces, spaces); | 108 out.write(kSpaces, spaces); |
109 return out; | 109 return out; |
110 } | 110 } |
OLD | NEW |