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 "tools/gn/action_target_generator.h" | 9 #include "tools/gn/action_target_generator.h" |
10 #include "tools/gn/binary_target_generator.h" | 10 #include "tools/gn/binary_target_generator.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 if (!FillTestonly()) | 52 if (!FillTestonly()) |
53 return; | 53 return; |
54 | 54 |
55 if (!FillAssertNoDeps()) | 55 if (!FillAssertNoDeps()) |
56 return; | 56 return; |
57 | 57 |
58 if (!Visibility::FillItemVisibility(target_, scope_, err_)) | 58 if (!Visibility::FillItemVisibility(target_, scope_, err_)) |
59 return; | 59 return; |
60 | 60 |
| 61 if (!FillWriteRuntimeDeps()) |
| 62 return; |
| 63 |
61 // Do type-specific generation. | 64 // Do type-specific generation. |
62 DoRun(); | 65 DoRun(); |
63 } | 66 } |
64 | 67 |
65 // static | 68 // static |
66 void TargetGenerator::GenerateTarget(Scope* scope, | 69 void TargetGenerator::GenerateTarget(Scope* scope, |
67 const FunctionCallNode* function_call, | 70 const FunctionCallNode* function_call, |
68 const std::vector<Value>& args, | 71 const std::vector<Value>& args, |
69 const std::string& output_type, | 72 const std::string& output_type, |
70 Err* err) { | 73 Err* err) { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 379 |
377 bool TargetGenerator::FillGenericDeps(const char* var_name, | 380 bool TargetGenerator::FillGenericDeps(const char* var_name, |
378 LabelTargetVector* dest) { | 381 LabelTargetVector* dest) { |
379 const Value* value = scope_->GetValue(var_name, true); | 382 const Value* value = scope_->GetValue(var_name, true); |
380 if (value) { | 383 if (value) { |
381 ExtractListOfLabels(*value, scope_->GetSourceDir(), | 384 ExtractListOfLabels(*value, scope_->GetSourceDir(), |
382 ToolchainLabelForScope(scope_), dest, err_); | 385 ToolchainLabelForScope(scope_), dest, err_); |
383 } | 386 } |
384 return !err_->has_error(); | 387 return !err_->has_error(); |
385 } | 388 } |
| 389 |
| 390 bool TargetGenerator::FillWriteRuntimeDeps() { |
| 391 const Value* value = scope_->GetValue(variables::kWriteRuntimeDeps, true); |
| 392 if (!value) |
| 393 return true; |
| 394 |
| 395 // Compute the file name and make sure it's in the output dir. |
| 396 SourceFile source_file = scope_->GetSourceDir().ResolveRelativeFile( |
| 397 *value, err_, GetBuildSettings()->root_path_utf8()); |
| 398 if (err_->has_error()) |
| 399 return false; |
| 400 if (!EnsureStringIsInOutputDir(GetBuildSettings()->build_dir(), |
| 401 source_file.value(), value->origin(), err_)) |
| 402 return false; |
| 403 OutputFile output_file(GetBuildSettings(), source_file); |
| 404 target_->set_write_runtime_deps_output(output_file); |
| 405 |
| 406 g_scheduler->AddWriteRuntimeDepsTarget(target_); |
| 407 return true; |
| 408 } |
OLD | NEW |