protected override SolutionEntityItem LoadSolutionItem (IProgressMonitor monitor, string fileName) { SolutionEntityItem entry = base.LoadSolutionItem (monitor, fileName); if (entry == null) return null; Project project = entry as Project; if (project == null) return entry; //Project MakefileData data = entry.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; if (data == null) return entry; monitor.BeginTask (GettextCatalog.GetString ("Updating project from Makefile"), 1); try { data.OwnerProject = project; if (data.SupportsIntegration) data.UpdateProject (monitor, false); monitor.Step (1); } catch (Exception e) { monitor.ReportError (GettextCatalog.GetString ( "Error loading Makefile for project {0}", project.Name), e); } finally { monitor.EndTask (); } return entry; }
protected override void OnReadProject(ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) { base.OnReadProject(monitor, msproject); var ext = msproject.GetMonoDevelopProjectExtension("MonoDevelop.Autotools.MakefileInfo"); if (ext == null) { return; } data = MakefileData.Read(ext); if (data == null) { return; } monitor.BeginTask(GettextCatalog.GetString("Updating project from Makefile"), 1); try { data.OwnerProject = Project; if (data.SupportsIntegration) { data.UpdateProject(monitor, false); } monitor.Step(1); } catch (Exception e) { monitor.ReportError(GettextCatalog.GetString( "\tError loading Makefile for project {0}", Project.Name), e); } finally { monitor.EndTask(); } }
public bool ValidateChanges(Project project) { data.IntegrationEnabled = this.cbEnableMakefileIntegration.Active; data.RelativeMakefileName = this.fileEntryMakefilePath.Path; data.BuildFilesVar.Sync = this.cbKeepFilesSync.Active; data.BuildFilesVar.Name = GetActiveVar(comboFilesVar); data.BuildFilesVar.Prefix = this.entryFilesPattern.Text.Trim(); data.DeployFilesVar.Sync = this.cbKeepDeployFilesSync.Active; data.DeployFilesVar.Name = GetActiveVar(comboDeployFilesVar); data.DeployFilesVar.Prefix = this.entryDeployFilesPattern.Text.Trim(); data.ResourcesVar.Sync = this.cbKeepResourcesSync.Active; data.ResourcesVar.Name = GetActiveVar(comboResourcesVar); data.ResourcesVar.Prefix = this.entryResourcesPattern.Text.Trim(); data.OthersVar.Sync = this.cbKeepOthersSync.Active; data.OthersVar.Name = GetActiveVar(comboOthersVar); data.OthersVar.Prefix = this.entryOthersPattern.Text.Trim(); if (!this.cbFileSync.Active) { // Files sync is unchecked, disable syncing of all files data.BuildFilesVar.Sync = false; data.DeployFilesVar.Sync = false; data.ResourcesVar.Sync = false; data.OthersVar.Sync = false; } // References data.SyncReferences = this.cbKeepRefSync.Active; data.PackageRefVar.Sync = this.cbKeepRefSync.Active; data.PackageRefVar.Name = GetActiveVar(comboPackageRefVar); data.PackageRefVar.Prefix = this.entryPackageRefPattern.Text.Trim(); data.AsmRefVar.Sync = this.cbKeepRefSync.Active; data.AsmRefVar.Name = GetActiveVar(comboAsmRefVar); data.AsmRefVar.Prefix = this.entryAsmRefPattern.Text.Trim(); data.ProjectRefVar.Sync = this.cbKeepRefSync.Active; data.ProjectRefVar.Name = GetActiveVar(comboProjectRefVar); data.ProjectRefVar.Prefix = this.entryProjectRefPattern.Text.Trim(); data.IsAutotoolsProject = this.cbAutotoolsProject.Active; if (this.cbAutotoolsProject.Active) { data.RelativeConfigureInPath = this.fileEntryConfigureInPath.Path; } //data.AssemblyNameVar = GetActiveVar (comboAssemblyName); //data.OutputDirVar = GetActiveVar (comboOutputDir); data.BuildTargetName = this.BuildTargetName.Text.Trim(); data.ExecuteTargetName = this.ExecuteTargetName.Text.Trim(); data.CleanTargetName = this.CleanTargetName.Text.Trim(); data.ParallelProcesses = this.spinProcesses.ValueAsInt; data.MessageRegexName = GetActiveVar(comboMessageType); if (data.MessageRegexName == "Custom") { data.CustomErrorRegex = this.entryErrorRegex.Text; data.CustomWarningRegex = this.entryWarningRegex.Text; } // Data validation MakefileData oldData = project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; MakefileData tmpData = data; if (tmpData.IntegrationEnabled) { //Validate try { tmpData.Makefile.GetVariables(); } catch (FileNotFoundException e) { ShowMakefileNotFoundError(e); return(false); } catch (Exception e) { MessageService.ShowException(parentDialog, e, GettextCatalog.GetString("Specified makefile is invalid: {0}", tmpData.AbsoluteMakefileName)); return(false); } if (tmpData.IsAutotoolsProject && !File.Exists(System.IO.Path.Combine(tmpData.AbsoluteConfigureInPath, "configure.in")) && !File.Exists(System.IO.Path.Combine(tmpData.AbsoluteConfigureInPath, "configure.ac"))) { MessageService.ShowError(parentDialog, GettextCatalog.GetString("Path specified for configure.in is invalid: {0}", tmpData.RelativeConfigureInPath)); return(false); } if (tmpData.SyncReferences && (String.IsNullOrEmpty(tmpData.PackageRefVar.Name) || String.IsNullOrEmpty(tmpData.AsmRefVar.Name) || String.IsNullOrEmpty(tmpData.ProjectRefVar.Name))) { MessageService.ShowError(parentDialog, GettextCatalog.GetString("'Sync References' is enabled, but one of Reference variables is not set. Please correct this.")); return(false); } if (!CheckNonEmptyFileVar(tmpData.BuildFilesVar, "Build")) { return(false); } if (!CheckNonEmptyFileVar(tmpData.DeployFilesVar, "Deploy")) { return(false); } if (!CheckNonEmptyFileVar(tmpData.ResourcesVar, "Resources")) { return(false); } if (!CheckNonEmptyFileVar(tmpData.OthersVar, "Others")) { return(false); } //FIXME: All file vars must be distinct try { tmpData.GetErrorRegex(true); } catch (Exception e) { MessageService.ShowError(parentDialog, GettextCatalog.GetString("Invalid regex for Error messages: {0}", e.Message)); return(false); } try { tmpData.GetWarningRegex(true); } catch (Exception e) { MessageService.ShowError(parentDialog, GettextCatalog.GetString( "Invalid regex for Warning messages: {0}", e.Message)); return(false); } //FIXME: Do this only if there are changes b/w tmpData and Data project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] = tmpData; IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor( GettextCatalog.GetString("Updating project"), "gtk-run", true); tmpData.UpdateProject(monitor, oldData == null || (!oldData.IntegrationEnabled && tmpData.IntegrationEnabled)); } else { if (oldData != null) { oldData.IntegrationEnabled = false; } } return(true); }