You are viewing a plain text version of this content. The canonical link for it is here.
Posted to nmaven-commits@incubator.apache.org by si...@apache.org on 2007/03/02 18:14:09 UTC

svn commit: r513874 - in /incubator/nmaven/branches/SI_IDE: components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ components/dotnet-executable/src/main...

Author: sisbell
Date: Fri Mar  2 10:14:08 2007
New Revision: 513874

URL: http://svn.apache.org/viewvc?view=rev&rev=513874
Log:
 Moved ArtifactType to dotnet.artifact module. The concept of artifact type is no longer specific to compilers, we need a way of installing artifacts differently based on type (specifically exe).

Added:
    incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactType.java   (with props)
Removed:
    incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/ArtifactType.java
Modified:
    incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactContext.java
    incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java
    incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/ExecutableConfig.java
    incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/CompilerConfig.java
    incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java
    incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/CompilerMojo.java
    incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/TestCompilerMojo.java
    incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java

Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactContext.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactContext.java?view=diff&rev=513874&r1=513873&r2=513874
==============================================================================
--- incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactContext.java (original)
+++ incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactContext.java Fri Mar  2 10:14:08 2007
@@ -79,7 +79,7 @@
      *         but not null.
      */
     List<Artifact> getArtifactsFor( String groupId, String artifactId, String version, String type );
-
+    
     /**
      * Returns an artifact installer used for installing NMaven artifacts into the local Maven repository.
      *

Added: incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactType.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactType.java?view=auto&rev=513874
==============================================================================
--- incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactType.java (added)
+++ incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactType.java Fri Mar  2 10:14:08 2007
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+package org.apache.maven.dotnet.artifact;
+
+/**
+ * Enumeration of all the valid target types (module, library, winexe, exe, nar) for the .NET platform.
+ *
+ * @author Shane Isbell
+ */
+public enum ArtifactType
+{
+    MODULE( "module", "netmodule" ),
+    LIBRARY( "library", "dll" ),
+    EXE( "exe", "exe" ),
+    WINEXE( "winexe", "exe" ),
+    NAR( "nar", "nar" ),
+    EXECONFIG( "exe.config", "exe.config" ),
+    NULL( "null", "null" );
+
+    private String extension;
+
+    private String artifactTypeName;
+
+    /**
+     * Constructor
+     */
+    ArtifactType( String artifactTypeName, String extension )
+    {
+        this.artifactTypeName = artifactTypeName;
+        this.extension = extension;
+    }
+
+    /**
+     * Returns extension used for the artifact(netmodule, dll, exe).
+     *
+     * @return Extension used for the artifact(netmodule, dll, exe).
+     */
+    public String getExtension()
+    {
+        return extension;
+    }
+
+    /**
+     * Returns target types (module, library, winexe, exe) for the .NET platform.
+     *
+     * @return target types (module, library, winexe, exe) for the .NET platform.
+     */
+    public String getArtifactTypeName()
+    {
+        return artifactTypeName;
+    }
+
+    public static synchronized ArtifactType getArtifactTypeForName(String name)
+    {
+        if ( name.equals( ArtifactType.MODULE.getArtifactTypeName() ) )
+        {
+            return ArtifactType.MODULE;
+        }
+        else if ( name.equals( ArtifactType.LIBRARY.getArtifactTypeName() ) )
+        {
+            return ArtifactType.LIBRARY;
+        }
+        else if ( name.equals( ArtifactType.EXE.getArtifactTypeName() ) )
+        {
+            return ArtifactType.EXE;
+        }
+        else if ( name.equals( ArtifactType.WINEXE.getArtifactTypeName() ) )
+        {
+            return ArtifactType.WINEXE;
+        }
+        else if ( name.equals( ArtifactType.NAR.getArtifactTypeName() ) )
+        {
+           return ArtifactType.LIBRARY;
+        }
+        return ArtifactType.NULL;
+    }
+
+    public static synchronized ArtifactType getArtifactTypeForExtension(String extension)
+    {
+        if ( extension.equals( ArtifactType.MODULE.getExtension()) )
+        {
+            return ArtifactType.MODULE;
+        }
+        else if ( extension.equals( ArtifactType.LIBRARY.getExtension() ) )
+        {
+            return ArtifactType.LIBRARY;
+        }
+        else if ( extension.equals( ArtifactType.EXE.getExtension() ) )
+        {
+            return ArtifactType.EXE;
+        }
+        else if ( extension.equals( ArtifactType.WINEXE.getExtension() ) )
+        {
+            return ArtifactType.WINEXE;
+        }
+        else if ( extension.equals( ArtifactType.NAR.getExtension() ) )
+        {
+           return ArtifactType.LIBRARY;
+        }
+        return ArtifactType.NULL;
+    }
+}

