incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r607346 - in /incubator/nmaven/trunk: components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/ components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/ components/maven-dotnet-compiler/sr...
Date Fri, 28 Dec 2007 22:14:58 GMT
Author: sisbell
Date: Fri Dec 28 14:14:57 2007
New Revision: 607346

URL: http://svn.apache.org/viewvc?rev=607346&view=rev
Log:
Compiler context now supports artifact scope. Fixed modules to only be used for direct dependencies.
Disabled support for GAC dependencies (working on fix for this).

Added:
    incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DummyArtifactHandler.java
  (with props)
    incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ArtifactScope.java
  (with props)
Modified:
    incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerContext.java
    incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
    incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java
    incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ArtifactType.java
    incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
    incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml

Modified: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerContext.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerContext.java?rev=607346&r1=607345&r2=607346&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerContext.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/DotnetCompilerContext.java
Fri Dec 28 14:14:57 2007
@@ -19,11 +19,13 @@
 package org.apache.maven.dotnet.compiler;
 
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.dotnet.ArtifactScope;
 
 import java.io.File;
 import java.util.Set;
 
-public interface DotnetCompilerContext extends CompilerContext
+public interface DotnetCompilerContext
+    extends CompilerContext
 {
     /**
      * Role used to register component implementations with the container.
@@ -52,14 +54,7 @@
      *
      * @return a list of library (dll) dependencies of the class files.
      */
-    Set<Artifact> getLibraryDependencies();
-
-    /**
-     * Returns a list of module (netmodule) dependencies of the class files.
-     *
-     * @return a list of module (netmodule) dependencies of the class files.
-     */
-    Set<Artifact> getModuleDependencies();
+    Set<Artifact> getLibraryDependenciesFor( ArtifactScope artifactScope );
 
     /**
      * Returns a list of resources that the compiler should link to the compiled assembly
@@ -89,5 +84,5 @@
      * @return a list of win32 resources.
      */
     Set<File> getWin32Resources();
-    
+
 }

Modified: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java?rev=607346&r1=607345&r2=607346&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImpl.java
Fri Dec 28 14:14:57 2007
@@ -26,6 +26,9 @@
 import java.util.HashSet;
 import java.util.Set;
 import java.util.Enumeration;
+import java.util.Map;
+import java.util.List;
+import java.util.HashMap;
 import java.net.URL;
 
 import org.apache.maven.artifact.Artifact;
@@ -38,6 +41,7 @@
 import org.apache.maven.dotnet.InitializationException;
 import org.apache.maven.dotnet.BuildDirectories;
 import org.apache.maven.dotnet.ArtifactType;
+import org.apache.maven.dotnet.ArtifactScope;
 import org.apache.maven.dotnet.compiler.CompilerAnnotation;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.logging.Logger;
@@ -55,7 +59,7 @@
 
     private DotnetCompilerConfig netCompilerConfig;
 
-    private Set<Artifact> libraryDependencies;
+    private Map<ArtifactScope, Set<Artifact>> libraryArtifactDependencyMap;
 
     private Set<Artifact> moduleDependencies;
 
@@ -85,17 +89,12 @@
 
     public Set<Artifact> getDirectModuleDependencies()
     {
-        return null;
-    }
-
-    public Set<Artifact> getLibraryDependencies()
-    {
-        return libraryDependencies;
+        return moduleDependencies;
     }
 
-    public Set<Artifact> getModuleDependencies()
+    public Set<Artifact> getLibraryDependenciesFor( ArtifactScope artifactScope )
     {
-        return moduleDependencies;
+        return libraryArtifactDependencyMap.get( artifactScope );
     }
 
     public Set<File> getLinkedResources()
@@ -161,9 +160,46 @@
         this.netCompilerConfig = (DotnetCompilerConfig) compilerConfig;
         netCompilerConfig.verifyCompilerConfig();
 
