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

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

Issue 1104313002: Allow paths to be resolved in the GN args file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « tools/gn/setup.h ('k') | no next file » | 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/setup.h" 5 #include "tools/gn/setup.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <sstream> 10 #include <sstream>
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 const char Setup::kBuildArgFileName[] = "args.gn"; 153 const char Setup::kBuildArgFileName[] = "args.gn";
154 154
155 Setup::Setup() 155 Setup::Setup()
156 : build_settings_(), 156 : build_settings_(),
157 loader_(new LoaderImpl(&build_settings_)), 157 loader_(new LoaderImpl(&build_settings_)),
158 builder_(new Builder(loader_.get())), 158 builder_(new Builder(loader_.get())),
159 root_build_file_("//BUILD.gn"), 159 root_build_file_("//BUILD.gn"),
160 check_for_bad_items_(true), 160 check_for_bad_items_(true),
161 check_for_unused_overrides_(true), 161 check_for_unused_overrides_(true),
162 check_public_headers_(false), 162 check_public_headers_(false),
163 empty_settings_(&empty_build_settings_, std::string()), 163 dotfile_settings_(&build_settings_, std::string()),
164 dotfile_scope_(&empty_settings_), 164 dotfile_scope_(&dotfile_settings_),
165 fill_arguments_(true) { 165 fill_arguments_(true) {
166 empty_settings_.set_toolchain_label(Label()); 166 dotfile_settings_.set_toolchain_label(Label());
167 build_settings_.set_item_defined_callback( 167 build_settings_.set_item_defined_callback(
168 base::Bind(&ItemDefinedCallback, scheduler_.main_loop(), builder_)); 168 base::Bind(&ItemDefinedCallback, scheduler_.main_loop(), builder_));
169 169
170 loader_->set_complete_callback(base::Bind(&DecrementWorkCount)); 170 loader_->set_complete_callback(base::Bind(&DecrementWorkCount));
171 // The scheduler's main loop wasn't created when the Loader was created, so 171 // The scheduler's main loop wasn't created when the Loader was created, so
172 // we need to set it now. 172 // we need to set it now.
173 loader_->set_main_loop(scheduler_.main_loop()); 173 loader_->set_main_loop(scheduler_.main_loop());
174 } 174 }
175 175
176 Setup::~Setup() { 176 Setup::~Setup() {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 err.PrintToStdout(); 333 err.PrintToStdout();
334 return false; 334 return false;
335 } 335 }
336 336
337 args_root_ = Parser::Parse(args_tokens_, &err); 337 args_root_ = Parser::Parse(args_tokens_, &err);
338 if (err.has_error()) { 338 if (err.has_error()) {
339 err.PrintToStdout(); 339 err.PrintToStdout();
340 return false; 340 return false;
341 } 341 }
342 342
343 Scope arg_scope(&empty_settings_); 343 Scope arg_scope(&dotfile_settings_);
344 args_root_->Execute(&arg_scope, &err); 344 args_root_->Execute(&arg_scope, &err);
345 if (err.has_error()) { 345 if (err.has_error()) {
346 err.PrintToStdout(); 346 err.PrintToStdout();
347 return false; 347 return false;
348 } 348 }
349 349
350 // Save the result of the command args. 350 // Save the result of the command args.
351 Scope::KeyValueMap overrides; 351 Scope::KeyValueMap overrides;
352 arg_scope.GetCurrentScopeValues(&overrides); 352 arg_scope.GetCurrentScopeValues(&overrides);
353 build_settings_.build_args().AddArgOverrides(overrides); 353 build_settings_.build_args().AddArgOverrides(overrides);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 err.PrintToStdout(); 622 err.PrintToStdout();
623 return false; 623 return false;
624 } 624 }
625 whitelist->insert(current_dir.ResolveRelativeFile(item.string_value())); 625 whitelist->insert(current_dir.ResolveRelativeFile(item.string_value()));
626 } 626 }
627 build_settings_.set_exec_script_whitelist(whitelist.Pass()); 627 build_settings_.set_exec_script_whitelist(whitelist.Pass());
628 } 628 }
629 629
630 return true; 630 return true;
631 } 631 }
OLDNEW
« no previous file with comments | « tools/gn/setup.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698