OLD | NEW |
1 # The MB (Meta-Build wrapper) user guide | 1 # The MB (Meta-Build wrapper) user guide |
2 | 2 |
3 [TOC] | 3 [TOC] |
4 | 4 |
5 ## Introduction | 5 ## Introduction |
6 | 6 |
7 `mb` is a simple python wrapper around the GYP and GN meta-build tools to | 7 `mb` is a simple python wrapper around the GYP and GN meta-build tools to |
8 be used as part of the GYP->GN migration. | 8 be used as part of the GYP->GN migration. |
9 | 9 |
10 It is intended to be used by bots to make it easier to manage the configuration | 10 It is intended to be used by bots to make it easier to manage the configuration |
(...skipping 16 matching lines...) Expand all Loading... |
27 mb analyze -c chromium_linux_rel //out/Release input.json output.json | 27 mb analyze -c chromium_linux_rel //out/Release input.json output.json |
28 ``` | 28 ``` |
29 | 29 |
30 Either the `-c/--config` flag or the `-m/--master` and `-b/--builder` flags | 30 Either the `-c/--config` flag or the `-m/--master` and `-b/--builder` flags |
31 must be specified so that `mb` can figure out which config to use. | 31 must be specified so that `mb` can figure out which config to use. |
32 | 32 |
33 The first positional argument must be a GN-style "source-absolute" path | 33 The first positional argument must be a GN-style "source-absolute" path |
34 to the build directory. | 34 to the build directory. |
35 | 35 |
36 The second positional argument is a (normal) path to a JSON file containing | 36 The second positional argument is a (normal) path to a JSON file containing |
37 a single object with two fields: | 37 a single object with the following fields: |
38 | 38 |
39 * `files`: an array of the modified filenames to check (as | 39 * `files`: an array of the modified filenames to check (as paths relative to |
40 paths relative to the checkout root). | 40 the checkout root). |
41 * `targets`: an array of the unqualified target names to check. | 41 * `test_targets`: an array of (ninja) build targets that needed to run the |
| 42 tests we wish to run. An empty array will be treated as if there are |
| 43 no tests that will be run. |
| 44 * `additional_compile_targets`: an array of (ninja) build targets that |
| 45 reflect the stuff we might want to build *in addition to* the list |
| 46 passed in `test_targets`. Targets in this list will be treated |
| 47 specially, in the following way: if a given target is a "meta" |
| 48 (GN: group, GYP: none) target like 'blink_tests' or |
| 49 'chromium_builder_tests', or even the ninja-specific 'all' target, |
| 50 then only the *dependencies* of the target that are affected by |
| 51 the modified files will be rebuilt (not the target itself, which |
| 52 might also cause unaffected dependencies to be rebuilt). An empty |
| 53 list will be treated as if there are no additional targets to build. |
| 54 Empty lists for both `test_targets` and `additional_compile_targets` |
| 55 would cause no work to be done, so will result in an error. |
| 56 * `targets`: a legacy field that resembled a union of `compile_targets` |
| 57 and `test_targets`. Support for this field will be removed once the |
| 58 bots have been updated to use compile_targets and test_targets instead. |
42 | 59 |
43 The third positional argument is a (normal) path to where mb will write | 60 The third positional argument is a (normal) path to where mb will write |
44 the result, also as a JSON object. This object may contain the following | 61 the result, also as a JSON object. This object may contain the following |
45 fields: | 62 fields: |
46 | 63 |
47 * `error`: this should only be present if something failed. | 64 * `error`: this should only be present if something failed. |
48 * `targets`: the subset of the input `targets` that depend on the | 65 * `compile_targets`: the list of ninja targets that should be passed |
49 input `files`. | 66 directly to the corresponding ninja / compile.py invocation. This |
50 * `build_targets`: the minimal subset of targets needed to build all | 67 list may contain entries that are *not* listed in the input (see |
51 of `targets` that were affected. | 68 the description of `additional_compile_targets` above and |
52 * `status`: one of three strings: | 69 [design_spec.md](the design spec) for how this works). |
53 * `"Found dependency"` (build the `build_targets`) | 70 * `invalid_targets`: a list of any targets that were passed in |
| 71 either of the input lists that weren't actually found in the graph. |
| 72 * `test_targets`: the subset of the input `test_targets` that are |
| 73 potentially out of date, indicating that the matching test steps |
| 74 should be re-run. |
| 75 * `targets`: a legacy field that indicates the subset of the input `targets` |
| 76 that depend on the input `files`. |
| 77 * `build_targets`: a legacy field that indicates the minimal subset of |
| 78 targets needed to build all of `targets` that were affected. |
| 79 * `status`: a field containing one of three strings: |
| 80 |
| 81 * `"Found dependency"` (build the `compile_targets`) |
54 * `"No dependency"` (i.e., no build needed) | 82 * `"No dependency"` (i.e., no build needed) |
55 * `"Found dependency (all)"` (build everything, in which case | 83 * `"Found dependency (all)"` (`test_targets` is returned as-is; |
56 `targets` and `build_targets` are not returned). | 84 `compile_targets` should contain the union of `test_targets` and |
| 85 `additional_compile_targets`. In this case the targets do not |
| 86 need to be pruned). |
| 87 |
| 88 See [design_spec.md](the design spec) for more details and examples; the |
| 89 differences can be subtle. We won't even go into how the `targets` and |
| 90 `build_targets` differ from each other or from `compile_targets` and |
| 91 `test_targets`. |
57 | 92 |
58 The `-b/--builder`, `-c/--config`, `-f/--config-file`, `-m/--master`, | 93 The `-b/--builder`, `-c/--config`, `-f/--config-file`, `-m/--master`, |
59 `-q/--quiet`, and `-v/--verbose` flags work as documented for `mb gen`. | 94 `-q/--quiet`, and `-v/--verbose` flags work as documented for `mb gen`. |
60 | 95 |
61 | |
62 ### `mb gen` | 96 ### `mb gen` |
63 | 97 |
64 `mb gen` is responsible for generating the Ninja files by invoking either GYP | 98 `mb gen` is responsible for generating the Ninja files by invoking either GYP |
65 or GN as appropriate. It takes arguments to specify a build config and | 99 or GN as appropriate. It takes arguments to specify a build config and |
66 a directory, then runs GYP or GN as appropriate: | 100 a directory, then runs GYP or GN as appropriate: |
67 | 101 |
68 ``` | 102 ``` |
69 % mb gen -m tryserver.chromium.linux -b linux_rel //out/Release | 103 % mb gen -m tryserver.chromium.linux -b linux_rel //out/Release |
70 % mb gen -c linux_rel_trybot //out/Release | 104 % mb gen -c linux_rel_trybot //out/Release |
71 ``` | 105 ``` |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 run than you expect; running `'mb -v'` will print what it's doing and | 270 run than you expect; running `'mb -v'` will print what it's doing and |
237 run the commands; `'mb -n'` will print what it will do but *not* run | 271 run the commands; `'mb -n'` will print what it will do but *not* run |
238 the commands. | 272 the commands. |
239 | 273 |
240 If you hit weirder things than that, add some print statements to the | 274 If you hit weirder things than that, add some print statements to the |
241 python script, send a question to gn-dev@chromium.org, or | 275 python script, send a question to gn-dev@chromium.org, or |
242 [file a bug](https://crbug.com/new) with the label | 276 [file a bug](https://crbug.com/new) with the label |
243 'mb' and cc: dpranke@chromium.org. | 277 'mb' and cc: dpranke@chromium.org. |
244 | 278 |
245 | 279 |
OLD | NEW |