-        libraryDependencies = new HashSet<Artifact>();
+        HashSet<Artifact> compileLibraryDependencies = new HashSet<Artifact>();
+        HashSet<Artifact> systemLibraryDependencies = new HashSet<Artifact>();
+        HashSet<Artifact>  providedLibraryDependencies = new HashSet<Artifact>();
+        HashSet<Artifact> testLibraryDependencies = new HashSet<Artifact>();
+        HashSet<Artifact> runtimeLibraryDependencies = new HashSet<Artifact>();
+
+        libraryArtifactDependencyMap = new HashMap<ArtifactScope, Set<Artifact>>();
+        libraryArtifactDependencyMap.put( ArtifactScope.COMPILE, compileLibraryDependencies
);
+        libraryArtifactDependencyMap.put( ArtifactScope.SYSTEM, systemLibraryDependencies
);
+        libraryArtifactDependencyMap.put( ArtifactScope.PROVIDED, providedLibraryDependencies
);
+        libraryArtifactDependencyMap.put( ArtifactScope.TEST, testLibraryDependencies );
+        libraryArtifactDependencyMap.put( ArtifactScope.RUNTIME, runtimeLibraryDependencies
);
+
         moduleDependencies = new HashSet<Artifact>();
 
+        //Module dependencies non-transitive
+        Set<Artifact> directDependentArtifacts = project.getDependencyArtifacts();
+        if ( directDependentArtifacts != null )
+        {
+            for ( Artifact artifact : directDependentArtifacts )
+            {
+                String type = artifact.getType();
+                if ( type.equals( ArtifactType.MODULE.getPackagingType() ) )
+                {
+                    if ( !ArtifactScope.COMPILE.isMatchByString( artifact.getScope() ) )
+                    {
+                        throw new InitializationException(
+                            "Module must be of compile scope: Scope = " + artifact.getScope()
);
+                    }
+                    moduleDependencies.add( artifact );
+                }
+            }
+        }
+
+        addLibraryArtifactsToTarget( project.getCompileArtifacts(), compileLibraryDependencies
);
+        addLibraryArtifactsToTarget( project.getTestArtifacts(), testLibraryDependencies
);
+        addLibraryArtifactsToTarget( project.getRuntimeArtifacts(), runtimeLibraryDependencies
);
+/*
+        List<Artifact> providedArtifacts = project.getSystemArtifacts();
+
         Set<Artifact> dependentArtifacts = project.getArtifacts();
 
         if ( dependentArtifacts != null )
@@ -171,22 +207,14 @@
             for ( Artifact dependentArtifact : dependentArtifacts )
             {
                 String type = dependentArtifact.getType();
-                if ( type.equals( ArtifactType.MODULE.getPackagingType() ) )
-                {
-                    moduleDependencies.add( dependentArtifact );
-                }
-                else if ( type.equals( ArtifactType.LIBRARY.getPackagingType() ) ||
-                    type.equals( ArtifactType.EXE.getPackagingType() ) )
-                {
-                    libraryDependencies.add( dependentArtifact );
-                }
-                else if ( type.startsWith( "dotnet:gac" ) )
+                String scope = dependentArtifact.getScope();
+                if ( type.startsWith( "dotnet:gac" ) )
                 {
                     if ( StringUtils.isEmpty( dependentArtifact.getClassifier() ) )
                     {
                         throw new IllegalArgumentException( "classifier" );
                     }
-                    if ( type.equals( "dotnet:gac_generic" ) )
+                    if ( type.equals( ArtifactType.GAC_GENERIC.getPackagingType() ) )
                     {
                         String gacRoot = null;
                         if ( netCompilerConfig.getVendor().equals( Vendor.MICROSOFT ) &&
@@ -211,21 +239,21 @@
                             libraryDependencies.add( dependentArtifact );
                         }
                     }
-                    else if ( type.equals( "dotnet:gac" ) )
+                    else if ( type.equals( ArtifactType.GAC.getPackagingType() ) )
                     {
                         String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL
) ) ? getGacRootForMono()
                             : replaceFileSeparator( System.getenv( "SystemRoot" ) + "\\assembly\\GAC\\"
);
                         setArtifactGacFile( gacRoot, dependentArtifact );
                         libraryDependencies.add( dependentArtifact );
                     }
-                    else if ( type.equals( "dotnet:gac_32" ) )
+                    else if ( type.equals( ArtifactType.GAC_32.getPackagingType() ) )
                     {
                         String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL
) ) ? getGacRootForMono()
                             : replaceFileSeparator( System.getenv( "SystemRoot" ) + "\\assembly\\GAC_32\\"
);
                         setArtifactGacFile( gacRoot, dependentArtifact );
                         libraryDependencies.add( dependentArtifact );
                     }
-                    else if ( type.equals( "dotnet:gac_msil" ) )
+                    else if ( type.equals( ArtifactType.GAC_MSIL.getPackagingType() ) )
                     {
                         String gacRoot = ( netCompilerConfig.getVendor().equals( Vendor.NOVELL
) ) ? getGacRootForMono()
                             : replaceFileSeparator( System.getenv( "SystemRoot" ) + "\\assembly\\GAC_MSIL\\"
);
@@ -234,8 +262,9 @@
                     }
                 }
             }//end for loop
-        }
 
+        }
+          */
         Enumeration<URL> resources =
             this.getClass().getClassLoader().getResources( "/META-INF/nmaven/annotation-resources.txt"
);
 
