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

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

Issue 149163005: Work on GN iOS build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
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/args.h" 5 #include "tools/gn/args.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "tools/gn/variables.h" 8 #include "tools/gn/variables.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 void Args::AddArgOverrides(const Scope::KeyValueMap& overrides) { 74 void Args::AddArgOverrides(const Scope::KeyValueMap& overrides) {
75 for (Scope::KeyValueMap::const_iterator i = overrides.begin(); 75 for (Scope::KeyValueMap::const_iterator i = overrides.begin();
76 i != overrides.end(); ++i) { 76 i != overrides.end(); ++i) {
77 overrides_[i->first] = i->second; 77 overrides_[i->first] = i->second;
78 all_overrides_[i->first] = i->second; 78 all_overrides_[i->first] = i->second;
79 } 79 }
80 } 80 }
81 81
82 const Value* Args::GetArgOverride(const char* name) const {
83 Scope::KeyValueMap::const_iterator found =
84 all_overrides_.find(base::StringPiece(name));
85 if (found == all_overrides_.end())
86 return NULL;
87 return &found->second;
88 }
89
82 void Args::SetupRootScope(Scope* dest, 90 void Args::SetupRootScope(Scope* dest,
83 const Scope::KeyValueMap& toolchain_overrides) const { 91 const Scope::KeyValueMap& toolchain_overrides) const {
84 SetSystemVars(dest); 92 SetSystemVars(dest);
85 ApplyOverrides(overrides_, dest); 93 ApplyOverrides(overrides_, dest);
86 ApplyOverrides(toolchain_overrides, dest); 94 ApplyOverrides(toolchain_overrides, dest);
87 SaveOverrideRecord(toolchain_overrides); 95 SaveOverrideRecord(toolchain_overrides);
88 } 96 }
89 97
90 bool Args::DeclareArgs(const Scope::KeyValueMap& args, 98 bool Args::DeclareArgs(const Scope::KeyValueMap& args,
91 Scope* scope_to_set, 99 Scope* scope_to_set,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // Do not declare the build* variants since these shouldn't be changed. 234 // Do not declare the build* variants since these shouldn't be changed.
227 // 235 //
228 // Mark these variables used so the build config file can override them 236 // Mark these variables used so the build config file can override them
229 // without geting a warning about overwriting an unused variable. 237 // without geting a warning about overwriting an unused variable.
230 declared_arguments_[variables::kOs] = os_val; 238 declared_arguments_[variables::kOs] = os_val;
231 declared_arguments_[variables::kCpuArch] = arch_val; 239 declared_arguments_[variables::kCpuArch] = arch_val;
232 dest->MarkUsed(variables::kCpuArch); 240 dest->MarkUsed(variables::kCpuArch);
233 dest->MarkUsed(variables::kOs); 241 dest->MarkUsed(variables::kOs);
234 } 242 }
235 243
236
237 void Args::ApplyOverrides(const Scope::KeyValueMap& values, 244 void Args::ApplyOverrides(const Scope::KeyValueMap& values,
238 Scope* scope) const { 245 Scope* scope) const {
239 for (Scope::KeyValueMap::const_iterator i = values.begin(); 246 for (Scope::KeyValueMap::const_iterator i = values.begin();
240 i != values.end(); ++i) 247 i != values.end(); ++i)
241 scope->SetValue(i->first, i->second, i->second.origin()); 248 scope->SetValue(i->first, i->second, i->second.origin());
242 } 249 }
243 250
244 void Args::SaveOverrideRecord(const Scope::KeyValueMap& values) const { 251 void Args::SaveOverrideRecord(const Scope::KeyValueMap& values) const {
245 base::AutoLock lock(lock_); 252 base::AutoLock lock(lock_);
246 for (Scope::KeyValueMap::const_iterator i = values.begin(); 253 for (Scope::KeyValueMap::const_iterator i = values.begin();
247 i != values.end(); ++i) 254 i != values.end(); ++i)
248 all_overrides_[i->first] = i->second; 255 all_overrides_[i->first] = i->second;
249 } 256 }
OLDNEW
« build/config/BUILDCONFIG.gn ('K') | « tools/gn/args.h ('k') | tools/gn/command_gyp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698