From nmaven-commits-return-271-apmail-incubator-nmaven-commits-archive=incubator.apache.org@incubator.apache.org Mon May 07 23:55:35 2007 Return-Path: Delivered-To: apmail-incubator-nmaven-commits-archive@locus.apache.org Received: (qmail 70992 invoked from network); 7 May 2007 23:55:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 May 2007 23:55:33 -0000 Received: (qmail 31065 invoked by uid 500); 7 May 2007 23:55:40 -0000 Delivered-To: apmail-incubator-nmaven-commits-archive@incubator.apache.org Received: (qmail 31040 invoked by uid 500); 7 May 2007 23:55:40 -0000 Mailing-List: contact nmaven-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: nmaven-dev@incubator.apache.org Delivered-To: mailing list nmaven-commits@incubator.apache.org Received: (qmail 31030 invoked by uid 99); 7 May 2007 23:55:40 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 May 2007 16:55:39 -0700 X-ASF-Spam-Status: No, hits=-97.4 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME,WEIRD_QUOTING X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 May 2007 16:55:29 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 64FC41A9842; Mon, 7 May 2007 16:55:09 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r536025 [2/3] - in /incubator/nmaven/branches/SI_XPT: ./ assemblies/ assemblies/NMaven.Core/ assemblies/NMaven.Core/src/main/csharp/Core/Impl/ assemblies/NMaven.IDE/ assemblies/NMaven.IDE/src/main/csharp/ assemblies/NMaven.IDE/src/main/csha... Date: Mon, 07 May 2007 23:55:06 -0000 To: nmaven-commits@incubator.apache.org From: sisbell@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070507235509.64FC41A9842@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-embedder/src/main/java/org/apache/maven/dotnet/embedder/impl/MavenEmbedderServiceImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-embedder/src/main/java/org/apache/maven/dotnet/embedder/impl/MavenEmbedderServiceImpl.java?view=diff&rev=536025&r1=536024&r2=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-embedder/src/main/java/org/apache/maven/dotnet/embedder/impl/MavenEmbedderServiceImpl.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-embedder/src/main/java/org/apache/maven/dotnet/embedder/impl/MavenEmbedderServiceImpl.java Mon May 7 16:55:03 2007 @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.Set; import java.util.HashSet; +import java.util.logging.Logger; import java.io.File; import java.io.IOException; @@ -29,6 +30,7 @@ import org.apache.maven.dotnet.embedder.MavenExecutionRequest; import org.apache.maven.dotnet.embedder.MavenProject; import org.apache.maven.dotnet.embedder.Artifact; +import org.apache.maven.dotnet.embedder.EmbedderException; import org.apache.maven.dotnet.embedder.logger.SocketLoggerManager; import org.apache.maven.dotnet.embedder.logger.SocketLogger; import org.apache.maven.embedder.MavenEmbedder; @@ -60,6 +62,8 @@ */ private MavenEmbedder embedder; + private static Logger logger = Logger.getAnonymousLogger(); + /** * Constructor. This method is intended to by invoked by xfire, not by the application developer. */ @@ -76,23 +80,33 @@ { public void run() { - if ( request.getLoggerPort() <= 0 ) + try { - resetSocket( 9099 ); + if ( request.getLoggerPort() <= 0 ) + { + resetSocket( 9099 ); + } + else + { + resetSocket( request.getLoggerPort() ); + } + + logger.info( "NMAVEN: Executing Maven Build Request: Goal = " + request.getGoal() + + ", Pom File = " + request.getPomFile() ); + List goals = new ArrayList(); + goals.add( request.getGoal() ); + org.apache.maven.execution.MavenExecutionRequest executionRequest = + new DefaultMavenExecutionRequest(); + executionRequest.setPomFile( request.getPomFile() ); + executionRequest.setGoals( goals ); + executionRequest.setRecursive( true ); + executionRequest.setSettings( embedder.getSettings() ); + embedder.execute( executionRequest ); } - else + catch ( EmbedderException e ) { - resetSocket( request.getLoggerPort() ); + e.printStackTrace(); } - - List goals = new ArrayList(); - goals.add( request.getGoal() ); - org.apache.maven.execution.MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest(); - executionRequest.setPomFile( request.getPomFile() ); - executionRequest.setGoals( goals ); - executionRequest.setRecursive( true ); - executionRequest.setSettings( embedder.getSettings() ); - embedder.execute( executionRequest ); } } ).start(); } @@ -110,7 +124,9 @@ * @see MavenEmbedderService#getMavenProjectsFor(String) */ public Set getMavenProjectsFor( String basedir ) + throws EmbedderException { + logger.info( "NMAVEN: Getting maven projects: BaseDir = " + basedir ); Set allMavenProjects = getMavenProjectsFrom( basedir, "**/*pom*.xml" ); Set mavenProjects = new HashSet(); for ( MavenProject mavenProject : getMavenProjectsFrom( basedir, "*pom*.xml" ) ) @@ -124,6 +140,8 @@ ( (MavenProjectImpl) mavenProject ).setIsOrphaned( true ); } mavenProjects.addAll( orphanedMavenProjects ); + logger.info( "NMAVEN: Found projects: Orphaned = " + orphanedMavenProjects.size() + ", Total = " + + allMavenProjects.size() + ", Returned = " + mavenProjects.size() ); return mavenProjects; } @@ -182,7 +200,9 @@ * @param port the socket logger port */ private void resetSocket( int port ) + throws EmbedderException { + logger.info( "NMAVEN: Resetting logger port: " + port ); SocketLoggerManager socketLoggerManager = (SocketLoggerManager) embedder.getPlexusContainer().getLoggerManager(); SocketLogger socketLogger = (SocketLogger) socketLoggerManager.createLogger( "90" ); @@ -190,9 +210,9 @@ { socketLogger.setHandlerFor( port ); } - catch ( IOException e )//TODO: Throw this + catch ( IOException e ) { - e.printStackTrace(); + throw new EmbedderException( "NMAVEN: Failed to set socket handler port: Port = " + port, e ); } } @@ -217,10 +237,11 @@ * Returns a set of maven projects that follow the specified pattern under the specified root directory. * * @param rootDirectory the root directory from which to look for pom files - * @param pattern the pattern of the pom files + * @param pattern the pattern of the pom files * @return a set of maven projects that follow the specified pattern under the specified root directory */ private Set getMavenProjectsFrom( String rootDirectory, String pattern ) + throws EmbedderException { DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir( rootDirectory ); @@ -231,28 +252,32 @@ for ( String pomFile : scanner.getIncludedFiles() ) { MavenProjectImpl mavenProject = new MavenProjectImpl(); - Model model = null; + Model model; try { model = embedder.readModel( new File( rootDirectory, pomFile ) ); } - catch ( XmlPullParserException e )//TODO: throw + catch ( XmlPullParserException e ) { - e.printStackTrace(); + throw new EmbedderException( "NMAVEN: Failed to read model: Pom File = " + pomFile ); } - catch ( IOException e )//TODO: throw + catch ( IOException e ) { - e.printStackTrace(); + throw new EmbedderException( "NMAVEN: Failed to read model: Pom File = " + pomFile ); } - if ( model != null ) + + if ( model == null ) { - mavenProject.setArtifactId( model.getArtifactId() ); - mavenProject.setGroupId( model.getGroupId() ); - mavenProject.setVersion( model.getVersion() ); - mavenProject.setPomPath( new File( rootDirectory, pomFile ).getAbsolutePath() ); - mavenProject.setModel( model ); - mavenProjects.add( mavenProject ); + throw new EmbedderException( "NMAVEN: Failed to read model - value is null: Pom File = " + pomFile ); } + + mavenProject.setArtifactId( model.getArtifactId() ); + mavenProject.setGroupId( model.getGroupId() ); + mavenProject.setVersion( model.getVersion() ); + mavenProject.setPomPath( new File( rootDirectory, pomFile ).getAbsolutePath() ); + mavenProject.setModel( model ); + mavenProjects.add( mavenProject ); + } return mavenProjects; } @@ -262,7 +287,7 @@ * For this directory, the root directory is most likely the root local maven repository. * * @param rootDirectory the root directory from which to look for artifacts - * @param pattern the pattern of the pom files + * @param pattern the pattern of the pom files * @return a set of artifacts that follow the specified pattern under the specified root directory */ private Set getArtifactsFrom( String rootDirectory, String pattern ) @@ -291,8 +316,10 @@ e.printStackTrace(); } if ( model != null && ( model.getPackaging().equals( "library" ) || model.getPackaging().equals( "exe" ) || - model.getPackaging().equals( "netmodule" ) || - model.getPackaging().equals( "winexe" ) ) ) //TODO: Add nar and netplugin types + model.getPackaging().equals( "netmodule" ) || model.getPackaging().equals( "winexe" ) || + model.getPackaging().equals( "visual-studio-addin" ) || + model.getPackaging().equals( "sharp-develop-addin" ) || model.getPackaging().equals( "nar" ) || + model.getPackaging().equals( "netplugin" ) ) ) { artifact.setArtifactId( model.getArtifactId() ); artifact.setGroupId( model.getGroupId() ); @@ -306,6 +333,7 @@ } private MavenProject getMavenProjectForPomFile( File pomFile, Set allMavenProjects ) + throws EmbedderException { for ( MavenProject mavenProject : allMavenProjects ) { @@ -314,15 +342,18 @@ return mavenProject; } } - return null; + throw new EmbedderException( "NMAVEN: Could not find a matching maven project: Pom File = " + + pomFile.getAbsolutePath() + " Maven Project File Count = " + allMavenProjects.size() ); } private Set attachMavenProjectsFor( File pomFile, Set allMavenProjects ) + throws EmbedderException { Set attachedMavenProjects = new HashSet(); MavenProjectImpl mavenProject = (MavenProjectImpl) getMavenProjectForPomFile( pomFile, allMavenProjects ); attachedMavenProjects.add( mavenProject ); - List modules = mavenProject.getModel().getModules(); + Model model = mavenProject.getModel(); + List modules = ( model != null ) ? model.getModules() : new ArrayList(); Set childProjects = new HashSet(); for ( String module : modules ) { @@ -339,7 +370,7 @@ * Prints out the maven project artifact ids for the specified maven projects, with indents for children projects * * @param mavenProjects the maven projects to print information about - * @param indent the number of dashes to use for each child node iteration + * @param indent the number of dashes to use for each child node iteration */ private void printProjects( Set mavenProjects, int indent ) { Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/impl/PluginContextImpl.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/impl/PluginContextImpl.java?view=diff&rev=536025&r1=536024&r2=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/impl/PluginContextImpl.java (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/impl/PluginContextImpl.java Mon May 7 16:55:03 2007 @@ -18,12 +18,11 @@ ConfigurationAppendersRepository repository = (ConfigurationAppendersRepository) repositoryRegistry.find( "configuration-appenders" ); Set appenderClasses = repository.getAppenderClasses(); - System.out.println("AC CLASSES = " + appenderClasses.size()); for ( Class c : appenderClasses ) { ConfigurationAppenderAnnotation annotation = (ConfigurationAppenderAnnotation) c.getAnnotation( ConfigurationAppenderAnnotation.class ); - System.out.println(field.getType().getName() + ":" + annotation.targetClassName()); + //System.out.println(field.getType().getName() + ":" + annotation.targetClassName()); if ( field.getType().getName().equals( annotation.targetClassName() ) ) { Object o; @@ -34,17 +33,17 @@ catch ( InstantiationException e ) { e.printStackTrace(); - return null; + return null;//TODO: throw } catch ( IllegalAccessException e ) { e.printStackTrace(); - return null; + return null;//TODO: throw } return (ConfigurationAppender) o; } } - return null; + return null; //TODO: throw } } Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-registry/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-registry/pom.xml?view=diff&rev=536025&r1=536024&r2=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/dotnet-registry/pom.xml (original) +++ incubator/nmaven/branches/SI_XPT/components/dotnet-registry/pom.xml Mon May 7 16:55:03 2007 @@ -29,7 +29,6 @@ jar 0.14-SNAPSHOT dotnet-registry - org.apache.maven @@ -37,7 +36,7 @@ 2.1-SNAPSHOT - kxml2 + net.sf.kxml kxml2 2.1.8 Modified: incubator/nmaven/branches/SI_XPT/components/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/pom.xml?view=diff&rev=536025&r1=536024&r2=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/components/pom.xml (original) +++ incubator/nmaven/branches/SI_XPT/components/pom.xml Mon May 7 16:55:03 2007 @@ -18,6 +18,11 @@ --> + + org.apache.maven.dotnet + 0.14-SNAPSHOT + dotnet-project + 4.0.0 org.apache.maven.dotnet dotnet-components Modified: incubator/nmaven/branches/SI_XPT/maven-dotnet.iml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/maven-dotnet.iml?view=diff&rev=536025&r1=536024&r2=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/maven-dotnet.iml (original) +++ incubator/nmaven/branches/SI_XPT/maven-dotnet.iml Mon May 7 16:55:03 2007 @@ -25,6 +25,7 @@ + @@ -65,6 +66,7 @@ + @@ -115,729 +117,144 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -925,69 +342,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1006,15 +360,6 @@ - - - - - - - - - @@ -1051,24 +396,6 @@ - - - - - - - - - - - - - - - - - - @@ -1114,15 +441,6 @@ - - - - - - - - - @@ -1134,24 +452,6 @@ - - - - - - - - - - - - - - - - - - @@ -1161,133 +461,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -1296,7 +470,7 @@ - + @@ -1305,16 +479,17 @@ - + + - + @@ -1323,7 +498,7 @@ - + @@ -1332,7 +507,7 @@ - + @@ -1341,7 +516,7 @@ - + @@ -1350,17 +525,16 @@ - + - - + @@ -1369,7 +543,7 @@ - + @@ -1378,7 +552,7 @@ - + Modified: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/NMaven.Plugin.Addin.suo URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/NMaven.Plugin.Addin.suo?view=diff&rev=536025&r1=536024&r2=536025 ============================================================================== Binary files - no diff available. Modified: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/pom.xml?view=diff&rev=536025&r1=536024&r2=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/pom.xml (original) +++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/pom.xml Mon May 7 16:55:03 2007 @@ -18,10 +18,11 @@ --> - NMaven + NMaven.Plugins 0.14 - NMaven.Assemblies - + NMaven.Plugins + ..\pom-netplugins.xml + 4.0.0 NMaven.Plugin NMaven.Plugin.Addin @@ -37,7 +38,7 @@ NMaven.Model - NMaven.Model.Pom + NMaven.Model.AutomationExtensibility library 0.14 Modified: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/src/main/csharp/NMaven.Plugin.Addin.csproj URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/src/main/csharp/NMaven.Plugin.Addin.csproj?view=diff&rev=536025&r1=536024&r2=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/src/main/csharp/NMaven.Plugin.Addin.csproj (original) +++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/src/main/csharp/NMaven.Plugin.Addin.csproj Mon May 7 16:55:03 2007 @@ -18,6 +18,10 @@ C:\Documents and Settings\shane\.m2\repository\NMaven\Core\NMaven.Core\0.14\NMaven.Core.dll + + False + ..\..\..\..\..\..\..\.m2\repository\NMaven\Model\NMaven.Model.AutomationExtensibility\0.14\NMaven.Model.AutomationExtensibility.dll + Modified: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/src/main/csharp/NMaven/Plugin/Addin/AutomationExtensibilityMojo.cs URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/src/main/csharp/NMaven/Plugin/Addin/AutomationExtensibilityMojo.cs?view=diff&rev=536025&r1=536024&r2=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/src/main/csharp/NMaven/Plugin/Addin/AutomationExtensibilityMojo.cs (original) +++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Addin/src/main/csharp/NMaven/Plugin/Addin/AutomationExtensibilityMojo.cs Mon May 7 16:55:03 2007 @@ -1,65 +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. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Xml; -using System.Xml.Serialization; - -using NMaven.Plugin; -using NMaven.Model; -using NMaven.Artifact; - -namespace NMaven.Plugin.Addin -{ - /// - /// Description - /// - [ClassAttribute(Phase = "package", Goal = "package")] - public sealed class AutomationExtensibilityMojo : AbstractMojo - { - public AutomationExtensibilityMojo() - { - } - - [FieldAttribute("repository", Expression = "${settings.localRepository}", Type = "java.lang.String")] - public String localRepository; - - [FieldAttribute("mavenProject", Expression = "${project}", Type = "org.apache.maven.project.MavenProject")] - public NMaven.Model.Model mavenProject; - - - public override Type GetMojoImplementationType() - { - return this.GetType(); - } - - public override void Execute() - { - ArtifactRepositoryLayout layout = new ArtifactRepositoryLayout(); - ArtifactContext artifactContext = new ArtifactContext(); - NMaven.Artifact.Artifact artifact = artifactContext.GetArtifactFor(mavenProject); - Console.WriteLine("Artifact Id = " + artifact.ArtifactId); - Console.WriteLine("Path = " + layout.pathOf(artifact)); - FileInfo artifactFileInfo = new FileInfo(localRepository + @"\" + layout.pathOf(artifact)); - Console.WriteLine("Artifact Path = " + artifactFileInfo.FullName); - } - } -} +// +// 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. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml; +using System.Xml.Serialization; + +using NMaven.Plugin; +using NMaven.Model; +using NMaven.Artifact; + +namespace NMaven.Plugin.Addin +{ + /// + /// Description + /// + [ClassAttribute(Phase = "package", Goal = "package")] + public sealed class AutomationExtensibilityMojo : AbstractMojo + { + public AutomationExtensibilityMojo() + { + } + + [FieldAttribute("repository", Expression = "${settings.localRepository}", Type = "java.lang.String")] + public String localRepository; + + [FieldAttribute("mavenProject", Expression = "${project}", Type = "org.apache.maven.project.MavenProject")] + public NMaven.Model.Model mavenProject; + + + public override Type GetMojoImplementationType() + { + return this.GetType(); + } + + public override void Execute() + { + ArtifactRepositoryLayout layout = new ArtifactRepositoryLayout(); + ArtifactContext artifactContext = new ArtifactContext(); + NMaven.Artifact.Artifact artifact = artifactContext.GetArtifactFor(mavenProject); + FileInfo artifactFileInfo = new FileInfo(localRepository + @"\" + layout.pathOf(artifact)); + Console.WriteLine("Artifact Path = " + artifactFileInfo.FullName); + + object[] extensibilityItems = new object[2]; + //Host Application + ExtensibilityHostApplication hostApplication = new ExtensibilityHostApplication(); + List itemsChoiceTypes = new List(); + List itemsChoiceTypeValues = new List(); + + itemsChoiceTypes.Add(ItemsChoiceType.Name); + itemsChoiceTypeValues.Add("Microsoft Visual Studio"); + + itemsChoiceTypes.Add(ItemsChoiceType.Version); + itemsChoiceTypeValues.Add("8.0"); + + hostApplication.Items = itemsChoiceTypeValues.ToArray(); + hostApplication.ItemsElementName = itemsChoiceTypes.ToArray(); + extensibilityItems[0] = hostApplication; + + //Addin + ExtensibilityAddin addin = new ExtensibilityAddin(); + List itemNames = new List(); + List itemValues = new List(); + + itemNames.Add(ItemsChoiceType1.Assembly); + itemValues.Add(artifactFileInfo.FullName); + + itemNames.Add(ItemsChoiceType1.FullClassName); + itemValues.Add(mavenProject.artifactId + ".Connect"); + + itemNames.Add(ItemsChoiceType1.FriendlyName); + itemValues.Add(mavenProject.name); + + itemNames.Add(ItemsChoiceType1.Description); + itemValues.Add(mavenProject.description); + + itemNames.Add(ItemsChoiceType1.LoadBehavior); + itemValues.Add("0"); + + itemNames.Add(ItemsChoiceType1.CommandLineSafe); + itemValues.Add("0"); + + itemNames.Add(ItemsChoiceType1.CommandPreload); + itemValues.Add("1"); + + addin.Items = itemValues.ToArray(); + addin.ItemsElementName = itemNames.ToArray(); + extensibilityItems[1] = addin; + + Extensibility extensibility = new Extensibility(); + extensibility.Items = extensibilityItems; + + //write XML + XmlSerializer serializer = new XmlSerializer(typeof(NMaven.Model.Extensibility)); + XmlTextWriter xmlWriter = new XmlTextWriter(@"c:\tmp\NMavenBuild.AddIn", System.Text.Encoding.Unicode); + xmlWriter.Formatting = Formatting.Indented; + serializer.Serialize(xmlWriter, extensibility); + } + } +} Added: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/NMaven.Plugin.Devenv.sln URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/NMaven.Plugin.Devenv.sln?view=auto&rev=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/NMaven.Plugin.Devenv.sln (added) +++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/NMaven.Plugin.Devenv.sln Mon May 7 16:55:03 2007 @@ -0,0 +1,17 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMaven.Plugin.Devenv", "C:\Documents and Settings\shane\nmaven-apache\SI_XPT\plugins\NMaven.Plugin.Devenv\src\main\csharp\NMaven.Plugin.Devenv.csproj", "{693B0AD9-AC1B-49F4-8386-E4E097960D8B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {693B0AD9-AC1B-49F4-8386-E4E097960D8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {693B0AD9-AC1B-49F4-8386-E4E097960D8B}.Debug|Any CPU.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Added: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/pom-java.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/pom-java.xml?view=auto&rev=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/pom-java.xml (added) +++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/pom-java.xml Mon May 7 16:55:03 2007 @@ -0,0 +1,49 @@ + + + + org.apache.maven.dotnet.plugins + 0.14-SNAPSHOT + maven-dotnet-plugins + ..\pom.xml + + 4.0.0 + NMaven.Plugin + NMaven.Plugin.Devenv.JavaBinding + maven-plugin + NMaven.Plugin.Devenv.JavaBinding + 0.14 + + + + maven-compiler-plugin + + 1.5 + 1.5 + + + + + + + org.apache.maven.dotnet + dotnet-assembler + 0.14-SNAPSHOT + + + org.apache.maven.dotnet + dotnet-executable + 0.14-SNAPSHOT + + + org.apache.maven.dotnet + dotnet-artifact + 0.14-SNAPSHOT + + + org.apache.maven.dotnet + dotnet-plugin + 0.14-SNAPSHOT + + + \ No newline at end of file Propchange: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/pom-java.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/pom.xml URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/pom.xml?view=auto&rev=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/pom.xml (added) +++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/pom.xml Mon May 7 16:55:03 2007 @@ -0,0 +1,40 @@ + + + + NMaven.Plugins + 0.14 + NMaven.Plugins + ..\pom-netplugins.xml + + 4.0.0 + NMaven.Plugin + NMaven.Plugin.Devenv + netplugin + 0.14 + NMaven.Plugin.Devenv + + + NMaven.Plugin + NMaven.Plugin + library + 0.14 + + + \ No newline at end of file Propchange: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/csharp/NMaven.Plugin.Devenv.csproj URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/csharp/NMaven.Plugin.Devenv.csproj?view=auto&rev=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/csharp/NMaven.Plugin.Devenv.csproj (added) +++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/csharp/NMaven.Plugin.Devenv.csproj Mon May 7 16:55:03 2007 @@ -0,0 +1,29 @@ + + + {693b0ad9-ac1b-49f4-8386-e4e097960d8b} + Debug + NMaven.Plugin + NMaven.Plugin.Devenv + ..\..\..\target\obj\ + Library + + + ..\..\..\target\bin\Debug\ + + + + + + + + + + + + + + + + + + \ No newline at end of file Added: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/csharp/NMaven/Plugin/Devenv/DevenvMojo.cs URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/csharp/NMaven/Plugin/Devenv/DevenvMojo.cs?view=auto&rev=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/csharp/NMaven/Plugin/Devenv/DevenvMojo.cs (added) +++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/csharp/NMaven/Plugin/Devenv/DevenvMojo.cs Mon May 7 16:55:03 2007 @@ -0,0 +1,65 @@ +// +// 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. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Diagnostics; + +using Microsoft.Win32; + +using NMaven.Plugin; + +namespace NMaven.Plugin.Devenv +{ + /// + /// Description + /// + [Serializable] + [ClassAttribute(Phase = "deploy", Goal = "start")] + public sealed class DevenvMojo : AbstractMojo + { + public DevenvMojo() + { + } + + [FieldAttribute("artifactId", Expression = "${project.artifactId}", Type = "java.lang.String")] + public String artifactId; + + [FieldAttribute("buildDirectory", Expression = "${project.build.directory}", Type = "java.lang.String")] + public String buildDirectory; + + public override Type GetMojoImplementationType() + { + return this.GetType(); + } + + public override void Execute() + { + string args = "/ResetAddin " + artifactId + ".Connect " + "/Log " + @"""" + @buildDirectory + + @"\VisualStudio.log" + @""""; + RegistryKey visualStudioKey = + Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\VisualStudio\8.0"); + String installDir = (String) visualStudioKey.GetValue("InstallDir"); + ProcessStartInfo processStartInfo = + new ProcessStartInfo(@installDir + "devenv.exe", args); + Process.Start(processStartInfo); + } + } +} Added: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/java/NMaven/Plugin/Devenv/DevenvMojo.java URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/java/NMaven/Plugin/Devenv/DevenvMojo.java?view=auto&rev=536025 ============================================================================== --- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/java/NMaven/Plugin/Devenv/DevenvMojo.java (added) +++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/java/NMaven/Plugin/Devenv/DevenvMojo.java Mon May 7 16:55:03 2007 @@ -0,0 +1,109 @@ +package NMaven.Plugin.Devenv; + +import org.apache.maven.dotnet.plugin.FieldAnnotation; + +/** + * @phase deploy + * @goal start + */ +public class DevenvMojo + extends org.apache.maven.dotnet.plugin.AbstractMojo +{ + /** + * @parameter expression = "${project.artifactId}" + */ + @FieldAnnotation() + public java.lang.String artifactId; + + /** + * @parameter expression = "${project.build.directory}" + */ + @FieldAnnotation() + public java.lang.String buildDirectory; + + /** + * @parameter expression = "${project}" + */ + private org.apache.maven.project.MavenProject project; + + /** + * @parameter expression = "${settings.localRepository}" + */ + private String localRepository; + + /** + * @parameter expression = "${vendor}" + */ + private String vendor; + + /** + * @parameter expression = "${vendorVersion}" + */ + private String vendorVersion; + + /** + * @parameter expression = "${frameworkVersion}" + */ + private String frameworkVersion; + + /** + * @component + */ + private org.apache.maven.dotnet.executable.NetExecutableFactory netExecutableFactory; + + /** + * @component + */ + private org.apache.maven.dotnet.plugin.PluginContext pluginContext; + + public String getMojoArtifactId() + { + return "NMaven.Plugin.Devenv"; + } + + public String getMojoGroupId() + { + return "NMaven.Plugin"; + } + + public String getClassName() + { + return "NMaven.Plugin.Devenv.DevenvMojo"; + } + + public org.apache.maven.dotnet.plugin.PluginContext getNetPluginContext() + { + return pluginContext; + } + + public org.apache.maven.dotnet.executable.NetExecutableFactory getNetExecutableFactory() + { + return netExecutableFactory; + } + + public org.apache.maven.project.MavenProject getMavenProject() + { + return project; + } + + public String getLocalRepository() + { + return localRepository; + } + + public String getVendorVersion() + { + return vendorVersion; + } + + public String getVendor() + { + return vendor; + } + + public String getFrameworkVersion() + { + return frameworkVersion; + } + +} Propchange: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Devenv/src/main/java/NMaven/Plugin/Devenv/DevenvMojo.java ------------------------------------------------------------------------------ svn:eol-style = native