From 7482bfe33dc8db7ccc1b02d80f6c3b6dbac601ca Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Mon, 25 Oct 2010 22:24:06 +0200 Subject: Partial FIX to NAR-155 --- .../java/org/apache/maven/plugin/nar/Linker.java | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src') 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 dfdea08..810c540 100644 --- a/src/main/java/org/apache/maven/plugin/nar/Linker.java +++ b/src/main/java/org/apache/maven/plugin/nar/Linker.java @@ -200,10 +200,6 @@ public class Linker { version = m.group( 0 ); } - else - { - throw new MojoFailureException( "Cannot deduce version number from: " + out ); - } } else if ( name.equals( "msvc" ) ) { @@ -214,10 +210,6 @@ public class Linker { version = m.group( 0 ); } - else - { - throw new MojoFailureException( "Cannot deduce version number from: " + out ); - } } else if ( name.equals( "icc" ) || name.equals( "icpc" ) ) { @@ -228,10 +220,6 @@ public class Linker { version = m.group( 0 ); } - else - { - throw new MojoFailureException( "Cannot deduce version number from: " + out ); - } } else if ( name.equals( "icl" ) ) { @@ -242,15 +230,25 @@ public class Linker { version = m.group( 0 ); } - else - { - throw new MojoFailureException( "Cannot deduce version number from: " + out.toString() ); - } + } + else if ( name.equals( "CC" ) ) + { + NarUtil.runCommand( "CC", new String[] { "-V" }, null, null, out, err, dbg ); + Pattern p = Pattern.compile( "\\d+\\.d+" ); + Matcher m = p.matcher( err.toString() ); + if ( m.find() ) + { + version = m.group( 0 ); + } } else { throw new MojoFailureException( "Cannot find version number for linker '" + name + "'" ); } + + if (version == null) { + throw new MojoFailureException( "Cannot deduce version number from: " + out.toString() ); + } return version; } -- cgit v1.2.3