incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r534187 - in /incubator/nmaven/branches/SI_XPT: ./ assemblies/NMaven.Plugin.MojoGenerator/src/main/csharp/NMaven/Plugin/MojoGenerator/ assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/ components/dotnet-core/src/main/resourc...
Date Tue, 01 May 2007 18:32:44 GMT
Author: sisbell
Date: Tue May  1 11:32:43 2007
New Revision: 534187

URL: http://svn.apache.org/viewvc?view=rev&rev=534187
Log:
Converted settings executable into plugin.

Added:
    incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/NMaven.Plugin.Settings.sln
    incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/csharp/Plugin/Settings/SettingsGeneratorMojo.cs
    incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/java/NMaven/Plugin/Settings/SettingsGeneratorMojo.java
  (with props)
    incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/site/
    incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/site/site.xml   (with
props)
Removed:
    incubator/nmaven/branches/SI_XPT/plugins/maven-settings-plugin/
Modified:
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.MojoGenerator/src/main/csharp/NMaven/Plugin/MojoGenerator/Generator.cs
    incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClassUnmarshaller.cs
    incubator/nmaven/branches/SI_XPT/components/dotnet-core/src/main/resources/META-INF/nmaven/net-dependencies.xml
    incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/AbstractMojo.java
    incubator/nmaven/branches/SI_XPT/maven-dotnet.iml
    incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/pom-java.xml
    incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/pom.xml
    incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/csharp/NMaven.Plugin.Settings.csproj
    incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionMojo.cs
    incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.MojoGenerator/src/main/csharp/NMaven/Plugin/MojoGenerator/Generator.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.MojoGenerator/src/main/csharp/NMaven/Plugin/MojoGenerator/Generator.cs?view=diff&rev=534187&r1=534186&r2=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.MojoGenerator/src/main/csharp/NMaven/Plugin/MojoGenerator/Generator.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin.MojoGenerator/src/main/csharp/NMaven/Plugin/MojoGenerator/Generator.cs
Tue May  1 11:32:43 2007
@@ -69,7 +69,7 @@
 		/// <param name="applicationDomain">
 		/// the application domain used to create the specified mojo name instance</param>
 		/// <returns>an instance of the specified mojo name within the specified application
