Author: sisbell Date: Fri Nov 23 21:52:34 2007 New Revision: 597810 URL: http://svn.apache.org/viewvc?rev=597810&view=rev Log: More complete interface for compilers. Removed inheritence from general excecutable.
Added: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/ incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/Compiler.java (with props) incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerConfig.java (with props) incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerContext.java (with props) incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/InvalidArtifactException.java (with props) incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/JavaCompilerContext.java (with props) incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/KeyInfo.java (with props) incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerConfig.java (with props) incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerContext.java (with props) incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/ incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/NetCompilerContextImpl.java (with props) Removed: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/executable/ Added: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/Compiler.java URL: http://svn.apache.org/viewvc/incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/Compiler.java?rev=597810&view=auto ============================================================================== --- incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/Compiler.java (added) +++ incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/Compiler.java Fri Nov 23 21:52:34 2007 @@ -0,0 +1,53 @@ +package org.apache.maven.dotnet.compiler; + +import java.io.File; +import java.util.List; + +public interface Compiler +{ + /** + * Returns a file pointing to the compiled artifact for this executable. + * + * @return a file pointing to the compiled artifact for this executable + * @throws InvalidArtifactException if the artifact is invalid + */ + File getCompiledArtifact() + throws InvalidArtifactException; + + /** + * Returns true to fail the build if the compiler writes anything to the error stream, otherwise return false. + * + * @return true to fail the build if the compiler writes anything to the error stream, otherwise return false + */ + boolean failOnErrorOutput(); + + /** + * Returns the commands that this compiler will use to compile the application. This list is unmodifiable. + * + * @return the commands that this compiler will use to compile the application + */ + List<String> getCommands(); + + /** + * Resets the commands to be used by the executable. This should only be used if the executable is being reused with + * different commands from the one that it was initialized with. + * + * @param commands + */ + void resetCommands(List<String> commands); + + /** + * Compiles class files. + * + */ + void compile(); + + /** + * Returns the executable file name that this compiler will use to compile the application. + * + * @return the executable file name that this compiler will use to compile the application + * + */ + String getCompilerFileName(); + +} Propchange: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/Compiler.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerConfig.java URL: http://svn.apache.org/viewvc/incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerConfig.java?rev=597810&view=auto ============================================================================== --- incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerConfig.java (added) +++ incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerConfig.java Fri Nov 23 21:52:34 2007 @@ -0,0 +1,74 @@ +package org.apache.maven.dotnet.compiler; + +import org.apache.maven.dotnet.ArtifactType; + +import java.io.File; + +public interface CompilerConfig +{ + /** + * The target artifact for the compile: library, module, exe, winexe or nar. + * + * @return target artifact for the compile + */ + ArtifactType getArtifactType(); + + /** + * Returns true if the compiler plugin should compile the test classes, otherwise returns false. + * + * @return true if the compiler plugin should compile the test classes, otherwise returns false. + */ + boolean isTestCompile(); + + /** + * Returns local repository + * + * @return local repository + */ + File getLocalRepository(); + + /** + * Sets the artifact type for the compiler plugin: library, module, exe, winexe or nar + * + * @param artifactType + */ + void setArtifactType( ArtifactType artifactType ); + + /** + * If true, tells the compiler to compile the test classes, otherwise tells the compiler to compile the main classes. + * + * @param testCompile + */ + void setTestCompile( boolean testCompile ); + + /** + * Sets local repository + * + * @param localRepository + */ + void setLocalRepository( File localRepository ); + + void setSourceDirectory( File sourceDirectory ); + + /** + * Returns the source directory (or test source directory) path of the class files. These are defined in the pom.xml + * by the properties ${build.sourceDirectory} or ${build.testSourceDirectory}. + * + * @return the source directory (or test source directory) path of the class files. + */ + File getSourceDirectory(); + + void setTargetDirectory( File targetDirectory ); + + /** + * Returns build directory. + * + * @return the build directory. + */ + File getTargetDirectory(); + + String getProgramLanguage(); + + void setProgramLanguage( String programLanguage ); + +} Propchange: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerConfig.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerContext.java URL: http://svn.apache.org/viewvc/incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerContext.java?rev=597810&view=auto ============================================================================== --- incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerContext.java (added) +++ incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerContext.java Fri Nov 23 21:52:34 2007 @@ -0,0 +1,20 @@ +package org.apache.maven.dotnet.compiler; + +public interface CompilerContext +{ + /** + * Returns the user provided configuration associated to this context. This is a live copy, so any changes to the + * config will be reflected during compilation. + * + * @return the user provided configuration associated to this context + */ + CompilerConfig getCompilerConfig(); + + /** + * Returns an instance of the NetExecutable appropriate for given language/vendor/OS. + * + * @return an instance of the NetExecutable appropriate for given language/vendor/OS. + */ + Compiler getCompiler(); + +} Propchange: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/CompilerContext.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/InvalidArtifactException.java URL: http://svn.apache.org/viewvc/incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/InvalidArtifactException.java?rev=597810&view=auto ============================================================================== --- incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/InvalidArtifactException.java (added) +++ incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/InvalidArtifactException.java Fri Nov 23 21:52:34 2007 @@ -0,0 +1,50 @@ +package org.apache.maven.dotnet.compiler; + +/** + * Exception thrown when the framework either does not recognize the target artifact (module, library, exe, winexe) or + * the target artifact is not valid for the compiler. + * + */ +public class InvalidArtifactException extends Exception +{ + static final long serialVersionUID = -3214341783478731432L; + + /** + * Constructs an <code>InvalidArtifactException</code> with no exception message. + */ + public InvalidArtifactException() + { + super(); + } + + /** + * Constructs an <code>InvalidArtifactException</code> with the specified exception message. + * + * @param message the exception message + */ + public InvalidArtifactException( String message ) + { + super( message ); + } + + /** + * Constructs an <code>InvalidArtifactException</code> with the specified exception message and cause of the exception. + * + * @param message the exception message + * @param cause the cause of the exception + */ + public InvalidArtifactException( String message, Throwable cause ) + { + super( message, cause ); + } + + /** + * Constructs an <code>InvalidArtifactException</code> with the cause of the exception. + * + * @param cause the cause of the exception + */ + public InvalidArtifactException( Throwable cause ) + { + super( cause ); + } +} Propchange: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/InvalidArtifactException.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/JavaCompilerContext.java URL: http://svn.apache.org/viewvc/incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/JavaCompilerContext.java?rev=597810&view=auto ============================================================================== --- incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/JavaCompilerContext.java (added) +++ incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/JavaCompilerContext.java Fri Nov 23 21:52:34 2007 @@ -0,0 +1,5 @@ +package org.apache.maven.dotnet.compiler; + +public interface JavaCompilerContext extends CompilerContext +{ +} Propchange: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/JavaCompilerContext.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/KeyInfo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/KeyInfo.java?rev=597810&view=auto ============================================================================== --- incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/KeyInfo.java (added) +++ incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/KeyInfo.java Fri Nov 23 21:52:34 2007 @@ -0,0 +1,69 @@ +package org.apache.maven.dotnet.compiler; + +/** + * Provides services for obtaining information about the key file. + * + */ +public interface KeyInfo +{ + /** + * Returns the path of the key + * + * @return the path of the key + */ + String getKeyFileUri(); + + /** + * Sets the path of the key + * + * @param keyFileUri the path of the key + */ + void setKeyFileUri(String keyFileUri); + + String getKeyContainerName(); + + void setKeyContainerName(String keyContainerName); + + public static class Factory + { + /** + * Constructor + */ + private Factory() + { + } + + /** + * Returns a default instance of key info. + * + * @return a default instance of key info + */ + public static KeyInfo createDefaultKeyInfo() + { + return new KeyInfo() + { + private String keyFileUri; + + private String keyContainerName; + + public String getKeyFileUri() { + return keyFileUri; + } + + public void setKeyFileUri(String keyFileUri) { + this.keyFileUri = keyFileUri; + } + + public String getKeyContainerName() { + return keyContainerName; + } + + public void setKeyContainerName(String keyContainerName) { + this.keyContainerName = keyContainerName; + } + + }; + } + } + +} Propchange: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/KeyInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerConfig.java URL: http://svn.apache.org/viewvc/incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerConfig.java?rev=597810&view=auto ============================================================================== --- incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerConfig.java (added) +++ incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerConfig.java Fri Nov 23 21:52:34 2007 @@ -0,0 +1,19 @@ +package org.apache.maven.dotnet.compiler; + +public interface NetCompilerConfig extends CompilerConfig +{ + + /** + * Returns key info used for signing assemblies. + * + * @return key info used for signing assemblies + */ + KeyInfo getKeyInfo(); + + /** + * Sets key info used for signing assemblies. + * + * @param keyInfo key info used for signing assemblies + */ + void setKeyInfo( KeyInfo keyInfo); +} Propchange: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerConfig.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerContext.java URL: http://svn.apache.org/viewvc/incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerContext.java?rev=597810&view=auto ============================================================================== --- incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerContext.java (added) +++ incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerContext.java Fri Nov 23 21:52:34 2007 @@ -0,0 +1,70 @@ +package org.apache.maven.dotnet.compiler; + +import org.apache.maven.artifact.Artifact; + +import java.io.File; +import java.util.List; + +public interface NetCompilerContext extends CompilerContext +{ + + /** + * Returns assembly names that should be referenced by the compiler. If the List is emtpy, then all core assemblies + * should be includes. These are assemblies that are not standard + * dependencies, but are system assemblies that replace the core .NET framework assemblies (used to create profiles) + * + * @return assembly names that should be referenced by the compiler. + */ + List<String> getCoreAssemblyNames(); + + /** + * Returns a list of module (netmodule) dependencies that exist directly within the invoking projects pom + * (no transitive module dependencies). + * + * @return a list of module (netmodule) dependencies of the class files. + */ + List<Artifact> getDirectModuleDependencies(); + + /** + * Returns a list of library (dll) dependencies of the class files. + * + * @return a list of library (dll) dependencies of the class files. + */ + List<Artifact> getLibraryDependencies(); + + /** + * Returns a list of module (netmodule) dependencies of the class files. + * + * @return a list of module (netmodule) dependencies of the class files. + */ + List<Artifact> getModuleDependencies(); + + /** + * Returns a list of resources that the compiler should link to the compiled assembly + * + * @return a list of resources that the compiler should link to the compiled assembly + */ + List<File> getLinkedResources(); + + /** + * Returns a list of resources that the compiler should embed in the compiled assembly. These may of any mime-type + * or it may be a generated .resource file. + * + * @return a list of resources that the compiler should embed in the compiled assembly. + */ + List<File> getEmbeddedResources(); + + /** + * Returns the icon that the assembly should display when viewed. Should not be used in conjunction with win32res. + * + * @return the icon that the assembly should display when viewed. + */ + File getWin32Icon(); + + /** + * Returns a list of win32 resources. Should not be used in conjunction with win32icon. + * + * @return a list of win32 resources. + */ + List<File> getWin32Resources(); +} Propchange: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/NetCompilerContext.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/NetCompilerContextImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/NetCompilerContextImpl.java?rev=597810&view=auto ============================================================================== --- incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/NetCompilerContextImpl.java (added) +++ incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/NetCompilerContextImpl.java Fri Nov 23 21:52:34 2007 @@ -0,0 +1,69 @@ +package org.apache.maven.dotnet.compiler.impl; + +import org.apache.maven.dotnet.compiler.NetCompilerContext; +import org.apache.maven.dotnet.compiler.KeyInfo; +import org.apache.maven.dotnet.compiler.InvalidArtifactException; +import org.apache.maven.dotnet.compiler.CompilerConfig; +import org.apache.maven.artifact.Artifact; + +import java.util.List; +import java.io.File; + +public class NetCompilerContextImpl implements NetCompilerContext +{ + public List<String> getCoreAssemblyNames() + { + return null; + } + + public List<Artifact> getDirectModuleDependencies() + { + return null; + } + + public KeyInfo getKeyInfo() + { + return null; + } + + public List<Artifact> getLibraryDependencies() + { + return null; + } + + public List<Artifact> getModuleDependencies() + { + return null; + } + + public List<File> getLinkedResources() + { + return null; + } + + public List<File> getEmbeddedResources() + { + return null; + } + + public File getWin32Icon() + { + return null; + } + + public List<File> getWin32Resources() + { + return null; + } + + public File getArtifact() + throws InvalidArtifactException + { + return null; + } + + public CompilerConfig getCompilerConfig() + { + return null; + } +} Propchange: incubator/nmaven/tags/SI_MAVEN_INTEGRATION/sandbox/components/dotnet-executable/src/org/apache/maven/dotnet/compiler/impl/NetCompilerContextImpl.java ------------------------------------------------------------------------------ svn:eol-style = native