Author: sisbell Date: Thu Dec 20 10:05:52 2007 New Revision: 605985 URL: http://svn.apache.org/viewvc?rev=605985&view=rev Log: Added platform awareness to the compiler plugin.
Modified: incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/Vendor.java incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java Modified: incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/Vendor.java URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/Vendor.java?rev=605985&r1=605984&r2=605985&view=diff ============================================================================== --- incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/Vendor.java (original) +++ incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/Vendor.java Thu Dec 20 10:05:52 2007 @@ -25,5 +25,18 @@ { MICROSOFT, NOVELL, - ANY + ANY, + NULL; + + /** + * Returns the default vendor of the operating system on which the application is running: + * Microsoft for windows and Mono for all others. + * + * @return the default vendor of the operating system on which the application is running + */ + public static synchronized Vendor getDefaultVendorForOS() + { + return System.getProperty( "os.name" ).toLowerCase().trim().contains( "windows" ) ? Vendor.MICROSOFT + : Vendor.NOVELL; + } } Modified: incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java?rev=605985&r1=605984&r2=605985&view=diff ============================================================================== --- incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java (original) +++ incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java Thu Dec 20 10:05:52 2007 @@ -94,12 +94,11 @@ private String language; /** - * The Vendor for the Compiler. Not - * case or white-space sensitive. + * The Vendor for the Compiler. Not case or white-space sensitive. * * @parameter expression="${vendor}" */ - private String vendor; + private String vendorName; /** * @component @@ -109,8 +108,19 @@ public void execute() throws MojoExecutionException, MojoFailureException { + Vendor vendor = Vendor.NULL; + if ( vendorName != null ) + { + vendor = Vendor.valueOf( vendorName.toUpperCase() ); + } + else + { + vendor = Vendor.getDefaultVendorForOS(); + } + DotnetCompilerConfig compilerConfig = DotnetCompilerConfig.Factory.createDefaultCompilerConfig(); - compilerConfig.setArtifactType( ArtifactType.valueOf( project.getPackaging().split( "[:]")[1].toUpperCase() ) ); + compilerConfig.setArtifactType( + ArtifactType.valueOf( project.getPackaging().split( "[:]" )[1].toUpperCase() ) ); compilerConfig.setCompilerPlatformVersion( DotnetCompilerPlatformVersion.valueFromVersion( frameworkVersion ) ); KeyInfo keyInfo = KeyInfo.Factory.createDefaultKeyInfo(); @@ -133,7 +143,7 @@ compilerConfig.setProgrammingLanguage( ProgrammingLanguage.C_SHARP ); compilerConfig.setCompilerSourceDirectory( new File( project.getBuild().getDirectory(), BuildDirectories.BUILD_SOURCES.getBuildDirectoryName() ) ); - compilerConfig.setVendor( Vendor.MICROSOFT );//TODO: Platform dependent + compilerConfig.setVendor( vendor ); compilerConfig.setTargetDirectory( new File( project.getBuild().getDirectory() ) ); compilerConfig.setArtifactFileName( project.getBuild().getFinalName() + "." + compilerConfig.getArtifactType().getExtension() );