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

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

Issue 35933003: Add documentation for GN's GYP generation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « no previous file | tools/gn/variables.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 <iostream> 5 #include <iostream>
6 #include <map> 6 #include <map>
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 263 }
264 264
265 } // namespace 265 } // namespace
266 266
267 // Suppress output on success. 267 // Suppress output on success.
268 const char kSwitchQuiet[] = "q"; 268 const char kSwitchQuiet[] = "q";
269 269
270 const char kGyp[] = "gyp"; 270 const char kGyp[] = "gyp";
271 const char kGyp_HelpShort[] = 271 const char kGyp_HelpShort[] =
272 "gyp: Make GYP files from GN."; 272 "gyp: Make GYP files from GN.";
273 const char kGyp_Help[] = "Doooooom.\n"; 273 const char kGyp_Help[] =
274 "gyp: Make GYP files from GN.\n"
275 "\n"
276 " This command will generate GYP files from GN sources. You can then run\n"
277 " GYP over the result to produce a build. Native GYP targets can depend\n"
278 " on any GN target except source sets. GN targets can depend on native\n"
279 " GYP targets, but all/direct dependent settings will NOT be pushed\n"
280 " across the boundary.\n"
281 "\n"
282 " To make this work you first need to manually run GN, then GYP, then\n"
283 " do the build. Because GN doesn't generate the final .ninja files,\n"
284 " there will be no rules to regenerate the .ninja files if the inputs\n"
285 " change, so you will have to manually repeat these steps each time\n"
286 " something changes:\n"
287 "\n"
288 " out/Debug/gn gyp\n"
289 " python build/gyp_chromiunm\n"
290 " ninja -C out/Debug foo_target\n"
291 "\n"
292 " Two variables are used to control how a target relates to GYP:\n"
293 "\n"
294 " - \"external != true\" and \"gyp_file\" is set: This target will be\n"
295 " written to the named GYP file in the source tree (not restricted to\n"
296 " an output or generated files directory).\n"
297 "\n"
298 " - \"external == true\" and \"gyp_file\" is set: The target will not\n"
299 " be written to a GYP file. But other targets being written to GYP\n"
300 " files can depend on it, and they will reference the given GYP file\n"
301 " name for GYP to use. This allows you to specify how GN->GYP\n"
302 " dependencies and named, and provides a place to manually set the\n"
303 " dependent configs from GYP to GN.\n"
304 "\n"
305 " - \"gyp_file\" is unset: Like the previous case, but if a GN target is\n"
306 " being written to a GYP file that depends on this one, the default\n"
307 " GYP file name will be assumed. The default name will match the name\n"
308 " of the current directory, so \"//foo/bar:baz\" would be\n"
309 " \"<(DEPTH)/foo/bar/bar.gyp:baz\".\n"
310 "\n"
311 "Example:\n"
312 " # This target is assumed to be in the GYP build in the file\n"
313 " # \"foo/foo.gyp\". This declaration tells GN where to find the GYP\n"
314 " # equivalent, and gives it some direct dependent settings that targets\n"
315 " # depending on it should receive (since these don't flow from GYP to\n"
316 " # GN-generated targets).\n"
317 " shared_library(\"gyp_target\") {\n"
318 " gyp_file = \"//foo/foo.gyp\"\n"
319 " external = true\n"
320 " direct_dependen_configs = [ \":gyp_target_config\" ]\n"
321 " }\n"
322 "\n"
323 " executable(\"my_app\") {\n"
324 " deps = [ \":gyp_target\" ]\n"
325 " gyp_file = \"//foo/myapp.gyp\"\n"
326 " sources = ...\n"
327 " }\n";
274 328
275 int RunGyp(const std::vector<std::string>& args) { 329 int RunGyp(const std::vector<std::string>& args) {
276 const CommandLine* cmdline = CommandLine::ForCurrentProcess(); 330 const CommandLine* cmdline = CommandLine::ForCurrentProcess();
277 331
278 base::TimeTicks begin_time = base::TimeTicks::Now(); 332 base::TimeTicks begin_time = base::TimeTicks::Now();
279 333
280 // Deliberately leaked to avoid expensive process teardown. 334 // Deliberately leaked to avoid expensive process teardown.
281 Setup* setup_debug = new Setup; 335 Setup* setup_debug = new Setup;
282 if (!setup_debug->DoSetup()) 336 if (!setup_debug->DoSetup())
283 return 1; 337 return 1;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 + " GN files in " + 379 + " GN files in " +
326 base::IntToString((end_time - begin_time).InMilliseconds()) + "ms\n"; 380 base::IntToString((end_time - begin_time).InMilliseconds()) + "ms\n";
327 381
328 OutputString(stats); 382 OutputString(stats);
329 } 383 }
330 384
331 return 0; 385 return 0;
332 } 386 }
333 387
334 } // namespace commands 388 } // namespace commands
OLDNEW
« no previous file with comments | « no previous file | tools/gn/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698