summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/it/it0019-compiler/pom.xml67
-rw-r--r--src/it/it0019-compiler/src/main/c/Executable.c27
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/AbstractNarMojo.java61
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java31
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java8
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java11
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java9
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarValidateMojo.java16
-rw-r--r--src/site/apt/configuration.apt1
20 files changed, 169 insertions, 161 deletions
diff --git a/src/it/it0019-compiler/pom.xml b/src/it/it0019-compiler/pom.xml
new file mode 100644
index 0000000..40c199b
--- /dev/null
+++ b/src/it/it0019-compiler/pom.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.its.nar</groupId>
+ <artifactId>it-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../it-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>it0019-compiler</artifactId>
+ <packaging>nar</packaging>
+
+ <name>Maven NAR Compiler Test</name>
+ <version>1.0-SNAPSHOT</version>
+ <description>
+ Compiler Configuration Test
+ </description>
+ <url>http://maven.apache.org/</url>
+
+ <properties>
+ <skipTests>true</skipTests>
+ </properties>
+
+ <build>
+ <defaultGoal>integration-test</defaultGoal>
+ <plugins>
+ <plugin>
+ <artifactId>maven-nar-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <ignore>true</ignore>
+ <linker>
+ <name>icc</name>
+ </linker>
+ <libraries>
+ <library>
+ <type>executable</type>
+ <run>true</run>
+ </library>
+ </libraries>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/it0019-compiler/src/main/c/Executable.c b/src/it/it0019-compiler/src/main/c/Executable.c
new file mode 100644
index 0000000..19afb26
--- /dev/null
+++ b/src/it/it0019-compiler/src/main/c/Executable.c
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+
+int main(int argc, char *argv[]) {
+ printf("Helloworld\n");
+ return 0;
+}
+
+
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 5c6bdc1..3725d71 100644
--- a/src/main/java/org/apache/maven/plugin/nar/AbstractNarMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/AbstractNarMojo.java
@@ -42,6 +42,13 @@ public abstract class AbstractNarMojo
private boolean skip;
/**
+ * Ignore errors and failures.
+ *
+ * @parameter expression="${nar.ignore}" default-value="false"
+ */
+ private boolean ignore;
+
+ /**
* The Architecture for the nar, Some choices are: "x86", "i386", "amd64", "ppc", "sparc", ... Defaults to a derived
* value from ${os.arch}
*
@@ -98,10 +105,12 @@ public abstract class AbstractNarMojo
* @required
*/
private MavenProject mavenProject;
-
+
private AOL aolId;
- protected final void validate() throws MojoFailureException, MojoExecutionException {
+ protected final void validate()
+ throws MojoFailureException, MojoExecutionException
+ {
linker = NarUtil.getLinker( linker );
architecture = NarUtil.getArchitecture( architecture );
@@ -113,14 +122,9 @@ public abstract class AbstractNarMojo
targetDirectory = new File( mavenProject.getBuild().getDirectory(), "nar" );
}
}
-
- protected final boolean shouldSkip()
- {
- return skip;
- }
protected final String getArchitecture()
- {
+ {
return architecture;
}
@@ -159,4 +163,45 @@ public abstract class AbstractNarMojo
{
return mavenProject;
}
+
+ public final void execute()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( skip )
+ {
+ getLog().info( getClass().getName() + " skipped" );
+ return;
+ }
+
+ try
+ {
+ validate();
+ narExecute();
+ }
+ catch ( MojoFailureException mfe )
+ {
+ if ( ignore )
+ {
+ getLog().warn( "IGNORED: " + mfe.getMessage() );
+ }
+ else
+ {
+ throw mfe;
+ }
+ }
+ catch ( MojoExecutionException mee )
+ {
+ if ( ignore )
+ {
+ getLog().warn( "IGNORED: " + mee.getMessage() );
+ }
+ else
+ {
+ throw mee;
+ }
+ }
+ }
+
+ public abstract void narExecute()
+ throws MojoFailureException, MojoExecutionException;
}
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 846aba1..e5dd1dc 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java
@@ -54,20 +54,9 @@ public class NarAssemblyMojo
/**
* Copies the unpacked nar libraries and files into the projects target area
*/
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- getLog().info( "***********************************************************************" );
- getLog().info( "NAR Assembly SKIPPED since no NAR libraries were built/downloaded." );
- getLog().info( "***********************************************************************" );
- // NOTE: continue since the standard assemble mojo fails if we do
- // not create the directories...
- }
-
- validate();
-
for ( Iterator j = classifiers.iterator(); j.hasNext(); )
{
String classifier = (String) j.next();
@@ -92,22 +81,10 @@ public class NarAssemblyMojo
try
{
FileUtils.mkdir( dstDir.getPath() );
- if ( shouldSkip() )
- {
- File note = new File( dstDir, "NAR_ASSEMBLY_SKIPPED" );
- FileUtils.fileWrite(
- note.getPath(),
- "The NAR Libraries of this distribution are missing because \n"
- + "the NAR dependencies were not built/downloaded, presumably because\n"
- + "the the distribution was built with the '-Dnar.skip=true' flag." );
- }
- else
+ getLog().debug( "SrcDir: " + srcDir );
+ if ( srcDir.exists() )
{
- getLog().debug( "SrcDir: " + srcDir );
- if ( srcDir.exists() )
- {
- FileUtils.copyDirectoryStructure( srcDir, dstDir );
- }
+ FileUtils.copyDirectoryStructure( srcDir, dstDir );
}
}
catch ( IOException ioe )
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 fcdd322..f773211 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarCompileMojo.java
@@ -55,16 +55,9 @@ import org.codehaus.plexus.util.StringUtils;
public class NarCompileMojo
extends AbstractCompileMojo
{
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- return;
- }
-
- validate();
-
// make sure destination is there
getTargetDirectory().mkdirs();
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 ea049fa..d7f6343 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarDownloadMojo.java
@@ -64,16 +64,9 @@ public class NarDownloadMojo
*/
private List classifiers;
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- 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 c6f4eb4..4e15f48 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuConfigureMojo.java
@@ -55,15 +55,9 @@ public class NarGnuConfigureMojo
private static final String CONFIGURE = "configure";
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- 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 c99e0d3..b2eae70 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuMakeMojo.java
@@ -35,16 +35,9 @@ import org.apache.maven.plugin.MojoFailureException;
public class NarGnuMakeMojo
extends AbstractGnuMojo
{
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- 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 f919d92..7bbf48f 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuProcess.java
@@ -35,16 +35,9 @@ import org.apache.maven.plugin.MojoFailureException;
public class NarGnuProcess
extends AbstractGnuMojo
{
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- 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 39eb3a5..0122ebc 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarGnuResources.java
@@ -35,16 +35,9 @@ import org.apache.maven.plugin.MojoFailureException;
public class NarGnuResources
extends AbstractGnuMojo
{
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- 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 bd86ed8..ffab127 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarIntegrationTestMojo.java
@@ -555,12 +555,10 @@ public class NarIntegrationTestMojo
private MavenSession session;
- public void execute()
+ // DUNS, changed name
+ public void narExecute()
throws MojoExecutionException, MojoFailureException
{
- // DUNS
- validate();
-
if ( verifyParameters() )
{
SurefireBooter surefireBooter = constructSurefireBooter();
@@ -623,11 +621,6 @@ public class NarIntegrationTestMojo
throws MojoFailureException
{
// DUNS
- if (shouldSkip() ) {
- return false;
- }
-
- // DUNS
if ( skipNar || skipNarTests || skipNarExec )
{
getLog().info( "Tests are skipped." );
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 c570461..9edc963 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarJavahMojo.java
@@ -57,16 +57,9 @@ public class NarJavahMojo
return session;
}
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- return;
- }
-
- validate();
-
getJavah().execute();
}
} \ No newline at end of file
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 751f85c..f2a01ec 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarPackageMojo.java
@@ -60,16 +60,9 @@ public class NarPackageMojo
*/
private MavenProjectHelper projectHelper;
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- 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 e3fcfe0..fa05acd 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarResourcesMojo.java
@@ -54,16 +54,9 @@ public class NarResourcesMojo
*/
private File resourceDirectory;
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- 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 c778228..0eb2905 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarSystemMojo.java
@@ -40,16 +40,9 @@ public class NarSystemMojo
extends AbstractCompileMojo
{
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- return;
- }
-
- validate();
-
// get packageName if specified for JNI.
String packageName = null;
String narSystemName = 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 db5c3bf..70fcd8b 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarTestCompileMojo.java
@@ -56,16 +56,9 @@ public class NarTestCompileMojo
*/
private boolean skipNar;
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() || skipNar)
- {
- return;
- }
-
- validate();
-
// make sure destination is there
getTestTargetDirectory().mkdirs();
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 d361728..db4e68d 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarTestMojo.java
@@ -52,16 +52,9 @@ public class NarTestMojo
*/
private List classpathElements;
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- 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 0e9d347..991f3e3 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarUnpackMojo.java
@@ -55,16 +55,9 @@ public class NarUnpackMojo
*/
private ArchiverManager archiverManager;
- public final void execute()
+ public final void narExecute()
throws MojoExecutionException, MojoFailureException
{
- if ( shouldSkip() )
- {
- return;
- }
-
- validate();
-
List narArtifacts = getNarManager().getNarDependencies( "compile" );
if ( classifiers == null )
{
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarValidateMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarValidateMojo.java
index d6e0e48..e299dfb 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarValidateMojo.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarValidateMojo.java
@@ -33,21 +33,9 @@ import org.apache.maven.plugin.MojoFailureException;
public class NarValidateMojo
extends AbstractCompileMojo
{
- public final void execute()
+ public final void narExecute()
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 );
diff --git a/src/site/apt/configuration.apt b/src/site/apt/configuration.apt
index 8fa5d20..25fac5e 100644
--- a/src/site/apt/configuration.apt
+++ b/src/site/apt/configuration.apt
@@ -11,6 +11,7 @@ NAR Configuration
+--
<configuration>
+ <ignore/>
<skip/>
<skipNar/>
<skipNarTest/>