incubator-npanday-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apadi...@apache.org
Subject svn commit: r1083725 - in /incubator/npanday/trunk: components/dotnet-core/src/main/resources/META-INF/npanday/ plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/ plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ plugins/netp...
Date Mon, 21 Mar 2011 10:44:08 GMT
Author: apadilla
Date: Mon Mar 21 10:44:07 2011
New Revision: 1083725

URL: http://svn.apache.org/viewvc?rev=1083725&view=rev
Log:
[NPANDAY-377] - fix hardcoded path for <repository-config> in registry-config.xml

Modified:
    incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/registry-config.xml
    incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxCompilerMojo.java
    incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java
    incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/javabinding/src/main/java/NPanday/Plugin/Settings/SettingsGeneratorMojo.java
    incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/SettingsGeneratorMojo.cs

Modified: incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/registry-config.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/registry-config.xml?rev=1083725&r1=1083724&r2=1083725&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/registry-config.xml
(original)
+++ incubator/npanday/trunk/components/dotnet-core/src/main/resources/META-INF/npanday/registry-config.xml
Mon Mar 21 10:44:07 2011
@@ -22,7 +22,7 @@ under the License.
     <repository>
       <repository-name>npanday-settings</repository-name>
       <repository-class>npanday.vendor.impl.SettingsRepository</repository-class>
-      <repository-config>${user.home}/.m2/npanday-settings.xml</repository-config>
+      <repository-config>${npanday.settings}</repository-config>
       <init-param>
         <param-name>optional</param-name>
         <param-value>true</param-value>

Modified: incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxCompilerMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxCompilerMojo.java?rev=1083725&r1=1083724&r2=1083725&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxCompilerMojo.java
(original)
+++ incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxCompilerMojo.java
Mon Mar 21 10:44:07 2011
@@ -22,6 +22,7 @@ package npanday.plugin.aspx;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Hashtable;
 import java.util.List;
 
 import npanday.ArtifactType;
@@ -30,7 +31,10 @@ import npanday.executable.ExecutionExcep
 import npanday.executable.compiler.CompilerConfig;
 import npanday.executable.compiler.CompilerExecutable;
 import npanday.executable.compiler.CompilerRequirement;
+import npanday.registry.RepositoryRegistry;
+import npanday.registry.impl.StandardRepositoryLoader;
 import npanday.vendor.VendorFactory;
+import npanday.vendor.impl.SettingsRepository;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
@@ -52,6 +56,11 @@ public class AspxCompilerMojo
     private static final String DEFAULT_EXCLUDES = "obj/**, target/**, **/*.pdb, **/*.csproj,
**/*.vbproj, **/*.suo, **/*.user,pom.xml, **/*.sln,build.log,PrecompiledApp.config,csproj.user,Properties/**,**.releaseBackup,^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/**";
 
     /**
+     * @parameter expression ="${npanday.settings}"
+     */
+    private String settingsPath;
+    
+    /**
      * The maven project.
      *
      * @parameter expression="${project}"
@@ -142,10 +151,17 @@ public class AspxCompilerMojo
     
     private File webSourceDirectory;
 
+    /** 
+     * @component
+     */
+    private RepositoryRegistry repositoryRegistry;
+
     public void execute()
         throws MojoExecutionException
     {
         long startTime = System.currentTimeMillis();
+        
+        getNPandaySettingsPath();
 
         webSourceDirectory = new File( project.getBuild().getSourceDirectory() ); 
 
@@ -398,4 +414,37 @@ public class AspxCompilerMojo
         }
     }
     
+    protected void getNPandaySettingsPath()
+    {
+        if ( settingsPath == null )
+        {
+            settingsPath = System.getProperty( "user.home" ) + "/.m2";
+        }
+
+        File settingsFile = new File( settingsPath, "npanday-settings.xml" );
+
+        try
+        {
+            SettingsRepository settingsRepository = (SettingsRepository) repositoryRegistry.find(
"npanday-settings" );
+
+            if ( settingsRepository != null )
+            {
+                repositoryRegistry.removeRepository( "npanday-settings" );
+            }
+            try
+            {
+                StandardRepositoryLoader repoLoader = new StandardRepositoryLoader();
+                repoLoader.setRepositoryRegistry( repositoryRegistry );
+                settingsRepository = (SettingsRepository) repoLoader.loadRepository( settingsFile.getAbsolutePath(),
SettingsRepository.class.getName(), new Hashtable() );
+                repositoryRegistry.addRepository( "npanday-settings", settingsRepository
);
+            }
+            catch ( IOException e )
+            {
+            }            
+        }
+        catch ( Exception ex )
+        {
+            ex.printStackTrace();
+        }
+    }
 }

Modified: incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java?rev=1083725&r1=1083724&r2=1083725&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java
(original)
+++ incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java
Mon Mar 21 10:44:07 2011
@@ -26,6 +26,7 @@ import npanday.executable.ExecutionExcep
 import npanday.executable.compiler.CompilerConfig;
 import npanday.executable.compiler.CompilerExecutable;
 import npanday.executable.compiler.CompilerRequirement;
