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/err.h" | 5 #include "tools/gn/err.h" |
6 #include "tools/gn/functions.h" | 6 #include "tools/gn/functions.h" |
7 #include "tools/gn/parse_tree.h" | 7 #include "tools/gn/parse_tree.h" |
8 #include "tools/gn/scheduler.h" | 8 #include "tools/gn/scheduler.h" |
9 #include "tools/gn/scope.h" | 9 #include "tools/gn/scope.h" |
10 #include "tools/gn/settings.h" | 10 #include "tools/gn/settings.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 scoped_ptr<Toolchain> toolchain(new Toolchain(scope->settings(), label)); | 106 scoped_ptr<Toolchain> toolchain(new Toolchain(scope->settings(), label)); |
107 toolchain->set_defined_from(function); | 107 toolchain->set_defined_from(function); |
108 | 108 |
109 Scope block_scope(scope); | 109 Scope block_scope(scope); |
110 block_scope.SetProperty(&kToolchainPropertyKey, toolchain.get()); | 110 block_scope.SetProperty(&kToolchainPropertyKey, toolchain.get()); |
111 block->ExecuteBlockInScope(&block_scope, err); | 111 block->ExecuteBlockInScope(&block_scope, err); |
112 block_scope.SetProperty(&kToolchainPropertyKey, NULL); | 112 block_scope.SetProperty(&kToolchainPropertyKey, NULL); |
113 if (err->has_error()) | 113 if (err->has_error()) |
114 return Value(); | 114 return Value(); |
115 | 115 |
116 // Extract the gyp_header contents, if any. | |
117 const Value* gyp_header_value = | |
118 block_scope.GetValue(variables::kGypHeader, true); | |
119 if (gyp_header_value) { | |
120 if (!gyp_header_value->VerifyTypeIs(Value::STRING, err)) | |
121 return Value(); | |
122 toolchain->set_gyp_header(gyp_header_value->string_value()); | |
123 } | |
124 | |
125 if (!block_scope.CheckForUnusedVars(err)) | 116 if (!block_scope.CheckForUnusedVars(err)) |
126 return Value(); | 117 return Value(); |
127 | 118 |
128 scope->settings()->build_settings()->ItemDefined(toolchain.PassAs<Item>()); | 119 scope->settings()->build_settings()->ItemDefined(toolchain.PassAs<Item>()); |
129 return Value(); | 120 return Value(); |
130 } | 121 } |
131 | 122 |
132 // tool ------------------------------------------------------------------------ | 123 // tool ------------------------------------------------------------------------ |
133 | 124 |
134 const char kTool[] = "tool"; | 125 const char kTool[] = "tool"; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 return Value(); | 294 return Value(); |
304 | 295 |
305 Scope::KeyValueMap values; | 296 Scope::KeyValueMap values; |
306 block_scope.GetCurrentScopeValues(&values); | 297 block_scope.GetCurrentScopeValues(&values); |
307 toolchain->args() = values; | 298 toolchain->args() = values; |
308 | 299 |
309 return Value(); | 300 return Value(); |
310 } | 301 } |
311 | 302 |
312 } // namespace functions | 303 } // namespace functions |
OLD | NEW |