Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: tools/gn/loader.cc

Issue 287693002: Support private values in GN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix semicolon Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/gn/import_manager.cc ('k') | tools/gn/parse_tree.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/loader.h" 5 #include "tools/gn/loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "tools/gn/build_settings.h" 10 #include "tools/gn/build_settings.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 our_scope.set_item_collector(&collected_items); 238 our_scope.set_item_collector(&collected_items);
239 239
240 ScopedTrace trace(TraceItem::TRACE_FILE_EXECUTE, file_name.value()); 240 ScopedTrace trace(TraceItem::TRACE_FILE_EXECUTE, file_name.value());
241 trace.SetToolchain(settings->toolchain_label()); 241 trace.SetToolchain(settings->toolchain_label());
242 242
243 Err err; 243 Err err;
244 root->Execute(&our_scope, &err); 244 root->Execute(&our_scope, &err);
245 if (err.has_error()) 245 if (err.has_error())
246 g_scheduler->FailWithError(err); 246 g_scheduler->FailWithError(err);
247 247
248 if (!our_scope.CheckForUnusedVars(&err))
249 g_scheduler->FailWithError(err);
250
248 // Pass all of the items that were defined off to the builder. 251 // Pass all of the items that were defined off to the builder.
249 for (size_t i = 0; i < collected_items.size(); i++) 252 for (size_t i = 0; i < collected_items.size(); i++)
250 settings->build_settings()->ItemDefined(collected_items[i]->Pass()); 253 settings->build_settings()->ItemDefined(collected_items[i]->Pass());
251 254
252 trace.Done(); 255 trace.Done();
253 256
254 main_loop_->PostTask(FROM_HERE, base::Bind(&LoaderImpl::DidLoadFile, this)); 257 main_loop_->PostTask(FROM_HERE, base::Bind(&LoaderImpl::DidLoadFile, this));
255 } 258 }
256 259
257 void LoaderImpl::BackgroundLoadBuildConfig( 260 void LoaderImpl::BackgroundLoadBuildConfig(
(...skipping 20 matching lines...) Expand all
278 base_config->SetProperty(kDefaultToolchainKey, &default_toolchain_label); 281 base_config->SetProperty(kDefaultToolchainKey, &default_toolchain_label);
279 282
280 ScopedTrace trace(TraceItem::TRACE_FILE_EXECUTE, 283 ScopedTrace trace(TraceItem::TRACE_FILE_EXECUTE,
281 settings->build_settings()->build_config_file().value()); 284 settings->build_settings()->build_config_file().value());
282 trace.SetToolchain(settings->toolchain_label()); 285 trace.SetToolchain(settings->toolchain_label());
283 286
284 const BlockNode* root_block = root->AsBlock(); 287 const BlockNode* root_block = root->AsBlock();
285 Err err; 288 Err err;
286 root_block->ExecuteBlockInScope(base_config, &err); 289 root_block->ExecuteBlockInScope(base_config, &err);
287 290
291 // Clear all private variables left in the scope. We want the root build
292 // config to be like a .gni file in that variables beginning with an
293 // underscore aren't exported.
294 base_config->RemovePrivateIdentifiers();
295
288 trace.Done(); 296 trace.Done();
289 297
290 if (err.has_error()) 298 if (err.has_error())
291 g_scheduler->FailWithError(err); 299 g_scheduler->FailWithError(err);
292 300
293 base_config->ClearProcessingBuildConfig(); 301 base_config->ClearProcessingBuildConfig();
294 if (settings->is_default()) { 302 if (settings->is_default()) {
295 // The default toolchain must have been set in the default build config 303 // The default toolchain must have been set in the default build config
296 // file. 304 // file.
297 if (default_toolchain_label.is_null()) { 305 if (default_toolchain_label.is_null()) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 const SourceFile& file_name, 394 const SourceFile& file_name,
387 const base::Callback<void(const ParseNode*)>& callback, 395 const base::Callback<void(const ParseNode*)>& callback,
388 Err* err) { 396 Err* err) {
389 if (async_load_file_.is_null()) { 397 if (async_load_file_.is_null()) {
390 return g_scheduler->input_file_manager()->AsyncLoadFile( 398 return g_scheduler->input_file_manager()->AsyncLoadFile(
391 origin, build_settings, file_name, callback, err); 399 origin, build_settings, file_name, callback, err);
392 } 400 }
393 return async_load_file_.Run( 401 return async_load_file_.Run(
394 origin, build_settings, file_name, callback, err); 402 origin, build_settings, file_name, callback, err);
395 } 403 }
OLDNEW
« no previous file with comments | « tools/gn/import_manager.cc ('k') | tools/gn/parse_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698