[Monodevelop-patches-list] r2646 - trunk/MonoDevelop/Extras/MonoDeveloperExtensions

Lluis Sanchez <lluis@ximian.com> lluis at mono-cvs.ximian.com
Wed Jul 13 14:16:10 EDT 2005


Author: lluis
Date: 2005-07-13 14:16:10 -0400 (Wed, 13 Jul 2005)
New Revision: 2646

Added:
   trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoTestProvider.cs
Modified:
   trunk/MonoDevelop/Extras/MonoDeveloperExtensions/ChangeLog
   trunk/MonoDevelop/Extras/MonoDeveloperExtensions/Makefile.am
   trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoDeveloperExtensions.addin.xml
   trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoMakefileFormat.cs
   trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoProject.cs
Log:
2005-07-13  Lluis Sanchez Gual  <lluis at novell.com>

	* MonoMakefileFormat.cs: Avoid adding projects twice.
	* MonoProject.cs: 
	* MonoTestProvider.cs: Generate a unit test tree for assemblies that
	have a Test directory.
	* Makefile.am: Added conditional build.
	* MonoDeveloperExtensions.addin.xml: This addin depends on the nunit addin.



Modified: trunk/MonoDevelop/Extras/MonoDeveloperExtensions/ChangeLog
===================================================================
--- trunk/MonoDevelop/Extras/MonoDeveloperExtensions/ChangeLog	2005-07-13 17:49:16 UTC (rev 2645)
+++ trunk/MonoDevelop/Extras/MonoDeveloperExtensions/ChangeLog	2005-07-13 18:16:10 UTC (rev 2646)
@@ -1,3 +1,12 @@
+2005-07-13  Lluis Sanchez Gual  <lluis at novell.com>
+
+	* MonoMakefileFormat.cs: Avoid adding projects twice.
+	* MonoProject.cs: 
+	* MonoTestProvider.cs: Generate a unit test tree for assemblies that
+	have a Test directory.
+	* Makefile.am: Added conditional build.
+	* MonoDeveloperExtensions.addin.xml: This addin depends on the nunit addin.
+
 2005-07-11  Lluis Sanchez Gual  <lluis at novell.com>
 
 	* MonoProject.cs: Implemented CreateConfiguration method.

Modified: trunk/MonoDevelop/Extras/MonoDeveloperExtensions/Makefile.am
===================================================================
--- trunk/MonoDevelop/Extras/MonoDeveloperExtensions/Makefile.am	2005-07-13 17:49:16 UTC (rev 2645)
+++ trunk/MonoDevelop/Extras/MonoDeveloperExtensions/Makefile.am	2005-07-13 18:16:10 UTC (rev 2646)
@@ -5,11 +5,14 @@
 MonoMakefileFormat.cs \
 MonoProject.cs \
 Commands.cs \
-MonoProjectConfiguration.cs
+MonoProjectConfiguration.cs \
+MonoTestProvider.cs
 
 REFS = /r:$(top_builddir)/build/bin/MonoDevelop.Core.dll \
        /r:$(top_builddir)/build/bin/MonoDevelop.Gui.Widgets.dll \
        /r:$(top_builddir)/build/bin/MonoDevelop.Base.dll \
+       /r:$(top_builddir)/build/AddIns/NUnit/MonoDevelop.NUnit.dll \
+       /r:nunit.core.dll \
        $(GTK_SHARP_LIBS) \
        $(GLADE_SHARP_LIBS) \
        $(GCONF_SHARP_LIBS) \
@@ -21,7 +24,11 @@
 
 DLL = $(ADDIN_BUILD)/MonoDeveloperExtensions.dll
 
+if ENABLE_MONOEXTENSIONS
 all: $(ADDIN_BUILD)/$(ADDIN) $(DLL)
+else
+all:
+endif
 
 $(ADDIN_BUILD)/$(ADDIN): $(srcdir)/$(ADDIN)
 	mkdir -p $(ADDIN_BUILD)
@@ -37,6 +44,7 @@
 
 include $(top_srcdir)/Makefile.include
 
+if ENABLE_MONOEXTENSIONS
 MonoDeveloperExtensionsdir = $(MD_ADDIN_DIR)/MonoDeveloperExtensions
 MonoDeveloperExtensions_DATA = $(DLL) $(ADDIN_BUILD)/$(ADDIN)
-
+endif

Modified: trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoDeveloperExtensions.addin.xml
===================================================================
--- trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoDeveloperExtensions.addin.xml	2005-07-13 17:49:16 UTC (rev 2645)
+++ trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoDeveloperExtensions.addin.xml	2005-07-13 18:16:10 UTC (rev 2646)
@@ -8,6 +8,10 @@
     <Runtime>
         <Import assembly="MonoDeveloperExtensions.dll"/>
     </Runtime>
