incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r616007 - in /incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain: DotnetToolchain.java ProgrammingLanguageMatchPolicy.java Toolchain.java ToolchainContext.java
Date Mon, 28 Jan 2008 19:17:46 GMT
Author: sisbell
Date: Mon Jan 28 11:17:44 2008
New Revision: 616007

URL: http://svn.apache.org/viewvc?rev=616007&view=rev
Log:
Fleshed out toolchain impl more.

Modified:
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/DotnetToolchain.java
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProgrammingLanguageMatchPolicy.java
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/Toolchain.java
    incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainContext.java

Modified: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/DotnetToolchain.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/DotnetToolchain.java?rev=616007&r1=616006&r2=616007&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/DotnetToolchain.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/DotnetToolchain.java
Mon Jan 28 11:17:44 2008
@@ -8,9 +8,19 @@
 {
     private Vendor vendor;
 
+    private ProgrammingLanguage programmingLanguage;
+
+    private ToolchainModel toolchainModel;
+
     public ToolchainModel getToolchainModel()
     {
-        return null;
+        return toolchainModel;
+    }
+
+    public void init( ToolchainModel toolchainModel )
+    {
+        this.toolchainModel = toolchainModel;
+        //set vendor and programming language here.
     }
 
     public Vendor getVendor(){
@@ -19,6 +29,6 @@
 
     public ProgrammingLanguage getProgrammingLanguage()
     {
-        return null;
-    }    
+        return programmingLanguage;
+    }
 }

Modified: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProgrammingLanguageMatchPolicy.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProgrammingLanguageMatchPolicy.java?rev=616007&r1=616006&r2=616007&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProgrammingLanguageMatchPolicy.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ProgrammingLanguageMatchPolicy.java
Mon Jan 28 11:17:44 2008
@@ -14,6 +14,12 @@
 
     public boolean match( Toolchain toolchain )
     {
-        return false;
+        if ( toolchain == null || ! ( toolchain instanceof DotnetToolchain ) )
+        {
+            throw new IllegalArgumentException( "toolchain" );
+        }
+
+        DotnetToolchain dotnetToolchain = (DotnetToolchain) toolchain;
+        return programmingLanguage.equals(dotnetToolchain.getProgrammingLanguage());
     }
 }

Modified: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/Toolchain.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/Toolchain.java?rev=616007&r1=616006&r2=616007&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/Toolchain.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/Toolchain.java
Mon Jan 28 11:17:44 2008
@@ -5,4 +5,6 @@
 public interface Toolchain
 {
     ToolchainModel getToolchainModel();
+
+    public void init(ToolchainModel toolchainModel);
 }

Modified: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainContext.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainContext.java?rev=616007&r1=616006&r2=616007&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainContext.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ToolchainContext.java
Mon Jan 28 11:17:44 2008
@@ -1,19 +1,52 @@
 package org.apache.maven.dotnet.toolchain;
 
+import org.apache.maven.toolchain.model.ToolchainModel;
+import org.apache.maven.toolchain.model.PersistedToolchains;
+
 import java.util.Collection;
 import java.util.List;
 import java.util.ArrayList;
 
 public class ToolchainContext
 {
-    Collection<Toolchain> getToolchainsFor(Collection<ToolchainMatchPolicy> toolchainMatchPolicies)
-    {
-        //get list of toolchain models
-        //convert list of models into platform specific type
-        //match list of types to policies
-        //return list of matches
+    private PersistedToolchains toolchainModels;
 
+    public Collection<Toolchain> getToolchainsFor( Collection<ToolchainMatchPolicy>
toolchainMatchPolicies )
+    {
         List<Toolchain> toolchains = new ArrayList<Toolchain>();
+        for ( ToolchainModel model : (List<ToolchainModel>) toolchainModels.getToolchains()
)
+        {
+            Toolchain toolchain = new DotnetToolchain();//exact type should be configured
in toolchains.xml
+            toolchain.init( model );
+
+            if ( toolchainMatchPolicies == null || isMatch( toolchain, toolchainMatchPolicies
) )
+            {
+                toolchains.add( toolchain );
+            }
+
+        }
         return toolchains;
+    }
+
+    private static boolean isMatch( Toolchain toolchain, Collection<ToolchainMatchPolicy>
toolchainMatchPolicies )
+    {
+        for ( ToolchainMatchPolicy policy : toolchainMatchPolicies )
+        {
+            if ( !policy.match( toolchain ) )
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public void init( PersistedToolchains toolchainModels )
+    {
+        if ( toolchainModels == null )
+        {
+            throw new IllegalArgumentException( "toolchainModels" );
+        }
+
+        this.toolchainModels = toolchainModels;
     }
 }



Mime
View raw message