incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r598880 - in /incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler: ArtifactType.java CompilerConfig.java KeyInfo.java NetCompilerConfig.java impl/NetCompilerContextImpl.java
Date Wed, 28 Nov 2007 06:41:21 GMT
Author: sisbell
Date: Tue Nov 27 22:41:19 2007
New Revision: 598880

URL: http://svn.apache.org/viewvc?rev=598880&view=rev
Log:
Default CompilerContext and KeyInfo implementations. Better exception checking.

Added:
    incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/ArtifactType.java
  (with props)
Modified:
    incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerConfig.java
    incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/KeyInfo.java
    incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerConfig.java
    incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/NetCompilerContextImpl.java

Added: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/ArtifactType.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/ArtifactType.java?rev=598880&view=auto
==============================================================================
--- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/ArtifactType.java
(added)
+++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/ArtifactType.java
Tue Nov 27 22:41:19 2007
@@ -0,0 +1,125 @@
+package org.apache.maven.dotnet.compiler;
+
+/**
+ * Enumeration of all the valid target types (module, library, winexe, exe, nar) for the
.NET platform.
+ *
+ */
+public enum ArtifactType
+{
+    MODULE( "module", "module", "netmodule" ),
+    LIBRARY( "library", "library", "dll" ),
+    EXE( "exe", "exe", "exe" ),
+    WINEXE( "winexe", "winexe", "exe" ),
+    NAR( "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" );
+
+    /**
+     * The extension used for the artifact(netmodule, dll, exe)
+     */
+    private String extension;
+
+    /**
+     * The packaging type (as given in the package tag within the pom.xml) of the artifact.
+     */
+    private String packagingType;
+
+    /**
+     * The target types (module, library, winexe, exe) for the .NET platform.
+     */
+    private String targetCompileType;
+
+    /**
+     * Constructor
+     */
+    ArtifactType( String packagingType, String targetCompileType, String extension )
+    {
+        this.packagingType = packagingType;
+        this.targetCompileType = targetCompileType;
+        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 the packaging type (as given in the package tag within the pom.xml) of the
artifact.
+     *
+     * @return the packaging type (as given in the package tag within the pom.xml) of the
artifact.
+     */
+    public String getPackagingType()
+    {
+        return packagingType;
+    }
+
+    /**
+     * Returns target types (module, library, winexe, exe) for the .NET platform.
+     *
+     * @return target types (module, library, winexe, exe) for the .NET platform.
+     */
+    public String getTargetCompileType()
+    {
+        return targetCompileType;
+    }
+
+    /**
+     * Returns artifact type for the specified packaging name
+     *
+     * @param packagingName the package name (as given in the package tag within the pom.xml)
of the artifact.
+     * @return the artifact type for the specified packaging name
+     */
+    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() ) )
+        {
+            return ArtifactType.EXE;
+        }
+        else if ( packagingName.equals( ArtifactType.WINEXE.getPackagingType() ) )
+        {
+            return ArtifactType.WINEXE;
+        }
+        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;
+    }
+}

Propchange: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/ArtifactType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerConfig.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerConfig.java?rev=598880&r1=598879&r2=598880&view=diff
==============================================================================
--- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerConfig.java
(original)
+++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerConfig.java
Tue Nov 27 22:41:19 2007
@@ -1,7 +1,5 @@
 package org.apache.maven.dotnet.compiler;
 
-import org.apache.maven.dotnet.ArtifactType;
-
 import java.io.File;
 
 public interface CompilerConfig
@@ -74,6 +72,8 @@
     void setVendor(Vendor vendor);
 
     Vendor getVendor();
