From e9ca26c0dd60ac196dfb4390cf7352bd7f834821 Mon Sep 17 00:00:00 2001 From: Thomas Broyer Date: Thu, 28 Jun 2012 01:15:02 +0200 Subject: [PATCH] MGWT-331: add new flags from GWT 2.5 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. --- src/it/compile/pom.xml | 4 ++ src/it/compile/verify.groovy | 6 ++- .../codehaus/mojo/gwt/shell/CompileMojo.java | 49 ++++++++++++++++++- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/src/it/compile/pom.xml b/src/it/compile/pom.xml index cfb3ef41..b1b2ab06 100644 --- a/src/it/compile/pom.xml +++ b/src/it/compile/pom.xml @@ -53,6 +53,10 @@ ${project.build.directory}/deploy true ${project.build.directory}/persistentunitcache + true + true + true + 2 diff --git a/src/it/compile/verify.groovy b/src/it/compile/verify.groovy index 6a6250da..64a1947b 100644 --- a/src/it/compile/verify.groovy +++ b/src/it/compile/verify.groovy @@ -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; diff --git a/src/main/java/org/codehaus/mojo/gwt/shell/CompileMojo.java b/src/main/java/org/codehaus/mojo/gwt/shell/CompileMojo.java index 8d46b15e..71d443f0 100644 --- a/src/main/java/org/codehaus/mojo/gwt/shell/CompileMojo.java +++ b/src/main/java/org/codehaus/mojo/gwt/shell/CompileMojo.java @@ -148,6 +148,9 @@ public class CompileMojo *

* Can be set from command line using '-Dgwt.draftCompile=true'. *

+ *

+ * This is equivalent to '-Dgwt.compiler.optimizationLevel=0 -Dgwt.compiler.disableAggressiveOptimization=true'. + *

* * @parameter default-value="false" expression="${gwt.draftCompile}" */ @@ -219,6 +222,46 @@ public class CompileMojo * @since 2.1.0-1 */ private boolean strict; + + /** + * EXPERIMENTAL: add -XenableClosureCompiler parameter to the compiler command line + *

+ * Can be set from the command line using '-Dgwt.compiler.enableClosureCompiler=true' + *

+ * @parameter default-value="false" expression="${gwt.compiler.enableClosureCompiler}" + * @since 2.5.0 + */ + private boolean enableClosureCompiler; + + /** + * EXPERIMENTAL: add -XdisableAggressiveOptimization parameter to the compiler command line + *

+ * Can be set from the command line using '-Dgwt.compiler.disableAggressiveOptimization=true' + *

+ * @parameter default-value="false" expression="${gwt.compiler.disableAggressiveOptimization}" + * @since 2.5.0 + */ + private boolean disableAggressiveOptimization; + + /** + * EXPERIMENTAL: add -XcompilerMetrics parameter to the compiler command line + *

+ * Can be set from the command line using '-Dgwt.compiler.compilerMetrics=true' + *

+ * @parameter default-value="false" expression="${gwt.compiler.compilerMetrics}" + * @since 2.5.0 + */ + private boolean compilerMetrics; + + /** + * EXPERIMENTAL: add -XfragmentCount parameter to the compiler command line + *

+ * Can be set from the command line using '-Dgwt.compiler.fragmentCount=n' + *

+ * @parameter default-value="-1" expression="${gwt.compiler.fragmentCount}" + * @since 2.5.0 + */ + private int fragmentCount; public void doExecute( ) throws MojoExecutionException, MojoFailureException @@ -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 )