| 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/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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 if (g_scheduler->verbose_logging()) | 50 if (g_scheduler->verbose_logging()) |
| 51 g_scheduler->Log("Writing", FilePathToUTF8(ninja_file)); | 51 g_scheduler->Log("Writing", FilePathToUTF8(ninja_file)); |
| 52 | 52 |
| 53 base::CreateDirectory(ninja_file.DirName()); | 53 base::CreateDirectory(ninja_file.DirName()); |
| 54 | 54 |
| 55 // It's ridiculously faster to write to a string and then write that to | 55 // It's ridiculously faster to write to a string and then write that to |
| 56 // disk in one operation than to use an fstream here. | 56 // disk in one operation than to use an fstream here. |
| 57 std::stringstream file; | 57 std::stringstream file; |
| 58 | 58 |
| 59 // Call out to the correct sub-type of writer. | 59 // Call out to the correct sub-type of writer. |
| 60 if (target->output_type() == Target::COPY_FILES) { | 60 if (target->output_type() == Target::COPY_FILES || |
| 61 NinjaCopyTargetWriter writer(target, file); | 61 target->output_type() == Target::COPY_BUNDLE_DATA) { |
| 62 Toolchain::ToolType tool_type = |
| 63 target->output_type() == Target::COPY_FILES |
| 64 ? Toolchain::TYPE_COPY |
| 65 : Toolchain::TYPE_COPY_BUNDLE_DATA; |
| 66 NinjaCopyTargetWriter writer(target, file, tool_type); |
| 62 writer.Run(); | 67 writer.Run(); |
| 63 } else if (target->output_type() == Target::ACTION || | 68 } else if (target->output_type() == Target::ACTION || |
| 64 target->output_type() == Target::ACTION_FOREACH) { | 69 target->output_type() == Target::ACTION_FOREACH) { |
| 65 NinjaActionTargetWriter writer(target, file); | 70 NinjaActionTargetWriter writer(target, file); |
| 66 writer.Run(); | 71 writer.Run(); |
| 67 } else if (target->output_type() == Target::GROUP) { | 72 } else if (target->output_type() == Target::GROUP) { |
| 68 NinjaGroupTargetWriter writer(target, file); | 73 NinjaGroupTargetWriter writer(target, file); |
| 69 writer.Run(); | 74 writer.Run(); |
| 70 } else if (target->output_type() == Target::EXECUTABLE || | 75 } else if (target->output_type() == Target::EXECUTABLE || |
| 71 target->output_type() == Target::LOADABLE_MODULE || | 76 target->output_type() == Target::LOADABLE_MODULE || |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 << GetNinjaRulePrefixForToolchain(settings_) | 276 << GetNinjaRulePrefixForToolchain(settings_) |
| 272 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP); | 277 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP); |
| 273 path_output_.WriteFiles(out_, files); | 278 path_output_.WriteFiles(out_, files); |
| 274 | 279 |
| 275 if (!order_only_deps.empty()) { | 280 if (!order_only_deps.empty()) { |
| 276 out_ << " ||"; | 281 out_ << " ||"; |
| 277 path_output_.WriteFiles(out_, order_only_deps); | 282 path_output_.WriteFiles(out_, order_only_deps); |
| 278 } | 283 } |
| 279 out_ << std::endl; | 284 out_ << std::endl; |
| 280 } | 285 } |
| OLD | NEW |