@@ -302,6 +331,29 @@
             if ( icons.length == 1 )
             {
                 win32icon = icons[0];
+            }
+        }
+    }
+
+    private void addLibraryArtifactsToTarget( List<Artifact> sourceArtifacts, Set<Artifact>
targetArtifacts )
+        throws InitializationException
+    {
+        if ( sourceArtifacts == null )
+        {
+            return;
+        }
+
+        for ( Artifact artifact : sourceArtifacts )
+        {
+            String type = artifact.getType();
+            if ( ArtifactType.LIBRARY.isMatchByString( type ) || ArtifactType.EXE.isMatchByString(
type ) ||
+                ArtifactType.WINEXE.isMatchByString( type ) )
+            {
+                targetArtifacts.add( artifact );
+            }
+            else if ( type.startsWith( "dotnet:gac" ) )
+            {
+                throw new InitializationException( "Gac dependency scope must be specified
as provided or system" );
             }
         }
     }

Modified: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java?rev=607346&r1=607345&r2=607346&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DotnetCompilerContextImplTest.java
Fri Dec 28 14:14:57 2007
@@ -18,6 +18,7 @@
 import org.apache.maven.dotnet.ProgrammingLanguage;
 import org.apache.maven.dotnet.Vendor;
 import org.apache.maven.dotnet.InitializationException;
+import org.apache.maven.dotnet.ArtifactScope;
 import org.apache.maven.dotnet.compiler.ClassCompiler;
 
 import org.junit.Test;
@@ -25,7 +26,6 @@
 import org.hamcrest.BaseMatcher;
 import org.hamcrest.CoreMatchers;
 import static org.junit.Assert.*;
-import org.codehaus.plexus.util.FileUtils;
 
 public class DotnetCompilerContextImplTest
 {
@@ -56,7 +56,7 @@
         MavenProject project = new MavenProject();
 
         Set<Artifact> dependencyArtifacts = new HashSet<Artifact>();
-        project.setArtifacts( dependencyArtifacts );
+        project.setDependencyArtifacts( dependencyArtifacts );
         Artifact artifact = new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersion(
"1.0" ),
                                                  "compile", "dotnet:module", null, new DefaultArtifactHandler(
"dotnet:module" ),
                                                  false );
@@ -69,7 +69,7 @@
         ctx.turnOffCompilerExistsCheck();
         ctx.init( project, getDefaultDotnetCompilerConfig() );
 
-        Set<Artifact> modules = ctx.getModuleDependencies();
+        Set<Artifact> modules = ctx.getDirectModuleDependencies();
         assertThat( modules.size(), equalTo( 1 ) );
     }
 
@@ -85,6 +85,7 @@
         Artifact artifact = new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersion(
"1.0" ),
                                                  "compile", "dotnet:library", null, new DefaultArtifactHandler(
"dotnet:library" ),
                                                  false );
