Blink bindings

73 views
Skip to first unread message

Kevin Bailey

unread,
Oct 5, 2016, 11:58:28 AM10/5/16
to chromium-mojo
In this document it says that having a build target of mojom("example_blink") will cause Blink bindings to be generated for an example.mojom file. I've tried this but it's not generating mojom-blink.h files.

I see under third_party/WebKit that many mojom-blink.h files get generated, apparently without a build file to specify a target name.

Has the policy described in the document been deprecated in favor of automatic generation under the Blink tree? Is there a way to generate them outside of Blink?

thx

Ken Rockot

unread,
Oct 5, 2016, 12:06:08 PM10/5/16
to Kevin Bailey, chromium-mojo
You only define the mojom("example") target. This template always generates (among others) two concrete targets: example and example_blink.

Dependents then depend on "example_blink" explicitly if they need the Blink variant.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.
To post to this group, send email to chromi...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-mojo/CAONXcNJvFg5Mi9HwL2vNT3KN9N5PPe_1gMWCrbGJZPGJSG1W2A%40mail.gmail.com.

Kevin Bailey

unread,
Oct 6, 2016, 12:16:24 PM10/6/16
to Ken Rockot, chromium-mojo
Almost got it, but it's a little more tricky than this. When specifying a dependency under third_party/WebKit (public/BUILD.gn), it will automatically add the "_blink", so we still just say, "example". However, while this fixes my compile problems, I now get link errors (for the symbols in what would be example.mojom-blink.cc). For the Android build, is there somewhere additional that I have to explicitly ask for "example_blink" ? Or is there a separate target for linking? I've already added "example_java" to chrome/android/BUILD.gn (and adding "example_blink" doesn't help.)

thx,
krb

Ken Rockot

unread,
Oct 6, 2016, 12:19:08 PM10/6/16
to Kevin Bailey, chromium-mojo

Kevin Bailey

unread,
Oct 6, 2016, 12:30:59 PM10/6/16
to Ken Rockot, chromium-mojo
Unfortunately, 'upload' is currently complaining about some dependencies. I'm working on them.

Ken Rockot

unread,
Oct 6, 2016, 12:31:48 PM10/6/16
to Kevin Bailey, chromium-mojo
you can always --bypass-hooks

Kevin Bailey

unread,
Oct 6, 2016, 12:49:03 PM10/6/16
to Ken Rockot, chromium-mojo
Handy; I didn't know about that. But I seem to have made it happy.


It's a bit large right now so here are the highlights:

third_party/WebKit/public/platform/modules/payments/payment_request.mojom moved to components/payments/
third_party/WebKit/public/BUILD.gn updated to point to it
chrome/android/BUILD.gn and chrome/browser/BUILD.gn might also be relevant ?

% ls -l out/Default/obj/components/payments/payment_request_blink_cpp_sources
total 608
-rw-r----- 1 krb eng 620836 Oct  6 09:01 payment_request.mojom-blink.o

It produces lots of:
../../third_party/WebKit/Source/modules/payments/PaymentRequest.cpp:157: error: undefined reference to 'blink::mojom::blink::Payment...

Colin Blundell

unread,
Oct 6, 2016, 1:09:28 PM10/6/16
to Kevin Bailey, Ken Rockot, chromium-mojo
What target are you building on which platform that generates the link errors?

you can always --bypass-hooks

krb


To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

To post to this group, send email to chromi...@chromium.org.

Kevin Bailey

unread,
Oct 6, 2016, 1:25:30 PM10/6/16
to Colin Blundell, Ken Rockot, chromium-mojo
chrome_public_apk on Android.

you can always --bypass-hooks

krb


To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.

To post to this group, send email to chromi...@chromium.org.

Colin Blundell

unread,
Oct 6, 2016, 3:28:51 PM10/6/16
to Kevin Bailey, Colin Blundell, Ken Rockot, chromium-mojo


You should depend on the new mojom target directly from the code using it, i.e., //third_party/WebKit/Sources/modules/payments/BUILD.gn. At least from that location, you need to specify the dependency using the "_blink" suffix.

Looking at how //third_party/WebKit/Sources/modules/vibration works will hopefully be useful if those changes alone don't solve the problem, as it's similar to what you're trying to do.

Best,

Colin

you can always --bypass-hooks

krb


To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

To post to this group, send email to chromi...@chromium.org.

Ken Rockot

unread,
Oct 6, 2016, 4:08:09 PM10/6/16
to Colin Blundell, Kevin Bailey, chromium-mojo
I don't see anything obviously wrong with your build rules. Let me try to repro locally.

Colin

you can always --bypass-hooks

krb


To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.

To post to this group, send email to chromi...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.

To post to this group, send email to chromi...@chromium.org.

Kevin Bailey

unread,
Oct 6, 2016, 4:13:21 PM10/6/16
to Ken Rockot, Colin Blundell, chromium-mojo
Hi Ken,

Colin's suggestion fixed it for me. It doesn't need the dependency in third_party/WebKit/public at all.

Thanks for looking at this everyone!

Kevin Bailey

unread,
Oct 20, 2016, 12:56:01 PM10/20/16
to Ken Rockot, Colin Blundell, chromium-mojo
I spoke too soon. The tests wouldn't link. I also had to add an explicit ("..._blink") dependency under third_party/WebKit/Source/modules/BUILD.gn:unit_tests. This makes no sense at all, when the files being tested already list the dependency. It sounds like build dependencies aren't transitive.

Ken Rockot

unread,
Oct 20, 2016, 1:19:06 PM10/20/16
to Kevin Bailey, Colin Blundell, chromium-mojo
On Thu, Oct 20, 2016 at 9:55 AM, Kevin Bailey <k...@chromium.org> wrote:
I spoke too soon. The tests wouldn't link. I also had to add an explicit ("..._blink") dependency under third_party/WebKit/Source/modules/BUILD.gn:unit_tests. This makes no sense at all, when the files being tested already list the dependency. It sounds like build dependencies aren't transitive.

Well, build dependencies are certainly transitive.

Could you update https://codereview.chromium.org/2373103002/ if it's not up to date?

Kevin Bailey

unread,
Oct 20, 2016, 1:30:59 PM10/20/16
to Ken Rockot, Colin Blundell, chromium-mojo
I split the CL. This https://codereview.chromium.org/2406923002/ has the essential part, and patch set 9 the latest fix.

Ken Rockot

unread,
Oct 20, 2016, 1:40:31 PM10/20/16
to Kevin Bailey, Colin Blundell, chromium-mojo
So it's not a dependency issue, it's a component build issue. In a component build, the Blink modules target is a shared library. Any of its dependencies which are not explicitly exported cannot be transitively depended upon (at link time) by the "modules" target's dependents.

Not sure what the right approach is here, but this sort of issue keeps popping up. Maybe we just need to support mojom targets-as-components.
Reply all
Reply to author
Forward
0 new messages