{"id":574,"date":"2010-02-24T10:07:22","date_gmt":"2010-02-24T16:07:22","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/archives\/000574"},"modified":"2010-02-24T10:07:22","modified_gmt":"2010-02-24T16:07:22","slug":"finding-supported-gwt-useragent-values","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/574","title":{"rendered":"Finding supported GWT user.agent values"},"content":{"rendered":"<p>The GWT compile process has been taking longer and longer, as I&#8217;ve moved from 1.0 to 2.0, because they keep adding optimizations and functionality.\u00a0 You could deal with this in a number of ways.\u00a0 You could write less GWT.\u00a0 You could buy a faster computer.<\/p>\n<p>More realistically, you could live in your IDE, and run in development (nee hosted) mode.\u00a0 However, sometimes you just have to test with javascript.\u00a0 The <a href=\"http:\/\/code.google.com\/webtoolkit\/doc\/latest\/DevGuideCompilingAndDebugging.html#DevGuideDevMode\">external browser development environment<\/a> can be tough to set up correctly, especially if your application depends on external resources, and you can run into weird bugs.\u00a0 I&#8217;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.<\/p>\n<p>If I am compiling to javascript repeatedly, I often compile for just one user-agent, which saves about 80% of the compile time.\u00a0 When I have code more put together, I can compile for all other browsers.\u00a0 This process is not flawless, as I am currently debugging a cross browser issue (something that works fine on FF doesn&#8217;t work on Safari) but I probably wouldn&#8217;t have tested on Safari until after I was through the lion&#8217;s share of development anyway.<\/p>\n<p>The way to target just one browser is to put this string in your module (.gwt.xml) file:<\/p>\n<p>< set-property name=\"user.agent\" value=\"safari,ie6,gecko1_8\" \/ > (remove the spaces next to the angle brackets)<\/p>\n<p>How do you find valid values?\u00a0 Via <a href=\"http:\/\/groups.google.com\/group\/Google-Web-Toolkit\/browse_thread\/thread\/5ee4a86c60253931\">this thread<\/a>, I found that you look in UserAgent.gwt.xml, part of the gwt-user.jar file.\u00a0 This has the javascript code that looks at <code>navigator.userAgent<\/code>.\u00a0 It is not as fine grained as <a href=\"http:\/\/www.quirksmode.org\/js\/detect.html\">the ubiquitous browser detect script<\/a>, but shows you what different browsers are known to GWT.<\/p>\n<p>For other tips on speeding up the compile process, check out <a href=\"http:\/\/blog.bazoud.com\/post\/2008\/07\/31\/Can-I-speed-up-the-GWT-compiler\">this series of posts<\/a>.<\/p>\n<p>[tags]gwt,user.agent,gwt compiler, slow as molasses[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The GWT compile process has been taking longer and longer, as I&#8217;ve moved from 1.0 to 2.0, because they keep adding optimizations and functionality.\u00a0 You could deal with this in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,6],"tags":[],"class_list":["post-574","post","type-post","status-publish","format-standard","hentry","category-gwt","category-programming"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=574"}],"version-history":[{"count":0,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/574\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}