Author: sisbell Date: Thu Dec 6 19:40:48 2007 New Revision: 601974 URL: http://svn.apache.org/viewvc?rev=601974&view=rev Log: Added compiler plugin. There is still a problem with dynamically loading compilers from the classpath (need to do this by resolving dependency locations.
Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/It0001.cs incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/pom.xml (with props) incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/pom.xml (with props) incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java (with props) incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java (with props) incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/resources/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/resources/META-INF/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml (with props) incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/pom.xml (with props) incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/pom.xml (with props) Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java?rev=601974&r1=601973&r2=601974&view=diff ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java (original) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-assembler/src/main/java/org/apache/maven/dotnet/assembler/impl/AssemblerContextImpl.java Thu Dec 6 19:40:48 2007 @@ -25,7 +25,6 @@ import org.apache.maven.dotnet.assembler.AssemblyInfoMarshallerAnnotation; import org.apache.maven.dotnet.ProgrammingLanguage; import org.apache.maven.dotnet.BuildDirectories; -import org.apache.maven.dotnet.PlatformUnsupportedException; import org.apache.maven.project.MavenProject; import org.apache.maven.model.Organization; @@ -34,10 +33,7 @@ import org.codehaus.plexus.logging.Logger; import java.io.*; -import java.util.Arrays; -import java.util.HashMap; import java.util.Enumeration; -import java.util.HashSet; import java.util.List; import java.util.jar.JarFile; import java.util.jar.JarEntry; Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java?rev=601974&r1=601973&r2=601974&view=diff ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java (original) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java Thu Dec 6 19:40:48 2007 @@ -199,9 +199,10 @@ } }//end for loop } + System.out.println(System.getProperty( "java.class.path" )); String[] classPathJars = System.getProperty( "java.class.path" ).split( "[" + File.pathSeparator + "]" ); for ( String classPathJar : classPathJars ) - { + { System.out.println(classPathJar); if ( classPathJar.contains( "dotnet-extensions-" ) ) { JarFile jarFile = null; @@ -218,6 +219,7 @@ while ( jarEntries.hasMoreElements() ) { JarEntry jarEntry = (JarEntry) jarEntries.nextElement(); + System.out.println(jarEntry.getName()); if ( jarEntry.isDirectory() || !jarEntry.getName().endsWith( "class" ) ) { continue; @@ -228,7 +230,7 @@ { String[] tokens = jarEntry.getName().split( "[//]" ); - Class c = Class.forName( tokens[tokens.length - 1].split( "[.]")[0] ); + Class c = Class.forName( tokens[tokens.length - 1].split( "[.]" )[0] ); className = c.getName(); CompilerAnnotation annotation = (CompilerAnnotation) c.getAnnotation( CompilerAnnotation.class ); @@ -256,7 +258,10 @@ } } } - + if ( classCompiler == null ) + { + // throw new PlatformUnsupportedException("Could not find compiler"); + } String basedir = project.getBuild().getDirectory() + File.separator + "assembly-resources" + File.separator; linkedResources = new File( basedir, "linkresource" ).exists() ? new HashSet<File>( Arrays.asList( new File( basedir, "linkresource" ).listFiles() ) ) : new HashSet<File>(); Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml?rev=601974&r1=601973&r2=601974&view=diff ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml (original) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/pom.xml Thu Dec 6 19:40:48 2007 @@ -20,6 +20,11 @@ --> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.apache.maven.dotnet</groupId> + <version>0.14-incubating-SNAPSHOT</version> + <artifactId>dotnet-project</artifactId> + </parent> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.maven.dotnet</groupId> <artifactId>dotnet-components</artifactId> @@ -34,55 +39,4 @@ <module>dotnet-compiler</module> <module>dotnet-extensions-maven</module> </modules> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.4</version> - <scope>test</scope> - </dependency> - </dependencies> - <properties> - <mavenVersion>2.0.8</mavenVersion> - </properties> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - <version>${mavenVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-core</artifactId> - <version>${mavenVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-artifact</artifactId> - <version>${mavenVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-plugin-api</artifactId> - <version>${mavenVersion}</version> - </dependency> - </dependencies> - </dependencyManagement> - <build> - <plugins> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.3</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - </configuration> - </plugin> - </plugins> - </build> </project> Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/It0001.cs URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/It0001.cs?rev=601974&view=auto ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/It0001.cs (added) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/It0001.cs Thu Dec 6 19:40:48 2007 @@ -0,0 +1,8 @@ +namespace NMaven.IT { + +public class It0001 { + public static void Main () { + System.Console.Write("Hello World!"); + } +} +} Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/pom.xml?rev=601974&view=auto ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/pom.xml (added) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/pom.xml Thu Dec 6 19:40:48 2007 @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>NMaven.IT</groupId> + <artifactId>NMaven.IT.0001</artifactId> + <packaging>library</packaging> + <version>0.14-incubating-SNAPSHOT</version> + <name>it0001</name> + <build> + <sourceDirectory>.</sourceDirectory> + <plugins> + <plugin> + <groupId>org.apache.maven.dotnet.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <extensions>true</extensions> + </plugin> + </plugins> + </build> +</project> Propchange: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/integration-tests/it0001/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/pom.xml?rev=601974&view=auto ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/pom.xml (added) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/pom.xml Thu Dec 6 19:40:48 2007 @@ -0,0 +1,62 @@ +<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.apache.maven.dotnet.plugins</groupId> + <version>0.14-incubating-SNAPSHOT</version> + <artifactId>maven-dotnet-plugins</artifactId> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.dotnet.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <packaging>maven-plugin</packaging> + <name>maven-compiler-plugin</name> + <description>Maven Plugin for .NET: Handles source and test compiles</description> + <dependencies> + <dependency> + <groupId>org.apache.maven.dotnet</groupId> + <artifactId>dotnet-compiler</artifactId> + <version>${parent.version}</version> + </dependency> + <dependency> + <groupId>org.apache.maven.dotnet</groupId> + <artifactId>dotnet-assembler</artifactId> + <version>${parent.version}</version> + </dependency> + <dependency> + <groupId>org.apache.maven.dotnet</groupId> + <artifactId>dotnet-core</artifactId> + <version>${parent.version}</version> + </dependency> + <dependency> + <groupId>org.apache.maven.dotnet</groupId> + <artifactId>dotnet-extensions-maven</artifactId> + <version>${parent.version}</version> + </dependency> + </dependencies> + <distributionManagement> + <site> + <id>nmaven-apache-site</id> + <name>NMaven Site</name> + <url>file://${basedir}/../../../www/plugins/maven-compile-plugin</url> + </site> + </distributionManagement> +</project> Propchange: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java?rev=601974&view=auto ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java (added) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java Thu Dec 6 19:40:48 2007 @@ -0,0 +1,151 @@ +/** + * Maven Mojo for compiling Class files to the .NET Intermediate Language. + * To use a specific vendor (MICROSOFT/MONO) or language, the compiler/language must be previously installed AND + * configured through the plugin-compiler.xml file: otherwise the Mojo either will throw a MojoExecutionException + * telling you that the platform is not supported (occurs if entry is not in plugin-compilers.xml, regardless of + * whether the compiler/language is installed) or will attempt to execute the compiler and fail (occurs if entry is in + * plugin-compilers.xml and the compiler/language is not installed). + * + * @author Shane Isbell + * @goal compile + * @phase compile + * @description Maven Mojo for compiling class files to the .NET Intermediate Language + */ +package org.apache.maven.dotnet.plugin.compiler; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.dotnet.compiler.DotnetCompilerContext; +import org.apache.maven.dotnet.compiler.DotnetCompilerConfig; +import org.apache.maven.dotnet.compiler.DotnetCompilerPlatformVersion; +import org.apache.maven.dotnet.compiler.KeyInfo; +import org.apache.maven.dotnet.ProgrammingLanguage; +import org.apache.maven.dotnet.PlatformUnsupportedException; +import org.apache.maven.dotnet.Vendor; +import org.apache.maven.dotnet.BuildDirectories; +import org.apache.maven.dotnet.ArtifactType; +import org.apache.maven.dotnet.compiler.impl.DotnetCompilerContextImpl; +import org.apache.maven.project.MavenProject; + +import java.io.File; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Set; +import java.util.HashSet; + +public class CompilerMojo + extends AbstractMojo +{ + /** + * The maven project. + * + * @parameter expression="${project}" + * @required + */ + private MavenProject project; + + /** + * The location of the local Maven repository. + * + * @parameter expression="${settings.localRepository}" + */ + private File localRepository; + + /** + * Specify a strong name key file. + * + * @parameter expression = "${keyfile}" + */ + private File keyfile; + + /** + * Specifies a strong name key container. (not currently supported) + * + * @parameter expression = "${keycontainer}" + */ + private String keycontainer; + + /** + * The framework version to compile under: 1.1, 2.0, 3.0 + * + * @parameter expression = "${frameworkVersion}" default-value="2.0.50727" + */ + private String frameworkVersion; + + /** + * .NET Language. The default value is <code>C_SHARP</code>. Not case or white-space sensitive. + * + * @parameter expression="${language}" default-value = "C_SHARP" + * @required + */ + private String language; + + /** + * The Vendor for the Compiler. Not + * case or white-space sensitive. + * + * @parameter expression="${vendor}" + */ + private String vendor; + + public void execute() + throws MojoExecutionException, MojoFailureException + { + DotnetCompilerConfig compilerConfig = DotnetCompilerConfig.Factory.createDefaultCompilerConfig(); + compilerConfig.setArtifactType( ArtifactType.valueOf( project.getPackaging().toUpperCase() ) ); + compilerConfig.setCompilerPlatformVersion( DotnetCompilerPlatformVersion.valueFromVersion( frameworkVersion ) ); + + KeyInfo keyInfo = KeyInfo.Factory.createDefaultKeyInfo(); + if ( keyfile != null ) + { + try + { + keyInfo.setKeyFileUri( new URI( keyfile.getAbsolutePath() ) ); + } + catch ( URISyntaxException e ) + { + e.printStackTrace(); + } + } + + keyInfo.setKeyContainerName( keycontainer ); + compilerConfig.setKeyInfo( keyInfo ); + + compilerConfig.setLocalRepository( localRepository ); + compilerConfig.setProgrammingLanguage( ProgrammingLanguage.C_SHARP ); + compilerConfig.setCompilerSourceDirectory( + new File( project.getBuild().getDirectory(), BuildDirectories.BUILD_SOURCES.getBuildDirectoryName() ) ); + compilerConfig.setVendor( Vendor.MICROSOFT ); + compilerConfig.setTargetDirectory( new File( project.getBuild().getDirectory() ) ); + DotnetCompilerContext ctx = new DotnetCompilerContextImpl(); + try + { + ctx.init( project, compilerConfig ); + } + catch ( PlatformUnsupportedException e ) + { + e.printStackTrace(); + } + ctx.getClassCompiler().compile(); + } + + private static Set<File> getCompilerSourceDirectoriesFrom( List<String> directories ) + throws MojoExecutionException + { + Set<File> compilerSourceDirectories = new HashSet<File>(); + for ( String directory : directories ) + { + File file = new File( directory ); + if ( !file.exists() ) + { + throw new MojoExecutionException( "" ); + } + + compilerSourceDirectories.add( file ); + } + + return compilerSourceDirectories; + } +} Propchange: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java?rev=601974&view=auto ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java (added) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java Thu Dec 6 19:40:48 2007 @@ -0,0 +1,119 @@ +package org.apache.maven.dotnet.plugin.compiler; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.dotnet.ProgrammingLanguage; +import org.apache.maven.dotnet.BuildDirectories; +import org.apache.maven.project.MavenProject; + +import org.codehaus.plexus.util.DirectoryScanner; +import org.codehaus.plexus.util.FileUtils; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.ArrayList; + +/** + * Copies source files to target directory. + * + * @goal process-sources + * @phase process-sources + * @description Copies source files to target directory. + */ + +public class SourceProcessorMojo + extends AbstractMojo +{ + + /** + * The maven project. + * + * @parameter expression="${project}" + * @required + */ + private MavenProject project; + + /** + * @parameter expression = "${includes}" + */ + private String[] includes; + + /** + * @parameter expression = "${excludes}" + */ + private String[] excludes; + + /** + * .NET Language. The default value is <code>C_SHARP</code>. Not case or white-space sensitive. + * + * @parameter expression="${language}" default-value = "C_SHARP" + * @required + */ + private String language; + + public void execute() + throws MojoExecutionException + { + File sourceDirectory = new File( project.getBuild().getSourceDirectory() ); + File outputDirectory = + new File( project.getBuild().getDirectory(), BuildDirectories.BUILD_SOURCES.getBuildDirectoryName() ); + + if ( !sourceDirectory.exists() ) + { + getLog().info( "NMAVEN-904-001: No source files to copy" ); + return; + } + DirectoryScanner directoryScanner = new DirectoryScanner(); + directoryScanner.setBasedir( project.getBuild().getSourceDirectory() ); + + List<String> excludeList = new ArrayList<String>(); + //target files + excludeList.add( "obj/**" ); + excludeList.add( "bin/**" ); + excludeList.add( "target/**" ); + //Misc + excludeList.add( "Resources/**" ); + excludeList.add( "Test/**" ); + + List<String> includeList = new ArrayList<String>(); + includeList.add( "**/*." + ProgrammingLanguage.valueOf( language ).getClassFileExtension() ); + + for ( int i = 0; i < includes.length; ++i ) + { + includeList.add( includes[i] ); + } + directoryScanner.setIncludes( includeList.toArray( includes ) ); + for ( int i = 0; i < excludes.length; ++i ) + { + excludeList.add( excludes[i] ); + } + directoryScanner.setExcludes( excludeList.toArray( excludes ) ); + directoryScanner.addDefaultExcludes(); + + directoryScanner.scan(); + String[] files = directoryScanner.getIncludedFiles(); + getLog().info( "NMAVEN-904-002: Copying source files: From = " + sourceDirectory + ", To = " + + outputDirectory + ", File Count = " + files.length ); + + super.getPluginContext().put( "SOURCE_FILES_UP_TO_DATE", Boolean.TRUE ); + for ( String file : files ) + { + try + { + File sourceFile = new File( sourceDirectory, file ); + File targetFile = new File( outputDirectory, file ); + if ( sourceFile.lastModified() > targetFile.lastModified() ) + { + super.getPluginContext().put( "SOURCE_FILES_UP_TO_DATE", Boolean.FALSE ); + FileUtils.copyFile( sourceFile, targetFile ); + targetFile.setLastModified( System.currentTimeMillis() ); + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( "NMAVEN-904-000: Unable to process sources", e ); + } + } + } +} Propchange: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/SourceProcessorMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml?rev=601974&view=auto ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml (added) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml Thu Dec 6 19:40:48 2007 @@ -0,0 +1,167 @@ +<component-set> + <components> + <component> + <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role> + <role-hint>library</role-hint> + <implementation> + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + </implementation> + <configuration> + <phases> + <process-sources> + org.apache.maven.dotnet.plugins:maven-compiler-plugin:process-sources + </process-sources> + <compile> + org.apache.maven.dotnet.plugins:maven-compiler-plugin:compile + </compile> + <install> + org.apache.maven.plugins:maven-install-plugin:install + </install> + <deploy> + org.apache.maven.plugins:maven-deploy-plugin:deploy + </deploy> + </phases> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>module</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <extension>netmodule</extension> + <type>module</type> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>exe.config</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <extension>exe.config</extension> + <type>exe.config</type> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>library</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <extension>dll</extension> + <type>library</type> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>winexe</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <extension>exe</extension> + <type>winexe</type> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>gac</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <extension>dll</extension> + <type>gac</type> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>gac_generic</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <extension>dll</extension> + <type>gac_generic</type> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>gac_msil</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <extension>dll</extension> + <type>gac_msil</type> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>gac_32</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <extension>dll</extension> + <type>gac_32</type> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>nar</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <type>nar</type> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>netplugin</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <extension>dll</extension> + <type>netplugin</type> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>visual-studio-addin</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <extension>dll</extension> + <type>visual-studio-addin</type> + </configuration> + </component> + <component> + <role>org.apache.maven.dotnet.executable.CapabilityMatcher</role> + <implementation>org.apache.maven.dotnet.executable.impl.CapabilityMatcherImpl</implementation> + <requirements> + <requirement> + <role>org.apache.maven.dotnet.registry.RepositoryRegistry</role> + </requirement> + </requirements> + </component> + <component> + <role>org.apache.maven.dotnet.vendor.VendorInfoRepository</role> + <implementation>org.apache.maven.dotnet.vendor.impl.VendorInfoRepositoryImpl</implementation> + <requirements> + <requirement> + <role>org.apache.maven.dotnet.registry.RepositoryRegistry</role> + </requirement> + </requirements> + </component> + <component> + <role>org.apache.maven.dotnet.vendor.StateMachineProcessor</role> + <implementation>org.apache.maven.dotnet.vendor.impl.StateMachineProcessorImpl</implementation> + <requirements> + <requirement> + <role>org.apache.maven.dotnet.vendor.VendorInfoRepository</role> + </requirement> + <requirement> + <role>org.apache.maven.dotnet.registry.RepositoryRegistry</role> + </requirement> + </requirements> + </component> + <component> + <role>org.apache.maven.dotnet.plugin.DotNetMojo</role> + <implementation>org.apache.maven.dotnet.plugin.AbstractMojo</implementation> + <requirements> + <requirement> + <role>org.apache.maven.dotnet.executable.NetExecutableFactory</role> + </requirement> + <requirement> + <role>org.apache.maven.dotnet.plugin.PluginContext</role> + </requirement> + </requirements> + </component> + </components> +</component-set> \ No newline at end of file Propchange: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/pom.xml?rev=601974&view=auto ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/pom.xml (added) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/pom.xml Thu Dec 6 19:40:48 2007 @@ -0,0 +1,35 @@ +<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.apache.maven.dotnet</groupId> + <version>0.14-incubating-SNAPSHOT</version> + <artifactId>dotnet-project</artifactId> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.dotnet.plugins</groupId> + <artifactId>maven-dotnet-plugins</artifactId> + <packaging>pom</packaging> + <name>maven-dotnet-plugins</name> + <modules> + <module>maven-compiler-plugin</module> + </modules> +</project> Propchange: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/plugins/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/pom.xml?rev=601974&view=auto ============================================================================== --- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/pom.xml (added) +++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/pom.xml Thu Dec 6 19:40:48 2007 @@ -0,0 +1,192 @@ +<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.dotnet</groupId> + <artifactId>dotnet-project</artifactId> + <packaging>pom</packaging> + <version>0.14-incubating-SNAPSHOT</version> + <name>dotnet</name> + <mailingLists> + <mailingList> + <name>NMaven Dev List</name> + <subscribe>[EMAIL PROTECTED]</subscribe> + <unsubscribe>[EMAIL PROTECTED]</unsubscribe> + <post>[EMAIL PROTECTED]</post> + <archive>http://mail-archives.apache.org/mod_mbox/incubator-nmaven-dev/</archive> + <otherArchives> + <otherArchive>http://www.nabble.com/nmaven-dev-f17655.html</otherArchive> + </otherArchives> + </mailingList> + <mailingList> + <name>NMaven Commits List</name> + <subscribe>[EMAIL PROTECTED]</subscribe> + <unsubscribe>[EMAIL PROTECTED]</unsubscribe> + <post>nmaven-commits@incubator.apache.org</post> + <archive>http://mail-archives.apache.org/mod_mbox/incubator-nmaven-commits/</archive> + <otherArchives> + <otherArchive>http://www.nabble.com/nmaven-commits-f17656.html</otherArchive> + </otherArchives> + </mailingList> + </mailingLists> + <scm> + <url>https://svn.apache.org/repos/asf/incubator/nmaven/</url> + <connection>scm:svn:https://svn.apache.org/repos/asf/incubator/nmaven/</connection> + <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/nmaven/</developerConnection> + <tag>REL_0_14_SNAPSHOT</tag> + </scm> + <organization> + <name>NMaven</name> + <url>http://incubator.apache.org/nmaven</url> + </organization> + <issueManagement> + <system>JIRA Bugtracking</system> + <url>http://jira.codehaus.org/browse/NMAVEN</url> + </issueManagement> + <licenses> + <license> + <name>Apache 2.0</name> + <url>LICENSE.txt</url> + </license> + </licenses> + <developers> + <developer> + <name>Brett Porter</name> + <id>brett</id> + <email>[EMAIL PROTECTED]</email> + <roles> + <role>champion</role> + <role>mentor</role> + </roles> + </developer> + <developer> + <name>Jason van Zyl</name> + <id>jvanzyl</id> + <email>[EMAIL PROTECTED]</email> + <roles> + <role>champion</role> + <role>mentor</role> + </roles> + </developer> + <developer> + <name>Shane Isbell</name> + <id>sisbell</id> + <email>[EMAIL PROTECTED]</email> + <url>http://jroller.com/page/random7</url> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Dan Fabulich</name> + <id>dfabulich</id> + <email>[EMAIL PROTECTED]</email> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Chris Stevenson</name> + <id>chrisjs</id> + <email>[EMAIL PROTECTED]</email> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>Trygve Laugstol</name> + <id>trygvis</id> + <email>[EMAIL PROTECTED]</email> + <roles> + <role>committer</role> + </roles> + </developer> + <developer> + <name>James Strachan</name> + <id>jstrachan</id> + <email>[EMAIL PROTECTED]</email> + <roles> + <role>committer</role> + </roles> + </developer> + </developers> + <modules> + <module>components</module> + <module>plugins</module> + </modules> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.3</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.easymock</groupId> + <artifactId>easymock</artifactId> + <version>2.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.4</version> + <scope>test</scope> + </dependency> + </dependencies> + <properties> + <mavenVersion>2.0.8</mavenVersion> + </properties> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + <version>${mavenVersion}</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + <version>${mavenVersion}</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-artifact</artifactId> + <version>${mavenVersion}</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>${mavenVersion}</version> + </dependency> + </dependencies> + </dependencyManagement> +</project> Propchange: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native