public UnitTest CreateUnitTest (WorkspaceObject entry)
		{
			var ext = entry.GetService<MonoMakefileProjectExtension> ();
			if (ext != null) {
				var project = (DotNetProject) entry;
				if (ext.UnitTest != null)
					return (UnitTest) ext.UnitTest;
				string testFileBase = ext.GetTestFileBase ();
				UnitTest testSuite = new MonoTestSuite (project, project.Name, testFileBase);
				ext.UnitTest = testSuite;
				return testSuite;
			}
			return null;
		}
Пример #2
0
		public UnitTest CreateUnitTest (IWorkspaceObject entry)
		{
			if (entry is DotNetProject) {
				DotNetProject project = (DotNetProject) entry;
				MonoSolutionItemHandler handler = ProjectExtensionUtil.GetItemHandler (project) as MonoSolutionItemHandler;
				if (handler != null) {
					if (handler.UnitTest != null)
						return (UnitTest) handler.UnitTest;
					string testFileBase = handler.GetTestFileBase ();
					UnitTest testSuite = new MonoTestSuite (project, project.Name, testFileBase);
					handler.UnitTest = testSuite;
					return testSuite;
				}
			}
			return null;
		}
Пример #3
0
        public UnitTest CreateUnitTest(WorkspaceObject entry)
        {
            var ext = entry.GetService <MonoMakefileProjectExtension> ();

            if (ext != null)
            {
                var project = (DotNetProject)entry;
                if (ext.UnitTest != null)
                {
                    return((UnitTest)ext.UnitTest);
                }
                string   testFileBase = ext.GetTestFileBase();
                UnitTest testSuite    = new MonoTestSuite(project, project.Name, testFileBase);
                ext.UnitTest = testSuite;
                return(testSuite);
            }
            return(null);
        }
Пример #4
0
 public UnitTest CreateUnitTest(IWorkspaceObject entry)
 {
     if (entry is DotNetProject)
     {
         DotNetProject           project = (DotNetProject)entry;
         MonoSolutionItemHandler handler = ProjectExtensionUtil.GetItemHandler(project) as MonoSolutionItemHandler;
         if (handler != null)
         {
             if (handler.UnitTest != null)
             {
                 return((UnitTest)handler.UnitTest);
             }
             string   testFileBase = handler.GetTestFileBase();
             UnitTest testSuite    = new MonoTestSuite(project, project.Name, testFileBase);
             handler.UnitTest = testSuite;
             return(testSuite);
         }
     }
     return(null);
 }
Пример #5
0
        void Read(MonoMakefile mkfile)
        {
            loading = true;

            string basePath = Path.GetDirectoryName (mkfile.FileName);
            string aname;

            string targetAssembly = mkfile.GetVariable ("LIBRARY");
            if (targetAssembly == null) {
                targetAssembly = mkfile.GetVariable ("PROGRAM");
                if (Path.GetDirectoryName (targetAssembly) == "")
                    targetAssembly = Path.Combine (basePath, targetAssembly);
                aname = Path.GetFileName (targetAssembly);
            } else {
                aname = Path.GetFileName (targetAssembly);
                string targetName = mkfile.GetVariable ("LIBRARY_NAME");
                if (targetName != null) targetAssembly = targetName;
                targetAssembly = "$(topdir)/class/lib/$(PROFILE)/" + targetAssembly;
            }

            Name = Path.GetFileNameWithoutExtension (aname);
            outFile = Path.Combine (basePath, aname);
            FileName = mkfile.FileName;

            ArrayList checkedFolders = new ArrayList ();

            // Parse projects
            string sources = outFile + ".sources";
            StreamReader sr = new StreamReader (sources);
            string line;
            while ((line = sr.ReadLine ()) != null) {
                line = line.Trim (' ','\t');
                if (line != "") {
                    string fname = Path.Combine (basePath, line);
                    ProjectFiles.Add (new ProjectFile (fname));

                    string dir = Path.GetDirectoryName (fname);
                    if (!checkedFolders.Contains (dir)) {
                        checkedFolders.Add (dir);
                        fname = Path.Combine (dir, "ChangeLog");
                        if (File.Exists (fname))
                            ProjectFiles.Add (new ProjectFile (fname, BuildAction.Exclude));
                    }
                }
            }

            sr.Close ();

            // Project references
            string refs = mkfile.GetVariable ("LIB_MCS_FLAGS");
            if (refs == null || refs == "") refs = mkfile.GetVariable ("LOCAL_MCS_FLAGS");

            if (refs != null && refs != "") {
                Regex var = new Regex(@"(.*?/r:(?<ref>.*?)(( |\t)|$).*?)*");
                Match match = var.Match (refs);
                if (match.Success) {
                    foreach (Capture c in match.Groups["ref"].Captures)
                        refNames.Add (Path.GetFileNameWithoutExtension (c.Value));
                }
            }

            int i = basePath.LastIndexOf ("/mcs/", basePath.Length - 2);
            string topdir = basePath.Substring (0, i + 4);
            targetAssembly = targetAssembly.Replace ("$(topdir)", topdir);

            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.OutputDirectory = basePath;
            conf.AssemblyPathTemplate = targetAssembly;
            Configurations.Add (conf);

            Console.WriteLine ("{0} {1}", aname, GetOutputFileName ());
            loading = false;
            Runtime.ProjectService.CombineOpened += new CombineEventHandler (CombineOpened);
        }