The GWT compile process has been taking longer and longer, as I’ve moved from 1.0 to 2.0, because they keep adding optimizations and functionality. You could deal with this in a number of ways. You could write less GWT. You could buy a faster computer.
More realistically, you could live in your IDE, and run in development (nee hosted) mode. However, sometimes you just have to test with javascript. The external browser development environment can be tough to set up correctly, especially if your application depends on external resources, and you can run into weird bugs. I’m currently dealing with an issue where I depend on an external library and it is consistently throwing an assertion exception in development but runs fine in production mode.
If I am compiling to javascript repeatedly, I often compile for just one user-agent, which saves about 80% of the compile time. When I have code more put together, I can compile for all other browsers. This process is not flawless, as I am currently debugging a cross browser issue (something that works fine on FF doesn’t work on Safari) but I probably wouldn’t have tested on Safari until after I was through the lion’s share of development anyway.
The way to target just one browser is to put this string in your module (.gwt.xml) file:
< set-property name="user.agent" value="safari,ie6,gecko1_8" / > (remove the spaces next to the angle brackets)
How do you find valid values? Via this thread, I found that you look in UserAgent.gwt.xml, part of the gwt-user.jar file. This has the javascript code that looks at navigator.userAgent
. It is not as fine grained as the ubiquitous browser detect script, but shows you what different browsers are known to GWT.
For other tips on speeding up the compile process, check out this series of posts.
[tags]gwt,user.agent,gwt compiler, slow as molasses[/tags]