mojom() template should not generate all languages by default. |
|||||||||
Issue descriptionMy motivation for this change is from the .mojom.js that is added as a runtime_dep to every target. It's only necessary if the client uses the .js bindings *and* doesn't ship the bindings via a .pak file. As suggested in https://codereview.chromium.org/1875213002/ It would be better to have: mojom("foo") { sources=["foo.mojom"] language = ["cpp"] } So that mojom wouldn't generate unused bindings by default.
,
Apr 14 2016
I would prefer generating a separate foo_js target containing the generated .mojom.js files. Then a target that needs the generated JS bindings would add that target as a data dependency. It probably would be nicer to have users of the JS bindings be explicit about their dependencies.
,
May 3 2016
,
Jul 11 2016
,
Sep 29 2016
Looks like there are close to 100 android_library() targets that are not used by any android_apk() target. Most of these are from mojo. Our builders build all targets, so it'd be really nice to not generate these unused targets (hard to really say how much it's slowing us down without actually doing it. With a call to action to have more things converted to Mojo, this will just keep getting worse :(.
,
Jan 9 2017
,
Jul 26 2017
This is now creating a lot of unused java targets, which are much more heavy-weight than native targets.
I added a print(target_name) to the android_library() within mojom(), and found there are 153 mojom java libraries that are defined.
I then guarded the android_library behind a crude whitelist:
if (target_gen_dir == "$root_gen_dir/components/payments/mojom" ||
target_gen_dir == "$root_gen_dir/media/mojo/interfaces" ||
target_gen_dir == "$root_gen_dir/mojo/common" ||
target_gen_dir == "$root_gen_dir/mojo/public/interfaces/bindings/tests" ||
target_gen_dir == "$root_gen_dir/services/device/public/interfaces" ||
target_gen_dir == "$root_gen_dir/services/service_manager/public/interfaces" ||
target_gen_dir == "$root_gen_dir/services/shape_detection/public/interfaces" ||
target_gen_dir == "$root_gen_dir/skia/public/interfaces" ||
target_gen_dir == "$root_gen_dir/third_party/WebKit/public" ||
target_gen_dir == "$root_gen_dir/ui/base/mojo" ||
target_gen_dir == "$root_gen_dir/ui/gfx/geometry/mojo" ||
target_gen_dir == "$root_gen_dir/ui/latency/mojo" ||
target_gen_dir == "$root_gen_dir/ui/gfx/mojo" ||
target_gen_dir == "$root_gen_dir/device/bluetooth/public/interfaces" ||
target_gen_dir == "$root_gen_dir/device/screen_orientation/public/interfaces" ||
target_gen_dir == "$root_gen_dir/cc/ipc" ||
target_gen_dir == "$root_gen_dir/gpu/ipc/common" ||
target_gen_dir == "$root_gen_dir/services/shape_detection/public/interfaces" ||
target_gen_dir == "$root_gen_dir/url/mojo") {
And only 53 targets are defined (based on the crude whitelist, some of these may also be unused).
Furthermore, the status message went from:
Done. Made 16339 targets from 1246 files in 4050ms
To:
Done. Made 15339 targets from 1246 files in 4180ms
Somewhat easy math here :P. I trimmed exactly 100 targets, and that resulted in exactly 1000 fewer ninja targets.
Note that our bots build all defined targets, so these unused 1000 targets are also consuming compile time on the bots.
,
Jul 26 2017
+1 to only generate Java bindings when needed.
,
Jul 27
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Nov 14
This was fixed quite a while ago. We only generate C++ bindings by default, and we have explicitly suffixed (e.g. _js, _java) target names for the other languages.
,
Nov 16
I don't think this is fixed: https://cs.chromium.org/chromium/src/mojo/public/tools/bindings/mojom.gni?rcl=e7c85230ef5c8c4a9e11a1c0e8ba19f6af955239&l=1053 The template still generates _java targets for all mojom regardless of whether anyone uses them. The ask here is essentially to have "cpp_only=true" be the default.
,
Dec 3
The bug was that the mojom build rules were generating actual *sources* for other languages. I don't see why generating the *targets* themselves is problematic if they aren't actually reachable in the build. This should have negligible overhead. Am I missing some reason why they are problematic?
,
Dec 3
There are two motivations that I see: 1. GN has to generated targets that are not needed. Because android_library() is a fairly complicated template, having a lot of unused targets can unnecessarily slow down "gn gen". Timings for "gn gen" with target_os = "linux" vs "android": 3535ms, 5387ms 2. Many builders build all targets, and so are slowed down a bit when there are unused templates that exist. Personally I think #1 is the bigger issue, since #2 only affects bots. Neither one of them is super important, which is why that it's fine this bug has remained unfixed for so long.
,
Dec 3
|
|||||||||
►
Sign in to add a comment |
|||||||||
Comment 1 by yzshen@chromium.org
, Apr 13 2016