Build Issues with importing another Mojo file

28 views
Skip to first unread message

George Benz

unread,
Nov 1, 2021, 2:28:59 PM11/1/21
to chromium-mojo
I am running into some errors while trying to import import `"components/media_router/common/mojom/media_router.mojom";` into the `chrome/browser/ui/webui/enterprise_casting/enterprise_casting.mojom` mojom file used by our UI.
```
ERROR Unresolved dependencies. //chrome/browser/ui/webui/enterprise_casting:mojo_bindings_webui_js(//build/toolchain/linux:clang_x64) needs //components/media_router/common/mojom:media_router_webui_js(//build/toolchain/linux:clang_x64)
```
This is what the chrome/browser/ui/webui/enterprise_casting/BUILD.gn file looks like:
```
mojom("mojo_bindings") { sources = ["enterprise_casting.mojom"] public_deps = [ "//components/media_router/common/mojom:media_router", ] webui_module_path = "/" disable_variants = true }
```
and the corresponding chrome/browser/resources/enterprise_casting/BUILD.gn
```
copy("copy_mojo") { deps = [ "//chrome/browser/ui/webui/enterprise_casting:mojo_bindings_webui_js" ] mojom_folder = "$root_gen_dir/mojom-webui/chrome/browser/ui/webui/enterprise_casting/" sources = [ "$mojom_folder/enterprise_casting.mojom-webui.js" ] outputs = [ "$target_gen_dir/{{source_file_part}}" ] }
```

You can also look at the patchset and reproduce the error here: https://chromium-review.googlesource.com/c/chromium/src/+/3252705.

I think this issue arises from the fact that WebUI generates JS from the mojoms its using. Since I am importing the media_router.mojom file, the WebUI is trying to import JS bindings that are explictly not generated by the media_router.mojom -- https://source.chromium.org/chromium/chromium/src/+/main:components/media_router/common/mojom/BUILD.gn;l=50

Any ideas how I should go about solving this problem? Thanks!
Reply all
Reply to author
Forward
0 new messages