incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r506828 - in /incubator/nmaven/trunk: integration-tests/tests/ integration-tests/tests/it0018/ plugins/nmaven-utility-settings/src/main/csharp/ plugins/nmaven-utility-settings/src/test/csharp/
Date Tue, 13 Feb 2007 02:49:24 GMT
Author: sisbell
Date: Mon Feb 12 18:49:23 2007
New Revision: 506828

URL: http://svn.apache.org/viewvc?view=rev&rev=506828
Log:
Merged BUG_NMAVEN_1 to the trunk.

Modified:
    incubator/nmaven/trunk/integration-tests/tests/integration-tests.txt
    incubator/nmaven/trunk/integration-tests/tests/it0018/pom.xml
    incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/main/csharp/SettingsGenerator.cs
    incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/main/csharp/nmavenSettings.cs
    incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/test/csharp/SettingsGeneratorTest.cs

Modified: incubator/nmaven/trunk/integration-tests/tests/integration-tests.txt
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/integration-tests/tests/integration-tests.txt?view=diff&rev=506828&r1=506827&r2=506828
==============================================================================
--- incubator/nmaven/trunk/integration-tests/tests/integration-tests.txt (original)
+++ incubator/nmaven/trunk/integration-tests/tests/integration-tests.txt Mon Feb 12 18:49:23
2007
@@ -15,5 +15,4 @@
 it0019
 it0020
 it0021
-it0022
-it0023
\ No newline at end of file
+it0022
\ No newline at end of file

Modified: incubator/nmaven/trunk/integration-tests/tests/it0018/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/integration-tests/tests/it0018/pom.xml?view=diff&rev=506828&r1=506827&r2=506828
==============================================================================
--- incubator/nmaven/trunk/integration-tests/tests/it0018/pom.xml (original)
+++ incubator/nmaven/trunk/integration-tests/tests/it0018/pom.xml Mon Feb 12 18:49:23 2007
@@ -14,6 +14,8 @@
                 <artifactId>maven-compile-plugin</artifactId>
                 <extensions>true</extensions>
                 <configuration>
+
+                  <vendor>MONO</vendor>
                     <frameworkVersion>1.1.4322</frameworkVersion>
                 </configuration>
             </plugin>

