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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 if (target->output_type() == Target::COPY_FILES) { | 60 if (target->output_type() == Target::COPY_FILES) { |
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->IsBinary()) { |
71 target->output_type() == Target::LOADABLE_MODULE || | |
72 target->output_type() == Target::STATIC_LIBRARY || | |
73 target->output_type() == Target::SHARED_LIBRARY || | |
74 target->output_type() == Target::SOURCE_SET) { | |
75 NinjaBinaryTargetWriter writer(target, file); | 71 NinjaBinaryTargetWriter writer(target, file); |
76 writer.Run(); | 72 writer.Run(); |
77 } else { | 73 } else { |
78 CHECK(0) << "Output type of target not handled."; | 74 CHECK(0) << "Output type of target not handled."; |
79 } | 75 } |
80 | 76 |
81 std::string contents = file.str(); | 77 std::string contents = file.str(); |
82 base::WriteFile(ninja_file, contents.c_str(), | 78 base::WriteFile(ninja_file, contents.c_str(), |
83 static_cast<int>(contents.size())); | 79 static_cast<int>(contents.size())); |
84 } | 80 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 << GetNinjaRulePrefixForToolchain(settings_) | 267 << GetNinjaRulePrefixForToolchain(settings_) |
272 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP); | 268 << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP); |
273 path_output_.WriteFiles(out_, files); | 269 path_output_.WriteFiles(out_, files); |
274 | 270 |
275 if (!order_only_deps.empty()) { | 271 if (!order_only_deps.empty()) { |
276 out_ << " ||"; | 272 out_ << " ||"; |
277 path_output_.WriteFiles(out_, order_only_deps); | 273 path_output_.WriteFiles(out_, order_only_deps); |
278 } | 274 } |
279 out_ << std::endl; | 275 out_ << std::endl; |
280 } | 276 } |
OLD | NEW |