+        artifact.setArtifactHandler( new DummyArtifactHandler());
         dependencyArtifacts.add( artifact );
 
         Build build = new Build();
@@ -94,7 +95,7 @@
         ctx.turnOffCompilerExistsCheck();
         ctx.init( project, getDefaultDotnetCompilerConfig() );
 
-        Set<Artifact> libraries = ctx.getLibraryDependencies();
+        Set<Artifact> libraries = ctx.getLibraryDependenciesFor( ArtifactScope.COMPILE);
         assertThat( libraries.size(), equalTo( 1 ) );
     }
 
@@ -109,6 +110,7 @@
         project.setArtifacts( dependencyArtifacts );
         Artifact artifact = new DefaultArtifact( "groupId", "artifactId", VersionRange.createFromVersion(
"1.0" ),
                                                  "compile", "dotnet:exe", null, new DefaultArtifactHandler(
"dotnet:exe" ), false );
+        artifact.setArtifactHandler( new DummyArtifactHandler());
         dependencyArtifacts.add( artifact );
 
         Build build = new Build();
@@ -118,11 +120,11 @@
         ctx.turnOffCompilerExistsCheck();
         ctx.init( project, getDefaultDotnetCompilerConfig() );
 
-        Set<Artifact> libraries = ctx.getLibraryDependencies();
+        Set<Artifact> libraries = ctx.getLibraryDependenciesFor(ArtifactScope.COMPILE);
         assertThat( libraries.size(), equalTo( 1 ) );
     }
 
