How do I disable pruning in the GWT compiler?
(I'm trying to use the GWT compiler to create a Javascript version of a some game logic written in Java)
Maybe pruning is not the issue? I'm testing with the following Java class and none of the fields or the string "test123" are in the generated .js file;
Test1.java
package com.joyplay.web.games.mmrb.shared.d1;
public class Test1 {
public String field1;
public int field2=0;
public void onModuleLoad() {
field1 = "test123";
}
public int doSomething1(int a){
return a+555;
}
public int doSomething2(){
return ++field2;
}
}
Test1.gwt.xml
<module rename-to="hello">
<inherits name="com.google.gwt.core.Core" />
开发者_运维问答 <source path="d1"/>
<entry-point class="com.joyplay.web.games.mmrb.shared.d1.Test1"/>
</module>
(I'm trying to use the GWT compiler to create a Javascript version of a some game logic written in Java)
Have a look at the gwt-exporter project.
GWT compiler will remove all of the code above, since it is doing nothing. You can turn off optimization using -draftCompile or -optimize 0 flags
Mainly this depends on how you build it.
For maven:
<gwt.jsStyle>PRETTY</gwt.jsStyle>
Or regarding to the official documentation:
-style Script output style: OBF[USCATED], PRETTY, or DETAILED (defaults to OBF)
精彩评论