Propchange: incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/ArtifactType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java?view=diff&rev=513874&r1=513873&r2=513874
==============================================================================
--- incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java (original)
+++ incubator/nmaven/branches/SI_IDE/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java Fri Mar  2 10:14:08 2007
@@ -22,6 +22,7 @@
 import org.apache.maven.dotnet.artifact.ArtifactContext;
 import org.apache.maven.dotnet.artifact.AssemblyRepositoryLayout;
 import org.apache.maven.dotnet.artifact.ApplicationConfig;
+import org.apache.maven.dotnet.artifact.ArtifactType;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
@@ -185,15 +186,6 @@
             if ( artifact.getFile() != null && artifact.getFile().exists() )//maybe just a test compile and no install
             {
                 mavenInstaller.install( artifact.getFile(), artifact, artifactRepository );
-                //Installing Linked file for IDE:
-                /*
-                File linkedFile =
-                    new File( artifact.getFile().getParent() + File.separatorChar + artifact.getArtifactId() + ".dll" );
-                if ( artifact.getType().equals( "module" ) && linkedFile.exists() )
-                {
-                    mavenInstaller.install( linkedFile, artifact, artifactRepository );
-                }
-                */
             }
         }
         catch ( ArtifactInstallationException e )
@@ -300,12 +292,12 @@
 
             depPath.append( dependency.getArtifactId() ).append( File.separator )
                 .append( dependency.getVersion() ).append( File.separator );
-            File file = new File(
-                depPath.toString() + dependency.getArtifactId() + ".dll" ); //TODO: other types
+            File file = new File( depPath.toString() + dependency.getArtifactId() +
+                ArtifactType.getArtifactTypeForName( dependency.getType() ) ); //TODO: other types
 
             try
             {
-                logger.info( "NMAVEN-002-000: Installing File: From = " + file.getAbsolutePath() + ", To = " +
+                logger.info( "NMAVEN-002-016: Installing File: From = " + file.getAbsolutePath() + ", To = " +
                     depPath.toString() + dependency.getArtifactId() + ".dll" );
                 FileUtils.copyFileToDirectory( file, new File( path.toString() ) );
             }

Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/ExecutableConfig.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/ExecutableConfig.java?view=diff&rev=513874&r1=513873&r2=513874
==============================================================================
--- incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/ExecutableConfig.java (original)
+++ incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/ExecutableConfig.java Fri Mar  2 10:14:08 2007
@@ -19,7 +19,7 @@
 package org.apache.maven.dotnet.executable;
 
 import org.apache.maven.dotnet.executable.compiler.CompilerConfig;
-import org.apache.maven.dotnet.executable.compiler.ArtifactType;
+import org.apache.maven.dotnet.artifact.ArtifactType;
 import org.apache.maven.dotnet.executable.compiler.KeyInfo;
 
 import java.util.List;

Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/CompilerConfig.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/CompilerConfig.java?view=diff&rev=513874&r1=513873&r2=513874
==============================================================================
--- incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/CompilerConfig.java (original)
+++ incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/CompilerConfig.java Fri Mar  2 10:14:08 2007
@@ -18,7 +18,7 @@
  */
 package org.apache.maven.dotnet.executable.compiler;
 
-import org.apache.maven.dotnet.executable.compiler.ArtifactType;
+import org.apache.maven.dotnet.artifact.ArtifactType;
 import org.apache.maven.dotnet.executable.ExecutableConfig;
 
 import java.io.File;

Modified: incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java?view=diff&rev=513874&r1=513873&r2=513874
==============================================================================
--- incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java (original)
+++ incubator/nmaven/branches/SI_IDE/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/impl/CompilerContextImpl.java Fri Mar  2 10:14:08 2007
@@ -26,6 +26,7 @@
 import org.apache.maven.dotnet.executable.compiler.InvalidArtifactException;
 import org.apache.maven.dotnet.artifact.ArtifactContext;
 import org.apache.maven.dotnet.artifact.ArtifactException;
+import org.apache.maven.dotnet.artifact.ArtifactType;
 
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.artifact.Artifact;

Modified: incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/CompilerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/CompilerMojo.java?view=diff&rev=513874&r1=513873&r2=513874
==============================================================================
--- incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/CompilerMojo.java (original)
+++ incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/CompilerMojo.java Fri Mar  2 10:14:08 2007
@@ -23,6 +23,7 @@
 
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.dotnet.PlatformUnsupportedException;
+import org.apache.maven.dotnet.artifact.ArtifactType;
 import org.apache.maven.dotnet.executable.ExecutionException;
 import org.apache.maven.dotnet.vendor.VendorFactory;
 import org.apache.maven.dotnet.executable.compiler.*;
@@ -75,12 +76,14 @@
 
     /**
      * 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;
@@ -179,32 +182,13 @@
             compilerConfig.setCommands( parameters );
         }
         String artifactTypeName = project.getArtifact().getType();
-
-        if ( artifactTypeName.equals( ArtifactType.MODULE.getArtifactTypeName() ) )
-        {
-            compilerConfig.setArtifactType( ArtifactType.MODULE );
-        }
-        else if ( artifactTypeName.equals( ArtifactType.LIBRARY.getArtifactTypeName() ) )
-        {
-            compilerConfig.setArtifactType( ArtifactType.LIBRARY );
-        }
-        else if ( artifactTypeName.equals( ArtifactType.EXE.getArtifactTypeName() ) )
-        {
-            compilerConfig.setArtifactType( ArtifactType.EXE );
-        }
-        else if ( artifactTypeName.equals( ArtifactType.WINEXE.getArtifactTypeName() ) )
-        {
-            compilerConfig.setArtifactType( ArtifactType.WINEXE );
-        }
-        else if ( artifactTypeName.equals( ArtifactType.NAR.getArtifactTypeName() ) )
-        {
-            compilerConfig.setArtifactType( ArtifactType.LIBRARY );
-        }
-        else
+        ArtifactType artifactType = ArtifactType.getArtifactTypeForName( artifactTypeName );
+        if ( artifactType.equals( ArtifactType.NULL ) )
         {
             throw new MojoExecutionException( "NMAVEN-900-001: Unrecognized artifact type: Language = " + language +
                 ", Vendor = " + vendor + ", ArtifactType = " + artifactTypeName );
         }
+        compilerConfig.setArtifactType( artifactType );
 
         if ( keyfile != null )
         {
@@ -234,14 +218,4 @@
                 project.getBuild().getSourceDirectory(), e );
         }
     }
-}
-
-/*
-        if (compilerVendor.equals(Vendor.MICROSOFT)) {
-            File frameworkPath = new File("C:\\WINDOWS\\Microsoft.NET\\Framework\\v" + frameworkVersion);
-            if (!frameworkPath.exists())
-                throw new MojoExecutionException("NMAVEN-900-006: Could not find .NET framework: "
-                        + ", Path = " + frameworkPath.getAbsolutePath());
-            compilerConfig.setExecutionPath(frameworkPath.getAbsolutePath() + File.separator);
-        }
-*/
\ No newline at end of file
+}
\ No newline at end of file

