如何找到GWT排列的根本原因

时间:2014-01-21 19:10:55

标签: gwt

我有相当大的GWT项目,取决于许多第三方库。在编译应用程序的GWT部分时,我看到GWT编译器经历了10个排列。但我只针对5种不同的浏览器和一种语言环境进行编译。我怎样才能弄清楚导致每个排列的原因?是否有一些我可以启用的设置打印出编译时每个排列的内容。能给我输出的东西:

Compiling Permutation 0 - Browser ie8 and Locale En  ....
Compiling Permutation 1 - Browser ie9 and Locale En  ....

我的gwt.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<!--
  When updating your version of GWT, you should also update this DTD reference,
  so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN"
   "http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='LibraryPlace'>

   <inherits name="com.github.gwtbootstrap.BootstrapNoResources"/>
   <inherits name='com.biglibrary.libraryplace.model.LibraryModel'/>
   <inherits name="com.biglibrary.common.LiCommon"/>
   <inherits name="org.atmosphere.gwt20.AtmosphereGwt20"/>
   <inherits name='com.google.web.bindery.event.EventBinder'/>
   <inherits name="com.google.gwt.logging.Logging"/>

   <stylesheet src="/css/datepicker.css"/>

   <!-- LATO font -->
   <!--<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic">-->
   <!-- Bootstrap CSS -->
   <stylesheet src="http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic"/>
   <!--<stylesheet src="/css/bootstrap.css"/>
   <stylesheet src="/css/bootstrap-responsive.css"/>-->

   <stylesheet src="/css/toastr.css"/>
   <stylesheet src="/css/fullcalendar.css"/>
   <!-- Library Place New Custom CSS based on MyAdmin Theme Custom CSS -->
   <stylesheet src="/css/style.css"/>

   <stylesheet src="/css/clock/clock-style.css"/>


   <source path='resources'/>
   <replace-with class="com.biglibrary.libraryplace.resources.LibraryConfigurator">
      <when-type-is class="com.github.gwtbootstrap.client.ui.config.Configurator"/>
   </replace-with>
   <public path="resources">
      <exclude name="** /*.java"/>
      <exclude name="** /*.class"/>
   </public>


   <!-- Other module inherits-->
   <inherits name="de.devbliss.gwt.xdm.XDM"/>
   <inherits name="com.watopi.chosen.Chosen"/>

   <!-- enable @CORS annotations in restygwt -->
   <extend-configuration-property
      name="org.fusesource.restygwt.annotationresolver"
      value="org.fusesource.restygwt.rebind.CORSAnnotationResolver"/>

   <replace-with class="de.devbliss.gwt.xdm.client.impl.CORSTransportLayer">
      <when-type-is class="com.biglibrary.libraryplace.client.xdr.XDRTransportLayer"/>
      <any>
         <when-property-is name="user.agent"
                           value="gecko1_8"/>
         <when-property-is name="user.agent"
                           value="safari"/>
      </any>
   </replace-with>

   <inherits name="com.google.gwt.logging.Logging"/>

   <!-- gwt logging properties -->
   <set-property name="gwt.logging.logLevel"
                 value="FINE"/>

   <set-property name="gwt.logging.popupHandler"
                 value="ENABLED">
      <any>
         <when-property-is name="user.agent"
                           value="ie8"/>
         <when-property-is name="user.agent"
                           value="ie9"/>
      </any>
   </set-property>

   <!--Gives java like stack trace for errors that come up in js-->
   <set-property name="compiler.emulatedStack"
                 value="true"/>
   <set-configuration-property
      name="compiler.emulatedStack.recordFileNames"
      value="true"/>


   <!-- Specify the app entry point class.                         -->
   <entry-point class='com.biglibrary.libraryplace.client.LibraryPlace'/>

   <!--Chrome or Safari-->

   <set-property name="user.agent" value="opera,ie8, gecko1_8, safari, ie9"/>

   <!-- Specify the paths for translatable code                    -->
   <source path='client'/>

   <define-configuration-property name="gin.ginjector"
                                  is-multi-valued="false"/>
   <set-configuration-property name="gin.ginjector"
                               value="com.biglibrary.libraryplace.client.gin.AppGinjector"/>
   <!--
   Ensure Ui Binder files are using Safe HTML to prevent XSS.
   -->
   <set-configuration-property name="UiBinder.useSafeHtmlTemplates"
                               value="true"/>
   <!-- English language, independent of country. -->
   <extend-property name="locale"
                    values="en"/>

   <!-- Default language (English) -->
   <set-property-fallback name="locale"
                          value="en"/>

   <add-linker name="xsiframe"/>
   <set-configuration-property name="gwt.superdevmode"
                               value="on"/>
   <set-configuration-property name="devModeRedirectEnabled"
                               value="true"/>
   <set-property name="compiler.useSourceMaps"
                 value="true"/>
</module>

3 个答案:

答案 0 :(得分:5)

在使用xsiframe链接器编译项目时,您的javascript文件夹中会有一个compilation-mappings.txt文件。

它包含一个非常有用的列表,其中包含所有排列和触发每个排列的属性。

 F7437BC8947642CC76A8E491E7E52DB4.cache.js
 mgwt.os desktop
 user.agent safari 

 F7437BC8947642CC76A8E491E7E52DB4.cache.js
 mgwt.os desktop
 user.agent gecko1_8
 [...]

一旦您知道哪些属性产生了每个排列,您就可以深入了解*.gwt.xml个文件,以了解哪些属性正在增加排列数。

在你的情况下,如果你只使用en语言,最好不要设置它,因为gwt只编译default,否则它正在编译defaulten种语言。

减少排列的另一个有用选项是使用collapse-property功能。

 <collapse-property name="language" values="*" />

答案 1 :(得分:3)

我的猜测是,它正在为英语编译5x,为默认语言环境编译5x(也恰好是英语)。

答案 2 :(得分:2)

Thomas Broyer的评论让我发现GWT可以编写报告:

http://www.gwtproject.org/doc/latest/DevGuideCompileReport.html

它给了我一个很好的印刷品,说明为什么要创建每个排列。谢谢!