From a18df54301d3c988c167506b832323fec973a936 Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Tue, 1 Dec 2009 12:08:03 +0100 Subject: Fixed NAR-55 and NAR-113 --- .../maven/plugin/nar/AbstractDependencyMojo.java | 3 +- .../apache/maven/plugin/nar/AbstractGnuMojo.java | 10 ++- .../apache/maven/plugin/nar/AbstractNarMojo.java | 29 ++++--- .../java/org/apache/maven/plugin/nar/Compiler.java | 18 +++-- .../java/org/apache/maven/plugin/nar/Linker.java | 8 +- .../apache/maven/plugin/nar/NarAssemblyMojo.java | 2 + .../apache/maven/plugin/nar/NarCompileMojo.java | 11 +-- .../apache/maven/plugin/nar/NarDownloadMojo.java | 8 +- .../maven/plugin/nar/NarGnuConfigureMojo.java | 2 + .../apache/maven/plugin/nar/NarGnuMakeMojo.java | 2 + .../org/apache/maven/plugin/nar/NarGnuProcess.java | 4 +- .../apache/maven/plugin/nar/NarGnuResources.java | 2 + .../maven/plugin/nar/NarIntegrationTestMojo.java | 3 + .../org/apache/maven/plugin/nar/NarJavahMojo.java | 2 + .../org/apache/maven/plugin/nar/NarManager.java | 2 +- .../apache/maven/plugin/nar/NarPackageMojo.java | 2 + .../apache/maven/plugin/nar/NarResourcesMojo.java | 2 + .../org/apache/maven/plugin/nar/NarSystemMojo.java | 2 + .../maven/plugin/nar/NarTestCompileMojo.java | 7 +- .../org/apache/maven/plugin/nar/NarTestMojo.java | 2 + .../org/apache/maven/plugin/nar/NarUnpackMojo.java | 2 + .../java/org/apache/maven/plugin/nar/NarUtil.java | 6 +- .../apache/maven/plugin/nar/NarValidateMojo.java | 91 ++++++++++++++++++++++ 23 files changed, 173 insertions(+), 47 deletions(-) create mode 100644 src/main/java/org/apache/maven/plugin/nar/NarValidateMojo.java (limited to 'src/main/java/org/apache/maven') 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. tag is missing inside the 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() ); + } + } +} -- cgit v1.2.3