domain</returns>
-		internal void BuildPluginProject(AppDomain applicationDomain, FileInfo pluginArtifact,

+		internal int BuildPluginProject(AppDomain applicationDomain, FileInfo pluginArtifact, 
 		                                FileInfo outputDirectory, string groupId, string artifactId,

 		                                string version)
 		{
@@ -84,6 +84,13 @@
 			DirectoryInfo sourceDirectory = new DirectoryInfo(@outputDirectory.FullName + "/src/main/java/"

 			                                                  + artifactId.Replace('.', '/'));
 			sourceDirectory.Create();
+			if(javaClasses.Count == 0)
+			{
+				Console.WriteLine("NMAVEN-000-000: There are no Mojos within the assembly: Artifact Id
= " 
+				                  + artifactId);
+				return 1;
+			}
+			
 			foreach(JavaClass javaClass in javaClasses)
 			{
 				string[] tokens = javaClass.ClassName.Split(delim);
@@ -107,9 +114,10 @@
 			FileInfo outputPomXml = new FileInfo(@outputDirectory.FullName + "/pom-java.xml");
 			TextWriter textWriter = new StreamWriter(@outputPomXml.FullName);
 			serializer.Serialize(textWriter, model);
+			return 0;
 		}
 		
-		public static void Main(string[] args)
+		public static int Main(string[] args)
 		{
 		
 			string targetAssemblyFile = GetArgFor("targetAssemblyFile", args);
@@ -119,12 +127,12 @@
 			string artifactId = GetArgFor("artifactId", args);
 			string version = GetArgFor("artifactVersion", args); 
 			
-			Console.WriteLine("targetAssemblyFile = {0}, outputDirectory = {1}, pluginArtifactPath
= {2}, version = {3}", 
-			                  targetAssemblyFile, outputDirectory, pluginArtifactPath, version);
+			//Console.WriteLine("targetAssemblyFile = {0}, outputDirectory = {1}, pluginArtifactPath
= {2}, version = {3}", 
+			//                  targetAssemblyFile, outputDirectory, pluginArtifactPath, version);
 			Generator generator = new Generator();
 			AppDomain applicationDomain = 
 				generator.GetApplicationDomainFor(new FileInfo(targetAssemblyFile));
-			generator.BuildPluginProject(applicationDomain, new FileInfo(pluginArtifactPath), 
+			return generator.BuildPluginProject(applicationDomain, new FileInfo(pluginArtifactPath),

 			                             new FileInfo(outputDirectory), 
 			                             groupId, artifactId, version);
 		}

Modified: incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClassUnmarshaller.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClassUnmarshaller.cs?view=diff&rev=534187&r1=534186&r2=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClassUnmarshaller.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Generator/JavaClassUnmarshaller.cs
Tue May  1 11:32:43 2007
@@ -39,7 +39,6 @@
 			
 		public List<JavaClass> GetMojosFor(string assemblyName, string groupId)
 		{
-			Console.WriteLine("Print ...");
 			List<JavaClass> javaClasses = new List<JavaClass>();
 			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
 			foreach(Assembly assembly in assemblies)
@@ -50,7 +49,7 @@
 					Type[] types = assembly.GetTypes();
 					foreach(Type type in types)
 					{
-						String baseName = type.BaseType.Name;//.Equals("NMaven.Plugin.AbstractMojo");
+						String baseName = type.BaseType.Name;
 						if(baseName.Equals("AbstractMojo"))
 						{
 							JavaClass javaClass = convert(type, groupId);
@@ -102,6 +101,8 @@
 	        }
         	
         	//mojo parameters
+        	javaFields.Add(CreateJavaField("private", "org.apache.maven.project.MavenProject",
"project",  
+        	                               CreateMojoComment("${project}"), null));        

         	javaFields.Add(CreateJavaField("private", "String", "localRepository",  
         	                               CreateMojoComment("${settings.localRepository}"),
null));
         	javaFields.Add(CreateJavaField("private", "String", "vendor",  
@@ -143,7 +144,7 @@
         	                                 CreateCodeWithSimpleReturnType("netExecutableFactory")));

         	                                
         	javaMethods.Add(CreateJavaMethod("public", "org.apache.maven.project.MavenProject",
"getMavenProject", 
-        	                                 CreateCodeWithSimpleReturnType("mavenProject")));

+        	                                 CreateCodeWithSimpleReturnType("project"))); 
         	                                
         	javaMethods.Add(CreateJavaMethod("public", "String", "getLocalRepository", 
         	                                 CreateCodeWithSimpleReturnType("localRepository")));
 

Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-core/src/main/resources/META-INF/nmaven/net-dependencies.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-core/src/main/resources/META-INF/nmaven/net-dependencies.xml?view=diff&rev=534187&r1=534186&r2=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-core/src/main/resources/META-INF/nmaven/net-dependencies.xml
(original)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-core/src/main/resources/META-INF/nmaven/net-dependencies.xml
Tue May  1 11:32:43 2007
@@ -10,7 +10,7 @@
     <groupId>NMaven.Plugin</groupId>
     <artifactId>NMaven.Plugin.Settings</artifactId>
     <version>0.14</version>
-    <type>exe</type>
+    <type>netplugin</type>
   </netDependency>
   <netDependency>
     <groupId>NMaven.Plugin</groupId>

Modified: incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/AbstractMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/AbstractMojo.java?view=diff&rev=534187&r1=534186&r2=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/AbstractMojo.java
(original)
+++ incubator/nmaven/branches/SI_XPT/components/dotnet-plugin/src/main/java/org/apache/maven/dotnet/plugin/AbstractMojo.java
Tue May  1 11:32:43 2007
@@ -64,6 +64,11 @@
     public final void execute()
         throws MojoExecutionException, MojoFailureException
     {
+        if ( !preExecute() )
+        {
+            return;
+        }
+
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder;
         try
@@ -158,7 +163,6 @@
         document.appendChild( root );
 
         Set<Field> fields = getAnnotatedFieldsFrom( this.getClass().getDeclaredFields()
);
-        // Set<Class> appenderClasses = getConfigurationAppenderClasses();
         for ( Field field : fields )
         {
             ConfigurationAppender configurationAppender = getNetPluginContext().getConfigurationAppenderFor(
field );
@@ -211,5 +215,14 @@
     public abstract String getVendorVersion();
 
     public abstract String getFrameworkVersion();
+
+    /**
+     * Override this method for pre-execution commands.
+     */
+    public boolean preExecute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        return true;
+    }
 
 }

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=534187&r1=534186&r2=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/maven-dotnet.iml (original)
+++ incubator/nmaven/branches/SI_XPT/maven-dotnet.iml Tue May  1 11:32:43 2007
@@ -61,12 +61,13 @@
       <sourceFolder url="file://$MODULE_DIR$/integration-tests/tests/it0022/src/main/csharp"
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/integration-tests/tests/it0025/it/test1/src/main/csharp"
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/net-plugins/NMaven.Plugin.Generator/src/main/java"
isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/plugins/NMaven.Plugin.Settings/src/main/java"
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/plugins/maven-archetype-plugin/src/main/java"
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/plugins/maven-compile-plugin/src/main/java"
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/plugins/maven-compile-plugin/src/main/resources"
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/plugins/maven-mojo-generator-plugin/src/main/java"
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/plugins/maven-install-plugin/src/main/java"
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/plugins/maven-link-plugin/src/main/java"
isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/plugins/maven-mojo-generator-plugin/src/main/java"
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/plugins/maven-resgen-plugin/src/main/java"
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/plugins/maven-resolver-plugin/src/main/java"
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/plugins/maven-sdaddin-plugin/src/main/java"
isTestSource="false" />

Added: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/NMaven.Plugin.Settings.sln
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/NMaven.Plugin.Settings.sln?view=auto&rev=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/NMaven.Plugin.Settings.sln
(added)
+++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/NMaven.Plugin.Settings.sln
Tue May  1 11:32:43 2007
@@ -0,0 +1,16 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# SharpDevelop 2.0.0.1710
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMaven.Plugin.Settings", "src\main\csharp\NMaven.Plugin.Settings.csproj",
"{34c7738a-d98c-4cf8-bb48-9b41fee3774e}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{34C7738A-D98C-4CF8-BB48-9B41FEE3774E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{34C7738A-D98C-4CF8-BB48-9B41FEE3774E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{34C7738A-D98C-4CF8-BB48-9B41FEE3774E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{34C7738A-D98C-4CF8-BB48-9B41FEE3774E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+	EndGlobalSection
+EndGlobal

Modified: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/pom-java.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/pom-java.xml?view=diff&rev=534187&r1=534186&r2=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/pom-java.xml (original)
+++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/pom-java.xml Tue May 
1 11:32:43 2007
@@ -39,4 +39,11 @@
       <version>0.14-SNAPSHOT</version>
     </dependency>
   </dependencies>
+  <distributionManagement>
+    <site>
+      <id>nmaven-apache-site</id>
+      <name>NMaven Site</name>
+      <url>file://${basedir}/../../../www/plugins/maven-settings-plugin</url>
+    </site>
+  </distributionManagement>  
 </project>

Modified: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/pom.xml?view=diff&rev=534187&r1=534186&r2=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/pom.xml (original)
+++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/pom.xml Tue May  1 11:32:43
2007
@@ -25,15 +25,15 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>NMaven.Plugin</groupId>
   <artifactId>NMaven.Plugin.Settings</artifactId>
-  <packaging>exe</packaging>
+  <packaging>netplugin</packaging>
   <version>0.14</version>
   <name>NMaven.Plugin.Settings</name>
   <dependencies>
     <dependency>
-      <groupId>NUnit</groupId>
-      <artifactId>NUnit.Framework</artifactId>
-      <version>2.2.8.0</version>
+      <groupId>NMaven.Plugin</groupId>
+      <artifactId>NMaven.Plugin</artifactId>
       <type>library</type>
+      <version>0.14</version>
     </dependency>
   </dependencies>
   <profiles>

Modified: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/csharp/NMaven.Plugin.Settings.csproj
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/csharp/NMaven.Plugin.Settings.csproj?view=diff&rev=534187&r1=534186&r2=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/csharp/NMaven.Plugin.Settings.csproj
(original)
+++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/csharp/NMaven.Plugin.Settings.csproj
Tue May  1 11:32:43 2007
@@ -1,4 +1,4 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <ProjectGuid>{34c7738a-d98c-4cf8-bb48-9b41fee3774e}</ProjectGuid>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -6,8 +6,6 @@
     <AssemblyName>NMaven.Plugin.Settings</AssemblyName>
     <BaseIntermediateOutputPath>..\..\..\target\obj\</BaseIntermediateOutputPath>
     <OutputType>Exe</OutputType>
-  </PropertyGroup>
-  <PropertyGroup>
     <OutputPath>..\..\..\target\bin\Debug\</OutputPath>
   </PropertyGroup>
   <ItemGroup>
@@ -18,14 +16,13 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Plugin" />
-    <Folder Include="Plugin\Settings" />
-  </ItemGroup>
-  <ItemGroup>
     <Compile Include="Plugin\Settings\ExecutionException.cs" />
     <Compile Include="Plugin\Settings\nmavenSettings.cs" />
-    <Compile Include="Plugin\Settings\SettingsGenerator.cs" />
+    <Compile Include="Plugin\Settings\SettingsGeneratorMojo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Plugin" />
+    <Folder Include="Plugin\Settings" />
   </ItemGroup>
-  <ItemGroup />
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
 </Project>

Added: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/csharp/Plugin/Settings/SettingsGeneratorMojo.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/csharp/Plugin/Settings/SettingsGeneratorMojo.cs?view=auto&rev=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/csharp/Plugin/Settings/SettingsGeneratorMojo.cs
(added)
+++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/csharp/Plugin/Settings/SettingsGeneratorMojo.cs
Tue May  1 11:32:43 2007
@@ -0,0 +1,293 @@
+//
+// 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.IO;
+using System.Collections;
+using System.Xml.Serialization;
+using Microsoft.Win32;
+
+using NMaven.Plugin;
+
+namespace NMaven.Plugin.Settings
+{
+	[Serializable]
+    [ClassAttribute(Phase = "validate", Goal = "generate-settings")]
+	public sealed class SettingsGeneratorMojo : AbstractMojo
+    {
+        public SettingsGeneratorMojo() { }
+
+		public override Type GetMojoImplementationType()
+		{
+			return this.GetType();
+		}
+
+        public override void Execute()
+        {
+        	string outputFile = Environment.GetEnvironmentVariable("HOMEPATH") + "/.m2/nmaven-settings.xml";
+            XmlSerializer serializer = new XmlSerializer(typeof(nmavenSettings));
+
+            nmavenSettings  settings = new nmavenSettings();
+            settings.operatingSystem = Environment.OSVersion.ToString();
+
+            RegistryKey monoRegistryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Novell\Mono");
+            RegistryKey microsoftRegistryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\.NETFramework");
+
+            string defaultMonoCLR = (monoRegistryKey != null) ? (string) monoRegistryKey.GetValue("DefaultCLR")
: null;
+
+            settings.defaultSetup = GetDefaultSetup(defaultMonoCLR,
+                (string) microsoftRegistryKey.GetValue("InstallRoot"));
+
+            nmavenSettingsVendorsVendor[] microsoftVendors = null;
+            try
+            {
+                microsoftVendors = GetVendorsForMicrosoft(microsoftRegistryKey);
+            }
+            catch(ExecutionException e)
+            {
+                Console.WriteLine(e.ToString());
+            }
+
+            nmavenSettingsVendorsVendor[] monoVendors = null;
+            try
+            {
+                monoVendors = GetVendorsForMono(monoRegistryKey, defaultMonoCLR);
+            }
+            catch(ExecutionException e)
+            {
+                Console.WriteLine(e.ToString());
+            }
+
+            nmavenSettingsVendorsVendor 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;
+            int microsoftVendorsLength = (microsoftVendors == null) ? 0: microsoftVendors.Length;
+
+            nmavenSettingsVendorsVendor[] vendors =
+                new nmavenSettingsVendorsVendor[microsoftVendorsLength + monoVendorsLength
+ dotGnuVendorLength];
+
+            int copyLocation = 0;
+            if(microsoftVendors != null)
+            {
+                microsoftVendors.CopyTo(vendors, copyLocation);
+                copyLocation+=microsoftVendors.Length;
+            }
+            if(monoVendors != null)
+            {
+                monoVendors.CopyTo(vendors, copyLocation);
+                copyLocation+=monoVendors.Length;
+            }
+            if(dotGnuVendor != null)
+                vendors[copyLocation] = dotGnuVendor;
+
+            settings.vendors = vendors;
+
+            TextWriter writer = new StreamWriter(@outputFile);
+            serializer.Serialize(writer, settings);
+            writer.Close();
+        }
+
+        protected nmavenSettingsDefaultSetup GetDefaultSetup(string defaultMonoCLR,
+                                                             string installRoot)
+        {
+            nmavenSettingsDefaultSetup defaultSetup = new nmavenSettingsDefaultSetup();
+            if(installRoot == null)
+            {
+                defaultSetup.vendorName = "MONO";
+                defaultSetup.vendorVersion = defaultMonoCLR;
+                return (defaultMonoCLR != null) ? defaultSetup : null;
+            }
+            bool dirInfo11 = new DirectoryInfo(Path.Combine(installRoot, "v1.1.4322")).Exists;
+            bool dirInfo20 = new DirectoryInfo(Path.Combine(installRoot, "v2.0.50727")).Exists;
+
+            if(installRoot != null)
+            {
+                if(!dirInfo11 && !dirInfo20)
+                    return null;
+                defaultSetup.vendorName = "MICROSOFT";
+                defaultSetup.vendorVersion = (dirInfo20) ? "2.0.50727" :  "1.1.4322";
+                defaultSetup.frameworkVersion = defaultSetup.vendorVersion;
+                return defaultSetup;
+            }
+            else if(defaultMonoCLR != null)
+            {
+                defaultSetup.vendorName = "MONO";
+                defaultSetup.vendorVersion = defaultMonoCLR;
+                defaultSetup.frameworkVersion = "2.0.50727";
+                return defaultSetup;
+            }
+            return null;
+        }
+
+        protected nmavenSettingsVendorsVendor GetVendorForGnu(String libPath)
+        {
+            if(libPath == null)
+                throw new ExecutionException("NMAVEN-9011-000: No CSCC_LIB_PATH Found");
+
+            if (libPath.EndsWith("lib" + Path.DirectorySeparatorChar + "cscc" + Path.DirectorySeparatorChar
+ "lib"))
+            {
+                string installR = new DirectoryInfo(libPath).Parent.Parent.Parent.FullName;
+                string[] tokenizedInstallRoot = installR.Split(Path.DirectorySeparatorChar);
+                string vendorVersion = tokenizedInstallRoot[tokenizedInstallRoot.Length -
1];
+                if (!isValidVersion(vendorVersion))
+                {
+                    throw new ExecutionException("NMAVEN-9011-001: Invalid version format
for dotGNU: Version = " +
+                        vendorVersion + ", Root = " + installR);
+                }
+
+                nmavenSettingsVendorsVendor vendor = new nmavenSettingsVendorsVendor();
+                vendor.vendorName = "DotGNU";
+                vendor.vendorVersion = vendorVersion;
+                nmavenSettingsVendorsVendorFrameworksFramework[] vendorFrameworks 
+                	= new nmavenSettingsVendorsVendorFrameworksFramework[1];
+                nmavenSettingsVendorsVendorFrameworksFramework vf = new nmavenSettingsVendorsVendorFrameworksFramework();
+                vf.installRoot = Path.Combine(installR, "bin");
+                vf.frameworkVersion = "2.0.50727";//doesn't matter
+                vendorFrameworks[0] = vf;                                               
    ;
+                vendor.frameworks = vendorFrameworks;
+                return vendor;
+            }
+            throw new ExecutionException("NMAVEN-9011-002: CSCC_LIB_PATH found but could
not determine vendor information");
+        }
+
+        private nmavenSettingsVendorsVendor[] GetVendorsForMicrosoft(RegistryKey microsoftRegistryKey)
+        {
+            if(microsoftRegistryKey == null)
+                throw new ExecutionException("NMAVEN-9011-006: Microsoft installation could
not be found.");
+            string installRoot = (string) microsoftRegistryKey.GetValue("InstallRoot");
+            string sdkInstallRoot11 = (string) microsoftRegistryKey.GetValue("sdkInstallRootv1.1");
+            string sdkInstallRoot20 = (string) microsoftRegistryKey.GetValue("sdkInstallRootv2.0");
+            
+            if(installRoot == null) throw new ExecutionException("NMAVEN-9011-005");
+
+            nmavenSettingsVendorsVendor[] vendors = new nmavenSettingsVendorsVendor[3];
+            DirectoryInfo dirInfo11 = new DirectoryInfo(Path.Combine(installRoot, "v1.1.4322"));
+            DirectoryInfo dirInfo20 = new DirectoryInfo(Path.Combine(installRoot, "v2.0.50727"));
+            DirectoryInfo dirInfo30 = new DirectoryInfo(Path.Combine(installRoot, "v3.0"));
+            int vendorCounter = 0;
+            if (dirInfo11.Exists)
+            {
+                nmavenSettingsVendorsVendor vendor = new nmavenSettingsVendorsVendor();
+                vendor.vendorName = "MICROSOFT";
+                vendor.vendorVersion = "1.1.4322";
+                nmavenSettingsVendorsVendorFrameworksFramework[] vendorFrameworks 
+                	= new nmavenSettingsVendorsVendorFrameworksFramework[1];
+                nmavenSettingsVendorsVendorFrameworksFramework vf11 
+                	= new nmavenSettingsVendorsVendorFrameworksFramework();
+                vf11.installRoot = dirInfo11.FullName;
+                vf11.frameworkVersion = "1.1.4322";
+                
+                vendorFrameworks[0] = vf11;
+                vf11.sdkInstallRoot = sdkInstallRoot11;
+                vendor.frameworks = vendorFrameworks;
+                
+                vendors[vendorCounter++] = vendor;
+            }
+            if (dirInfo20.Exists)
+            {
+                nmavenSettingsVendorsVendor vendor = new nmavenSettingsVendorsVendor();
+                vendor.vendorName = "MICROSOFT";
+                vendor.vendorVersion = "2.0.50727";
+                nmavenSettingsVendorsVendorFrameworksFramework[] vendorFrameworks 
+                	= new nmavenSettingsVendorsVendorFrameworksFramework[1];
+                nmavenSettingsVendorsVendorFrameworksFramework vf11 = new nmavenSettingsVendorsVendorFrameworksFramework();
+                vf11.installRoot = dirInfo20.FullName;
+                vf11.frameworkVersion = "2.0.50727";
+                vendorFrameworks[0] = vf11;
+                vf11.sdkInstallRoot = sdkInstallRoot20;
+                vendor.frameworks = vendorFrameworks;
+                vendors[vendorCounter++] = vendor;
+            }
+            if (dirInfo30.Exists)
+            {
+                nmavenSettingsVendorsVendor vendor = new nmavenSettingsVendorsVendor();
+                vendor.vendorName = "MICROSOFT";
+                vendor.vendorVersion = "3.0";
+                nmavenSettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new nmavenSettingsVendorsVendorFrameworksFramework[1];
+                nmavenSettingsVendorsVendorFrameworksFramework vf11 = new nmavenSettingsVendorsVendorFrameworksFramework();
+                vf11.installRoot = dirInfo30.FullName;
+                vf11.frameworkVersion = "3.0";
+                vendorFrameworks[0] = vf11;
+                vf11.sdkInstallRoot = sdkInstallRoot20;
+                vendor.frameworks = vendorFrameworks;
+                vendors[vendorCounter++] = vendor;
+            }
+
+            return vendors;
+        }
+
+        private nmavenSettingsVendorsVendor[] GetVendorsForMono(RegistryKey monoRegistryKey,
string defaultMonoCLR)
+        {
+            if(monoRegistryKey == null)
+                throw new ExecutionException("NMAVEN-9011-007: Mono installation could not
be found.");
+            nmavenSettingsVendorsVendor[] vendors = new nmavenSettingsVendorsVendor[monoRegistryKey.SubKeyCount];
+            int i = 0;
+            foreach (string keyName in monoRegistryKey.GetSubKeyNames())
+            {
+                string sdkInstallRoot = (string) monoRegistryKey.OpenSubKey(keyName).GetValue("SdkInstallRoot");
+                if(sdkInstallRoot == null)
+                    throw new ExecutionException("NMAVEN-9011-004: Could not find install
root key for mono");
+                string installRoot = Path.Combine(sdkInstallRoot, "bin");
+                nmavenSettingsVendorsVendorFrameworksFramework[] vendorFrameworks = new nmavenSettingsVendorsVendorFrameworksFramework[2];
+                nmavenSettingsVendorsVendorFrameworksFramework vf11 = new nmavenSettingsVendorsVendorFrameworksFramework();
+                vf11.installRoot = installRoot;
+                vf11.frameworkVersion = "1.1.4322";
+                vendorFrameworks[0] = vf11;
+
+                nmavenSettingsVendorsVendorFrameworksFramework vf20 = new nmavenSettingsVendorsVendorFrameworksFramework();
+                vf20.installRoot = installRoot;
+                vf20.frameworkVersion = "2.0.50727";
+                vendorFrameworks[1] = vf20;
+
+                nmavenSettingsVendorsVendor vendor = new nmavenSettingsVendorsVendor();
+                vendor.vendorName = "MONO";
+                vendor.vendorVersion = keyName;
+                vendor.frameworks = vendorFrameworks;
+                if(defaultMonoCLR.Equals(keyName)) vendor.isDefault = "true";
+                vendors[i++] = vendor;
+            }
+            return vendors;
+        }
+
+        private bool isValidVersion(String version)
+        {
+            string[] vendorVersionToken = version.Split('.');
+            foreach (string token in vendorVersionToken)
+            {
+            	try
+            	{
+            		Single.Parse(token);
+            	}
+            	catch(Exception)
+            	{
+            		return false;
+            	}
+            }
+            return true;
+        }
+    }
+}

Added: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/java/NMaven/Plugin/Settings/SettingsGeneratorMojo.java
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/java/NMaven/Plugin/Settings/SettingsGeneratorMojo.java?view=auto&rev=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/java/NMaven/Plugin/Settings/SettingsGeneratorMojo.java
(added)
+++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/java/NMaven/Plugin/Settings/SettingsGeneratorMojo.java
Tue May  1 11:32:43 2007
@@ -0,0 +1,119 @@
+package NMaven.Plugin.Settings;
+
+import org.apache.maven.dotnet.plugin.FieldAnnotation;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+
+/**
+ * @phase validate
+ * @goal generate-settings
+ */
+public class SettingsGeneratorMojo
+    extends org.apache.maven.dotnet.plugin.AbstractMojo
+{
+    /**
+     * @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.Settings";
+    }
+
+    public String getMojoGroupId()
+    {
+        return "NMaven.Plugin";
+    }
+
+    public String getClassName()
+    {
+        return "NMaven.Plugin.Settings.SettingsGeneratorMojo";
+    }
+
+    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;
+    }
+
+    public boolean preExecute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        if ( !System.getProperty( "os.name" ).contains( "Windows" ) )
+        {
+            return false;
+        }
+
+        if ( System.getProperty( "bootstrap" ) != null )
+        {
+            return false;
+        }
+
+        String nmavenSettings =
+            System.getProperty( "user.home" ) + File.separator + ".m2" + File.separator +
"nmaven-settings.xml";
+
+        return !new File( nmavenSettings ).exists();
+    }
+}

Propchange: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/main/java/NMaven/Plugin/Settings/SettingsGeneratorMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/site/site.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/site/site.xml?view=auto&rev=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/site/site.xml (added)
+++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/site/site.xml Tue
May  1 11:32:43 2007
@@ -0,0 +1,16 @@
+<project name="NMaven">
+    <body>
+        <links>
+            <item name="Project Site" href="http://incubator.apache.org/projects/nmaven.html"/>
+            <item name="NMaven" href="http://incubator.apache.org/nmaven"/>
+            <item name="NMaven SVN" href="http://svn.apache.org/repos/asf/incubator/nmaven/"/>
+            <item name="Maven" href="http://maven.apache.org/"/>
+            <item name="Mono Project" href="http://www.mono-project.com/"/>
+            <item name="DotGNU" href="http://dotgnu.org/"/>
+        </links>
+        <menu name="General Info">
+            <item name="About" href="index.html"/>
+        </menu>
+        ${reports}
+    </body>
+</project>
\ No newline at end of file

Propchange: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Settings/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionMojo.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionMojo.cs?view=diff&rev=534187&r1=534186&r2=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionMojo.cs
(original)
+++ incubator/nmaven/branches/SI_XPT/plugins/NMaven.Plugin.Solution/src/main/csharp/Plugin/Solution/SolutionMojo.cs
Tue May  1 11:32:43 2007
@@ -20,20 +20,20 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.Xml;
+using System.Xml.Serialization;
+
 using NMaven.Core;
 using NMaven.Core.Impl;
 using NMaven.Plugin;
 
-using System.Xml.Serialization;
-using System.Xml;
-
 namespace NMaven.Plugin.Solution
 {
 	/// <summary>
 	/// Description
 	/// </summary>
 	[Serializable]
-	[ClassAttribute(Phase = "Package", Goal = "Solution")]
+	[ClassAttribute(Phase = "package", Goal = "solution")]
 	public sealed class SolutionMojo : AbstractMojo
 	{
 		public SolutionMojo()

Modified: incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=534187&r1=534186&r2=534187
==============================================================================
--- incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml
(original)
+++ incubator/nmaven/branches/SI_XPT/plugins/maven-compile-plugin/src/main/resources/META-INF/plexus/components.xml
Tue May  1 11:32:43 2007
@@ -15,7 +15,7 @@
           <validate>
             org.apache.maven.dotnet.plugins:maven-compile-plugin:initialize,
             org.apache.maven.dotnet.plugins:maven-resolver-plugin:resolve,
-            org.apache.maven.dotnet.plugins:maven-settings-plugin:generate-settings
+            NMaven.Plugin:NMaven.Plugin.Settings.JavaBinding:generate-settings
           </validate>
           <generate-sources>
             org.apache.maven.dotnet.plugins:maven-compile-plugin:generate-assembly-info
@@ -55,7 +55,7 @@
           <validate>
             org.apache.maven.dotnet.plugins:maven-compile-plugin:initialize,
             org.apache.maven.dotnet.plugins:maven-resolver-plugin:resolve,
-            org.apache.maven.dotnet.plugins:maven-settings-plugin:generate-settings
+            NMaven.Plugin:NMaven.Plugin.Settings.JavaBinding:generate-settings
           </validate>
           <process-sources>
             org.apache.maven.dotnet.plugins:maven-compile-plugin:process-sources,
@@ -91,7 +91,7 @@
           <validate>
             org.apache.maven.dotnet.plugins:maven-compile-plugin:initialize,
             org.apache.maven.dotnet.plugins:maven-resolver-plugin:resolve ,
-            org.apache.maven.dotnet.plugins:maven-settings-plugin:generate-settings
+            NMaven.Plugin:NMaven.Plugin.Settings.JavaBinding:generate-settings
           </validate>
           <generate-sources>
             org.apache.maven.dotnet.plugins:maven-compile-plugin:generate-assembly-info
@@ -130,7 +130,7 @@
           <validate>
             org.apache.maven.dotnet.plugins:maven-compile-plugin:initialize,
             org.apache.maven.dotnet.plugins:maven-resolver-plugin:resolve,
-            org.apache.maven.dotnet.plugins:maven-settings-plugin:generate-settings
+            NMaven.Plugin:NMaven.Plugin.Settings.JavaBinding:generate-settings
           </validate>
           <generate-sources>
             org.apache.maven.dotnet.plugins:maven-compile-plugin:generate-assembly-info
@@ -168,7 +168,7 @@
           <validate>
             org.apache.maven.dotnet.plugins:maven-compile-plugin:initialize,
             org.apache.maven.dotnet.plugins:maven-resolver-plugin:resolve,
-            org.apache.maven.dotnet.plugins:maven-settings-plugin:generate-settings
+            NMaven.Plugin:NMaven.Plugin.Settings.JavaBinding:generate-settings
           </validate>
           <generate-sources>
             org.apache.maven.dotnet.plugins:maven-compile-plugin:generate-assembly-info



Mime
View raw message