You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/24 01:21:46 UTC
svn commit: r327878 - in
/maven/components/trunk/maven-plugins/maven-compiler-plugin: pom.xml
src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
Author: brett
Date: Sun Oct 23 16:21:43 2005
New Revision: 327878
URL: http://svn.apache.org/viewcvs?rev=327878&view=rev
Log:
PR: MNG-976
Submitted by: Lester Ecarma
Reviewed by: Brett Porter
add meminitial and maxmem settings to the forking compiler
Modified:
maven/components/trunk/maven-plugins/maven-compiler-plugin/pom.xml
maven/components/trunk/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java (contents, props changed)
Modified: maven/components/trunk/maven-plugins/maven-compiler-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-compiler-plugin/pom.xml?rev=327878&r1=327877&r2=327878&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-compiler-plugin/pom.xml (original)
+++ maven/components/trunk/maven-plugins/maven-compiler-plugin/pom.xml Sun Oct 23 16:21:43 2005
@@ -13,18 +13,23 @@
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-api</artifactId>
- <version>1.5.1</version>
+ <version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-manager</artifactId>
- <version>1.5.1</version>
+ <version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac</artifactId>
- <version>1.5.1</version>
+ <version>1.6-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
@@ -33,4 +38,4 @@
<version>2.0</version>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
Modified: maven/components/trunk/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java?rev=327878&r1=327877&r2=327878&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java Sun Oct 23 16:21:43 2005
@@ -28,6 +28,7 @@
import org.codehaus.plexus.compiler.util.scan.mapping.SingleTargetSourceMapping;
import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
+import org.codehaus.plexus.util.StringUtils;
import java.io.File;
import java.util.ArrayList;
@@ -145,6 +146,20 @@
private boolean fork;
/**
+ * Initial size, in megabytes, of the memory allocation pool, ex. "64", "64m".
+ *
+ * @parameter
+ */
+ private String meminitial;
+
+ /**
+ * maximum size, in megabytes, of the memory allocation pool, ex. "128", "128m".
+ *
+ * @parameter
+ */
+ private String maxmem;
+
+ /**
* The executable of the compiler to use.
*
* @parameter
@@ -296,6 +311,37 @@
compilerConfiguration.setFork( fork );
+ if( fork )
+ {
+ if ( !StringUtils.isEmpty( meminitial ) )
+ {
+ String value = getMemoryValue( meminitial );
+
+ if ( value != null )
+ {
+ compilerConfiguration.setMeminitial( value );
+ }
+ else
+ {
+ getLog().info( "Invalid value for meminitial '" + meminitial + "'. Ignoring this option." );
+ }
+ }
+
+ if ( !StringUtils.isEmpty( maxmem ) )
+ {
+ String value = getMemoryValue( maxmem );
+
+ if ( value != null )
+ {
+ compilerConfiguration.setMaxmem( value );
+ }
+ else
+ {
+ getLog().info( "Invalid value for maxmem '" + maxmem + "'. Ignoring this option." );
+ }
+ }
+ }
+
compilerConfiguration.setExecutable( executable );
compilerConfiguration.setWorkingDirectory( basedir );
@@ -437,6 +483,38 @@
getLog().warn( message.toString() );
}
}
+ }
+
+ private String getMemoryValue( String setting )
+ {
+ String value = null;
+
+ // Allow '128' or '128m'
+ if ( isDigits( setting ) )
+ {
+ value = setting + "m";
+ }
+ else
+ {
+ if ( ( isDigits( setting.substring( 0, setting.length() - 1 ) ) ) &&
+ ( setting.toLowerCase().endsWith( "m" ) ) )
+ {
+ value = setting;
+ }
+ }
+ return value;
+ }
+
+ private boolean isDigits( String string )
+ {
+ for ( int i = 0; i < string.length(); i++ )
+ {
+ if ( !Character.isDigit( string.charAt( i ) ) )
+ {
+ return false;
+ }
+ }
+ return true;
}
private Set computeStaleSources( CompilerConfiguration compilerConfiguration, Compiler compiler,
Propchange: maven/components/trunk/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
------------------------------------------------------------------------------
svn:eol-style = native