incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r632163 - in /incubator/nmaven/trunk: components/maven-dotnet-core-it-runner/ components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ core-integration-tests/src/test/resources/MavenITmng-0000-CSharpCom...
Date Thu, 28 Feb 2008 23:17:30 GMT
Author: sisbell
Date: Thu Feb 28 15:17:26 2008
New Revision: 632163

URL: http://svn.apache.org/viewvc?rev=632163&view=rev
Log:
More complete toolchain implementation.

Added:
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ConfigurationTag.java
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ProvidesTag.java
Modified:
    incubator/nmaven/trunk/components/maven-dotnet-core-it-runner/pom.xml
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchain.java
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchainFactory.java
    incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0000-CSharpCompileLibrary/pom.xml
    incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
    incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/src/main/resources/META-INF/plexus/components.xml

Modified: incubator/nmaven/trunk/components/maven-dotnet-core-it-runner/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-core-it-runner/pom.xml?rev=632163&r1=632162&r2=632163&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-core-it-runner/pom.xml (original)
+++ incubator/nmaven/trunk/components/maven-dotnet-core-it-runner/pom.xml Thu Feb 28 15:17:26
2008
@@ -70,6 +70,11 @@
       <artifactId>maven-dotnet-test-plugin</artifactId>
       <version>${pom.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.plugins</groupId>
+      <artifactId>maven-toolchains-plugin</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
   </dependencies>
   <repositories>
     <repository>

Added: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ConfigurationTag.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ConfigurationTag.java?rev=632163&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ConfigurationTag.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ConfigurationTag.java
Thu Feb 28 15:17:26 2008
@@ -0,0 +1,20 @@
+package org.apache.maven.dotnet.extensions.toolchain;
+
+public enum ConfigurationTag
+{
+    CSharpCompiler("csharpCompiler"),
+    NUnitConsole("nunitConsole");
+
+    private String tagName;
+
+    ConfigurationTag(String tagName)
+    {
+        this.tagName = tagName;
+    }
+
+    public String getTagName()
+    {
+        return tagName;
+    }
+
+}

Modified: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchain.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchain.java?rev=632163&r1=632162&r2=632163&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchain.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchain.java
Thu Feb 28 15:17:26 2008
@@ -3,22 +3,59 @@
 import org.apache.maven.toolchain.DefaultToolchain;
 import org.apache.maven.toolchain.model.ToolchainModel;
 import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.List;
+import java.util.Arrays;
 
 public final class DotnetToolchain
     extends DefaultToolchain
 {
+    private String csharpCompiler;
+
+    private String nunitConsole;
+
     public DotnetToolchain( ToolchainModel model, Logger logger )
     {
-        super(model, logger);
+        this( model, null, logger );
     }
 
     public DotnetToolchain( ToolchainModel model, String type, Logger logger )
     {
-        super(model, type, logger);
+        super( model, type, logger );
+        Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
+        List<Xpp3Dom> configurations = Arrays.asList( dom.getChildren() );
+        for ( Xpp3Dom configuration : configurations )
+        {
+            String key = configuration.getName();
+            String value = configuration.getValue();
+            if ( ConfigurationTag.CSharpCompiler.getTagName().equals( key ) )
+            {
+                this.csharpCompiler = value;
+            }
+            else if(ConfigurationTag.NUnitConsole.getTagName().equals( key ))
+            {
+                this.nunitConsole = value;
+            }
+        }
     }
 
     public String findTool( String toolName )
     {
+        if ( toolName == null || toolName.isEmpty() )
+        {
+            throw new IllegalArgumentException( "toolName" );
+        }
+
+        if ( toolName.equals( ConfigurationTag.CSharpCompiler.getTagName() ) )
+        {
+            return csharpCompiler;
+        }
+        else if(toolName.equals( ConfigurationTag.NUnitConsole.getTagName() ))
+        {
+            return nunitConsole;
+        }
         return null;
     }
+       
 }

Modified: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchainFactory.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchainFactory.java?rev=632163&r1=632162&r2=632163&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchainFactory.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/DotnetToolchainFactory.java
Thu Feb 28 15:17:26 2008
@@ -3,29 +3,59 @@
 import org.apache.maven.toolchain.ToolchainFactory;
 import org.apache.maven.toolchain.ToolchainPrivate;
 import org.apache.maven.toolchain.MisconfiguredToolchainException;
+import org.apache.maven.toolchain.RequirementMatcherFactory;
 import org.apache.maven.toolchain.model.ToolchainModel;
 import org.codehaus.plexus.logging.LogEnabled;
 import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
 
-public final class DotnetToolchainFactory implements ToolchainFactory, LogEnabled
+import java.util.Arrays;
+import java.util.List;
+
+public final class DotnetToolchainFactory
+    implements ToolchainFactory, LogEnabled
 {
     private Logger logger;
 
     public ToolchainPrivate createToolchain( ToolchainModel model )
         throws MisconfiguredToolchainException
     {
-        if(model == null)
+        if ( model == null )
         {
-            return null;
+            throw new MisconfiguredToolchainException("Toolchain model is null");
         }
 
-        DotnetToolchain dotnetToolchain = new DotnetToolchain(model, logger);
-        return dotnetToolchain;  
+        DotnetToolchain dotnetToolchain = new DotnetToolchain( model, logger );
+
+        Xpp3Dom dom = (Xpp3Dom) model.getProvides();
+        List<Xpp3Dom> provides = Arrays.asList(dom.getChildren());
+
+        for(Xpp3Dom provide: provides)
+        {
+            String key = provide.getName();
+            String value = provide.getValue();
+            if ( value == null )
+            {
+                throw new MisconfiguredToolchainException(
+                    "Provides token '" + key + "' doesn't have any value configured." );
+            }
+            else if ( ProvidesTag.FrameworkVersion.getTagName().equals( key ) ||
+                ProvidesTag.VendorVersion.getTagName().equals( key ) )
+            {
+                dotnetToolchain.addProvideToken( key, RequirementMatcherFactory.createVersionMatcher(
value ) );
+            }
+            else
+            {
+                dotnetToolchain.addProvideToken( key, RequirementMatcherFactory.createExactMatcher(
value ) );
+            }
+        }
+        return dotnetToolchain;
     }
 
     public ToolchainPrivate createDefaultToolchain()
     {
         return null;
+       // return new DotnetToolchain(new ToolchainModel(), logger);
     }
 
     public void enableLogging( Logger logger )

Added: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ProvidesTag.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ProvidesTag.java?rev=632163&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ProvidesTag.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/toolchain/ProvidesTag.java
Thu Feb 28 15:17:26 2008
@@ -0,0 +1,21 @@
+package org.apache.maven.dotnet.extensions.toolchain;
+
+public enum ProvidesTag
+{
+    FrameworkVersion( "frameworkVersion" ),
+    Vendor( "vendor" ),
+    VendorVersion( "vendorVersion" ),
+    Id( "id" );
+
+    private String tagName;
+
+    ProvidesTag( String tagName )
+    {
+        this.tagName = tagName;
+    }
+
+    public String getTagName()
+    {
+        return tagName;
+    }
+}

Modified: incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0000-CSharpCompileLibrary/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0000-CSharpCompileLibrary/pom.xml?rev=632163&r1=632162&r2=632163&view=diff
==============================================================================
--- incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0000-CSharpCompileLibrary/pom.xml
(original)
+++ incubator/nmaven/trunk/core-integration-tests/src/test/resources/MavenITmng-0000-CSharpCompileLibrary/pom.xml
Thu Feb 28 15:17:26 2008
@@ -32,6 +32,5 @@
         <artifactId>maven-dotnet-compiler-plugin</artifactId>
         <extensions>true</extensions>
       </plugin>
-    </plugins>
   </build>
 </project>

Modified: incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java?rev=632163&r1=632162&r2=632163&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
(original)
+++ incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/src/main/java/org/apache/maven/dotnet/plugin/compiler/CompilerMojo.java
Thu Feb 28 15:17:26 2008
@@ -31,12 +31,10 @@
 import org.apache.maven.dotnet.BuildDirectories;
 import org.apache.maven.dotnet.ArtifactType;
 import org.apache.maven.dotnet.InitializationException;
-import org.apache.maven.dotnet.extensions.toolchain.DotnetToolchain;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.toolchain.ToolchainManager;
-import org.apache.maven.toolchain.ToolchainManagerPrivate;
-import org.apache.maven.toolchain.MisconfiguredToolchainException;
+import org.apache.maven.toolchain.Toolchain;
 
 import java.io.File;
 import java.io.IOException;
@@ -121,14 +119,14 @@
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
-        DotnetToolchain dotnetToolchain =
-            (DotnetToolchain) toolchainManager.getToolchainFromBuildContext( "toolchain-dotnet",
mavenSession );
+        Toolchain dotnetToolchain =
+            toolchainManager.getToolchainFromBuildContext( "dotnet", mavenSession );
 
         if ( dotnetToolchain == null )
         {
             this.getLog().info( "Could not find dotnet toolchain." );
         }
-        
+
         File sourceDir =
             new File( project.getBuild().getDirectory(), BuildDirectories.BUILD_SOURCES.getBuildDirectoryName()
);
 

Modified: incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/src/main/resources/META-INF/plexus/components.xml?rev=632163&r1=632162&r2=632163&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/src/main/resources/META-INF/plexus/components.xml
(original)
+++ incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/src/main/resources/META-INF/plexus/components.xml
Thu Feb 28 15:17:26 2008
@@ -27,9 +27,6 @@
       </implementation>
       <configuration>
         <phases>
-          <validate>
-            org.apache.maven.plugins:maven-toolchains-plugin:toolchain 
-          </validate>
           <generate-sources>
             org.apache.maven.dotnet.plugins:maven-dotnet-compiler-plugin:generate-assembly-info
           </generate-sources>
@@ -170,7 +167,7 @@
         <phases>
           <generate-sources>
             org.apache.maven.dotnet.plugins:maven-dotnet-compiler-plugin:generate-assembly-info
-          </generate-sources>          
+          </generate-sources>
           <process-sources>
             org.apache.maven.dotnet.plugins:maven-dotnet-compiler-plugin:process-sources
           </process-sources>
@@ -292,5 +289,10 @@
       <role>org.apache.maven.dotnet.compiler.DotnetCompilerContext</role>
       <implementation>org.apache.maven.dotnet.compiler.impl.DotnetCompilerContextImpl</implementation>
     </component>
+    <component>
+      <role>org.apache.maven.toolchain.ToolchainFactory</role>
+      <role-hint>dotnet</role-hint>
+      <implementation>org.apache.maven.dotnet.extensions.toolchain.DotnetToolchainFactory</implementation>
+    </component>    
   </components>
 </component-set>



Mime
View raw message