protected override BuildResult Build (IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration)
		{
			DotNetProject project = (DotNetProject) entry;
			GtkDesignInfo info = GtkDesignInfo.FromProject (project);

			// The code generator must run in the GUI thread since it needs to
			// access to Gtk classes
			Generator gen = new Generator ();
			lock (gen) {
				Gtk.Application.Invoke (delegate { gen.Run (monitor, project, configuration); });
				Monitor.Wait (gen);
			}
					
			BuildResult res = base.Build (monitor, entry, configuration);

			if (gen.Messages != null) {
				foreach (string s in gen.Messages)
//					res.AddWarning (info.GuiBuilderProject.File, 0, 0, null, s);
// TODO:	Add gtkx file name in the Generator 
					res.AddWarning ("", 0, 0, null, s);
						
				if (gen.Messages.Length > 0)
					info.ForceCodeGenerationOnBuild ();
			}
			return res;
		}
		protected override BuildResult Build (IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration)
		{
			DotNetProject project = (DotNetProject) entry;
			GtkDesignInfo info = GtkDesignInfo.FromProject (project);

			// The code generator must run in the GUI thread since it needs to
			// access to Gtk classes
			Generator gen = new Generator ();
			lock (gen) {
				Gtk.Application.Invoke (delegate { gen.Run (monitor, project, configuration); });
				Monitor.Wait (gen);
			}
					
			BuildResult res = base.Build (monitor, entry, configuration);

			if (gen.Messages != null) {
				foreach (string s in gen.Messages)
					res.AddWarning (info.GuiBuilderProject.File, 0, 0, null, s);
						
				if (gen.Messages.Length > 0)
					info.ForceCodeGenerationOnBuild ();
			}
			
			if (res.Failed && !Platform.IsWindows && !Platform.IsMac) {
				// Some gtk# packages don't include the .pc file unless you install gtk-sharp-devel
				if (project.AssemblyContext.GetPackage ("gtk-sharp-2.0") == null) {
					string msg = GettextCatalog.GetString (
						"ERROR: MonoDevelop could not find the Gtk# 2.0 development package. " +
						"Compilation of projects depending on Gtk# libraries will fail. " +
						"You may need to install development packages for gtk-sharp-2.0.");
					monitor.Log.WriteLine ();
					monitor.Log.WriteLine (msg);
				}
			}
			
			return res;
		}
		protected async override Task<BuildResult> OnBuild (ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext)
		{
			if (Project.References.Count == 0 || !GtkDesignInfo.HasDesignedObjects (Project))
				return await base.OnBuild (monitor, configuration, operationContext);

			Generator gen = new Generator ();
			if (!await gen.Run (monitor, Project, configuration)) {
				BuildResult gr = new BuildResult ();
				foreach (string s in gen.Messages)
					gr.AddError (DesignInfo.GuiBuilderProject.File, 0, 0, null, s);
				return gr;
			}
					
			BuildResult res = await base.OnBuild (monitor, configuration, operationContext);

			if (gen.Messages != null) {
				foreach (string s in gen.Messages)
					res.AddWarning (DesignInfo.GuiBuilderProject.File, 0, 0, null, s);
						
				if (gen.Messages.Length > 0)
					DesignInfo.ForceCodeGenerationOnBuild ();
			}
			
			if (res.Failed && !Platform.IsWindows && !Platform.IsMac) {
				// Some gtk# packages don't include the .pc file unless you install gtk-sharp-devel
				if (Project.AssemblyContext.GetPackage ("gtk-sharp-2.0") == null) {
					string msg = GettextCatalog.GetString (
						"ERROR: MonoDevelop could not find the Gtk# 2.0 development package. " +
						"Compilation of projects depending on Gtk# libraries will fail. " +
						"You may need to install development packages for gtk-sharp-2.0.");
					monitor.Log.WriteLine ();
					monitor.Log.WriteLine (BrandingService.BrandApplicationName (msg));
				}
			}
			
			return res;
		}
Example #4
0
		public void Convert (string guiFolderName, bool makeBackup)
		{
			GtkDesignInfo info = GtkDesignInfo.FromProject (project); 
			Stetic.Project gproject = GuiBuilderService.SteticApp.CreateProject (info);
			//Stetic.Project does not implement IDisposable
			try {
				string newGuiFolderName = project.BaseDirectory.Combine (guiFolderName);
				gproject.ConvertProject (info.SteticFile, newGuiFolderName);
				info.ConvertGtkFolder (guiFolderName, makeBackup);
				info.UpdateGtkFolder ();
				folderName = newGuiFolderName;
				IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetBuildProgressMonitor ();
				try {
					ConfigurationSelector configuration = IdeApp.Workspace.ActiveConfiguration;
					Generator generator = new Generator ();
					generator.Run (monitor, project, configuration);
					monitor.ReportSuccess ("Converting was succesfull");
				} finally {
					monitor.Dispose ();
				}
			} finally {
				gproject.Dispose ();
			}
		}
Example #5
0
		public void GenerateCode (string componentFile)
		{
			GtkDesignInfo info = GtkDesignInfo.FromProject (project);
			string gtkxFile = info.GetDesignerFileFromComponent (componentFile);
			if (gtkxFile != null && File.Exists (gtkxFile)) {
				
				Save (false);
				FileInfo fi = new FileInfo (gtkxFile);
				fi.LastWriteTime = DateTime.Now;
				
				IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetBuildProgressMonitor ();
				try {
					ConfigurationSelector configuration = IdeApp.Workspace.ActiveConfiguration;
					Generator generator = new Generator ();
					generator.Run (monitor, project, configuration);
				} finally {
					monitor.Dispose ();
				}
			}
		}