+
+    void verifyCompilerConfig() throws IllegalArgumentException;
 
 
 }

Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/KeyInfo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/KeyInfo.java?rev=598880&r1=598879&r2=598880&view=diff
==============================================================================
--- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/KeyInfo.java
(original)
+++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/KeyInfo.java
Tue Nov 27 22:41:19 2007
@@ -4,7 +4,6 @@
 
 /**
  * Provides services for obtaining information about the key file.
- *
  */
 public interface KeyInfo
 {
@@ -20,11 +19,11 @@
      *
      * @param keyFileUri the path of the key
      */
-    void setKeyFileUri(URI keyFileUri);
+    void setKeyFileUri( URI keyFileUri );
 
     String getKeyContainerName();
 
-    void setKeyContainerName(String keyContainerName);
+    void setKeyContainerName( String keyContainerName );
 
     public static class Factory
     {
@@ -48,22 +47,59 @@
 
                 private String keyContainerName;
 
-                public URI getKeyFileUri() {
+                public URI getKeyFileUri()
+                {
                     return keyFileUri;
                 }
 
-                public void setKeyFileUri(URI keyFileUri) {
+                public void setKeyFileUri( URI keyFileUri )
+                {
                     this.keyFileUri = keyFileUri;
                 }
 
-                public String getKeyContainerName() {
+                public String getKeyContainerName()
+                {
                     return keyContainerName;
                 }
 
-                public void setKeyContainerName(String keyContainerName) {
+                public void setKeyContainerName( String keyContainerName )
+                {
                     this.keyContainerName = keyContainerName;
                 }
 
+                public boolean equals( Object o )
+                {
+                    if ( this == o )
+                    {
+                        return true;
+                    }
+                    if ( o == null || getClass() != o.getClass() )
+                    {
+                        return false;
+                    }
+
+                    final KeyInfo that = (KeyInfo) o;
+
+                    if ( keyContainerName != null ? !keyContainerName.equals( that.getKeyContainerName()
)
+                        : that.getKeyContainerName() != null )
+                    {
+                        return false;
+                    }
+                    if ( keyFileUri != null ? !keyFileUri.equals( that.getKeyFileUri() )
: that.getKeyFileUri() != null )
+                    {
+                        return false;
+                    }
+
+                    return true;
+                }
+
+                public int hashCode()
+                {
+                    int result;
+                    result = ( keyFileUri != null ? keyFileUri.hashCode() : 0 );
+                    result = 29 * result + ( keyContainerName != null ? keyContainerName.hashCode()
: 0 );
+                    return result;
+                }
             };
         }
     }

Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerConfig.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerConfig.java?rev=598880&r1=598879&r2=598880&view=diff
==============================================================================
--- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerConfig.java
(original)
+++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerConfig.java
Tue Nov 27 22:41:19 2007
@@ -1,6 +1,9 @@
 package org.apache.maven.dotnet.compiler;
 
-public interface NetCompilerConfig extends CompilerConfig
+import java.io.File;
+
+public interface NetCompilerConfig
+    extends CompilerConfig
 {
 
     /**
@@ -10,14 +13,255 @@
      */
     KeyInfo getKeyInfo();
 
-     /**
+    /**
      * Sets key info used for signing assemblies.
      *
      * @param keyInfo key info used for signing assemblies
      */
-    void setKeyInfo( KeyInfo keyInfo);
+    void setKeyInfo( KeyInfo keyInfo );
 
     NetCompilerPlatformVersion getCompilerPlatformVersion();
 
-    void setCompilerPlatformVersion(NetCompilerPlatformVersion  compilerPlatformVersion);
+    void setCompilerPlatformVersion( NetCompilerPlatformVersion compilerPlatformVersion );
+
+    public static class Factory
+    {
+        /**
+         * Constructor
+         */
+        private Factory()
+        {
+        }
+
+        /**
+         * Returns a default instance of the executable config.
+         *
+         * @return a default instance of the executable config
+         */
+        public static NetCompilerConfig createDefaultExecutableConfig()
+        {
+            return new NetCompilerConfig()
+            {
+                private KeyInfo keyInfo;
+
+                private NetCompilerPlatformVersion compilerPlatformVersion;
+
+                private ArtifactType artifactType;
+
+                private boolean isTestCompile;
+
+                private File localRepository;
+
+                private File sourceDirectory;
+
+                private File targetDirectory;
+
+                private ProgrammingLanguage programmingLanguage;
+
+                private Vendor vendor;
+
+                public KeyInfo getKeyInfo()
+                {
+                    return keyInfo;
+                }
+
+                public void setKeyInfo( KeyInfo keyInfo )
+                {
+                    this.keyInfo = keyInfo;
+                }
+
+                public NetCompilerPlatformVersion getCompilerPlatformVersion()
+                {
+                    return compilerPlatformVersion;
+                }
+
+                public void setCompilerPlatformVersion( NetCompilerPlatformVersion compilerPlatformVersion
)
+                {
+                    this.compilerPlatformVersion = compilerPlatformVersion;
+                }
+
+                public ArtifactType getArtifactType()
+                {
+                    return artifactType;
+                }
+
+                public void setArtifactType( ArtifactType artifactType )
+                {
+                    this.artifactType = artifactType;
+                }
+
+                public boolean isTestCompile()
+                {
+                    return isTestCompile;
+                }
+
+                public void setTestCompile( boolean testCompile )
+                {
+                    isTestCompile = testCompile;
+                }
+
+                public File getLocalRepository()
+                {
+                    return localRepository;
+                }
+
+                public void setLocalRepository( File localRepository )
+                {
+                    this.localRepository = localRepository;
+                }
+
+                public File getSourceDirectory()
+                {
+                    return sourceDirectory;
+                }
+
+                public void setSourceDirectory( File sourceDirectory )
+                {
+                    this.sourceDirectory = sourceDirectory;
+                }
+
+                public File getTargetDirectory()
+                {
+                    return targetDirectory;
+                }
+
+                public void setTargetDirectory( File targetDirectory )
+                {
+                    this.targetDirectory = targetDirectory;
+                }
+
+                public ProgrammingLanguage getProgrammingLanguage()
+                {
+                    return programmingLanguage;
+                }
+
+                public void setProgrammingLanguage( ProgrammingLanguage programmingLanguage
)
+                {
+                    this.programmingLanguage = programmingLanguage;
+                }
+
+                public Vendor getVendor()
+                {
+                    return vendor;
+                }
+
+                public void setVendor( Vendor vendor )
+                {
+                    this.vendor = vendor;
+                }
+
+                public void verifyCompilerConfig()
+                    throws IllegalArgumentException
+                {
+                    if ( artifactType == null )
+                    {
+                       throw new IllegalArgumentException("artifactType");
+                    }
+
+                    if ( compilerPlatformVersion == null )
+                    {
+                      throw new IllegalArgumentException("compilerPlatformVersion");
+                    }
+
+                    if ( localRepository == null || !localRepository.exists() )
+                    {
+                        throw new IllegalArgumentException("localRepository");
+                    }
+
+                    if ( sourceDirectory == null || !sourceDirectory.exists() )
+                    {
+                        throw new IllegalArgumentException("sourceDirectory");
+                    }
+
+                    if ( targetDirectory == null || !targetDirectory.exists() )
+                    {
+                        throw new IllegalArgumentException("targetDirectory");
+                    }
+
+                    if(programmingLanguage == null)
+                    {
+                       throw new IllegalArgumentException("programmingLanguage");
+                    }
+
+                    if(vendor == null)
+                    {
+                        throw new IllegalArgumentException("vendor");
+                    }
+
+                    if(artifactType == null)
+                    {
+                         throw new IllegalArgumentException("artifactType");
+                    }
+                }
+
+                public boolean equals( Object o )
+                {
+                    if ( this == o )
+                    {
+                        return true;
+                    }
+                    if ( o == null || getClass() != o.getClass() )
+                    {
+                        return false;
+                    }
+
+                    final NetCompilerConfig that = (NetCompilerConfig) o;
+
+                    if ( isTestCompile != that.isTestCompile() )
+                    {
+                        return false;
+                    }
+                    if ( artifactType != that.getArtifactType() )
+                    {
+                        return false;
+                    }
+                    if ( compilerPlatformVersion != that.getCompilerPlatformVersion() )
+                    {
+                        return false;
+                    }
+                    if ( keyInfo != null ? !keyInfo.equals( that.getKeyInfo() ) : that.getKeyInfo()
!= null )
+                    {
+                        return false;
+                    }
+                    if ( !localRepository.equals( that.getLocalRepository() ) )
+                    {
+                        return false;
+                    }
+                    if ( programmingLanguage != that.getProgrammingLanguage() )
+                    {
+                        return false;
+                    }
+                    if ( !sourceDirectory.equals( that.getSourceDirectory() ) )
+                    {
+                        return false;
+                    }
+                    if ( !targetDirectory.equals( that.getTargetDirectory() ) )
+                    {
+                        return false;
+                    }
+                    if ( vendor != that.getVendor() )
+                    {
+                        return false;
+                    }
+
+                    return true;
+                }
+
+                public int hashCode()
+                {
+                    int result;
+                    result = ( keyInfo != null ? keyInfo.hashCode() : 0 );
+                    result = 29 * result + compilerPlatformVersion.hashCode();
+                    result = 29 * result + artifactType.hashCode();
+                    result = 29 * result + ( isTestCompile ? 1 : 0 );
+                    result = 29 * result + localRepository.hashCode();
+                    result = 29 * result + sourceDirectory.hashCode();
+                    result = 29 * result + targetDirectory.hashCode();
+                    result = 29 * result + programmingLanguage.hashCode();
+                    result = 29 * result + vendor.hashCode();
+                    return result;
+                }
+            };
+        }
+    }
 }

Modified: incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/NetCompilerContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/NetCompilerContextImpl.java?rev=598880&r1=598879&r2=598880&view=diff
==============================================================================
--- incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/NetCompilerContextImpl.java
(original)
+++ incubator/nmaven/branches/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/NetCompilerContextImpl.java
Tue Nov 27 22:41:19 2007
@@ -104,8 +104,20 @@
     public void init( MavenProject project, CompilerConfig compilerConfig )
         throws PlatformUnsupportedException
     {
+        if(project == null)
+        {
+            throw new IllegalArgumentException("mavenProject");
+        }
+
+        if(compilerConfig == null)
+        {
+            throw new IllegalArgumentException("compilerConfig");
+        }
+
         this.project = project;
         this.netCompilerConfig = (NetCompilerConfig) compilerConfig;
+        netCompilerConfig.verifyCompilerConfig();
+
         libraryDependencies = new HashSet<Artifact>();
         moduleDependencies = new HashSet<Artifact>();
 



Mime
View raw message