Ilya Lakhin
Ilya Lakhin

Reputation: 1964

GWT compilation on the fly

Is there a way to run Google Web Toolkit compiler directly from Java code to compile the source code made on the fly? In the same manner as javax.tools for example.

Upvotes: 2

Views: 412

Answers (2)

Chris Lercher
Chris Lercher

Reputation: 37788

I think so: com.google.gwt.dev.Compiler has a main method. Either call that method directly, or look into its code, and you should be able to build the CompilerOptions etc. yourself.

When you create a GWT project using webAppCreator, you get a build.xml with a gwtc target. This should help you with the classpath and the arguments you need to run the compiler.

Upvotes: 1

Hilbrand Bouwkamp
Hilbrand Bouwkamp

Reputation: 13519

GWT compiles all sources at once, because it compiles the result in one file and performs a lot of optimizations, like leaving out methods not used and inline methods to minimize the total size of the JavaScript file generated. A compilation step is therefor takes some time, so compilation on the fly would not be a workable solution.

Upvotes: 1

Related Questions