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

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

Issue 26561005: GYP generator for GN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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/args.h ('k') | tools/gn/build_settings.h » ('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/args.h" 5 #include "tools/gn/args.h"
6 6
7 #include "tools/gn/variables.h" 7 #include "tools/gn/variables.h"
8 8
9 const char kBuildArgs_Help[] = 9 const char kBuildArgs_Help[] =
10 "Build Arguments Overview\n" 10 "Build Arguments Overview\n"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 "\n" 45 "\n"
46 " Often, the root build config file will declare global arguments that\n" 46 " Often, the root build config file will declare global arguments that\n"
47 " will be passed to all buildfiles. Individual build files can also\n" 47 " will be passed to all buildfiles. Individual build files can also\n"
48 " specify arguments that apply only to those files. It is also usedful\n" 48 " specify arguments that apply only to those files. It is also usedful\n"
49 " to specify build args in an \"import\"-ed file if you want such\n" 49 " to specify build args in an \"import\"-ed file if you want such\n"
50 " arguments to apply to multiple buildfiles.\n"; 50 " arguments to apply to multiple buildfiles.\n";
51 51
52 Args::Args() { 52 Args::Args() {
53 } 53 }
54 54
55 Args::Args(const Args& other)
56 : overrides_(other.overrides_),
57 all_overrides_(other.all_overrides_),
58 declared_arguments_(other.declared_arguments_) {
59 }
60
55 Args::~Args() { 61 Args::~Args() {
56 } 62 }
57 63
64 void Args::AddArgOverride(const char* name, const Value& value) {
65 overrides_[base::StringPiece(name)] = value;
66 all_overrides_[base::StringPiece(name)] = value;
67 }
68
58 void Args::AddArgOverrides(const Scope::KeyValueMap& overrides) { 69 void Args::AddArgOverrides(const Scope::KeyValueMap& overrides) {
59 for (Scope::KeyValueMap::const_iterator i = overrides.begin(); 70 for (Scope::KeyValueMap::const_iterator i = overrides.begin();
60 i != overrides.end(); ++i) { 71 i != overrides.end(); ++i) {
61 overrides_.insert(*i); 72 overrides_[i->first] = i->second;
62 all_overrides_.insert(*i); 73 all_overrides_[i->first] = i->second;
63 } 74 }
64 } 75 }
65 76
66 void Args::SetupRootScope(Scope* dest, 77 void Args::SetupRootScope(Scope* dest,
67 const Scope::KeyValueMap& toolchain_overrides) const { 78 const Scope::KeyValueMap& toolchain_overrides) const {
68 SetSystemVars(dest); 79 SetSystemVars(dest);
69 ApplyOverrides(overrides_, dest); 80 ApplyOverrides(overrides_, dest);
70 ApplyOverrides(toolchain_overrides, dest); 81 ApplyOverrides(toolchain_overrides, dest);
71 SaveOverrideRecord(toolchain_overrides); 82 SaveOverrideRecord(toolchain_overrides);
72 } 83 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 i != values.end(); ++i) 190 i != values.end(); ++i)
180 scope->SetValue(i->first, i->second, i->second.origin()); 191 scope->SetValue(i->first, i->second, i->second.origin());
181 } 192 }
182 193
183 void Args::SaveOverrideRecord(const Scope::KeyValueMap& values) const { 194 void Args::SaveOverrideRecord(const Scope::KeyValueMap& values) const {
184 base::AutoLock lock(lock_); 195 base::AutoLock lock(lock_);
185 for (Scope::KeyValueMap::const_iterator i = values.begin(); 196 for (Scope::KeyValueMap::const_iterator i = values.begin();
186 i != values.end(); ++i) 197 i != values.end(); ++i)
187 all_overrides_[i->first] = i->second; 198 all_overrides_[i->first] = i->second;
188 } 199 }
OLDNEW
« no previous file with comments | « tools/gn/args.h ('k') | tools/gn/build_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698