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/functions.h" | 5 #include "tools/gn/functions.h" |
6 | 6 |
7 #include "tools/gn/config_values_generator.h" | 7 #include "tools/gn/config_values_generator.h" |
8 #include "tools/gn/err.h" | 8 #include "tools/gn/err.h" |
9 #include "tools/gn/parse_tree.h" | 9 #include "tools/gn/parse_tree.h" |
10 #include "tools/gn/scope.h" | 10 #include "tools/gn/scope.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 return Value(); | 34 return Value(); |
35 Scope block_scope(scope); | 35 Scope block_scope(scope); |
36 if (!FillTargetBlockScope(scope, function, target_type, block, | 36 if (!FillTargetBlockScope(scope, function, target_type, block, |
37 args, &block_scope, err)) | 37 args, &block_scope, err)) |
38 return Value(); | 38 return Value(); |
39 | 39 |
40 block->ExecuteBlockInScope(&block_scope, err); | 40 block->ExecuteBlockInScope(&block_scope, err); |
41 if (err->has_error()) | 41 if (err->has_error()) |
42 return Value(); | 42 return Value(); |
43 | 43 |
44 TargetGenerator::GenerateTarget(&block_scope, function->function(), args, | 44 TargetGenerator::GenerateTarget(&block_scope, function, args, |
45 target_type, err); | 45 target_type, err); |
46 if (err->has_error()) | 46 if (err->has_error()) |
47 return Value(); | 47 return Value(); |
48 | 48 |
49 block_scope.CheckForUnusedVars(err); | 49 block_scope.CheckForUnusedVars(err); |
50 return Value(); | 50 return Value(); |
51 } | 51 } |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 return Value(); | 102 return Value(); |
103 Scope block_scope(scope); | 103 Scope block_scope(scope); |
104 if (!FillTargetBlockScope(scope, function, component_mode.c_str(), block, | 104 if (!FillTargetBlockScope(scope, function, component_mode.c_str(), block, |
105 args, &block_scope, err)) | 105 args, &block_scope, err)) |
106 return Value(); | 106 return Value(); |
107 | 107 |
108 block->ExecuteBlockInScope(&block_scope, err); | 108 block->ExecuteBlockInScope(&block_scope, err); |
109 if (err->has_error()) | 109 if (err->has_error()) |
110 return Value(); | 110 return Value(); |
111 | 111 |
112 TargetGenerator::GenerateTarget(&block_scope, function->function(), args, | 112 TargetGenerator::GenerateTarget(&block_scope, function, args, |
113 component_mode, err); | 113 component_mode, err); |
114 return Value(); | 114 return Value(); |
115 } | 115 } |
116 | 116 |
117 // copy ------------------------------------------------------------------------ | 117 // copy ------------------------------------------------------------------------ |
118 | 118 |
119 const char kCopy[] = "copy"; | 119 const char kCopy[] = "copy"; |
120 const char kCopy_Help[] = | 120 const char kCopy_Help[] = |
121 "copy: Declare a target that copies files.\n" | 121 "copy: Declare a target that copies files.\n" |
122 "\n" | 122 "\n" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 " outputs = [ \"$target_gen_dir/{{source_file_part}}\" ]\n" | 156 " outputs = [ \"$target_gen_dir/{{source_file_part}}\" ]\n" |
157 " }\n"; | 157 " }\n"; |
158 | 158 |
159 Value RunCopy(const FunctionCallNode* function, | 159 Value RunCopy(const FunctionCallNode* function, |
160 const std::vector<Value>& args, | 160 const std::vector<Value>& args, |
161 Scope* scope, | 161 Scope* scope, |
162 Err* err) { | 162 Err* err) { |
163 if (!EnsureNotProcessingImport(function, scope, err) || | 163 if (!EnsureNotProcessingImport(function, scope, err) || |
164 !EnsureNotProcessingBuildConfig(function, scope, err)) | 164 !EnsureNotProcessingBuildConfig(function, scope, err)) |
165 return Value(); | 165 return Value(); |
166 TargetGenerator::GenerateTarget(scope, function->function(), args, | 166 TargetGenerator::GenerateTarget(scope, function, args, functions::kCopy, err); |
167 functions::kCopy, err); | |
168 return Value(); | 167 return Value(); |
169 } | 168 } |
170 | 169 |
171 // custom ---------------------------------------------------------------------- | 170 // custom ---------------------------------------------------------------------- |
172 | 171 |
173 const char kCustom[] = "custom"; | 172 const char kCustom[] = "custom"; |
174 const char kCustom_Help[] = | 173 const char kCustom_Help[] = |
175 "custom: Declare a script-generated target.\n" | 174 "custom: Declare a script-generated target.\n" |
176 "\n" | 175 "\n" |
177 " This target type allows you to run a script over a set of source\n" | 176 " This target type allows you to run a script over a set of source\n" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 Value RunTest(Scope* scope, | 429 Value RunTest(Scope* scope, |
431 const FunctionCallNode* function, | 430 const FunctionCallNode* function, |
432 const std::vector<Value>& args, | 431 const std::vector<Value>& args, |
433 BlockNode* block, | 432 BlockNode* block, |
434 Err* err) { | 433 Err* err) { |
435 return ExecuteGenericTarget(functions::kExecutable, scope, function, args, | 434 return ExecuteGenericTarget(functions::kExecutable, scope, function, args, |
436 block, err); | 435 block, err); |
437 } | 436 } |
438 | 437 |
439 } // namespace functions | 438 } // namespace functions |
OLD | NEW |