summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AOL.java26
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java8
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java8
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Compiler.java10
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Java.java6
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Javah.java16
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Linker.java6
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarArtifactHandler.java14
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarConstants.java8
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarInfo.java8
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java6
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarLayout20.java8
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarLayout21.java18
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarManager.java29
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarUtil.java18
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Test.java8
17 files changed, 109 insertions, 90 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/AOL.java b/src/main/java/org/apache/maven/plugin/nar/AOL.java
index 105fca9..e519026 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AOL.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AOL.java
@@ -35,15 +35,19 @@ public class AOL
// FIXME, need more complicated parsing for numbers as part of os.
public AOL( String aol )
{
- String[] aolString = aol.split( "-", 3 );
+ final int linkerIndex = 2;
+ final int osIndex = 1;
+ final int architectureIndex = 0;
+
+ String[] aolString = aol.split( "-", linkerIndex+1 );
switch ( aolString.length )
{
- case 3:
- linkerName = aolString[2];
- case 2:
- os = aolString[1];
- case 1:
- architecture = aolString[0];
+ case linkerIndex+1:
+ linkerName = aolString[linkerIndex];
+ case osIndex+1:
+ os = aolString[osIndex];
+ case architectureIndex+1:
+ architecture = aolString[architectureIndex];
break;
default:
@@ -62,13 +66,13 @@ public class AOL
* Returns an AOL string (arch-os-linker) to use as directory or file.
* @return dash separated AOL
*/
- public String toString()
+ public final String toString()
{
return architecture + ( ( os == null ) ? "" : "-" + os + ( ( linkerName == null ) ? "" : "-" + linkerName ) );
}
// FIXME, maybe change to something like isCompatible (AOL).
- public boolean hasLinker( String linker )
+ public final boolean hasLinker( String linker )
{
return linkerName.equals( linker );
}
@@ -77,12 +81,12 @@ public class AOL
* Returns an AOL key (arch.os.linker) to search in the properties files.
* @return dot separated AOL
*/
- public String getKey()
+ public final String getKey()
{
return architecture + ( ( os == null ) ? "" : "." + os + ( ( linkerName == null ) ? "" : "." + linkerName ) );
}
- String getOS() {
+ final String getOS() {
return os;
}
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java b/src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java
index 658b951..fad2193 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java
@@ -59,7 +59,7 @@ public abstract class AbstractGnuMojo
* @return
* @throws MojoFailureException
*/
- protected File getGnuAOLSourceDirectory()
+ protected final File getGnuAOLSourceDirectory()
throws MojoFailureException
{
return new File( getGnuAOLDirectory(), "src" );
@@ -69,13 +69,13 @@ public abstract class AbstractGnuMojo
* @return
* @throws MojoFailureException
*/
- protected File getGnuAOLTargetDirectory()
+ protected final File getGnuAOLTargetDirectory()
throws MojoFailureException
{
return new File( getGnuAOLDirectory(), "target" );
}
- protected File getGnuSourceDirectory() {
+ protected final File getGnuSourceDirectory() {
return gnuSourceDirectory;
}
@@ -94,7 +94,7 @@ public abstract class AbstractGnuMojo
*
* @return
*/
- protected boolean useGnu() {
+ protected final boolean useGnu() {
return gnuUseOnWindows || !OS.WINDOWS.equals(NarUtil.getOS( null ));
}
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java b/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java
index b889203..2aedf8b 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractResourcesMojo.java
@@ -72,7 +72,7 @@ public abstract class AbstractResourcesMojo
*/
private ArchiverManager archiverManager;
- protected int copyIncludes( File srcDir )
+ protected final int copyIncludes( File srcDir )
throws IOException, MojoExecutionException, MojoFailureException
{
int copied = 0;
@@ -89,7 +89,7 @@ public abstract class AbstractResourcesMojo
return copied;
}
- protected int copyBinaries( File srcDir, String aol )
+ protected final int copyBinaries( File srcDir, String aol )
throws IOException, MojoExecutionException, MojoFailureException
{
int copied = 0;
@@ -106,7 +106,7 @@ public abstract class AbstractResourcesMojo
return copied;
}
- protected int copyLibraries( File srcDir, String aol )
+ protected final int copyLibraries( File srcDir, String aol )
throws MojoFailureException, IOException, MojoExecutionException
{
int copied = 0;
@@ -139,7 +139,7 @@ public abstract class AbstractResourcesMojo
return copied;
}
- protected void copyResources( File srcDir, String aol )
+ protected final void copyResources( File srcDir, String aol )
throws MojoExecutionException, MojoFailureException
{
int copied = 0;
diff --git a/src/main/java/org/apache/maven/plugin/nar/Compiler.java b/src/main/java/org/apache/maven/plugin/nar/Compiler.java
index 2f340fc..3185201 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Compiler.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Compiler.java
@@ -220,6 +220,8 @@ public abstract class Compiler
private AbstractCompileMojo mojo;
+ private static final String TEST = "test";
+
protected Compiler()
{
}
@@ -239,7 +241,7 @@ public abstract class Compiler
List sourceDirectories = new ArrayList();
File baseDir = mojo.getMavenProject().getBasedir();
- if ( type.equals( "test" ) )
+ if ( type.equals( TEST ) )
{
if ( testSourceDirectory == null )
{
@@ -291,7 +293,7 @@ public abstract class Compiler
protected final List/* <String> */getIncludePaths( String type )
{
- return createIncludePaths( type, type.equals( "test" ) ? testIncludePaths : includePaths );
+ return createIncludePaths( type, type.equals( TEST ) ? testIncludePaths : includePaths );
}
private List/* <String> */createIncludePaths( String type, List paths )
@@ -317,7 +319,7 @@ public abstract class Compiler
throws MojoFailureException
{
Set result = new HashSet();
- if ( !type.equals( "test" ) && !includes.isEmpty() )
+ if ( !type.equals( TEST ) && !includes.isEmpty() )
{
result.addAll( includes );
}
@@ -587,7 +589,7 @@ public abstract class Compiler
}
// add other sources, FIXME seems
- if ( !type.equals( "test" ) )
+ if ( !type.equals( TEST ) )
{
for ( Iterator i = mojo.getMavenProject().getCompileSourceRoots().iterator(); i.hasNext(); )
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/Java.java b/src/main/java/org/apache/maven/plugin/nar/Java.java
index ec93775..4a61a53 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Java.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Java.java
@@ -85,12 +85,12 @@ public class Java
{
}
- public void setAbstractCompileMojo( AbstractCompileMojo mojo )
+ public final void setAbstractCompileMojo( AbstractCompileMojo mojo )
{
this.mojo = mojo;
}
- public void addIncludePaths( CCTask task, String outType )
+ public final void addIncludePaths( CCTask task, String outType )
throws MojoFailureException, MojoExecutionException
{
if ( include || mojo.getJavah().getJniDirectory().exists() )
@@ -120,7 +120,7 @@ public class Java
}
}
- public void addRuntime( CCTask task, File javaHome, String os, String prefix )
+ public final void addRuntime( CCTask task, File javaHome, String os, String prefix )
throws MojoFailureException
{
if ( link )
diff --git a/src/main/java/org/apache/maven/plugin/nar/Javah.java b/src/main/java/org/apache/maven/plugin/nar/Javah.java
index eeba43a..eba13e2 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Javah.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Javah.java
@@ -130,12 +130,12 @@ public class Javah
{
}
- public void setAbstractCompileMojo( AbstractCompileMojo mojo )
+ public final void setAbstractCompileMojo( AbstractCompileMojo mojo )
{
this.mojo = mojo;
}
- protected List getClassPaths()
+ protected final List getClassPaths()
throws MojoExecutionException
{
if ( classPaths.isEmpty() )
@@ -152,7 +152,7 @@ public class Javah
return classPaths;
}
- protected File getJniDirectory()
+ protected final File getJniDirectory()
{
if ( jniDirectory == null )
{
@@ -161,7 +161,7 @@ public class Javah
return jniDirectory;
}
- protected File getClassDirectory()
+ protected final File getClassDirectory()
{
if ( classDirectory == null )
{
@@ -170,7 +170,7 @@ public class Javah
return classDirectory;
}
- protected Set getIncludes()
+ protected final Set getIncludes()
{
if ( includes.isEmpty() )
{
@@ -179,7 +179,7 @@ public class Javah
return includes;
}
- protected File getTimestampDirectory()
+ protected final File getTimestampDirectory()
{
if ( timestampDirectory == null )
{
@@ -188,7 +188,7 @@ public class Javah
return timestampDirectory;
}
- protected File getTimestampFile()
+ protected final File getTimestampFile()
{
if ( timestampFile == null )
{
@@ -197,7 +197,7 @@ public class Javah
return timestampFile;
}
- public void execute()
+ public final void execute()
throws MojoExecutionException, MojoFailureException
{
getClassDirectory().mkdirs();
diff --git a/src/main/java/org/apache/maven/plugin/nar/Linker.java b/src/main/java/org/apache/maven/plugin/nar/Linker.java
index 42620ee..fa863eb 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Linker.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Linker.java
@@ -156,7 +156,7 @@ public class Linker
this.name = name;
}
- public String getName( Properties defaults, String prefix )
+ public final String getName( Properties defaults, String prefix )
throws MojoFailureException
{
if ( ( name == null ) && ( defaults != null ) && ( prefix != null ) )
@@ -172,7 +172,7 @@ public class Linker
return name;
}
- public String getVersion()
+ public final String getVersion()
throws MojoFailureException, MojoExecutionException
{
if ( name == null )
@@ -221,7 +221,7 @@ public class Linker
return version;
}
- public LinkerDef getLinker( AbstractCompileMojo mojo, Project antProject, String os, String prefix, String type )
+ public final LinkerDef getLinker( AbstractCompileMojo mojo, Project antProject, String os, String prefix, String type )
throws MojoFailureException, MojoExecutionException
{
if ( name == null )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarArtifactHandler.java b/src/main/java/org/apache/maven/plugin/nar/NarArtifactHandler.java
index 393129b..7d8304d 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarArtifactHandler.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarArtifactHandler.java
@@ -27,37 +27,37 @@ import org.apache.maven.artifact.handler.ArtifactHandler;
public class NarArtifactHandler
implements ArtifactHandler
{
- public String getPackaging()
+ public final String getPackaging()
{
return "nar";
}
- public String getClassifier()
+ public final String getClassifier()
{
return null;
}
- public String getDirectory()
+ public final String getDirectory()
{
return getExtension() + "s";
}
- public String getExtension()
+ public final String getExtension()
{
return "jar";
}
- public String getLanguage()
+ public final String getLanguage()
{
return "java";
}
- public boolean isAddedToClasspath()
+ public final boolean isAddedToClasspath()
{
return true;
}
- public boolean isIncludesDependencies()
+ public final boolean isIncludesDependencies()
{
return false;
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarConstants.java b/src/main/java/org/apache/maven/plugin/nar/NarConstants.java
index 97def90..5969c64 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarConstants.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarConstants.java
@@ -24,13 +24,17 @@ package org.apache.maven.plugin.nar;
*/
public interface NarConstants
{
- String NAR_EXTENSION = "nar";
+ String NAR = "nar";
+
+ String NAR_EXTENSION = NAR;
String NAR_NO_ARCH = "noarch";
+
+ String NAR_AOL = "aol";
String NAR_ROLE_HINT = "nar-library";
- String NAR_TYPE = "nar";
+ String NAR_TYPE = NAR;
int LOG_LEVEL_ERROR = 0;
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarInfo.java b/src/main/java/org/apache/maven/plugin/nar/NarInfo.java
index 845287a..1c6b116 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarInfo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarInfo.java
@@ -130,20 +130,20 @@ public class NarInfo
// FIXME replace with list of AttachedNarArtifacts
public final String[] getAttachedNars( AOL aol, String type )
{
- String attachedNars = getProperty( aol, "nar." + type );
+ String attachedNars = getProperty( aol, NarConstants.NAR+"." + type );
return attachedNars != null ? attachedNars.split( "," ) : null;
}
public final void addNar( AOL aol, String type, String nar )
{
- String nars = getProperty( aol, "nar." + type );
+ String nars = getProperty( aol, NarConstants.NAR+"." + type );
nars = ( nars == null ) ? nar : nars + ", " + nar;
- setProperty( aol, "nar." + type, nars );
+ setProperty( aol, NarConstants.NAR+"." + type, nars );
}
public final void setNar( AOL aol, String type, String nar )
{
- setProperty( aol, "nar." + type, nar );
+ setProperty( aol, NarConstants.NAR+"." + type, nar );
}
public AOL getAOL( AOL aol )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java
index e19310d..9c5b420 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java
@@ -49,15 +49,15 @@ public class NarJavahMojo
*/
private MavenSession session;
- protected ToolchainManager getToolchainManager() {
+ protected final ToolchainManager getToolchainManager() {
return toolchainManager;
}
- protected MavenSession getSession() {
+ protected final MavenSession getSession() {
return session;
}
- public void execute()
+ public final void execute()
throws MojoExecutionException, MojoFailureException
{
if ( shouldSkip() )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarLayout20.java b/src/main/java/org/apache/maven/plugin/nar/NarLayout20.java
index f011453..140007f 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarLayout20.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarLayout20.java
@@ -47,7 +47,7 @@ public class NarLayout20
* (non-Javadoc)
* @see org.apache.maven.plugin.nar.NarLayout#getIncludeDirectory(java.io.File)
*/
- public File getIncludeDirectory( File baseDir )
+ public final File getIncludeDirectory( File baseDir )
{
return new File( baseDir, "include" );
}
@@ -56,7 +56,7 @@ public class NarLayout20
* (non-Javadoc)
* @see org.apache.maven.plugin.nar.NarLayout#getLibDir(java.io.File, org.apache.maven.plugin.nar.AOL, String type)
*/
- public File getLibDirectory( File baseDir, String aol, String type ) throws MojoFailureException
+ public final File getLibDirectory( File baseDir, String aol, String type ) throws MojoFailureException
{
if ( type.equals( Library.EXECUTABLE ) )
{
@@ -73,7 +73,7 @@ public class NarLayout20
* (non-Javadoc)
* @see org.apache.maven.plugin.nar.NarLayout#getBinDirectory(java.io.File, java.lang.String)
*/
- public File getBinDirectory( File baseDir, String aol )
+ public final File getBinDirectory( File baseDir, String aol )
{
File dir = new File( baseDir, "bin" );
dir = new File( dir, aol );
@@ -85,7 +85,7 @@ public class NarLayout20
* @see org.apache.maven.plugin.nar.NarLayout#attachNars(java.io.File, org.apache.maven.project.MavenProjectHelper,
* org.apache.maven.project.MavenProject, org.apache.maven.plugin.nar.NarInfo)
*/
- public void attachNars( File baseDir, MavenProjectHelper projectHelper, MavenProject project, NarInfo narInfo )
+ public final void attachNars( File baseDir, MavenProjectHelper projectHelper, MavenProject project, NarInfo narInfo )
throws MojoExecutionException
{
if ( getIncludeDirectory( baseDir ).exists() )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarLayout21.java b/src/main/java/org/apache/maven/plugin/nar/NarLayout21.java
index 864748a..9968caf 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarLayout21.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarLayout21.java
@@ -43,12 +43,12 @@ public class NarLayout21
{
private File getNoarchDirectory( File baseDir )
{
- return new File( baseDir, "noarch" );
+ return new File( baseDir, NarConstants.NAR_NO_ARCH );
}
private File getAolDirectory( File baseDir )
{
- return new File( baseDir, "aol" );
+ return new File( baseDir, NarConstants.NAR_AOL );
}
private File getAolDirectory( File baseDir, String aol, String type )
@@ -60,7 +60,7 @@ public class NarLayout21
* (non-Javadoc)
* @see org.apache.maven.plugin.nar.NarLayout#getIncludeDirectory(java.io.File)
*/
- public File getIncludeDirectory( File baseDir )
+ public final File getIncludeDirectory( File baseDir )
{
return new File( getNoarchDirectory( baseDir ), "include" );
}
@@ -70,7 +70,7 @@ public class NarLayout21
* @see org.apache.maven.plugin.nar.NarLayout#getLibDir(java.io.File, org.apache.maven.plugin.nar.AOL,
* java.lang.String)
*/
- public File getLibDirectory( File baseDir, String aol, String type )
+ public final File getLibDirectory( File baseDir, String aol, String type )
throws MojoExecutionException
{
if ( type.equals( Library.EXECUTABLE ) )
@@ -91,7 +91,7 @@ public class NarLayout21
* @see org.apache.maven.plugin.nar.NarLayout#getLibDir(java.io.File, org.apache.maven.plugin.nar.AOL,
* java.lang.String)
*/
- public File getBinDirectory( File baseDir, String aol )
+ public final File getBinDirectory( File baseDir, String aol )
{
File dir = getAolDirectory( baseDir, aol, Library.EXECUTABLE );
dir = new File( dir, "bin" );
@@ -104,14 +104,14 @@ public class NarLayout21
* @see org.apache.maven.plugin.nar.NarLayout#attachNars(java.io.File, org.apache.maven.project.MavenProjectHelper,
* org.apache.maven.project.MavenProject, org.apache.maven.plugin.nar.NarInfo)
*/
- public void attachNars( File baseDir, MavenProjectHelper projectHelper, MavenProject project, NarInfo narInfo )
+ public final void attachNars( File baseDir, MavenProjectHelper projectHelper, MavenProject project, NarInfo narInfo )
throws MojoExecutionException
{
if ( getNoarchDirectory( baseDir ).exists() )
{
- attachNar( projectHelper, project, "noarch", getNoarchDirectory( baseDir ), "*/**" );
- narInfo.setNar( null, "noarch", project.getGroupId() + ":" + project.getArtifactId() + ":"
- + NarConstants.NAR_TYPE + ":" + "noarch" );
+ attachNar( projectHelper, project, NarConstants.NAR_NO_ARCH, getNoarchDirectory( baseDir ), "*/**" );
+ narInfo.setNar( null, NarConstants.NAR_NO_ARCH, project.getGroupId() + ":" + project.getArtifactId() + ":"
+ + NarConstants.NAR_TYPE + ":" + NarConstants.NAR_NO_ARCH );
}
File classifierDir = getAolDirectory( baseDir );
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarManager.java b/src/main/java/org/apache/maven/plugin/nar/NarManager.java
index 21b0060..904550e 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarManager.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarManager.java
@@ -24,9 +24,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.LinkedList;
import java.util.jar.JarFile;
import org.apache.maven.artifact.Artifact;
@@ -61,7 +61,7 @@ public class NarManager
private String linkerName;
- private String[] narTypes = { "noarch", Library.STATIC, Library.SHARED, Library.JNI, Library.PLUGIN };
+ private String[] narTypes = { NarConstants.NAR_NO_ARCH, Library.STATIC, Library.SHARED, Library.JNI, Library.PLUGIN };
public NarManager( Log log, ArtifactRepository repository, MavenProject project, String architecture, String os,
Linker linker )
@@ -179,17 +179,17 @@ public class NarManager
NarInfo narInfo = getNarInfo( dependency );
if ( noarch )
{
- artifactList.addAll( getAttachedNarDependencies( dependency, null, "noarch" ) );
+ artifactList.addAll( getAttachedNarDependencies( dependency, null, NarConstants.NAR_NO_ARCH ) );
}
// use preferred binding, unless non existing.
- String binding = narInfo.getBinding( aol, type != null ? type : "static" );
+ String binding = narInfo.getBinding( aol, type != null ? type : Library.STATIC );
// FIXME kludge, but does not work anymore since AOL is now a class
- if ( aol.equals( "noarch" ) )
+ if ( aol.equals( NarConstants.NAR_NO_ARCH ) )
{
// FIXME no handling of local
- artifactList.addAll( getAttachedNarDependencies( dependency, null, "noarch" ) );
+ artifactList.addAll( getAttachedNarDependencies( dependency, null, NarConstants.NAR_NO_ARCH ) );
}
else
{
@@ -309,11 +309,11 @@ public class NarManager
private List getDependencies( String scope )
{
- if ( scope.equals( "test" ) )
+ if ( scope.equals( Artifact.SCOPE_TEST ) )
{
return project.getTestArtifacts();
}
- else if ( scope.equals( "runtime" ) )
+ else if ( scope.equals( Artifact.SCOPE_RUNTIME ) )
{
return project.getRuntimeArtifacts();
}
@@ -397,25 +397,28 @@ public class NarManager
{
try
{
+ final String gpp = "g++";
+ final String gcc = "gcc";
+
unpackNar( manager, file, narLocation );
if ( !NarUtil.getOS( os ).equals( OS.WINDOWS ) )
{
NarUtil.makeExecutable( new File( narLocation, "bin/" + defaultAOL ), log );
// FIXME clumsy
- if ( defaultAOL.hasLinker( "g++" ) )
+ if ( defaultAOL.hasLinker( gpp ) )
{
NarUtil.makeExecutable( new File( narLocation, "bin/"
- + NarUtil.replace( "g++", "gcc", defaultAOL.toString() ) ), log );
+ + NarUtil.replace( gpp, gcc, defaultAOL.toString() ) ), log );
}
}
- if ( linkerName.equals( "gcc" ) || linkerName.equals( "g++" ) )
+ if ( linkerName.equals( gcc ) || linkerName.equals( gpp ) )
{
NarUtil.runRanlib( new File( narLocation, "lib/" + defaultAOL ), log );
// FIXME clumsy
- if ( defaultAOL.hasLinker( "g++" ) )
+ if ( defaultAOL.hasLinker( gpp ) )
{
NarUtil.runRanlib( new File( narLocation, "lib/"
- + NarUtil.replace( "g++", "gcc", defaultAOL.toString() ) ), log );
+ + NarUtil.replace( gpp, gcc, defaultAOL.toString() ) ), log );
}
}
FileUtils.fileDelete( flagFile.getPath() );
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
index 1f2d5ae..cecb138 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
@@ -63,7 +63,7 @@ public class NarResourcesMojo
}
// scan resourceDirectory for AOLs
- File aolDir = new File( resourceDirectory, "aol" );
+ File aolDir = new File( resourceDirectory, NarConstants.NAR_AOL );
if ( aolDir.exists() )
{
String[] aol = aolDir.list();
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
index 773feae..62817f1 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
@@ -257,24 +257,30 @@ public final class NarUtil
/* for jdk 1.4 */
private static String quote( String s )
{
- int slashEIndex = s.indexOf( "\\E" );
+ final String escQ = "\\Q";
+ final String escE = "\\E";
+
+ int slashEIndex = s.indexOf( escE );
if ( slashEIndex == -1 )
{
- return "\\Q" + s + "\\E";
+ return escQ + s + escE;
}
StringBuffer sb = new StringBuffer( s.length() * 2 );
- sb.append( "\\Q" );
+ sb.append( escQ );
slashEIndex = 0;
int current = 0;
- while ( ( slashEIndex = s.indexOf( "\\E", current ) ) != -1 )
+ while ( ( slashEIndex = s.indexOf( escE, current ) ) != -1 )
{
sb.append( s.substring( current, slashEIndex ) );
current = slashEIndex + 2;
- sb.append( "\\E\\\\E\\Q" );
+ sb.append( escE );
+ sb.append( "\\" );
+ sb.append( escE );
+ sb.append( escQ );
}
sb.append( s.substring( current, s.length() ) );
- sb.append( "\\E" );
+ sb.append( escE );
return sb.toString();
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/Test.java b/src/main/java/org/apache/maven/plugin/nar/Test.java
index 1bc8838..068a72e 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Test.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Test.java
@@ -62,7 +62,7 @@ public class Test
*/
private List/* <String> */args = new ArrayList();
- public String getName()
+ public final String getName()
throws MojoFailureException
{
if ( name == null )
@@ -72,17 +72,17 @@ public class Test
return name;
}
- public String getLink()
+ public final String getLink()
{
return link;
}
- public boolean shouldRun()
+ public final boolean shouldRun()
{
return run;
}
- public List/* <String> */getArgs()
+ public final List/* <String> */getArgs()
{
return args;
}