incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r537009 - /incubator/nmaven/branches/SI_XPT/plugins/maven-vsinstaller-plugin/src/main/java/org/apache/maven/dotnet/plugin/vsinstaller/VsInstallerMojo.java
Date Thu, 10 May 2007 21:52:32 GMT
Author: sisbell
Date: Thu May 10 14:52:31 2007
New Revision: 537009

URL: http://svn.apache.org/viewvc?view=rev&rev=537009
Log:
Nearly complete visual studio adding installer

Modified:
    incubator/nmaven/branches/SI_XPT/plugins/maven-vsinstaller-plugin/src/main/java/org/apache/maven/dotnet/plugin/vsinstaller/VsInstallerMojo.java

Modified: incubator/nmaven/branches/SI_XPT/plugins/maven-vsinstaller-plugin/src/main/java/org/apache/maven/dotnet/plugin/vsinstaller/VsInstallerMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/maven-vsinstaller-plugin/src/main/java/org/apache/maven/dotnet/plugin/vsinstaller/VsInstallerMojo.java?view=diff&rev=537009&r1=537008&r2=537009
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/maven-vsinstaller-plugin/src/main/java/org/apache/maven/dotnet/plugin/vsinstaller/VsInstallerMojo.java
(original)
+++ incubator/nmaven/branches/SI_XPT/plugins/maven-vsinstaller-plugin/src/main/java/org/apache/maven/dotnet/plugin/vsinstaller/VsInstallerMojo.java
Thu May 10 14:52:31 2007
@@ -16,6 +16,9 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.OutputStreamWriter;
 import java.util.ArrayList;
 import java.util.Map;
 import java.util.HashMap;
@@ -53,10 +56,10 @@
      */
     private ArtifactHandlerManager artifactHandlerManager;
 
-    private ArtifactHandler createArtifactHandler(String packaging, String extension)
+    private ArtifactHandler createArtifactHandler( String packaging, String extension )
     {
         Handler handler = new Handler();
-        handler.setExtension(extension);
+        handler.setExtension( extension );
         handler.setPackaging( packaging );
         return handler;
     }
@@ -65,9 +68,9 @@
         throws MojoExecutionException, MojoFailureException
     {
         Map handlers = new HashMap();
-        handlers.put("library",createArtifactHandler("library", "dll"));
-        handlers.put("netplugin",createArtifactHandler("netplugin", "dll"));
-        artifactHandlerManager.addHandlers(handlers);
+        handlers.put( "library", createArtifactHandler( "library", "dll" ) );
+        handlers.put( "netplugin", createArtifactHandler( "netplugin", "dll" ) );
+        artifactHandlerManager.addHandlers( handlers );
 
         artifactContext.init( project, new File( localRepository ) );
 
@@ -98,28 +101,42 @@
         {
             throw new MojoExecutionException( "NMAVEN-1600-003: Unable to resolve assemblies",
e );
         }
-/*
+
         FileOutputStream fos = null;
         try
         {
-            fos = new FileOutputStream("C:\\test.AddIn");
-            fos.write( addin.replaceAll( "${localRepository}", localRepository).getBytes());
+            File outputFile = new File( System.getProperty( "user.home" ) +
+                "\\My Documents\\Visual Studio 2005\\Addins\\NMaven.VisualStudio.AddIn" );
+
+            if ( !outputFile.getParentFile().exists() )
+            {
+                outputFile.getParentFile().mkdir();
+            }
+            fos = new FileOutputStream( outputFile );
+            OutputStreamWriter writer = new OutputStreamWriter( fos, "Unicode" );
+            writer.write(
+                addin.replaceAll( "\\$\\{localRepository\\}", localRepository.replaceAll(
"\\\\", "\\\\\\\\" ) ) );
+            writer.close();
         }
         catch ( IOException e )
         {
             e.printStackTrace();
         }
-        finally {
+        finally
+        {
             try
             {
-                if(fos != null) fos.close();
+                if ( fos != null )
+                {
+                    fos.close();
+                }
             }
             catch ( IOException e )
             {
                 e.printStackTrace();
             }
         }
-        */
+
     }
 
     private class Handler



Mime
View raw message