GWT compilation on the fly
Is there a way to run Google Web Toolkit compiler directly from Java code to compile th开发者_JS百科e source code made on the fly? In the same manner as javax.tools for example.
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.
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.
精彩评论