-    @Test
+    //@Test
     public void testInit_WithGacGenericAndMicrosoft()
         throws InitializationException, IOException
     {
@@ -145,7 +147,7 @@
 
         ctx.init( project, getDefaultDotnetCompilerConfig() );
 
-        Set<Artifact> libraries = ctx.getLibraryDependencies();
+        Set<Artifact> libraries = ctx.getLibraryDependenciesFor(ArtifactScope.COMPILE);
         assertThat( libraries.size(), equalTo( 1 ) );
         assertThat( ( (Artifact) libraries.toArray()[0] ).getFile().getAbsolutePath(),
                     CoreMatchers.allOf( new BaseMatcher()
@@ -168,7 +170,7 @@
    // @Test
     public void testInit_WithGacGenericAndNovellAndPath()
         throws InitializationException, IOException
-    {
+    {                                         
         String monoRoot = Vendor.getDefaultVendorForOS().equals( Vendor.NOVELL ) ? "/Mono"
: "C:\\Program Files\\Mono";
 
         System.setProperty( "PATH", monoRoot + File.separator + "bin" );
@@ -193,7 +195,7 @@
         ctx.turnOffCompilerExistsCheck();
         ctx.init( project, compilerConfig );
 
-        Set<Artifact> libraries = ctx.getLibraryDependencies();
+        Set<Artifact> libraries = ctx.getLibraryDependenciesFor(ArtifactScope.COMPILE);
         assertThat( libraries.size(), equalTo( 1 ) );
         assertThat( ( (Artifact) libraries.toArray()[0] ).getFile().getAbsolutePath(), equalTo(
             monoRoot + replaceFileSeparator( "\\lib\\mono\\gac\\artifactId\\1.0__dsfajkdsfajdfs\\artifactId.dll"
) ) );
@@ -226,7 +228,7 @@
         ctx.turnOffCompilerExistsCheck();
         ctx.init( project, compilerConfig );
 
-        Set<Artifact> libraries = ctx.getLibraryDependencies();
+        Set<Artifact> libraries = ctx.getLibraryDependenciesFor(ArtifactScope.COMPILE);
         assertThat( libraries.size(), equalTo( 1 ) );
         assertThat( ( (Artifact) libraries.toArray()[0] ).getFile().getAbsolutePath(), equalTo(
             monoRoot + replaceFileSeparator( "\\lib\\mono\\gac\\artifactId\\1.0__dsfajkdsfajdfs\\artifactId.dll"
) ) );

Added: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DummyArtifactHandler.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DummyArtifactHandler.java?rev=607346&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DummyArtifactHandler.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DummyArtifactHandler.java
Fri Dec 28 14:14:57 2007
@@ -0,0 +1,13 @@
+package org.apache.maven.dotnet.compiler.impl;
+
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+public final class DummyArtifactHandler
+    extends DefaultArtifactHandler
+{
+
+    public boolean isAddedToClasspath()
+    {
+        return true;
+    }
+}

Propchange: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/test/java/org/apache/maven/dotnet/compiler/impl/DummyArtifactHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ArtifactScope.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ArtifactScope.java?rev=607346&view=auto
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ArtifactScope.java
(added)
+++ incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ArtifactScope.java
Fri Dec 28 14:14:57 2007
@@ -0,0 +1,35 @@
+package org.apache.maven.dotnet;
+
+public enum ArtifactScope
+{
+    COMPILE( "compile" ),
+    TEST( "test" ),
+    RUNTIME( "runtime" ),
+    PROVIDED( "provided" ),
+    SYSTEM( "system" );
+
+    private final String scope;
+
+    ArtifactScope( String scope )
+    {
+        this.scope = scope;
+    }
+
+    public boolean isMatchByString( String artifactScope )
+    {
+        if ( artifactScope == null )
+        {
+            throw new IllegalArgumentException( "artifactScope" );
+        }
+        return scope.equals( artifactScope );
+    }
+
+    public static ArtifactScope getArtifactScopeFor( String artifactScope )
+    {
+        if ( artifactScope == null )
+        {
+            throw new IllegalArgumentException( "artifactScope" );
+        }
+        return ArtifactScope.valueOf( artifactScope.toUpperCase() );
+    }
+}

Propchange: incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ArtifactScope.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ArtifactType.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ArtifactType.java?rev=607346&r1=607345&r2=607346&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ArtifactType.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ArtifactType.java
Fri Dec 28 14:14:57 2007
@@ -23,15 +23,14 @@
  */
 public enum ArtifactType
 {
-    MODULE( "dotnet:module", "module", "netmodule" ),
-    LIBRARY( "dotnet:library", "library", "dll" ),
     EXE( "dotnet:exe", "exe", "exe" ),
+    GAC( "dotnet:gac", "library", "dll" ),
+    GAC_32( "dotnet:gac_32", "library", "dll" ),
+    GAC_GENERIC( "dotnet:gac_generic", "library", "dll" ),
+    GAC_MSIL( "dotnet:gac_msil", "library", "dll" ),
+    LIBRARY( "dotnet:library", "library", "dll" ),
+    MODULE( "dotnet:module", "module", "netmodule" ),
     WINEXE( "dotnet:winexe", "winexe", "exe" ),
-    NAR( "dotnet:nar", "null", "nar" ),
-    EXECONFIG( "exe.config", "null", "exe.config" ),
-    NETPLUGIN( "netplugin", "library", "dll" ),
-    VISUAL_STUDIO_ADDIN( "visual-studio-addin", "library", "dll" ),
-    SHARP_DEVELOP_ADDIN( "sharp-develop-addin", "library", "dll" ),
     NULL( "null", "null", "null" );
 
     /**
@@ -89,6 +88,15 @@
         return targetCompileType;
     }
 
+    public boolean isMatchByString( String packaging )
+    {
+        if ( packaging == null )
+        {
+            throw new IllegalArgumentException( "packaging" );
+        }
+        return packaging.equals( packagingType );
+    }
+
     /**
      * Returns artifact type for the specified packaging name
      *
@@ -97,46 +105,16 @@
      */
     public static synchronized ArtifactType getArtifactTypeForPackagingName( String packagingName
)
     {
-        if ( packagingName.equals( ArtifactType.MODULE.getPackagingType() ) )
-        {
-            return ArtifactType.MODULE;
-        }
-        else if ( packagingName.equals( ArtifactType.LIBRARY.getPackagingType() ) )
-        {
-            return ArtifactType.LIBRARY;
-        }
-        else if ( packagingName.equals( ArtifactType.EXE.getPackagingType() ) )
+        if(packagingName == null)
         {
-            return ArtifactType.EXE;
+            throw new IllegalArgumentException("packagingName");
         }
-        else if ( packagingName.equals( ArtifactType.WINEXE.getPackagingType() ) )
+        String[] packagingNameTokens = packagingName.split( "[:]");
+        if(packagingNameTokens.length != 2 || !packagingNameTokens[0].equals( "dotnet"))
         {
-            return ArtifactType.WINEXE;
+            throw new IllegalArgumentException("packagingName");
         }
-        else if ( packagingName.equals( ArtifactType.NAR.getPackagingType() ) )
-        {
-            return ArtifactType.LIBRARY;
-        }
-        else if ( packagingName.equals( ArtifactType.NAR.getPackagingType() ) )
-        {
-            return ArtifactType.NAR;
-        }
-        else if ( packagingName.equals( ArtifactType.EXECONFIG.getPackagingType() ) )
-        {
-            return ArtifactType.EXECONFIG;
-        }
-        else if ( packagingName.equals( ArtifactType.NETPLUGIN.getPackagingType() ) )
-        {
-            return ArtifactType.NETPLUGIN;
-        }
-        else if ( packagingName.equals( ArtifactType.SHARP_DEVELOP_ADDIN.getPackagingType()
) )
-        {
-            return ArtifactType.SHARP_DEVELOP_ADDIN;
-        }
-        else if ( packagingName.equals( ArtifactType.VISUAL_STUDIO_ADDIN.getPackagingType()
) )
-        {
-            return ArtifactType.VISUAL_STUDIO_ADDIN;
-        }
-        return ArtifactType.NULL;
+
+        return ArtifactType.valueOf( packagingNameTokens[1].toUpperCase());
     }
 }

Modified: incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java?rev=607346&r1=607345&r2=607346&view=diff
==============================================================================
--- incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
(original)
+++ incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java
Fri Dec 28 14:14:57 2007
@@ -35,6 +35,7 @@
 import org.apache.maven.dotnet.compiler.InvalidArtifactException;
 import org.apache.maven.dotnet.ProgrammingLanguage;
 import org.apache.maven.dotnet.Vendor;
+import org.apache.maven.dotnet.ArtifactScope;
 
 @CompilerAnnotation(programmingLanguaqe = ProgrammingLanguage.C_SHARP,
                     vendors = {Vendor.MICROSOFT, Vendor.NOVELL, Vendor.ANY},
@@ -55,7 +56,7 @@
     public List<String> getCommands()
     {
         DotnetCompilerConfig config = (DotnetCompilerConfig) compilerContext.getCompilerConfig();
-        Set<Artifact> references = compilerContext.getLibraryDependencies();
+        Set<Artifact> references = compilerContext.getLibraryDependenciesFor( ArtifactScope.COMPILE);
         Set<Artifact> modules = compilerContext.getDirectModuleDependencies();
 
         File sourceDirectory = config.getCompilerDirectory();

Modified: incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml?rev=607346&r1=607345&r2=607346&view=diff
==============================================================================
--- incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml
(original)
+++ incubator/nmaven/trunk/plugins/maven-compiler-plugin/src/main/resources/META-INF/plexus/components.xml
Fri Dec 28 14:14:57 2007
@@ -102,6 +102,7 @@
       <configuration>
         <extension>dll</extension>
         <type>dotnet:library</type>
+        <addedToClasspath>true</addedToClasspath>
       </configuration>
     </component>
     <component>
@@ -111,6 +112,7 @@
       <configuration>
         <extension>exe</extension>
         <type>dotnet:exe</type>
+        <addedToClasspath>true</addedToClasspath>
       </configuration>
     </component>
     <component>
@@ -120,6 +122,7 @@
       <configuration>
         <extension>netmodule</extension>
         <type>dotnet:module</type>
+        <addedToClasspath>true</addedToClasspath>
       </configuration>
     </component>
     <component>
@@ -129,6 +132,7 @@
       <configuration>
         <extension>exe</extension>
         <type>dotnet:winexe</type>
+        <addedToClasspath>true</addedToClasspath>
       </configuration>
     </component>
     <component>



Mime
View raw message