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

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

Issue 1126193005: Check for inputs not generated by deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data
Patch Set: Created 5 years, 6 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/build_settings.cc ('k') | tools/gn/command_desc.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 <stdio.h> 5 #include <stdio.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 std::string location, comment; 107 std::string location, comment;
108 GetContextForValue(value, &location, &comment); 108 GetContextForValue(value, &location, &comment);
109 OutputString(" " + location + "\n" + comment); 109 OutputString(" " + location + "\n" + comment);
110 } else { 110 } else {
111 OutputString(" (Internally set)\n"); 111 OutputString(" (Internally set)\n");
112 } 112 }
113 } 113 }
114 114
115 int ListArgs(const std::string& build_dir) { 115 int ListArgs(const std::string& build_dir) {
116 Setup* setup = new Setup; 116 Setup* setup = new Setup;
117 setup->set_check_for_bad_items(false); 117 setup->build_settings().set_check_for_bad_items(false);
118 if (!setup->DoSetup(build_dir, false) || !setup->Run()) 118 if (!setup->DoSetup(build_dir, false) || !setup->Run())
119 return 1; 119 return 1;
120 120
121 Scope::KeyValueMap build_args; 121 Scope::KeyValueMap build_args;
122 setup->build_settings().build_args().MergeDeclaredArguments(&build_args); 122 setup->build_settings().build_args().MergeDeclaredArguments(&build_args);
123 123
124 // Find all of the arguments we care about. Use a regular map so they're 124 // Find all of the arguments we care about. Use a regular map so they're
125 // sorted nicely when we write them out. 125 // sorted nicely when we write them out.
126 std::map<base::StringPiece, Value> sorted_args; 126 std::map<base::StringPiece, Value> sorted_args;
127 std::string list_value = 127 std::string list_value =
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return system(cmd.c_str()) == 0; 220 return system(cmd.c_str()) == 0;
221 } 221 }
222 222
223 #endif 223 #endif
224 224
225 int EditArgsFile(const std::string& build_dir) { 225 int EditArgsFile(const std::string& build_dir) {
226 { 226 {
227 // Scope the setup. We only use it for some basic state. We'll do the 227 // Scope the setup. We only use it for some basic state. We'll do the
228 // "real" build below in the gen command. 228 // "real" build below in the gen command.
229 Setup setup; 229 Setup setup;
230 setup.set_check_for_bad_items(false); 230 setup.build_settings().set_check_for_bad_items(false);
231 // Don't fill build arguments. We're about to edit the file which supplies 231 // Don't fill build arguments. We're about to edit the file which supplies
232 // these in the first place. 232 // these in the first place.
233 setup.set_fill_arguments(false); 233 setup.set_fill_arguments(false);
234 if (!setup.DoSetup(build_dir, true)) 234 if (!setup.DoSetup(build_dir, true))
235 return 1; 235 return 1;
236 236
237 // Ensure the file exists. Need to normalize path separators since on 237 // Ensure the file exists. Need to normalize path separators since on
238 // Windows they can come out as forward slashes here, and that confuses some 238 // Windows they can come out as forward slashes here, and that confuses some
239 // of the commands. 239 // of the commands.
240 base::FilePath arg_file = 240 base::FilePath arg_file =
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 "Or see \"gn help args\" for more variants.").PrintToStdout(); 339 "Or see \"gn help args\" for more variants.").PrintToStdout();
340 return 1; 340 return 1;
341 } 341 }
342 342
343 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchList)) 343 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchList))
344 return ListArgs(args[0]); 344 return ListArgs(args[0]);
345 return EditArgsFile(args[0]); 345 return EditArgsFile(args[0]);
346 } 346 }
347 347
348 } // namespace commands 348 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/build_settings.cc ('k') | tools/gn/command_desc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698