Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 gn\n" | |
|
jamesr
2013/10/22 21:54:49
did you mean
ninja -C out/gn foo_target
? why wo
| |
| 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.\n" | |
|
jamesr
2013/10/22 21:54:49
probably worth calling out that the target will be
| |
| 296 "\n" | |
| 297 " - \"external == true\" and \"gyp_file\" is set: The target will not\n" | |
| 298 " be written to a GYP file. But other targets being written to GYP\n" | |
| 299 " files can depend on it, and they will reference the given GYP file\n" | |
| 300 " name for GYP to use. This allows you to specify how GN->GYP\n" | |
| 301 " dependencies and named, and provides a place to manually set the\n" | |
| 302 " dependent configs from GYP to GN.\n" | |
| 303 "\n" | |
| 304 " - \"gyp_file\" is unset: Like the previous case, but if a GN target is\n" | |
| 305 " being written to a GYP file that depends on this one, the default\n" | |
| 306 " GYP file name will be assumed. The default name will match the name\n" | |
| 307 " of the current directory, so \"//foo/bar:baz\" would be\n" | |
| 308 " \"<(DEPTH)/foo/bar/bar.gyp:baz\".\n" | |
| 309 "\n" | |
| 310 "Example:\n" | |
| 311 " # This target is assumed to be in the GYP build in the file\n" | |
| 312 " # \"foo/foo.gyp\". This declaration tells GN where to find the GYP\n" | |
| 313 " # equivalent, and gives it some direct dependent settings that targets\n" | |
| 314 " # depending on it should receive (since these don't flow from GYP to\n" | |
| 315 " # GN-generated targets).\n" | |
| 316 " shared_library(\"gyp_target\") {\n" | |
| 317 " gyp_file = \"//foo/foo.gyp\"\n" | |
| 318 " external = true\n" | |
| 319 " direct_dependen_configs = [ \":gyp_target_config\" ]\n" | |
| 320 " }\n" | |
| 321 "\n" | |
| 322 " executable(\"my_app\") {\n" | |
| 323 " deps = [ \":gyp_target\" ]\n" | |
| 324 " gyp_file = \"//foo/myapp.gyp\"\n" | |
| 325 " sources = ...\n" | |
| 326 " }\n"; | |
| 274 | 327 |
| 275 int RunGyp(const std::vector<std::string>& args) { | 328 int RunGyp(const std::vector<std::string>& args) { |
| 276 const CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 329 const CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
| 277 | 330 |
| 278 base::TimeTicks begin_time = base::TimeTicks::Now(); | 331 base::TimeTicks begin_time = base::TimeTicks::Now(); |
| 279 | 332 |
| 280 // Deliberately leaked to avoid expensive process teardown. | 333 // Deliberately leaked to avoid expensive process teardown. |
| 281 Setup* setup_debug = new Setup; | 334 Setup* setup_debug = new Setup; |
| 282 if (!setup_debug->DoSetup()) | 335 if (!setup_debug->DoSetup()) |
| 283 return 1; | 336 return 1; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 + " GN files in " + | 378 + " GN files in " + |
| 326 base::IntToString((end_time - begin_time).InMilliseconds()) + "ms\n"; | 379 base::IntToString((end_time - begin_time).InMilliseconds()) + "ms\n"; |
| 327 | 380 |
| 328 OutputString(stats); | 381 OutputString(stats); |
| 329 } | 382 } |
| 330 | 383 |
| 331 return 0; | 384 return 0; |
| 332 } | 385 } |
| 333 | 386 |
| 334 } // namespace commands | 387 } // namespace commands |
| OLD | NEW |