Pergunta

I'm going to develop a system that generates gwt apps. These apps share a lot of widgets, and the compile time is very important for me. I'm wondering if I could prepare a set of widgets, wrap them in a module without an entrypoint, compile them just once and reuse the compiled code in others project in which other modules inherit from it.

  • ModuleA (only shared widgets)
  • Module1 (the rest of the app1, inherits from ModuleA).
  • Module2 (the rest of the app2, inherits from ModuleA).

can I compile Module2 without recompile ModuleA every time a new app is generated?

I also used superDevMode and all compilation optimizations, but this is become a principle issue :)

I don't care about GWT optimizations.

Thanks

Foi útil?

Solução

You cannot have compiled modules and call them from another modules without using jsni.

And even using jsni, you cannot pass objects between modules apart from primitive and Overlay types.

The best solution I see is that you could export the widgets from ModuleA to javascript using gwt-exporter, this tutorial I wrote some time ago could help you.

But after exporting your ModuleA as a javascript API, you have to wrap this api using jsni in GWT to call it from ModuleB and ModuleC.

IMHO, It's not worth the time you could save in the compilation of your ModuleB when you exclude your ModuleA.

Think that when you export the ModuleA, you have to compile everything although it is not used in ModuleB. Your code in ModuleB will be a mess if you have to interchange info with ModuleA using primitive and overlay types. An many other issues.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top