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.
A:
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.
Hilbrand
2010-07-14 09:04:35
Thanks for your response!Actually I'm working on IDE for GWT applications. Therefore compilation time is not important, but the able to running the GWT Compiler without command-line execution and XML configurations will be useful.
Eliah
2010-07-14 09:55:54
+1
A:
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.
Chris Lercher
2010-07-14 11:43:11