Modified: incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/TestCompilerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/TestCompilerMojo.java?view=diff&rev=513874&r1=513873&r2=513874
==============================================================================
--- incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/TestCompilerMojo.java (original)
+++ incubator/nmaven/branches/SI_IDE/plugins/maven-compile-plugin/src/main/java/org/apache/maven/dotnet/plugin/compile/TestCompilerMojo.java Fri Mar  2 10:14:08 2007
@@ -23,6 +23,7 @@
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.util.FileUtils;
 import org.apache.maven.dotnet.PlatformUnsupportedException;
+import org.apache.maven.dotnet.artifact.ArtifactType;
 import org.apache.maven.dotnet.executable.ExecutionException;
 import org.apache.maven.dotnet.vendor.VendorFactory;
 import org.apache.maven.dotnet.executable.compiler.*;

Modified: incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java?view=diff&rev=513874&r1=513873&r2=513874
==============================================================================
--- incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java (original)
+++ incubator/nmaven/branches/SI_IDE/plugins/maven-install-plugin/src/main/java/org/apache/maven/dotnet/plugin/install/InstallerMojo.java Fri Mar  2 10:14:08 2007
@@ -25,7 +25,7 @@
 import org.apache.maven.artifact.installer.ArtifactInstallationException;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.dotnet.artifact.ArtifactContext;
-import org.apache.maven.dotnet.executable.compiler.ArtifactType;
+import org.apache.maven.dotnet.artifact.ArtifactType;
 import org.apache.maven.model.Dependency;
 
 import java.io.File;
@@ -93,7 +93,7 @@
             }
             catch ( ArtifactInstallationException e )
             {
-                e.printStackTrace();
+                throw new MojoExecutionException( "NMAVEN-1001-002: Failed to install artifact file", e );
             }
         }