diff --git a/plexus-compilers/plexus-compiler-csharp/src/main/java/org/codehaus/plexus/compiler/csharp/CSharpCompiler.java b/plexus-compilers/plexus-compiler-csharp/src/main/java/org/codehaus/plexus/compiler/csharp/CSharpCompiler.java index 9dbc7553..7ff097de 100644 --- a/plexus-compilers/plexus-compiler-csharp/src/main/java/org/codehaus/plexus/compiler/csharp/CSharpCompiler.java +++ b/plexus-compilers/plexus-compiler-csharp/src/main/java/org/codehaus/plexus/compiler/csharp/CSharpCompiler.java @@ -44,6 +44,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -66,6 +67,8 @@ public class CSharpCompiler private static final String ARGUMENTS_FILE_NAME = "csharp-arguments"; private static final String[] DEFAULT_INCLUDES = { "**/**" }; + + private Map compilerArguments; // ---------------------------------------------------------------------- // @@ -142,6 +145,40 @@ public String[] createCommandLine( CompilerConfiguration config ) // // ---------------------------------------------------------------------- + private Map getCompilerArguments( CompilerConfiguration config ) + { + if (compilerArguments != null) + { + return compilerArguments; + } + + compilerArguments = config.getCustomCompilerArgumentsAsMap(); + + Iterator i = compilerArguments.keySet().iterator(); + + while ( i.hasNext() ) + { + String orig = i.next(); + String v = compilerArguments.get( orig ); + if ( orig.contains( ":" ) && v == null ) + { + String[] arr = orig.split( ":" ); + i.remove(); + String k = arr[0]; + v = arr[1]; + compilerArguments.put( k, v ); + if ( config.isDebug() ) + { + System.out.println( "transforming argument from " + orig + " to " + k + " = [" + v + "]" ); + } + } + } + + config.setCustomCompilerArgumentsAsMap( compilerArguments ); + + return compilerArguments; + } + private String findExecutable( CompilerConfiguration config ) { String executable = config.getExecutable(); @@ -267,7 +304,7 @@ private String[] buildCompilerArguments( CompilerConfiguration config, String[] // Main class // ---------------------------------------------------------------------- - Map compilerArguments = config.getCustomCompilerArguments(); + Map compilerArguments = getCompilerArguments( config ); String mainClass = compilerArguments.get( "-main" ); @@ -399,7 +436,9 @@ private File findResourceDir( CompilerConfiguration config ) { System.out.println( "Looking for resourcesDir" ); } - Map compilerArguments = config.getCustomCompilerArguments(); + + Map compilerArguments = getCompilerArguments( config ); + String tempResourcesDirAsString = (String) compilerArguments.get( "-resourceDir" ); File filteredResourceDir = null; if ( tempResourcesDirAsString != null )