+	
+	<Dependencies>
+		<AddIn name="MonoDevelop NUnit" />
+	</Dependencies>
 
 	<Extension path = "/SharpDevelop/Workbench/ProjectFileFormats">
 		<FileFormat id = "MonoMakefile"

Modified: trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoMakefileFormat.cs
===================================================================
--- trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoMakefileFormat.cs	2005-07-13 17:49:16 UTC (rev 2645)
+++ trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoMakefileFormat.cs	2005-07-13 18:16:10 UTC (rev 2646)
@@ -94,7 +94,10 @@
 					string[] dirs = subdirs.Split (' ');
 					
 					monitor.BeginTask ("Loading '" + fileName + "'", dirs.Length);
+					Hashtable added = new Hashtable ();
 					foreach (string dir in dirs) {
+						if (added.Contains (dir)) continue;
+						added.Add (dir, dir);
 						monitor.Step (1);
 						if (dir == null) continue;
 						string tdir = dir.Trim ();

Modified: trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoProject.cs
===================================================================
--- trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoProject.cs	2005-07-13 17:49:16 UTC (rev 2645)
+++ trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoProject.cs	2005-07-13 18:16:10 UTC (rev 2646)
@@ -41,6 +41,7 @@
 		string outFile;
 		ArrayList refNames = new ArrayList ();
 		bool loading;
+		MonoTestSuite testSuite;
 		
 		public override string ProjectType {
 			get { return "MonoMakefile"; }
@@ -116,12 +117,18 @@
 			string topdir = basePath.Substring (0, i + 4);
 			targetAssembly = targetAssembly.Replace ("$(topdir)", topdir);
 			
-			MonoProjectConfiguration conf = new MonoProjectConfiguration (".NET 1.1", "default");
+			if (mkfile.GetVariable ("NO_TEST") != "yes") {
+				string tname = Path.GetFileNameWithoutExtension (aname) + "_test_";
+				string testFileBase = Path.Combine (basePath, tname);
+				testSuite = new MonoTestSuite (this, Name, testFileBase);
+			}
+			
+			MonoProjectConfiguration conf = new MonoProjectConfiguration ("default", "default");
 			conf.OutputDirectory = basePath;
 			conf.AssemblyPathTemplate = targetAssembly;
 			Configurations.Add (conf);
 			
-			conf = new MonoProjectConfiguration (".NET 2.0", "net_2_0");
+			conf = new MonoProjectConfiguration ("net_2_0", "net_2_0");
 			conf.OutputDirectory = basePath;
 			conf.AssemblyPathTemplate = targetAssembly;
 			Configurations.Add (conf);
@@ -321,5 +328,10 @@
 			base.Dispose ();
 			Runtime.ProjectService.CombineOpened -= new CombineEventHandler (CombineOpened);
 		}
+		
+		internal MonoTestSuite GetTestSuite ()
+		{
+			return testSuite;
+		}
 	}
 }

Added: trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoTestProvider.cs
===================================================================
--- trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoTestProvider.cs	2005-07-13 17:49:16 UTC (rev 2645)
+++ trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoTestProvider.cs	2005-07-13 18:16:10 UTC (rev 2646)
@@ -0,0 +1,79 @@
+//
+// MonoTestProvider.cs
+//
+// Author:
+//   Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using MonoDevelop.Internal.Project;
+using MonoDevelop.Core.Services;
+using MonoDevelop.NUnit;
+
+namespace MonoDeveloper
+{	
+	class MonoTestProvider: ITestProvider
+	{
+		public UnitTest CreateUnitTest (CombineEntry entry)
+		{
+			if (entry is MonoProject) {
+				MonoProject project = (MonoProject) entry;
+				return project.GetTestSuite ();
+			} else
+				return null;
+		}
+		
+		public Type[] GetOptionTypes ()
+		{
+			return null;
+		}
+	}
+	
+	class MonoTestSuite: NUnitAssemblyTestSuite
+	{
+		string basePath;
+		
+		static MonoTestSuite ()
+		{
+			NUnitService testService = (NUnitService) ServiceManager.GetService (typeof(NUnitService));
+			testService.RegisterTestProvider (new MonoTestProvider ());
+		}
+		
+		public MonoTestSuite (Project p, string name, string basePath): base (name, p)
+		{
+			this.basePath = basePath;
+		}
+		
+		protected override string AssemblyPath {
+			get {
+				return basePath + "default.dll";
+			}
+		}
+		
+		protected override string TestInfoCachePath {
+			get { return Path.Combine (Path.GetDirectoryName (AssemblyPath), "test-cache"); }
+		}
+	}
+}




More information about the Monodevelop-patches-list mailing list