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 <iostream> | 7 #include <iostream> |
8 | 8 |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 if (!Visibility::FillItemVisibility(config.get(), scope, err)) | 236 if (!Visibility::FillItemVisibility(config.get(), scope, err)) |
237 return Value(); | 237 return Value(); |
238 | 238 |
239 // Fill it. | 239 // Fill it. |
240 const SourceDir& input_dir = scope->GetSourceDir(); | 240 const SourceDir& input_dir = scope->GetSourceDir(); |
241 ConfigValuesGenerator gen(&config->config_values(), scope, input_dir, err); | 241 ConfigValuesGenerator gen(&config->config_values(), scope, input_dir, err); |
242 gen.Run(); | 242 gen.Run(); |
243 if (err->has_error()) | 243 if (err->has_error()) |
244 return Value(); | 244 return Value(); |
245 | 245 |
246 // Mark as complete. | 246 // Save the generated item. |
247 scope->settings()->build_settings()->ItemDefined(config.PassAs<Item>()); | 247 Scope::ItemVector* collector = scope->GetItemCollector(); |
| 248 if (!collector) { |
| 249 *err = Err(function, "Can't define a config in this context."); |
| 250 return Value(); |
| 251 } |
| 252 collector->push_back(new scoped_ptr<Item>(config.PassAs<Item>())); |
| 253 |
248 return Value(); | 254 return Value(); |
249 } | 255 } |
250 | 256 |
251 // declare_args ---------------------------------------------------------------- | 257 // declare_args ---------------------------------------------------------------- |
252 | 258 |
253 const char kDeclareArgs[] = "declare_args"; | 259 const char kDeclareArgs[] = "declare_args"; |
254 const char kDeclareArgs_HelpShort[] = | 260 const char kDeclareArgs_HelpShort[] = |
255 "declare_args: Declare build arguments."; | 261 "declare_args: Declare build arguments."; |
256 const char kDeclareArgs_Help[] = | 262 const char kDeclareArgs_Help[] = |
257 "declare_args: Declare build arguments.\n" | 263 "declare_args: Declare build arguments.\n" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 INSERT_FUNCTION(StaticLibrary, true) | 645 INSERT_FUNCTION(StaticLibrary, true) |
640 INSERT_FUNCTION(Test, true) | 646 INSERT_FUNCTION(Test, true) |
641 | 647 |
642 INSERT_FUNCTION(Assert, false) | 648 INSERT_FUNCTION(Assert, false) |
643 INSERT_FUNCTION(Config, false) | 649 INSERT_FUNCTION(Config, false) |
644 INSERT_FUNCTION(Copy, false) | 650 INSERT_FUNCTION(Copy, false) |
645 INSERT_FUNCTION(DeclareArgs, false) | 651 INSERT_FUNCTION(DeclareArgs, false) |
646 INSERT_FUNCTION(Defined, false) | 652 INSERT_FUNCTION(Defined, false) |
647 INSERT_FUNCTION(ExecScript, false) | 653 INSERT_FUNCTION(ExecScript, false) |
648 INSERT_FUNCTION(GetEnv, false) | 654 INSERT_FUNCTION(GetEnv, false) |
| 655 INSERT_FUNCTION(GetTargetOutputs, false) |
649 INSERT_FUNCTION(Import, false) | 656 INSERT_FUNCTION(Import, false) |
650 INSERT_FUNCTION(Print, false) | 657 INSERT_FUNCTION(Print, false) |
651 INSERT_FUNCTION(ProcessFileTemplate, false) | 658 INSERT_FUNCTION(ProcessFileTemplate, false) |
652 INSERT_FUNCTION(ReadFile, false) | 659 INSERT_FUNCTION(ReadFile, false) |
653 INSERT_FUNCTION(RebasePath, false) | 660 INSERT_FUNCTION(RebasePath, false) |
654 INSERT_FUNCTION(SetDefaults, false) | 661 INSERT_FUNCTION(SetDefaults, false) |
655 INSERT_FUNCTION(SetDefaultToolchain, false) | 662 INSERT_FUNCTION(SetDefaultToolchain, false) |
656 INSERT_FUNCTION(SetSourcesAssignmentFilter, false) | 663 INSERT_FUNCTION(SetSourcesAssignmentFilter, false) |
657 INSERT_FUNCTION(Template, false) | 664 INSERT_FUNCTION(Template, false) |
658 INSERT_FUNCTION(Tool, false) | 665 INSERT_FUNCTION(Tool, false) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 return found_function->second.executed_block_runner( | 733 return found_function->second.executed_block_runner( |
727 function, args.list_value(), &block_scope, err); | 734 function, args.list_value(), &block_scope, err); |
728 } | 735 } |
729 | 736 |
730 // Otherwise it's a no-block function. | 737 // Otherwise it's a no-block function. |
731 return found_function->second.no_block_runner(scope, function, | 738 return found_function->second.no_block_runner(scope, function, |
732 args.list_value(), err); | 739 args.list_value(), err); |
733 } | 740 } |
734 | 741 |
735 } // namespace functions | 742 } // namespace functions |
OLD | NEW |