Modified: incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/main/csharp/SettingsGenerator.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/main/csharp/SettingsGenerator.cs?view=diff&rev=506828&r1=506827&r2=506828
==============================================================================
--- incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/main/csharp/SettingsGenerator.cs
(original)
+++ incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/main/csharp/SettingsGenerator.cs
Mon Feb 12 18:49:23 2007
@@ -1,282 +1,288 @@
-//
-//  Copyright 2006 Shane Isbell
-//
-//  Licensed 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.Utility;
-
-namespace NMaven.Utility.Settings
-{
-    public class SettingsGenerator
-    {
-        protected internal SettingsGenerator() { }
-
-        void Execute(string outputFile)
-        {
-            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"));
-
-            nmavenSettingsVendor[] microsoftVendors = null;
-            try
-            {
-                microsoftVendors = GetVendorsForMicrosoft(microsoftRegistryKey);
-            }
-            catch(ExecutionException e)
-            {
-                Console.WriteLine(e.ToString());
-            }
-
-            nmavenSettingsVendor[] monoVendors = null;
-            try
-            {
-                monoVendors = GetVendorsForMono(monoRegistryKey, defaultMonoCLR);
-            }
-            catch(ExecutionException e)
-            {
-                Console.WriteLine(e.ToString());
-            }
-
-            nmavenSettingsVendor 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;
-
-            nmavenSettingsVendor[] vendors =
-                new nmavenSettingsVendor[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();
-        }
-
-        public static int Main(string[] args)
-        {
-            if(args == null || args.Length != 1)
-            {
-                Console.WriteLine("NMAVEN-000-000: Incorrect number of arguements:");
-                return 1;
-            }
-
-            try {
-               new SettingsGenerator().Execute(args[0]);
-            }
-            catch(DirectoryNotFoundException e)
-            {
-                Console.WriteLine("NMAVEN-000-000:" + e.ToString());
-                return 1;
-            }
-            return 0;
-        }
-
-        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 nmavenSettingsVendor 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);
-                }
-
-                nmavenSettingsVendor vendor = new nmavenSettingsVendor();
-                vendor.vendorName = "DotGNU";
-                vendor.vendorVersion = vendorVersion;
-                nmavenSettingsVendorFramework[] vendorFrameworks = new nmavenSettingsVendorFramework[1];
-                nmavenSettingsVendorFramework vf = new nmavenSettingsVendorFramework();
-                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 nmavenSettingsVendor[] GetVendorsForMicrosoft(RegistryKey microsoftRegistryKey)
-        {
-            if(microsoftRegistryKey == null)
-                throw new ExecutionException("NMAVEN-9011-006: Microsoft installation could
not be found.");
-            string installRoot = (string) microsoftRegistryKey.GetValue("InstallRoot");
-            if(installRoot == null) throw new ExecutionException("NMAVEN-9011-005");
-
-            nmavenSettingsVendor[] vendors = new nmavenSettingsVendor[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)
-            {
-                nmavenSettingsVendor vendor = new nmavenSettingsVendor();
-                vendor.vendorName = "MICROSOFT";
-                vendor.vendorVersion = "1.1.4322";
-                nmavenSettingsVendorFramework[] vendorFrameworks = new nmavenSettingsVendorFramework[1];
-                nmavenSettingsVendorFramework vf11 = new nmavenSettingsVendorFramework();
-                vf11.installRoot = dirInfo11.FullName;
-                vf11.frameworkVersion = "1.1.4322";
-                vendorFrameworks[0] = vf11;
-                vendor.frameworks = vendorFrameworks;
-                vendors[vendorCounter++] = vendor;
-            }
-            if (dirInfo20.Exists)
-            {
-                nmavenSettingsVendor vendor = new nmavenSettingsVendor();
-                vendor.vendorName = "MICROSOFT";
-                vendor.vendorVersion = "2.0.50727";
-                nmavenSettingsVendorFramework[] vendorFrameworks = new nmavenSettingsVendorFramework[1];
-                nmavenSettingsVendorFramework vf11 = new nmavenSettingsVendorFramework();
-                vf11.installRoot = dirInfo20.FullName;
-                vf11.frameworkVersion = "2.0.50727";
-                vendorFrameworks[0] = vf11;
-                vendor.frameworks = vendorFrameworks;
-                vendors[vendorCounter++] = vendor;
-            }
-            if (dirInfo30.Exists)
-            {
-                nmavenSettingsVendor vendor = new nmavenSettingsVendor();
-                vendor.vendorName = "MICROSOFT";
-                vendor.vendorVersion = "3.0";
-                nmavenSettingsVendorFramework[] vendorFrameworks = new nmavenSettingsVendorFramework[1];
-                nmavenSettingsVendorFramework vf11 = new nmavenSettingsVendorFramework();
-                vf11.installRoot = dirInfo30.FullName;
-                vf11.frameworkVersion = "3.0";
-                vendorFrameworks[0] = vf11;
-                vendor.frameworks = vendorFrameworks;
-                vendors[vendorCounter++] = vendor;
-            }
-
-            return vendors;
-        }
-
-        private nmavenSettingsVendor[] GetVendorsForMono(RegistryKey monoRegistryKey, string
defaultMonoCLR)
-        {
-            if(monoRegistryKey == null)
-                throw new ExecutionException("NMAVEN-9011-007: Mono installation could not
be found.");
-            nmavenSettingsVendor[] vendors = new nmavenSettingsVendor[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");
-                nmavenSettingsVendorFramework[] vendorFrameworks = new nmavenSettingsVendorFramework[2];
-                nmavenSettingsVendorFramework vf11 = new nmavenSettingsVendorFramework();
-                vf11.installRoot = installRoot;
-                vf11.frameworkVersion = "1.1.4322";
-                vendorFrameworks[0] = vf11;
-
-                nmavenSettingsVendorFramework vf20 = new nmavenSettingsVendorFramework();
-                vf20.installRoot = installRoot;
-                vf20.frameworkVersion = "2.0.50727";
-                vendorFrameworks[1] = vf20;
-
-                nmavenSettingsVendor vendor = new nmavenSettingsVendor();
-                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('.');
-            float testValue = 0f;
-            foreach (string token in vendorVersionToken)
-            {
-                if (!Single.TryParse(token, out testValue)) return false;
-            }
-            return true;
-        }
-    }
-}
+//
+//  Copyright 2006 Shane Isbell
+//
+//  Licensed 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.Utility;
+
+namespace NMaven.Utility.Settings
+{
+    public class SettingsGenerator
+    {
+        protected internal SettingsGenerator() { }
+
+        void Execute(string outputFile)
+        {
+            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"));
+
+            nmavenSettingsVendor[] microsoftVendors = null;
+            try
+            {
+                microsoftVendors = GetVendorsForMicrosoft(microsoftRegistryKey);
+            }
+            catch(ExecutionException e)
+            {
+                Console.WriteLine(e.ToString());
+            }
+
+            nmavenSettingsVendor[] monoVendors = null;
+            try
+            {
+                monoVendors = GetVendorsForMono(monoRegistryKey, defaultMonoCLR);
+            }
+            catch(ExecutionException e)
+            {
+                Console.WriteLine(e.ToString());
+            }
+
+            nmavenSettingsVendor 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;
+
+            nmavenSettingsVendor[] vendors =
+                new nmavenSettingsVendor[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();
+        }
+
+        public static int Main(string[] args)
+        {
+            if(args == null || args.Length != 1)
+            {
+                Console.WriteLine("NMAVEN-000-000: Incorrect number of arguements:");
+                return 1;
+            }
+
+            try {
+               new SettingsGenerator().Execute(args[0]);
+            }
+            catch(DirectoryNotFoundException e)
+            {
+                Console.WriteLine("NMAVEN-000-000:" + e.ToString());
+                return 1;
+            }
+            return 0;
+        }
+
+        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 nmavenSettingsVendor 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);
+                }
+
+                nmavenSettingsVendor vendor = new nmavenSettingsVendor();
+                vendor.vendorName = "DotGNU";
+                vendor.vendorVersion = vendorVersion;
+                nmavenSettingsVendorFramework[] vendorFrameworks = new nmavenSettingsVendorFramework[1];
+                nmavenSettingsVendorFramework vf = new nmavenSettingsVendorFramework();
+                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 nmavenSettingsVendor[] GetVendorsForMicrosoft(RegistryKey microsoftRegistryKey)
+        {
+            if(microsoftRegistryKey == null)
+                throw new ExecutionException("NMAVEN-9011-006: Microsoft installation could
not be found.");
+            string installRoot = (string) microsoftRegistryKey.GetValue("InstallRoot");
+            if(installRoot == null) throw new ExecutionException("NMAVEN-9011-005");
+
+            nmavenSettingsVendor[] vendors = new nmavenSettingsVendor[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)
+            {
+                nmavenSettingsVendor vendor = new nmavenSettingsVendor();
+                vendor.vendorName = "MICROSOFT";
+                vendor.vendorVersion = "1.1.4322";
+                nmavenSettingsVendorFramework[] vendorFrameworks = new nmavenSettingsVendorFramework[1];
+                nmavenSettingsVendorFramework vf11 = new nmavenSettingsVendorFramework();
+                vf11.installRoot = dirInfo11.FullName;
+                vf11.frameworkVersion = "1.1.4322";
+                vendorFrameworks[0] = vf11;
+                vendor.frameworks = vendorFrameworks;
+                vendors[vendorCounter++] = vendor;
+            }
+            if (dirInfo20.Exists)
+            {
+                nmavenSettingsVendor vendor = new nmavenSettingsVendor();
+                vendor.vendorName = "MICROSOFT";
+                vendor.vendorVersion = "2.0.50727";
+                nmavenSettingsVendorFramework[] vendorFrameworks = new nmavenSettingsVendorFramework[1];
+                nmavenSettingsVendorFramework vf11 = new nmavenSettingsVendorFramework();
+                vf11.installRoot = dirInfo20.FullName;
+                vf11.frameworkVersion = "2.0.50727";
+                vendorFrameworks[0] = vf11;
+                vendor.frameworks = vendorFrameworks;
+                vendors[vendorCounter++] = vendor;
+            }
+            if (dirInfo30.Exists)
+            {
+                nmavenSettingsVendor vendor = new nmavenSettingsVendor();
+                vendor.vendorName = "MICROSOFT";
+                vendor.vendorVersion = "3.0";
+                nmavenSettingsVendorFramework[] vendorFrameworks = new nmavenSettingsVendorFramework[1];
+                nmavenSettingsVendorFramework vf11 = new nmavenSettingsVendorFramework();
+                vf11.installRoot = dirInfo30.FullName;
+                vf11.frameworkVersion = "3.0";
+                vendorFrameworks[0] = vf11;
+                vendor.frameworks = vendorFrameworks;
+                vendors[vendorCounter++] = vendor;
+            }
+
+            return vendors;
+        }
+
+        private nmavenSettingsVendor[] GetVendorsForMono(RegistryKey monoRegistryKey, string
defaultMonoCLR)
+        {
+            if(monoRegistryKey == null)
+                throw new ExecutionException("NMAVEN-9011-007: Mono installation could not
be found.");
+            nmavenSettingsVendor[] vendors = new nmavenSettingsVendor[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");
+                nmavenSettingsVendorFramework[] vendorFrameworks = new nmavenSettingsVendorFramework[2];
+                nmavenSettingsVendorFramework vf11 = new nmavenSettingsVendorFramework();
+                vf11.installRoot = installRoot;
+                vf11.frameworkVersion = "1.1.4322";
+                vendorFrameworks[0] = vf11;
+
+                nmavenSettingsVendorFramework vf20 = new nmavenSettingsVendorFramework();
+                vf20.installRoot = installRoot;
+                vf20.frameworkVersion = "2.0.50727";
+                vendorFrameworks[1] = vf20;
+
+                nmavenSettingsVendor vendor = new nmavenSettingsVendor();
+                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;
+        }
+    }
+}

Modified: incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/main/csharp/nmavenSettings.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/main/csharp/nmavenSettings.cs?view=diff&rev=506828&r1=506827&r2=506828
==============================================================================
--- incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/main/csharp/nmavenSettings.cs
(original)
+++ incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/main/csharp/nmavenSettings.cs
Mon Feb 12 18:49:23 2007
@@ -1,242 +1,95 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:2.0.50727.42
-//
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-using System.Xml.Serialization;
-
-// 
-// This source code was auto-generated by xsd, Version=2.0.50727.42.
-// 
-
-
-/// <remarks/>
-[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
-[System.SerializableAttribute()]
-[System.Diagnostics.DebuggerStepThroughAttribute()]
-[System.ComponentModel.DesignerCategoryAttribute("code")]
-[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
-public partial class nmavenSettings {
-    
-    private string operatingSystemField;
-    
-    private string architectureField;
-    
-    private nmavenSettingsDefaultSetup defaultSetupField;
-    
-    private nmavenSettingsVendor[] vendorsField;
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    public string operatingSystem {
-        get {
-            return this.operatingSystemField;
-        }
-        set {
-            this.operatingSystemField = value;
-        }
-    }
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    public string architecture {
-        get {
-            return this.architectureField;
-        }
-        set {
-            this.architectureField = value;
-        }
-    }
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    public nmavenSettingsDefaultSetup defaultSetup {
-        get {
-            return this.defaultSetupField;
-        }
-        set {
-            this.defaultSetupField = value;
-        }
-    }
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    [System.Xml.Serialization.XmlArrayItemAttribute("vendor", Form=System.Xml.Schema.XmlSchemaForm.Unqualified,
IsNullable=false)]
-    public nmavenSettingsVendor[] vendors {
-        get {
-            return this.vendorsField;
-        }
-        set {
-            this.vendorsField = value;
-        }
-    }
-}
-
-/// <remarks/>
-[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
-[System.SerializableAttribute()]
-[System.Diagnostics.DebuggerStepThroughAttribute()]
-[System.ComponentModel.DesignerCategoryAttribute("code")]
-public partial class nmavenSettingsDefaultSetup {
-    
-    private string vendorNameField;
-    
-    private string vendorVersionField;
-    
-    private string frameworkVersionField;
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    public string vendorName {
-        get {
-            return this.vendorNameField;
-        }
-        set {
-            this.vendorNameField = value;
-        }
-    }
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    public string vendorVersion {
-        get {
-            return this.vendorVersionField;
-        }
-        set {
-            this.vendorVersionField = value;
-        }
-    }
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    public string frameworkVersion {
-        get {
-            return this.frameworkVersionField;
-        }
-        set {
-            this.frameworkVersionField = value;
-        }
-    }
-}
-
-/// <remarks/>
-[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
-[System.SerializableAttribute()]
-[System.Diagnostics.DebuggerStepThroughAttribute()]
-[System.ComponentModel.DesignerCategoryAttribute("code")]
-public partial class nmavenSettingsVendor {
-    
-    private string vendorNameField;
-    
-    private string vendorVersionField;
-    
-    private string isDefaultField;
-    
-    private nmavenSettingsVendorFramework[] frameworksField;
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    public string vendorName {
-        get {
-            return this.vendorNameField;
-        }
-        set {
-            this.vendorNameField = value;
-        }
-    }
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    public string vendorVersion {
-        get {
-            return this.vendorVersionField;
-        }
-        set {
-            this.vendorVersionField = value;
-        }
-    }
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    public string isDefault {
-        get {
-            return this.isDefaultField;
-        }
-        set {
-            this.isDefaultField = value;
-        }
-    }
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    [System.Xml.Serialization.XmlArrayItemAttribute("framework", Form=System.Xml.Schema.XmlSchemaForm.Unqualified,
IsNullable=false)]
-    public nmavenSettingsVendorFramework[] frameworks {
-        get {
-            return this.frameworksField;
-        }
-        set {
-            this.frameworksField = value;
-        }
-    }
-}
-
-/// <remarks/>
-[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
-[System.SerializableAttribute()]
-[System.Diagnostics.DebuggerStepThroughAttribute()]
-[System.ComponentModel.DesignerCategoryAttribute("code")]
-public partial class nmavenSettingsVendorFramework {
-    
-    private string frameworkVersionField;
-    
-    private string installRootField;
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    public string frameworkVersion {
-        get {
-            return this.frameworkVersionField;
-        }
-        set {
-            this.frameworkVersionField = value;
-        }
-    }
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
-    public string installRoot {
-        get {
-            return this.installRootField;
-        }
-        set {
-            this.installRootField = value;
-        }
-    }
-}
-
-/// <remarks/>
-[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
-[System.SerializableAttribute()]
-[System.Diagnostics.DebuggerStepThroughAttribute()]
-[System.ComponentModel.DesignerCategoryAttribute("code")]
-[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
-public partial class NewDataSet {
-    
-    private nmavenSettings[] itemsField;
-    
-    /// <remarks/>
-    [System.Xml.Serialization.XmlElementAttribute("nmavenSettings")]
-    public nmavenSettings[] Items {
-        get {
-            return this.itemsField;
-        }
-        set {
-            this.itemsField = value;
-        }
-    }
-}
+//------------------------------------------------------------------------------
+// <autogenerated>
+//     This code was generated by a tool.
+//     Runtime Version: 1.1.4322.573
+//
+//     Changes to this file may cause incorrect behavior and will be lost if 
+//     the code is regenerated.
+// </autogenerated>
+//------------------------------------------------------------------------------
+
+// 
+// This source code was auto-generated by xsd, Version=1.1.4322.573.
+// 
+using System.Xml.Serialization;
+
+
+/// <remarks/>
+[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
+public class nmavenSettings {
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    public string operatingSystem;
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    public string architecture;
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    public nmavenSettingsDefaultSetup defaultSetup;
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    [System.Xml.Serialization.XmlArrayItemAttribute("vendor", Form=System.Xml.Schema.XmlSchemaForm.Unqualified,
IsNullable=false)]
+    public nmavenSettingsVendor[] vendors;
+}
+
+/// <remarks/>
+public class nmavenSettingsDefaultSetup {
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    public string vendorName;
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    public string vendorVersion;
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    public string frameworkVersion;
+}
+
+/// <remarks/>
+public class nmavenSettingsVendorFramework {
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    public string frameworkVersion;
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    public string installRoot;
+}
+
+/// <remarks/>
+public class nmavenSettingsVendor {
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    public string vendorName;
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    public string vendorVersion;
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    public string isDefault;
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+    [System.Xml.Serialization.XmlArrayItemAttribute("framework", Form=System.Xml.Schema.XmlSchemaForm.Unqualified,
IsNullable=false)]
+    public nmavenSettingsVendorFramework[] frameworks;
+}
+
+/// <remarks/>
+[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
+public class NewDataSet {
+    
+    /// <remarks/>
+    [System.Xml.Serialization.XmlElementAttribute("nmavenSettings")]
+    public nmavenSettings[] Items;
+}

Modified: incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/test/csharp/SettingsGeneratorTest.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/test/csharp/SettingsGeneratorTest.cs?view=diff&rev=506828&r1=506827&r2=506828
==============================================================================
--- incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/test/csharp/SettingsGeneratorTest.cs
(original)
+++ incubator/nmaven/trunk/plugins/nmaven-utility-settings/src/test/csharp/SettingsGeneratorTest.cs
Mon Feb 12 18:49:23 2007
@@ -53,7 +53,7 @@
             }
             catch(ExecutionException e)
             {
-                if(!e.ToString().Contains("NMAVEN-9011-000")) Assert.Fail("Unexpected failure
code: Message = "
+                if(e.ToString().IndexOf("NMAVEN-9011-000") == 0) Assert.Fail("Unexpected
failure code: Message = "
                     + e.ToString());;
             }
 		}
@@ -67,7 +67,7 @@
             }
             catch(ExecutionException e)
             {
-                if(!e.ToString().Contains("NMAVEN-9011-002")) Assert.Fail("Unexpected failure
code: Message = "
+                if(e.ToString().IndexOf("NMAVEN-9011-002") == 0) Assert.Fail("Unexpected
failure code: Message = "
                     + e.ToString());;
             }
 		}
@@ -95,7 +95,7 @@
             }
             catch(ExecutionException e)
             {
-                if(!e.ToString().Contains("NMAVEN-9011-001")) Assert.Fail("Unexpected failure
code: Message = "
+                if(e.ToString().IndexOf("NMAVEN-9011-001") == 0) Assert.Fail("Unexpected
failure code: Message = "
                     + e.ToString());;
             }
 		}



Mime
View raw message