0

[mojo][doc] Add info about mojom_component targets

Bug: 924272
Change-Id: If0a71bcb0782197b027ffec88428df36fde15803
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2718962
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#859892}
This commit is contained in:
Oksana Zhuravlova
2021-03-04 20:01:15 +00:00
committed by Chromium LUCI CQ
parent 93a6a75ed8
commit f337c28efb
2 changed files with 18 additions and 0 deletions
docs
mojo/public/tools/bindings

@ -40,6 +40,9 @@ style, your target should be named something simple and convenient (often
matching your directory name). If this is non-unique, override it with the
`output_name` variable.
**Note**: for information about `mojom_component` targets, see
[Mojo documentation](/mojo/public/tools/bindings/README.md#Component-targets).
### Dependencies between targets
When a component directly or indirectly depends on a static library or source

@ -746,6 +746,21 @@ struct NewStruct {
};
```
## Component targets
If there are multiple components depending on the same mojom target within one binary,
the target will need to be defined as `mojom_component` instead of `mojom`.
Since `mojom` targets are generated `source_set` targets and `mojom_component` targets
are generated `component` targets, you would use `mojom_component` in the same cases
where you would use `component` for non-mojom files.
*** note
**NOTE**: by default, components for both blink and non-blink bindings are generated.
Use the `disable_variants` target parameter to generate only non-blink bindings.
You can also generate a `source_set` for one of the variants by defining
[export_*](https://source.chromium.org/chromium/chromium/src/+/master:mojo/public/tools/bindings/mojom.gni;drc=739b9fbce50310c1dd2b59c279cd90a9319cb6e8;l=318)
parameters for the `mojom_component` target.
***
## Grammar Reference
Below is the (BNF-ish) context-free grammar of the Mojom language: