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

Side by Side Diff: tools/gn/docs/reference.md

Issue 2265833002: Implement `gn analyze`. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do not pretty print the written json; this gets around crlf issues Created 4 years, 3 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/commands.cc ('k') | tools/gn/filesystem_utils.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 # GN Reference 1 # GN Reference
2 2
3 *This page is automatically generated from* `gn help --markdown all`. 3 *This page is automatically generated from* `gn help --markdown all`.
4 4
5 ## **\--args**: Specifies build arguments overrides. 5 ## **\--args**: Specifies build arguments overrides.
6 6
7 ``` 7 ```
8 See "gn help buildargs" for an overview of how build arguments work. 8 See "gn help buildargs" for an overview of how build arguments work.
9 9
10 Most operations take a build directory. The build arguments are taken 10 Most operations take a build directory. The build arguments are taken
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 ``` 239 ```
240 ## **-v**: Verbose logging. 240 ## **-v**: Verbose logging.
241 241
242 ``` 242 ```
243 This will spew logging events to the console for debugging issues. 243 This will spew logging events to the console for debugging issues.
244 Good luck! 244 Good luck!
245 245
246 246
247 ``` 247 ```
248 ## **gn analyze <out_dir> <input_path> <output_path>**
249
250 ```
251 Analyze which targets are affected by a list of files.
252
253 This command takes three arguments:
254
255 out_dir is the path to the build directory.
256
257 input_path is a path to a file containing a JSON object with three
258 fields:
259
260 - "files": A list of the filenames to check.
261
262 - "compile_targets": A list of the labels targets that we wish to
263 rebuild, but aren't necessarily needed for testing. The
264 important difference between this field and "test_targets"
265 is that if an item in the compile_targets list is a group, then
266 any dependencies of that group will be returned if they are out
267 of date, but the group itself does not need to be. If the
268 dependencies themselves are groups, the same filtering is
269 repeated. This filtering can be used to avoid rebuilding
270 dependencies of a group that are unaffected by the input files.
271 The list may contain the string "all" to refer to a
272 pseudo-group that contains every root target in the build graph.
273
274 This filtering behavior is also known as "pruning" the list
275 of compile targets.
276
277 - "test_targets": A list of the labels for targets that
278 are needed to run the tests we wish to run. Unlike
279 "compile_targets", this list may not contain the string "all",
280 because having a test be dependent on everything in the build
281 would be silly.
282
283 output_path is a path indicating where the results of the command
284 are to be written. The results will be a file containing a JSON
285 object with one or more of following fields:
286
287 - "compile_targets": A list of the labels derived from the input
288 compile_targets list that are affected by the input files.
289 Due to the way the filtering works for compile targets as
290 described above, this list may contain targets that do not appear
291 in the input list.
292
293 - "test_targets": A list of the labels from the input
294 test_targets list that are affected by the input files. This list
295 will be a proper subset of the input list.
296
297 - "invalid_targets": A list of any names from the input that
298 do not exist in the build graph. If this list is non-empty,
299 the "error" field will also be set to "Invalid targets".
300
301 - "status": A string containing one of three values:
302
303 - "Found dependency"
304 - "No dependency"
305 - "Found dependency (all)"
306
307 In the first case, the lists returned in compile_targets and
308 test_targets should be passed to ninja to build. In the second
309 case, nothing was affected and no build is necessary. In the third
310 case, GN could not determine the correct answer and returned the
311 input as the output in order to be safe.
312
313 - "error": This will only be present if an error occurred, and
314 will contain a string describing the error. This includes cases
315 where the input file is not in the right format, or contains
316 invalid targets.
317 The command returns 1 if it is unable to read the input file or write
318 the output file, or if there is something wrong with the build such
319 that gen would also fail, and 0 otherwise. In particular, it returns
320 0 even if the "error" key is non-empty and a non-fatal error
321 occurred. In other words, it tries really hard to always write
322 something to the output JSON and convey errors that way rather than
323 via return codes.
324
325
326 ```
248 ## **gn args <out_dir> [\--list] [\--short] [\--args]** 327 ## **gn args <out_dir> [\--list] [\--short] [\--args]**
249 328
250 ``` 329 ```
251 See also "gn help buildargs" for a more high-level overview of how 330 See also "gn help buildargs" for a more high-level overview of how
252 build arguments work. 331 build arguments work.
253 332
254 ``` 333 ```
255 334
256 ### **Usage** 335 ### **Usage**
257 ``` 336 ```
(...skipping 3242 matching lines...) Expand 10 before | Expand all | Expand 10 after
3500 3579
3501 toolchain_args = { 3580 toolchain_args = {
3502 is_plugin = true 3581 is_plugin = true
3503 is_32bit = true 3582 is_32bit = true
3504 is_64bit = false 3583 is_64bit = false
3505 } 3584 }
3506 } 3585 }
3507 3586
3508 3587
3509 ``` 3588 ```
3510 ## **toolchain_args**: Set build arguments for toolchain build setup.
3511
3512 ```
3513 DEPRECATED. Instead use:
3514 toolchain_args = { ... }
3515
3516 See "gn help toolchain" for documentation.
3517
3518
3519 ```
3520 ## **write_file**: Write a file to disk. 3589 ## **write_file**: Write a file to disk.
3521 3590
3522 ``` 3591 ```
3523 write_file(filename, data) 3592 write_file(filename, data)
3524 3593
3525 If data is a list, the list will be written one-item-per-line with no 3594 If data is a list, the list will be written one-item-per-line with no
3526 quoting or brackets. 3595 quoting or brackets.
3527 3596
3528 If the file exists and the contents are identical to that being 3597 If the file exists and the contents are identical to that being
3529 written, the file will not be updated. This will prevent unnecessary 3598 written, the file will not be updated. This will prevent unnecessary
(...skipping 2925 matching lines...) Expand 10 before | Expand all | Expand 10 after
6455 ** \--root**: Explicitly specify source root. 6524 ** \--root**: Explicitly specify source root.
6456 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. 6525 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file.
6457 ** \--script-executable**: Set the executable used to execute scripts. 6526 ** \--script-executable**: Set the executable used to execute scripts.
6458 ** \--threads**: Specify number of worker threads. 6527 ** \--threads**: Specify number of worker threads.
6459 ** \--time**: Outputs a summary of how long everything took. 6528 ** \--time**: Outputs a summary of how long everything took.
6460 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. 6529 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file.
6461 ** -v**: Verbose logging. 6530 ** -v**: Verbose logging.
6462 ** \--version**: Prints the GN version number and exits. 6531 ** \--version**: Prints the GN version number and exits.
6463 6532
6464 ``` 6533 ```
OLDNEW
« no previous file with comments | « tools/gn/commands.cc ('k') | tools/gn/filesystem_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698