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/target_generator.h" | 5 #include "tools/gn/target_generator.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <utility> |
| 10 |
9 #include "tools/gn/action_target_generator.h" | 11 #include "tools/gn/action_target_generator.h" |
10 #include "tools/gn/binary_target_generator.h" | 12 #include "tools/gn/binary_target_generator.h" |
11 #include "tools/gn/build_settings.h" | 13 #include "tools/gn/build_settings.h" |
12 #include "tools/gn/bundle_data_target_generator.h" | 14 #include "tools/gn/bundle_data_target_generator.h" |
13 #include "tools/gn/config.h" | 15 #include "tools/gn/config.h" |
14 #include "tools/gn/copy_target_generator.h" | 16 #include "tools/gn/copy_target_generator.h" |
15 #include "tools/gn/create_bundle_target_generator.h" | 17 #include "tools/gn/create_bundle_target_generator.h" |
16 #include "tools/gn/err.h" | 18 #include "tools/gn/err.h" |
17 #include "tools/gn/filesystem_utils.h" | 19 #include "tools/gn/filesystem_utils.h" |
18 #include "tools/gn/functions.h" | 20 #include "tools/gn/functions.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 144 |
143 if (err->has_error()) | 145 if (err->has_error()) |
144 return; | 146 return; |
145 | 147 |
146 // Save this target for the file. | 148 // Save this target for the file. |
147 Scope::ItemVector* collector = scope->GetItemCollector(); | 149 Scope::ItemVector* collector = scope->GetItemCollector(); |
148 if (!collector) { | 150 if (!collector) { |
149 *err = Err(function_call, "Can't define a target in this context."); | 151 *err = Err(function_call, "Can't define a target in this context."); |
150 return; | 152 return; |
151 } | 153 } |
152 collector->push_back(target.release()); | 154 collector->push_back(std::move(target)); |
153 } | 155 } |
154 | 156 |
155 const BuildSettings* TargetGenerator::GetBuildSettings() const { | 157 const BuildSettings* TargetGenerator::GetBuildSettings() const { |
156 return scope_->settings()->build_settings(); | 158 return scope_->settings()->build_settings(); |
157 } | 159 } |
158 | 160 |
159 bool TargetGenerator::FillSources() { | 161 bool TargetGenerator::FillSources() { |
160 const Value* value = scope_->GetValue(variables::kSources, true); | 162 const Value* value = scope_->GetValue(variables::kSources, true); |
161 if (!value) | 163 if (!value) |
162 return true; | 164 return true; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 if (err_->has_error()) | 402 if (err_->has_error()) |
401 return false; | 403 return false; |
402 if (!EnsureStringIsInOutputDir(GetBuildSettings()->build_dir(), | 404 if (!EnsureStringIsInOutputDir(GetBuildSettings()->build_dir(), |
403 source_file.value(), value->origin(), err_)) | 405 source_file.value(), value->origin(), err_)) |
404 return false; | 406 return false; |
405 OutputFile output_file(GetBuildSettings(), source_file); | 407 OutputFile output_file(GetBuildSettings(), source_file); |
406 target_->set_write_runtime_deps_output(output_file); | 408 target_->set_write_runtime_deps_output(output_file); |
407 | 409 |
408 return true; | 410 return true; |
409 } | 411 } |
OLD | NEW |