Author: mkleint
Date: Thu Feb 14 11:15:30 2008
New Revision: 627845

URL: http://svn.apache.org/viewvc?rev=627845&view=rev
Log:
introduce ToolchainPrivate.matchesRequirement(Map) that pulls the requirement 
matching into the codebase of the toolchain type developer. Should be more 
flexible than having it hardwired into the toolchain plugin.

Modified:
    maven/plugins/trunk/maven-toolchains-plugin/pom.xml
    
maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java

Modified: maven/plugins/trunk/maven-toolchains-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-toolchains-plugin/pom.xml?rev=627845&r1=627844&r2=627845&view=diff
==============================================================================
--- maven/plugins/trunk/maven-toolchains-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-toolchains-plugin/pom.xml Thu Feb 14 11:15:30 2008
@@ -35,7 +35,7 @@
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-plugin-api</artifactId>
-      <version>2.0.9-SNAPSHOT</version>
+      <version>2.0.8</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.shared</groupId>

Modified: 
maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java?rev=627845&r1=627844&r2=627845&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java
 Thu Feb 14 11:15:30 2008
@@ -88,7 +88,7 @@
                     boolean matched = false;
                     for ( int i = 0; i < tcs.length; i++ )
                     {
-                        if ( toolchainMatchesRequirements( tcs[i], params ) )
+                        if ( tcs[i].matchesRequirements( params ) )
                         {
                             getLog(  ).info( "Toolchain (" + type + ") 
matched:" + tcs[i] );
                             toolchainManager.storeToolchainToBuildContext( 
tcs[i],
@@ -140,26 +140,4 @@
         }
     }
 
-    private boolean toolchainMatchesRequirements( ToolchainPrivate toolchain,
-                                                  Map params )
-    {
-        Map matchers = toolchain.getRequirementMatchers();
-        Iterator it = params.keySet().iterator();
-        while ( it.hasNext() )
-        {
-            String key = (String) it.next();
-            RequirementMatcher matcher = (RequirementMatcher) 
matchers.get(key);
-            if ( matcher == null )
-            {
-                getLog().debug( "Toolchain "  + toolchain + " is missing 
required property: "  + key );
-                return false;
-            }
-            if ( !matcher.matches( (String) params.get(key) ) )
-            {
-                getLog().debug( "Toolchain "  + toolchain + " doesn't match 
required property: "  + key );
-                return false;
-            }
-        }
-        return true;
-    }
 }


Reply via email to