GWT compile的时间很长,编码》编译》测试》修改,这样的过程苦不堪言。
于是上网搜索了一下如何减少GWT Compile,尤其是针对dev mode。
发布的时候,多等一会其实影响不大。
言归正传,根据GWT的特性,主要有两个方面可以入手。
1. 更好的利用硬件
- 如果你使用Ant,如果有多个module需要编译,可以使用<pararell>来同时编译几个module。
- 使用-localWorkers参数,制定GWTC利用多个线程来进行compile。
2. 简化Permutation编译
默认,GWT会针对不同的浏览器,生成不同的代码,但是开发测试的时候,我们往往只用一种浏览器,比如Firefox。
- 通过在module.gwt.xml中添加user-agent属性,可以指定GWT只为特定浏览器生成页面和代码。针对Firefox,使用gecko1_8, 不要使用gecko。
- 还可以制定locale,减少编译输出的文件
- 使用-draftCompile参数
3. 参考:
- A Few Ways To Get Better GWT Compile Times
http://supplychaintechnology.wordpress.com/2010/06/04/gwt_compile_times/ - How to speed up the GWT compiler
http://bazoud.free.fr/post/2008/07/31/can-i-speed-up-the-gwt-compiler/ - Finding Supported GWT user.agent values
http://www.mooreds.com/wordpress/archives/574
http://stackoverflow.com/questions/890352/gwt-module-xml-how-to-redefine-and-use-more-than-one-user-agent