Author: sisbell Date: Wed Mar 12 14:08:25 2008 New Revision: 636509 URL: http://svn.apache.org/viewvc?rev=636509&view=rev Log: Created abstract mojo for accessing toolchain since this should be common among all mojos. First cut a wix (windows installer) plugin.
Added: incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/CommandExecutor.java (contents, props changed) - copied, changed from r633575, incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ExecutionException.java (contents, props changed) - copied, changed from r633575, incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerException.java incubator/nmaven/trunk/components/maven-dotnet-plugin-api/ incubator/nmaven/trunk/components/maven-dotnet-plugin-api/pom.xml - copied, changed from r636129, incubator/nmaven/trunk/components/pom.xml incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/ incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/ incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/java/ incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/java/org/ incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/java/org/apache/ incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/java/org/apache/maven/ incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/java/org/apache/maven/dotnet/ incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/java/org/apache/maven/dotnet/plugin/ incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/java/org/apache/maven/dotnet/plugin/AbstractDotnetMojo.java incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/pom.xml - copied, changed from r636129, incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/pom.xml incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/org/ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/org/apache/ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/org/apache/maven/ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/org/apache/maven/dotnet/ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/org/apache/maven/dotnet/plugin/ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/org/apache/maven/dotnet/plugin/wix/ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/org/apache/maven/dotnet/plugin/wix/CandleMojo.java Removed: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerException.java Modified: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.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-core/pom.xml incubator/nmaven/trunk/components/maven-dotnet-extensions/src/main/java/org/apache/maven/dotnet/extensions/compiler/CSharpClassCompiler.java incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ConfigurationTag.java incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/DotnetToolchain.java incubator/nmaven/trunk/components/pom.xml incubator/nmaven/trunk/maven-dotnet.iml incubator/nmaven/trunk/plugins/maven-dotnet-test-plugin/pom.xml incubator/nmaven/trunk/plugins/maven-dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java incubator/nmaven/trunk/plugins/pom.xml Modified: incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java?rev=636509&r1=636508&r2=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java (original) +++ incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerContext.java Wed Mar 12 14:08:25 2008 @@ -21,6 +21,7 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.dotnet.InitializationException; import org.apache.maven.dotnet.ProgrammingLanguage; +import org.apache.maven.dotnet.ExecutionException; import org.apache.maven.toolchain.Toolchain; import org.codehaus.plexus.logging.Logger; @@ -48,7 +49,7 @@ */ ClassCompiler getClassCompiler(); - File getCompilerExecutableFor( ProgrammingLanguage programmingLanguage ) throws CompilerException; + File getCompilerExecutableFor( ProgrammingLanguage programmingLanguage ) throws ExecutionException; /** * Returns the maven project used to initialize this context. 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=636509&r1=636508&r2=636509&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 Wed Mar 12 14:08:25 2008 @@ -41,8 +41,8 @@ import org.apache.maven.dotnet.ArtifactType; import org.apache.maven.dotnet.ArtifactScope; import org.apache.maven.dotnet.ProgrammingLanguage; +import org.apache.maven.dotnet.ExecutionException; import org.apache.maven.dotnet.compiler.CompilerAnnotation; -import org.apache.maven.dotnet.compiler.CompilerException; import org.apache.maven.project.MavenProject; import org.apache.maven.toolchain.Toolchain; import org.codehaus.plexus.logging.Logger; @@ -130,7 +130,7 @@ } public File getCompilerExecutableFor( ProgrammingLanguage programmingLanguage ) - throws CompilerException + throws ExecutionException { if ( programmingLanguage == null ) { @@ -139,7 +139,7 @@ if ( toolchain == null ) { - throw new CompilerException( "No toolchain found." ); + throw new ExecutionException( "No toolchain found." ); } if ( programmingLanguage.equals( ProgrammingLanguage.C_SHARP ) ) @@ -147,12 +147,12 @@ File csharpExecutable = new File( toolchain.findTool( "csharpCompiler" ) ); if ( !csharpExecutable.exists() ) { - throw new CompilerException( + throw new ExecutionException( "The compiler does not exist: File = " + csharpExecutable.getAbsolutePath() ); } return csharpExecutable; } - throw new CompilerException( "Compiler could not be found: Language = " + programmingLanguage ); + throw new ExecutionException( "Compiler could not be found: Language = " + programmingLanguage ); } public MavenProject getMavenProject() Modified: incubator/nmaven/trunk/components/maven-dotnet-core/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-core/pom.xml?rev=636509&r1=636508&r2=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/components/maven-dotnet-core/pom.xml (original) +++ incubator/nmaven/trunk/components/maven-dotnet-core/pom.xml Wed Mar 12 14:08:25 2008 @@ -18,7 +18,8 @@ specific language governing permissions and limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> <groupId>org.apache.maven.dotnet</groupId> <version>0.16-incubating-SNAPSHOT</version> @@ -29,4 +30,14 @@ <artifactId>maven-dotnet-core</artifactId> <name>Apache NMaven: maven-dotnet-core</name> <description>maven-dotnet-core</description> + <dependencies> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-container-default</artifactId> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-utils</artifactId> + </dependency> + </dependencies> </project> Copied: incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/CommandExecutor.java (from r633575, incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java) URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/CommandExecutor.java?p2=incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/CommandExecutor.java&p1=incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java&r1=633575&r2=636509&rev=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CommandExecutor.java (original) +++ incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/CommandExecutor.java Wed Mar 12 14:08:25 2008 @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.dotnet.compiler; +package org.apache.maven.dotnet; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.cli.StreamConsumer; @@ -48,12 +48,12 @@ * * @param executable the name of the executable (csc, xsd, etc). * @param commands the command options for the compiler/executable - * @throws org.apache.maven.dotnet.compiler.CompilerException + * @throws ExecutionException * if compiler or executable writes anything to the standard error stream or if the process * returns a process result != 0. */ void executeCommand( String executable, List<String> commands ) - throws CompilerException; + throws ExecutionException; /** * Executes the command for the specified executable and list of command options. @@ -62,12 +62,12 @@ * @param commands the commands options for the compiler/executable * @param failsOnErrorOutput if true, throws an <code>ExecutionException</code> if there the compiler or executable * writes anything to the error output stream. By default, this value is true - * @throws org.apache.maven.dotnet.compiler.CompilerException + * @throws ExecutionException * if compiler or executable writes anything to the standard error stream (provided the * failsOnErrorOutput is not false) or if the process returns a process result != 0. */ void executeCommand( String executable, List<String> commands, boolean failsOnErrorOutput ) - throws CompilerException; + throws ExecutionException; /** * Executes the command for the specified executable and list of command options. If the compiler or executable is @@ -77,11 +77,11 @@ * @param executable the name of the executable (csc, xsd, etc). * @param commands the command options for the compiler/executable * @param workingDirectory the directory where the command will be executed - * @throws CompilerException if compiler or executable writes anything to the standard error stream (provided the + * @throws ExecutionException if compiler or executable writes anything to the standard error stream (provided the * failsOnErrorOutput is not false) or if the process returns a process result != 0. */ void executeCommand( String executable, List<String> commands, File workingDirectory, boolean failsOnErrorOutput ) - throws CompilerException; + throws ExecutionException; /** * Returns the process result of executing the command. Typically a value of 0 means that the process executed @@ -124,9 +124,9 @@ * * @return a default instance of the command executor */ - public static org.apache.maven.dotnet.compiler.CommandExecutor createDefaultCommmandExecutor() + public static CommandExecutor createDefaultCommmandExecutor() { - return new org.apache.maven.dotnet.compiler.CommandExecutor() + return new CommandExecutor() { /** * Instance of a plugin logger. @@ -156,20 +156,20 @@ public void executeCommand( String executable, List<String> commands ) - throws CompilerException + throws ExecutionException { executeCommand( executable, commands, null, true ); } public void executeCommand( String executable, List<String> commands, boolean failsOnErrorOutput ) - throws CompilerException + throws ExecutionException { executeCommand( executable, commands, null, failsOnErrorOutput ); } public void executeCommand( String executable, List<String> commands, File workingDirectory, boolean failsOnErrorOutput ) - throws CompilerException + throws ExecutionException { if ( commands == null ) { @@ -200,13 +200,13 @@ } if ( ( failsOnErrorOutput && stdErr.hasError() ) || result != 0 ) { - throw new CompilerException( "NMAVEN-040-001: Could not execute: Command = " + + throw new ExecutionException( "NMAVEN-040-001: Could not execute: Command = " + commandline.toString() + ", Result = " + result ); } } catch ( CommandLineException e ) { - throw new CompilerException( + throw new ExecutionException( "NMAVEN-040-002: Could not execute: Command = " + commandline.toString() ); } } Propchange: incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/CommandExecutor.java ------------------------------------------------------------------------------ svn:eol-style = native Copied: incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ExecutionException.java (from r633575, incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerException.java) URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ExecutionException.java?p2=incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ExecutionException.java&p1=incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerException.java&r1=633575&r2=636509&rev=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/components/maven-dotnet-compiler/src/main/java/org/apache/maven/dotnet/compiler/CompilerException.java (original) +++ incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ExecutionException.java Wed Mar 12 14:08:25 2008 @@ -16,13 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.dotnet.compiler; +package org.apache.maven.dotnet; /** * Exception thrown for compiler errors. * */ -public class CompilerException +public class ExecutionException extends Exception { @@ -31,7 +31,7 @@ /** * Constructs an <code>ExecutionException</code> with no exception message. */ - public CompilerException() + public ExecutionException() { super(); } @@ -41,7 +41,7 @@ * * @param message the exception message */ - public CompilerException( String message ) + public ExecutionException( String message ) { super( message ); } @@ -52,7 +52,7 @@ * @param message the exception message * @param cause the cause of the exception */ - public CompilerException( String message, Throwable cause ) + public ExecutionException( String message, Throwable cause ) { super( message, cause ); } @@ -62,7 +62,7 @@ * * @param cause the cause of the exception */ - public CompilerException( Throwable cause ) + public ExecutionException( Throwable cause ) { super( cause ); } Propchange: incubator/nmaven/trunk/components/maven-dotnet-core/src/main/java/org/apache/maven/dotnet/ExecutionException.java ------------------------------------------------------------------------------ svn:eol-style = native 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=636509&r1=636508&r2=636509&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 Wed Mar 12 14:08:25 2008 @@ -25,10 +25,10 @@ import java.util.ArrayList; import org.apache.maven.artifact.Artifact; -import org.apache.maven.dotnet.compiler.CommandExecutor; +import org.apache.maven.dotnet.CommandExecutor; import org.apache.maven.dotnet.compiler.CompilerAnnotation; import org.apache.maven.dotnet.compiler.CompilerContext; -import org.apache.maven.dotnet.compiler.CompilerException; +import org.apache.maven.dotnet.ExecutionException; import org.apache.maven.dotnet.compiler.DotnetCompilerConfig; import org.apache.maven.dotnet.compiler.DotnetCompilerContext; import org.apache.maven.dotnet.compiler.DotnetCompilerPlatformVersion; @@ -181,7 +181,7 @@ { commandExecutor.executeCommand( getCompilerFileName(), getCommands(), failOnErrorOutput() ); } - catch ( CompilerException e ) + catch ( ExecutionException e ) { throw new InvalidArtifactException( e ); } @@ -200,7 +200,7 @@ compilerExecutable = compilerContext.getCompilerExecutableFor( compilerContext.getCompilerConfig().getProgrammingLanguage() ); } - catch ( CompilerException e ) + catch ( ExecutionException e ) { e.printStackTrace(); } Copied: incubator/nmaven/trunk/components/maven-dotnet-plugin-api/pom.xml (from r636129, incubator/nmaven/trunk/components/pom.xml) URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-plugin-api/pom.xml?p2=incubator/nmaven/trunk/components/maven-dotnet-plugin-api/pom.xml&p1=incubator/nmaven/trunk/components/pom.xml&r1=636129&r2=636509&rev=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/components/pom.xml (original) +++ incubator/nmaven/trunk/components/maven-dotnet-plugin-api/pom.xml Wed Mar 12 14:08:25 2008 @@ -18,7 +18,8 @@ specific language governing permissions and limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> <groupId>org.apache.maven.dotnet</groupId> <version>0.16-incubating-SNAPSHOT</version> @@ -26,25 +27,24 @@ </parent> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.maven.dotnet</groupId> - <artifactId>maven-dotnet-components</artifactId> + <artifactId>maven-dotnet-plugin-api</artifactId> <version>0.16-incubating-SNAPSHOT</version> - <packaging>pom</packaging> - <name>Apache NMaven: maven-dotnet-components</name> + <name>Apache NMaven: maven-dotnet-plugin-api</name> <url>http://incubator.apache.org/nmaven</url> <description>NMaven provides Maven 2.x plugins to support building of .NET applications</description> - <modules> - <module>maven-dotnet-assembler</module> - <module>maven-dotnet-core</module> - <module>maven-dotnet-compiler</module> - <module>maven-dotnet-extensions</module> - <module>maven-dotnet-toolchain</module> - </modules> - <profiles> - <profile> - <id>run-its</id> - <modules> - <module>maven-dotnet-core-it-runner</module> - </modules> - </profile> - </profiles> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven.dotnet</groupId> + <artifactId>maven-dotnet-toolchain</artifactId> + <version>0.16-incubating-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + </dependency> + </dependencies> </project> Added: incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/java/org/apache/maven/dotnet/plugin/AbstractDotnetMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/java/org/apache/maven/dotnet/plugin/AbstractDotnetMojo.java?rev=636509&view=auto ============================================================================== --- incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/java/org/apache/maven/dotnet/plugin/AbstractDotnetMojo.java (added) +++ incubator/nmaven/trunk/components/maven-dotnet-plugin-api/src/main/java/org/apache/maven/dotnet/plugin/AbstractDotnetMojo.java Wed Mar 12 14:08:25 2008 @@ -0,0 +1,60 @@ +/* + * 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.plugin; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; + +import org.apache.maven.toolchain.Toolchain; +import org.apache.maven.toolchain.ToolchainManager; + +import org.apache.maven.execution.MavenSession; + +import org.apache.maven.dotnet.toolchain.DotnetToolchain; + +public abstract class AbstractDotnetMojo + extends AbstractMojo +{ + /** + * @parameter expression="${session}" + */ + private MavenSession mavenSession; + + /** + * @component + */ + private ToolchainManager toolchainManager; + + public abstract void execute() + throws MojoExecutionException, MojoFailureException; + + + public Toolchain getToolchain() + { + DotnetToolchain toolchain = + (DotnetToolchain) toolchainManager.getToolchainFromBuildContext( "dotnet", mavenSession ); + + if ( toolchain == null ) + { + this.getLog().info( "Could not find dotnet toolchain." ); + } + return toolchain; + } +} Modified: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ConfigurationTag.java URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ConfigurationTag.java?rev=636509&r1=636508&r2=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ConfigurationTag.java (original) +++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/ConfigurationTag.java Wed Mar 12 14:08:25 2008 @@ -3,7 +3,8 @@ public enum ConfigurationTag { CSharpCompiler("csharpCompiler"), - NUnitConsole("nunitConsole"); + NUnitConsole("nunitConsole"), + WixHome("wixHome"); private String tagName; Modified: incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/DotnetToolchain.java URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/DotnetToolchain.java?rev=636509&r1=636508&r2=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/DotnetToolchain.java (original) +++ incubator/nmaven/trunk/components/maven-dotnet-toolchain/src/main/java/org/apache/maven/dotnet/toolchain/DotnetToolchain.java Wed Mar 12 14:08:25 2008 @@ -9,6 +9,7 @@ import java.util.List; import java.util.Arrays; +import java.io.File; public final class DotnetToolchain extends DefaultToolchain @@ -17,6 +18,8 @@ private String nunitConsole; + private String wixHome; + public DotnetToolchain( ToolchainModel model, Logger logger ) { this( model, null, logger ); @@ -29,7 +32,7 @@ public DotnetCompilerPlatformVersion getDotnetCompilerPlatformVersion() { - return DotnetCompilerPlatformVersion.VERSION_2_0_50727; + return DotnetCompilerPlatformVersion.VERSION_2_0_50727; } public DotnetToolchain( ToolchainModel model, String type, Logger logger ) @@ -45,10 +48,14 @@ { this.csharpCompiler = value; } - else if(ConfigurationTag.NUnitConsole.getTagName().equals( key )) + else if ( ConfigurationTag.NUnitConsole.getTagName().equals( key ) ) { this.nunitConsole = value; } + else if ( ConfigurationTag.WixHome.getTagName().equals( key ) ) + { + this.wixHome = value; + } } } @@ -63,10 +70,14 @@ { return csharpCompiler; } - else if(toolName.equals( ConfigurationTag.NUnitConsole.getTagName() )) + else if ( toolName.equals( ConfigurationTag.NUnitConsole.getTagName() ) ) { return nunitConsole; } + else if(toolName.equals( ConfigurationTag.WixHome.getTagName() )) + { + return wixHome; + } return null; - } + } } Modified: incubator/nmaven/trunk/components/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/components/pom.xml?rev=636509&r1=636508&r2=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/components/pom.xml (original) +++ incubator/nmaven/trunk/components/pom.xml Wed Mar 12 14:08:25 2008 @@ -37,6 +37,7 @@ <module>maven-dotnet-core</module> <module>maven-dotnet-compiler</module> <module>maven-dotnet-extensions</module> + <module>maven-dotnet-plugin-api</module> <module>maven-dotnet-toolchain</module> </modules> <profiles> Modified: incubator/nmaven/trunk/maven-dotnet.iml URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/maven-dotnet.iml?rev=636509&r1=636508&r2=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/maven-dotnet.iml (original) +++ incubator/nmaven/trunk/maven-dotnet.iml Wed Mar 12 14:08:25 2008 @@ -11,14 +11,14 @@ <sourceFolder url="file://$MODULE_DIR$/components/maven-dotnet-core-it-runner/src/test/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/components/maven-dotnet-core/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/components/maven-dotnet-extensions/src/main/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/components/maven-dotnet-plugin-api/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/components/maven-dotnet-toolchain/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/core-integration-tests/src/test/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/imports/maven-toolchain-plugin/src/main/java" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/imports/maven-toolchain/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/imports/maven-toolchain/src/test/java" isTestSource="true" /> - <sourceFolder url="file://$MODULE_DIR$/imports/maven-toolchain/target/generated-sources/modello" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/plugins/maven-dotnet-compiler-plugin/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/plugins/maven-dotnet-test-plugin/src/main/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/plugins/maven-dotnet-wix-plugin/src/main/java" isTestSource="false" /> </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> Modified: incubator/nmaven/trunk/plugins/maven-dotnet-test-plugin/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-dotnet-test-plugin/pom.xml?rev=636509&r1=636508&r2=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/plugins/maven-dotnet-test-plugin/pom.xml (original) +++ incubator/nmaven/trunk/plugins/maven-dotnet-test-plugin/pom.xml Wed Mar 12 14:08:25 2008 @@ -37,6 +37,12 @@ <version>0.16-incubating-SNAPSHOT</version> </dependency> <dependency> + <groupId>org.apache.maven.dotnet</groupId> + <artifactId>maven-dotnet-toolchain</artifactId> + <version>0.16-incubating-SNAPSHOT</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-project</artifactId> </dependency> Modified: incubator/nmaven/trunk/plugins/maven-dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java?rev=636509&r1=636508&r2=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/plugins/maven-dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java (original) +++ incubator/nmaven/trunk/plugins/maven-dotnet-test-plugin/src/main/java/org/apache/maven/dotnet/plugin/nunit/DotnetTestMojo.java Wed Mar 12 14:08:25 2008 @@ -27,8 +27,10 @@ import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; + import org.apache.maven.dotnet.BuildDirectories; import org.apache.maven.dotnet.Vendor; + import org.codehaus.plexus.util.cli.CommandLineException; import org.codehaus.plexus.util.cli.CommandLineUtils; import org.codehaus.plexus.util.cli.Commandline; Copied: incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/pom.xml (from r636129, incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/pom.xml) URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/pom.xml?p2=incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/pom.xml&p1=incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/pom.xml&r1=636129&r2=636509&rev=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/plugins/maven-dotnet-compiler-plugin/pom.xml (original) +++ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/pom.xml Wed Mar 12 14:08:25 2008 @@ -27,31 +27,20 @@ </parent> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.maven.dotnet.plugins</groupId> - <artifactId>maven-dotnet-compiler-plugin</artifactId> + <artifactId>maven-dotnet-wix-plugin</artifactId> <packaging>maven-plugin</packaging> - <name>Apache NMaven: maven-dotnet-compiler-plugin</name> - <description>Maven Plugin for .NET: Handles source and test compiles</description> + <name>Apache NMaven: maven-dotnet-wix-plugin</name> + <description>Maven Plugin for .NET:</description> <dependencies> <dependency> <groupId>org.apache.maven.dotnet</groupId> - <artifactId>maven-dotnet-assembler</artifactId> - <version>0.16-incubating-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.maven.dotnet</groupId> - <artifactId>maven-dotnet-compiler</artifactId> - <version>0.16-incubating-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.maven.dotnet</groupId> <artifactId>maven-dotnet-core</artifactId> <version>0.16-incubating-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.maven.dotnet</groupId> - <artifactId>maven-dotnet-extensions</artifactId> + <artifactId>maven-dotnet-plugin-api</artifactId> <version>0.16-incubating-SNAPSHOT</version> - <scope>runtime</scope> </dependency> <dependency> <groupId>org.apache.maven.dotnet</groupId> @@ -59,36 +48,12 @@ <version>0.16-incubating-SNAPSHOT</version> <scope>provided</scope> </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-artifact</artifactId> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-plugin-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-toolchain</artifactId> - </dependency> </dependencies> <distributionManagement> <site> <id>nmaven-apache-site</id> <name>NMaven Site</name> - <url>file://${basedir}/../../../www/plugins/maven-compiler-plugin</url> + <url>file://${basedir}/../../../www/plugins/maven-dotnet-wix-plugin</url> </site> </distributionManagement> </project> Added: incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/org/apache/maven/dotnet/plugin/wix/CandleMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/org/apache/maven/dotnet/plugin/wix/CandleMojo.java?rev=636509&view=auto ============================================================================== --- incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/org/apache/maven/dotnet/plugin/wix/CandleMojo.java (added) +++ incubator/nmaven/trunk/plugins/maven-dotnet-wix-plugin/src/main/java/org/apache/maven/dotnet/plugin/wix/CandleMojo.java Wed Mar 12 14:08:25 2008 @@ -0,0 +1,71 @@ +/* + * 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.plugin.wix; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.dotnet.CommandExecutor; +import org.apache.maven.dotnet.ExecutionException; +import org.apache.maven.dotnet.plugin.AbstractDotnetMojo; +import org.apache.maven.dotnet.toolchain.DotnetToolchain; +import org.apache.maven.dotnet.toolchain.ConfigurationTag; + +import java.io.File; +import java.util.List; +import java.util.ArrayList; + +/** + * @goal candle + * @phase package + */ +public class CandleMojo + extends AbstractDotnetMojo +{ + /** + * WiX Source File + * + * @parameter expression = "${sourceFile}" + * @required + */ + private File sourceFile; + + public void execute() + throws MojoExecutionException, MojoFailureException + { + + DotnetToolchain toolchain = (DotnetToolchain) getToolchain(); + String wixHome = (toolchain != null) ? toolchain.findTool( ConfigurationTag.WixHome.getTagName() ) : null; + String executable = ( wixHome != null ) ? new File( wixHome, "candle" ).getAbsolutePath() : "candle"; + getLog().info( "Found executable = " + executable ); + + CommandExecutor exe = CommandExecutor.Factory.createDefaultCommmandExecutor(); + + List<String> commands = new ArrayList<String>(); + commands.add( sourceFile.getAbsolutePath() ); + + try + { + exe.executeCommand( executable, commands ); + } + catch ( ExecutionException e ) + { + throw new MojoExecutionException( "", e ); + } + } +} Modified: incubator/nmaven/trunk/plugins/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/pom.xml?rev=636509&r1=636508&r2=636509&view=diff ============================================================================== --- incubator/nmaven/trunk/plugins/pom.xml (original) +++ incubator/nmaven/trunk/plugins/pom.xml Wed Mar 12 14:08:25 2008 @@ -29,9 +29,10 @@ <artifactId>maven-dotnet-plugins</artifactId> <version>0.16-incubating-SNAPSHOT</version> <packaging>pom</packaging> - <name>Apache NMaven: maven-dotnet-plugins</name> + <name>Apache NMaven: maven-dotnet-plugins</name> <modules> <module>maven-dotnet-compiler-plugin</module> <module>maven-dotnet-test-plugin</module> + <module>maven-dotnet-wix-plugin</module> </modules> </project>