Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 NinjaCopyTargetWriter writer(target, file); | 61 NinjaCopyTargetWriter writer(target, file); |
| 62 writer.Run(); | 62 writer.Run(); |
| 63 } else if (target->output_type() == Target::ACTION || | 63 } else if (target->output_type() == Target::ACTION || |
| 64 target->output_type() == Target::ACTION_FOREACH) { | 64 target->output_type() == Target::ACTION_FOREACH) { |
| 65 NinjaActionTargetWriter writer(target, file); | 65 NinjaActionTargetWriter writer(target, file); |
| 66 writer.Run(); | 66 writer.Run(); |
| 67 } else if (target->output_type() == Target::GROUP) { | 67 } else if (target->output_type() == Target::GROUP) { |
| 68 NinjaGroupTargetWriter writer(target, file); | 68 NinjaGroupTargetWriter writer(target, file); |
| 69 writer.Run(); | 69 writer.Run(); |
| 70 } else if (target->output_type() == Target::EXECUTABLE || | 70 } else if (target->output_type() == Target::EXECUTABLE || |
| 71 target->output_type() == Target::LOADABLE_MODULE || | |
| 71 target->output_type() == Target::STATIC_LIBRARY || | 72 target->output_type() == Target::STATIC_LIBRARY || |
| 72 target->output_type() == Target::SHARED_LIBRARY || | 73 target->output_type() == Target::SHARED_LIBRARY || |
| 73 target->output_type() == Target::SOURCE_SET) { | 74 target->output_type() == Target::SOURCE_SET) { |
| 74 NinjaBinaryTargetWriter writer(target, file); | 75 NinjaBinaryTargetWriter writer(target, file); |
| 75 writer.Run(); | 76 writer.Run(); |
| 76 } else { | 77 } else { |
| 77 CHECK(0); | 78 NOTREACHED(); |
|
brettw
2015/10/14 17:45:57
Add << "foo" and move back to check
Bons
2015/10/14 18:03:42
Done.
| |
| 78 } | 79 } |
| 79 | 80 |
| 80 std::string contents = file.str(); | 81 std::string contents = file.str(); |
| 81 base::WriteFile(ninja_file, contents.c_str(), | 82 base::WriteFile(ninja_file, contents.c_str(), |
| 82 static_cast<int>(contents.size())); | 83 static_cast<int>(contents.size())); |
| 83 } | 84 } |
| 84 | 85 |
| 85 void NinjaTargetWriter::WriteSharedVars(const SubstitutionBits& bits) { | 86 void NinjaTargetWriter::WriteSharedVars(const SubstitutionBits& bits) { |
| 86 bool written_anything = false; | 87 bool written_anything = false; |
| 87 | 88 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 << GetNinjaRulePrefixForToolchain(settings_) | 256 << GetNinjaRulePrefixForToolchain(settings_) |
| 256 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP); | 257 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP); |
| 257 path_output_.WriteFiles(out_, files); | 258 path_output_.WriteFiles(out_, files); |
| 258 | 259 |
| 259 if (!order_only_deps.empty()) { | 260 if (!order_only_deps.empty()) { |
| 260 out_ << " ||"; | 261 out_ << " ||"; |
| 261 path_output_.WriteFiles(out_, order_only_deps); | 262 path_output_.WriteFiles(out_, order_only_deps); |
| 262 } | 263 } |
| 263 out_ << std::endl; | 264 out_ << std::endl; |
| 264 } | 265 } |
| OLD | NEW |