+import npanday.registry.impl.StandardRepositoryLoader;
 import npanday.registry.RepositoryRegistry;
 import npanday.vendor.impl.SettingsRepository;
 import org.apache.maven.plugin.AbstractMojo;
@@ -1255,19 +1256,20 @@ public abstract class AbstractCompilerMo
             {
                 repositoryRegistry.removeRepository( "npanday-settings" );
             }
-            Hashtable props = new Hashtable();
-            InputStream stream = new FileInputStream( settingsFile );    
-            settingsRepository = new SettingsRepository();
-            settingsRepository.setSourceUri( settingsFile.getAbsolutePath() );
-            settingsRepository.setRepositoryRegistry( repositoryRegistry );
-            settingsRepository.load( stream, props );
-            repositoryRegistry.addRepository( "npanday-settings", settingsRepository ); 
      
-        }   
+            try
+            {
+                StandardRepositoryLoader repoLoader = new StandardRepositoryLoader();
+                repoLoader.setRepositoryRegistry( repositoryRegistry );
+                settingsRepository = (SettingsRepository) repoLoader.loadRepository( settingsFile.getAbsolutePath(),
SettingsRepository.class.getName(), new Hashtable() );
+                repositoryRegistry.addRepository( "npanday-settings", settingsRepository
);
+            }
+            catch ( IOException e )
+            {
+            }
+        }
         catch ( Exception ex )
         {
             ex.printStackTrace();
-        }    
+        }
     }
-
-    
 }

Modified: incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/javabinding/src/main/java/NPanday/Plugin/Settings/SettingsGeneratorMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/javabinding/src/main/java/NPanday/Plugin/Settings/SettingsGeneratorMojo.java?rev=1083725&r1=1083724&r2=1083725&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/javabinding/src/main/java/NPanday/Plugin/Settings/SettingsGeneratorMojo.java
(original)
+++ incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/javabinding/src/main/java/NPanday/Plugin/Settings/SettingsGeneratorMojo.java
Mon Mar 21 10:44:07 2011
@@ -210,13 +210,17 @@ public class SettingsGeneratorMojo
             {
                 repositoryRegistry.removeRepository( "npanday-settings" );
             }
-            Hashtable props = new Hashtable();
-            InputStream stream = new FileInputStream( file );    
-            settingsRepository = new SettingsRepository();
-            settingsRepository.setSourceUri( file.getAbsolutePath() );
-            settingsRepository.setRepositoryRegistry( repositoryRegistry );
-            settingsRepository.load( stream, props );
-            repositoryRegistry.addRepository( "npanday-settings", settingsRepository ); 
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            try
+            {
+                StandardRepositoryLoader repoLoader = new StandardRepositoryLoader();
+                repoLoader.setRepositoryRegistry( repositoryRegistry );
+                settingsRepository = (SettingsRepository) repoLoader.loadRepository( file.getAbsolutePath(),
SettingsRepository.class.getName(), new Hashtable() );
+                repositoryRegistry.addRepository( "npanday-settings", settingsRepository
);
+            }
+            catch ( IOException e )
+            {
+            }
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
             DocumentBuilder db = dbf.newDocumentBuilder();
             Document doc = db.parse( file );
             doc.getDocumentElement().normalize();

Modified: incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/SettingsGeneratorMojo.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/SettingsGeneratorMojo.cs?rev=1083725&r1=1083724&r2=1083725&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/SettingsGeneratorMojo.cs
(original)
+++ incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Settings/src/main/csharp/NPanday/Plugin/Settings/SettingsGeneratorMojo.cs
Mon Mar 21 10:44:07 2011
@@ -74,27 +74,23 @@ namespace NPanday.Plugin.Settings
             }
 
             npandaySettingsVendorsVendor[] monoVendors = null;
-            npandaySettingsVendorsVendor dotGnuVendor = null;
-            
-            if ( File.Exists( outputFile ))
+            try
             {
-                try
-                {
-                    monoVendors = GetVendorsForMono(monoRegistryKey, defaultMonoCLR);
-                }
-                catch(ExecutionException e)
-                {
-                    Console.WriteLine(e.ToString());
-                }
+                monoVendors = GetVendorsForMono(monoRegistryKey, defaultMonoCLR);
+            }
+            catch(ExecutionException e)
+            {
+                Console.WriteLine(e.ToString());
+            }
 
-                try
-                {
-                    dotGnuVendor = GetVendorForGnu(Environment.GetEnvironmentVariable("CSCC_LIB_PATH"));
-                }
-                catch(ExecutionException e)
-                {
-                    Console.WriteLine(e.ToString());
-                }
+            npandaySettingsVendorsVendor dotGnuVendor = null;
+            try
+            {
+                dotGnuVendor = GetVendorForGnu(Environment.GetEnvironmentVariable("CSCC_LIB_PATH"));
+            }
+            catch(ExecutionException e)
+            {
+                Console.WriteLine(e.ToString());
             }
             int monoVendorsLength = (monoVendors == null) ? 0: monoVendors.Length;
             int dotGnuVendorLength = (dotGnuVendor == null) ? 0: 1;



Mime
View raw message