summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractDependencyMojo.java3
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java10
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractNarMojo.java29
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Compiler.java18
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/Linker.java8
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java11
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java8
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java4
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java3
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarManager.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java7
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java2
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarUtil.java6
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarValidateMojo.java91
-rw-r--r--src/main/resources/META-INF/plexus/components.xml2
-rw-r--r--src/main/resources/org/apache/maven/plugin/nar/aol.properties14
25 files changed, 181 insertions, 55 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/AbstractDependencyMojo.java b/src/main/java/org/apache/maven/plugin/nar/AbstractDependencyMojo.java
index aade4c3..d318166 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractDependencyMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractDependencyMojo.java
@@ -20,6 +20,7 @@ package org.apache.maven.plugin.nar;
*/
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
/**
@@ -42,7 +43,7 @@ public abstract class AbstractDependencyMojo
}
protected final NarManager getNarManager()
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
return new NarManager( getLog(), getLocalRepository(), getMavenProject(), getArchitecture(), getOS(),
getLinker() );
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 fad2193..b68206d 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractGnuMojo.java
@@ -21,6 +21,7 @@ package org.apache.maven.plugin.nar;
import java.io.File;
+import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
/**
@@ -58,9 +59,10 @@ public abstract class AbstractGnuMojo
/**
* @return
* @throws MojoFailureException
+ * @throws MojoExecutionException
*/
protected final File getGnuAOLSourceDirectory()
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
return new File( getGnuAOLDirectory(), "src" );
}
@@ -68,9 +70,10 @@ public abstract class AbstractGnuMojo
/**
* @return
* @throws MojoFailureException
+ * @throws MojoExecutionException
*/
protected final File getGnuAOLTargetDirectory()
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
return new File( getGnuAOLDirectory(), "target" );
}
@@ -82,9 +85,10 @@ public abstract class AbstractGnuMojo
/**
* @return
* @throws MojoFailureException
+ * @throws MojoExecutionException
*/
private File getGnuAOLDirectory()
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
return new File( gnuTargetDirectory, getAOL().toString() );
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/AbstractNarMojo.java b/src/main/java/org/apache/maven/plugin/nar/AbstractNarMojo.java
index 2c4b5a6..5c6bdc1 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractNarMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractNarMojo.java
@@ -22,6 +22,7 @@ package org.apache.maven.plugin.nar;
import java.io.File;
import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
@@ -97,33 +98,45 @@ public abstract class AbstractNarMojo
* @required
*/
private MavenProject mavenProject;
+
+ private AOL aolId;
+ protected final void validate() throws MojoFailureException, MojoExecutionException {
+ linker = NarUtil.getLinker( linker );
+
+ architecture = NarUtil.getArchitecture( architecture );
+ os = NarUtil.getOS( os );
+ aolId = NarUtil.getAOL( architecture, os, linker, aol );
+
+ if ( targetDirectory == null )
+ {
+ targetDirectory = new File( mavenProject.getBuild().getDirectory(), "nar" );
+ }
+ }
+
protected final boolean shouldSkip()
{
return skip;
}
protected final String getArchitecture()
- {
- architecture = NarUtil.getArchitecture( architecture );
+ {
return architecture;
}
protected final String getOS()
{
- os = NarUtil.getOS( os );
return os;
}
protected final AOL getAOL()
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
- return NarUtil.getAOL( architecture, os, linker, aol );
+ return aolId;
}
protected final Linker getLinker()
{
- linker = NarUtil.getLinker( linker );
return linker;
}
@@ -139,10 +152,6 @@ public abstract class AbstractNarMojo
protected final File getTargetDirectory()
{
- if ( targetDirectory == null )
- {
- targetDirectory = new File( mavenProject.getBuild().getDirectory(), "nar" );
- }
return targetDirectory;
}
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 0c71aa2..33c0a8f 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Compiler.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Compiler.java
@@ -37,6 +37,7 @@ import net.sf.antcontrib.cpptasks.types.ConditionalFileSet;
import net.sf.antcontrib.cpptasks.types.DefineArgument;
import net.sf.antcontrib.cpptasks.types.DefineSet;
+import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.StringUtils;
@@ -228,14 +229,15 @@ public abstract class Compiler
private AbstractCompileMojo mojo;
- private static final String TEST = "test";
+ public static final String MAIN = "main";
+ public static final String TEST = "test";
protected Compiler()
{
}
- private String getName()
- throws MojoFailureException
+ public String getName()
+ throws MojoFailureException, MojoExecutionException
{
// adjust default values
if ( name == null )
@@ -331,13 +333,13 @@ public abstract class Compiler
}
public final Set getIncludes()
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
return getIncludes( "main" );
}
protected final Set getIncludes( String type )
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
Set result = new HashSet();
if ( !type.equals( TEST ) && !includes.isEmpty() )
@@ -360,7 +362,7 @@ public abstract class Compiler
}
protected final Set getExcludes()
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
Set result = new HashSet();
@@ -386,13 +388,13 @@ public abstract class Compiler
}
protected final String getPrefix()
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
return mojo.getAOL().getKey() + "." + getLanguage() + ".";
}
public final CompilerDef getCompiler( String type, String output )
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
String name = getName();
if (name == null) return null;
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 951e06b..053462d 100644
--- a/src/main/java/org/apache/maven/plugin/nar/Linker.java
+++ b/src/main/java/org/apache/maven/plugin/nar/Linker.java
@@ -155,9 +155,13 @@ public class Linker
{
this.name = name;
}
+
+ public final String getName() {
+ return name;
+ }
public final String getName( Properties defaults, String prefix )
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
if ( ( name == null ) && ( defaults != null ) && ( prefix != null ) )
{
@@ -165,7 +169,7 @@ public class Linker
}
if ( name == null )
{
- throw new MojoFailureException( "NAR: One of two things may be wrong here:\n\n"
+ throw new MojoExecutionException( "NAR: One of two things may be wrong here:\n\n"
+ "1. <Name> tag is missing inside the <Linker> tag of your NAR configuration\n\n"
+ "2. no linker is defined in the aol.properties file for '" + prefix + "linker'\n" );
}
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java
index c0dab04..846aba1 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java
@@ -65,6 +65,8 @@ public class NarAssemblyMojo
// NOTE: continue since the standard assemble mojo fails if we do
// not create the directories...
}
+
+ validate();
for ( Iterator j = classifiers.iterator(); j.hasNext(); )
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
index ddf1407..fcdd322 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
@@ -63,6 +63,8 @@ public class NarCompileMojo
return;
}
+ validate();
+
// make sure destination is there
getTargetDirectory().mkdirs();
@@ -96,7 +98,7 @@ public class NarCompileMojo
}
private List getSourcesFor( Compiler compiler )
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
try
{
@@ -185,14 +187,11 @@ public class NarCompileMojo
runtimeType.setValue( getRuntime( getAOL() ) );
task.setRuntime( runtimeType );
- int noOfCompilers = 0;
-
// add C++ compiler
CompilerDef cpp = getCpp().getCompiler( type, getOutput( getAOL() ) );
if ( cpp != null )
{
task.addConfiguredCompiler( cpp );
- noOfCompilers++;
}
// add C compiler
@@ -200,7 +199,6 @@ public class NarCompileMojo
if ( c != null )
{
task.addConfiguredCompiler( c );
- noOfCompilers++;
}
// add Fortran compiler
@@ -208,9 +206,8 @@ public class NarCompileMojo
if ( fortran != null )
{
task.addConfiguredCompiler( fortran );
- noOfCompilers++;
}
-
+
// add javah include path
File jniDirectory = getJavah().getJniDirectory();
if ( jniDirectory.exists() )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java
index 6f4ec41..ea049fa 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java
@@ -67,16 +67,12 @@ public class NarDownloadMojo
public final void execute()
throws MojoExecutionException, MojoFailureException
{
- getLog().info( "Using AOL: " + getAOL() );
-
if ( shouldSkip() )
{
- getLog().info( "***********************************************************************" );
- getLog().info( "NAR Plugin SKIPPED, no NAR Libraries will be produced." );
- getLog().info( "***********************************************************************" );
-
return;
}
+
+ validate();
List narArtifacts = getNarManager().getNarDependencies( "compile" );
if ( classifiers == null )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
index 5c312ce..c6f4eb4 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
@@ -62,6 +62,8 @@ public class NarGnuConfigureMojo
{
return;
}
+
+ validate();
if ( !useGnu() )
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
index b700c46..c99e0d3 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
@@ -43,6 +43,8 @@ public class NarGnuMakeMojo
return;
}
+ validate();
+
if ( !useGnu() )
{
return;
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java
index 85e342d..f919d92 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java
@@ -42,7 +42,9 @@ public class NarGnuProcess
{
return;
}
-
+
+ validate();
+
File srcDir = getGnuAOLTargetDirectory();
if ( srcDir.exists() )
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java b/src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java
index 574a93d..39eb3a5 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java
@@ -43,6 +43,8 @@ public class NarGnuResources
return;
}
+ validate();
+
if ( getGnuSourceDirectory().exists() )
{
int copied = 0;
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java
index 65515fa..28c47ee 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java
@@ -568,6 +568,9 @@ public class NarIntegrationTestMojo
public void execute()
throws MojoExecutionException, MojoFailureException
{
+ // DUNS
+ validate();
+
if ( verifyParameters() )
{
SurefireBooter surefireBooter = constructSurefireBooter();
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 9c5b420..c570461 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java
@@ -65,6 +65,8 @@ public class NarJavahMojo
return;
}
+ validate();
+
getJavah().execute();
}
} \ No newline at end of file
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 5bb83fc..e5414b6 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarManager.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarManager.java
@@ -65,7 +65,7 @@ public class NarManager
public NarManager( Log log, ArtifactRepository repository, MavenProject project, String architecture, String os,
Linker linker )
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
this.log = log;
this.repository = repository;
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java
index 1f21490..751f85c 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java
@@ -67,6 +67,8 @@ public class NarPackageMojo
{
return;
}
+
+ validate();
// Avoid that -DupdateReleaseInfo copies to a .nar file
getMavenProject().getArtifact().setArtifactHandler( narArtifactHandler );
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 d0db151..e3fcfe0 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
@@ -62,6 +62,8 @@ public class NarResourcesMojo
return;
}
+ validate();
+
// scan resourceDirectory for AOLs
File aolDir = new File( resourceDirectory, NarConstants.NAR_AOL );
if ( aolDir.exists() )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java
index bd37bc6..c778228 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java
@@ -47,6 +47,8 @@ public class NarSystemMojo
{
return;
}
+
+ validate();
// get packageName if specified for JNI.
String packageName = null;
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
index 5c2bd36..6fd47ac 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
@@ -57,6 +57,8 @@ public class NarTestCompileMojo
{
return;
}
+
+ validate();
// make sure destination is there
getTestTargetDirectory().mkdirs();
@@ -106,14 +108,11 @@ public class NarTestCompileMojo
runtimeType.setValue( getRuntime( getAOL() ) );
task.setRuntime( runtimeType );
- int noOfCompilers = 0;
-
// add C++ compiler
CompilerDef cpp = getCpp().getCompiler( type, test.getName() );
if ( cpp != null )
{
task.addConfiguredCompiler( cpp );
- noOfCompilers++;
}
// add C compiler
@@ -121,7 +120,6 @@ public class NarTestCompileMojo
if ( c != null )
{
task.addConfiguredCompiler( c );
- noOfCompilers++;
}
// add Fortran compiler
@@ -129,7 +127,6 @@ public class NarTestCompileMojo
if ( fortran != null )
{
task.addConfiguredCompiler( fortran );
- noOfCompilers++;
}
// add java include paths
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java
index f520c01..d361728 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java
@@ -60,6 +60,8 @@ public class NarTestMojo
return;
}
+ validate();
+
// run all tests
for ( Iterator i = getTests().iterator(); i.hasNext(); )
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java
index 265dbf1..0e9d347 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java
@@ -62,6 +62,8 @@ public class NarUnpackMojo
{
return;
}
+
+ validate();
List narArtifacts = getNarManager().getNarDependencies( "compile" );
if ( classifiers == null )
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 b3d6ac5..654883a 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
@@ -107,13 +107,13 @@ public final class NarUtil
}
public static String getLinkerName( String architecture, String os, Linker linker )
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
return getLinker( linker ).getName( getDefaults(), getArchitecture( architecture ) + "." + getOS( os ) + "." );
}
public static AOL getAOL( String architecture, String os, Linker linker, String aol )
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
// adjust aol
return aol == null ? new AOL( getArchitecture( architecture ), getOS( os ), getLinkerName( architecture, os,
@@ -123,7 +123,7 @@ public final class NarUtil
// FIXME, should go to AOL.
public static String getAOLKey( String architecture, String os, Linker linker )
- throws MojoFailureException
+ throws MojoFailureException, MojoExecutionException
{
// construct AOL key prefix
return getArchitecture( architecture ) + "." + getOS( os ) + "." + getLinkerName( architecture, os, linker )
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarValidateMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarValidateMojo.java
new file mode 100644
index 0000000..d6e0e48
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugin/nar/NarValidateMojo.java
@@ -0,0 +1,91 @@
+package org.apache.maven.plugin.nar;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Validates the configuration of the NAR project (aol and pom)
+ *
+ * @goal nar-validate
+ * @phase validate
+ * @requiresProject
+ * @author Mark Donszelmann
+ */
+public class NarValidateMojo
+ extends AbstractCompileMojo
+{
+ public final void execute()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( shouldSkip() )
+ {
+ getLog().info( "***********************************************************************" );
+ getLog().info( "NAR Plugin SKIPPED, no NAR Libraries will be produced." );
+ getLog().info( "***********************************************************************" );
+
+ return;
+ }
+
+ // first validate
+ validate();
+
+ // check aol
+ AOL aol = getAOL();
+ getLog().info( "Using AOL: " + aol );
+
+ // check linker exists in retrieving the version number
+ Linker linker = getLinker();
+ getLog().debug( "Using linker version: "+linker.getVersion());
+
+ // check compilers
+ int noOfCompilers = 0;
+ Compiler cpp = getCpp();
+ if (cpp.getName() != null) {
+ noOfCompilers++;
+ // need includes
+ if (cpp.getIncludes( Compiler.MAIN ).isEmpty()) {
+ throw new MojoExecutionException( "No includes defined for compiler "+cpp.getName() );
+ }
+ }
+ Compiler c = getC();
+ if (c.getName() != null) {
+ noOfCompilers++;
+ // need includes
+ if (c.getIncludes( Compiler.MAIN ).isEmpty()) {
+ throw new MojoExecutionException( "No includes defined for compiler "+c.getName() );
+ }
+ }
+ Compiler fortran = getCpp();
+ if (fortran.getName() != null) {
+ noOfCompilers++;
+ // need includes
+ if (fortran.getIncludes( Compiler.MAIN ).isEmpty()) {
+ throw new MojoExecutionException( "No includes defined for compiler "+fortran.getName() );
+ }
+ }
+
+ // at least one compiler has to be defined
+ if (noOfCompilers == 0) {
+ throw new MojoExecutionException( "No compilers defined for linker "+linker.getName() );
+ }
+ }
+}
diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml
index 9c52a8e..0308dc3 100644
--- a/src/main/resources/META-INF/plexus/components.xml
+++ b/src/main/resources/META-INF/plexus/components.xml
@@ -24,7 +24,7 @@
</implementation>
<configuration>
<phases>
- <validate></validate>
+ <validate>org.apache.maven.plugins:maven-nar-plugin:nar-validate</validate>
<initialize></initialize>
<generate-sources>org.apache.maven.plugins:maven-nar-plugin:nar-download,
org.apache.maven.plugins:maven-nar-plugin:nar-system-generate
diff --git a/src/main/resources/org/apache/maven/plugin/nar/aol.properties b/src/main/resources/org/apache/maven/plugin/nar/aol.properties
index 636b572..68a1f08 100644
--- a/src/main/resources/org/apache/maven/plugin/nar/aol.properties
+++ b/src/main/resources/org/apache/maven/plugin/nar/aol.properties
@@ -127,7 +127,7 @@ x86.Windows.g++.plugin.extension=dll
x86.Windows.g++.jni.extension=dll
x86.Windows.g++.executable.extension=
-# FIXME to be removed when NARPLUGIN-137
+# FIXME to be removed when NAR-6
x86.Windows.gcc.static.extension=a
x86.Windows.gcc.shared.extension=dll
x86.Windows.gcc.plugin.extension=dll
@@ -167,7 +167,7 @@ i386.Linux.g++.plugin.extension=so
i386.Linux.g++.jni.extension=so
i386.Linux.g++.executable.extension=
-# FIXME to be removed when NARPLUGIN-137
+# FIXME to be removed when NAR-6
i386.Linux.gcc.static.extension=a
i386.Linux.gcc.shared.extension=so
i386.Linux.gcc.plugin.extension=so
@@ -340,7 +340,7 @@ amd64.Linux.g++.plugin.extension=so
amd64.Linux.g++.jni.extension=so
amd64.Linux.g++.executable.extension=
-# FIXME to be removed when NARPLUGIN-137
+# FIXME to be removed when NAR-6
amd64.Linux.gcc.static.extension=a
amd64.Linux.gcc.shared.extension=so
amd64.Linux.gcc.plugin.extension=so
@@ -382,7 +382,7 @@ ppc.MacOSX.g++.plugin.extension=bundle
ppc.MacOSX.g++.jni.extension=jnilib
ppc.MacOSX.g++.executable.extension=
-# FIXME to be removed when NARPLUGIN-137
+# FIXME to be removed when NAR-6
ppc.MacOSX.gcc.static.extension=a
ppc.MacOSX.gcc.shared.extension=dylib
ppc.MacOSX.gcc.plugin.extension=bundle
@@ -424,7 +424,7 @@ i386.MacOSX.g++.plugin.extension=bundle
i386.MacOSX.g++.jni.extension=jnilib
i386.MacOSX.g++.executable.extension=
-# FIXME to be removed when NARPLUGIN-137
+# FIXME to be removed when NAR-6
i386.MacOSX.gcc.static.extension=a
i386.MacOSX.gcc.shared.extension=dylib
i386.MacOSX.gcc.plugin.extension=bundle
@@ -466,7 +466,7 @@ x86_64.MacOSX.g++.plugin.extension=bundle
x86_64.MacOSX.g++.jni.extension=jnilib
x86_64.MacOSX.g++.executable.extension=
-# FIXME to be removed when NARPLUGIN-137
+# FIXME to be removed when NAR-6
x86_64.MacOSX.gcc.static.extension=a
x86_64.MacOSX.gcc.shared.extension=dylib
x86_64.MacOSX.gcc.plugin.extension=bundle
@@ -510,7 +510,7 @@ sparc.SunOS.CC.plugin.extension=so
sparc.SunOS.CC.jni.extension=so
sparc.SunOS.CC.executable.extension=
-# FIXME to be removed when NARPLUGIN-137
+# FIXME to be removed when NAR-6
sparc.SunOS.cc.static.extension=a
sparc.SunOS.cc.shared.extension=so
sparc.SunOS.cc.plugin.extension=so