Skip to content

Commit

Permalink
MGWT-331: add new flags from GWT 2.5
Browse files Browse the repository at this point in the history
Namely: -XenableClosureCompiler and -XfragmentCount
Also adds -XcompilerMetrics and -XdisbaleAggressiveOptimization that were
present in earlier GWT versions but weren't exposed by the gwt-maven-plugin.
  • Loading branch information
tbroyer committed Jun 27, 2012
1 parent b835bd1 commit e9ca26c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/it/compile/pom.xml
Expand Up @@ -53,6 +53,10 @@
<deploy>${project.build.directory}/deploy</deploy>
<persistentunitcache>true</persistentunitcache>
<persistentunitcachedir>${project.build.directory}/persistentunitcache</persistentunitcachedir>
<enableClosureCompiler>true</enableClosureCompiler>
<disableAggressiveOptimization>true</disableAggressiveOptimization>
<compilerMetrics>true</compilerMetrics>
<fragmentCount>2</fragmentCount>
</configuration>
<executions>
<execution>
Expand Down
6 changes: 5 additions & 1 deletion src/it/compile/verify.groovy
Expand Up @@ -38,6 +38,10 @@ content = new File(basedir, 'build.log').text;
assert content.contains( '-draftCompile' );
assert content.contains( '-strict' );
assert content.contains( '-optimize 1' );
assert content.contains( '-Dgwt.persistentunitcache=true' )
assert content.contains( '-Dgwt.persistentunitcache=true' );
assert content.contains( '-XenableClosureCompiler' );
assert content.contains( '-XdisableAggressiveOptimization' );
assert content.contains( '-XcompilerMetrics' );
assert content.contains( '-XfragmentCount 2' );

return true;
49 changes: 48 additions & 1 deletion src/main/java/org/codehaus/mojo/gwt/shell/CompileMojo.java
Expand Up @@ -148,6 +148,9 @@ public class CompileMojo
* <p>
* Can be set from command line using '-Dgwt.draftCompile=true'.
* </p>
* <p>
* This is equivalent to '-Dgwt.compiler.optimizationLevel=0 -Dgwt.compiler.disableAggressiveOptimization=true'.
* </p>
*
* @parameter default-value="false" expression="${gwt.draftCompile}"
*/
Expand Down Expand Up @@ -219,6 +222,46 @@ public class CompileMojo
* @since 2.1.0-1
*/
private boolean strict;

/**
* EXPERIMENTAL: add -XenableClosureCompiler parameter to the compiler command line
* <p>
* Can be set from the command line using '-Dgwt.compiler.enableClosureCompiler=true'
* </p>
* @parameter default-value="false" expression="${gwt.compiler.enableClosureCompiler}"
* @since 2.5.0
*/
private boolean enableClosureCompiler;

/**
* EXPERIMENTAL: add -XdisableAggressiveOptimization parameter to the compiler command line
* <p>
* Can be set from the command line using '-Dgwt.compiler.disableAggressiveOptimization=true'
* </p>
* @parameter default-value="false" expression="${gwt.compiler.disableAggressiveOptimization}"
* @since 2.5.0
*/
private boolean disableAggressiveOptimization;

/**
* EXPERIMENTAL: add -XcompilerMetrics parameter to the compiler command line
* <p>
* Can be set from the command line using '-Dgwt.compiler.compilerMetrics=true'
* </p>
* @parameter default-value="false" expression="${gwt.compiler.compilerMetrics}"
* @since 2.5.0
*/
private boolean compilerMetrics;

/**
* EXPERIMENTAL: add -XfragmentCount parameter to the compiler command line
* <p>
* Can be set from the command line using '-Dgwt.compiler.fragmentCount=n'
* </p>
* @parameter default-value="-1" expression="${gwt.compiler.fragmentCount}"
* @since 2.5.0
*/
private int fragmentCount;

public void doExecute( )
throws MojoExecutionException, MojoFailureException
Expand Down Expand Up @@ -267,7 +310,11 @@ private void compile( String[] modules )
.arg( disableCastChecking, "-XdisableCastChecking" )
.arg( disableRunAsync, "-XdisableRunAsync" )
.arg( strict, "-strict" )
.arg( soycDetailed, "-XsoycDetailed" );
.arg( soycDetailed, "-XsoycDetailed" )
.arg( enableClosureCompiler, "-XenableClosureCompiler" )
.arg( compilerMetrics, "-XcompilerMetrics" )
.arg( disableAggressiveOptimization, "-XdisableAggressiveOptimization" )
.arg( "-XfragmentCount", String.valueOf( fragmentCount ) );


if ( optimizationLevel >= 0 )
Expand Down

0 comments on commit e9ca26c

Please sign in to comment.