diff options
Diffstat (limited to 'main/src/addins/MonoDevelop.Autotools')
17 files changed, 172 insertions, 168 deletions
diff --git a/main/src/addins/MonoDevelop.Autotools/AutotoolsContext.cs b/main/src/addins/MonoDevelop.Autotools/AutotoolsContext.cs index 2b5465c414..99b3f1d937 100644 --- a/main/src/addins/MonoDevelop.Autotools/AutotoolsContext.cs +++ b/main/src/addins/MonoDevelop.Autotools/AutotoolsContext.cs @@ -45,7 +45,7 @@ namespace MonoDevelop.Autotools Set<SystemPackage> commonPackages; Set<string> globalFilesReferences = new Set<string>(); Set<string> compilers = new Set<string> (); - Set<SolutionItem> builtProjects = new Set<SolutionItem> (); + Set<SolutionFolderItem> builtProjects = new Set<SolutionFolderItem> (); // Useful for cleaning up in case of a problem in generation List<string> generatedFiles = new List<string> (); @@ -190,12 +190,12 @@ namespace MonoDevelop.Autotools globalFilesReferences.Add (filePath); } - public void RegisterBuiltProject (SolutionItem item) + public void RegisterBuiltProject (SolutionFolderItem item) { builtProjects.Add (item); } - public IEnumerable<SolutionItem> GetBuiltProjects () + public IEnumerable<SolutionFolderItem> GetBuiltProjects () { return builtProjects; } @@ -292,7 +292,7 @@ namespace MonoDevelop.Autotools // TODO: add an extension point with which addins can implement // autotools functionality. - public static IMakefileHandler GetMakefileHandler (SolutionItem entry, MakefileType mt) + public static IMakefileHandler GetMakefileHandler (SolutionFolderItem entry, MakefileType mt) { foreach (IMakefileHandler mh in AddinManager.GetExtensionObjects ("/MonoDevelop/Autotools/MakefileHandlers", typeof(IMakefileHandler), true)) { if (mh.CanDeploy (entry, mt)) diff --git a/main/src/addins/MonoDevelop.Autotools/Commands.cs b/main/src/addins/MonoDevelop.Autotools/Commands.cs index d3954156ae..d553c16ac0 100644 --- a/main/src/addins/MonoDevelop.Autotools/Commands.cs +++ b/main/src/addins/MonoDevelop.Autotools/Commands.cs @@ -39,7 +39,7 @@ namespace MonoDevelop.Autotools { public override bool CanBuildNode (Type dataType) { - return typeof (Solution).IsAssignableFrom (dataType) || typeof (SolutionItem).IsAssignableFrom (dataType); + return typeof (Solution).IsAssignableFrom (dataType) || typeof (SolutionFolderItem).IsAssignableFrom (dataType); } public override Type CommandHandlerType { @@ -52,25 +52,25 @@ namespace MonoDevelop.Autotools [CommandHandler (Commands.GenerateFiles)] protected void OnGenerate() { - SolutionItem entry = CurrentNode.DataItem as SolutionItem; + SolutionFolderItem entry = CurrentNode.DataItem as SolutionFolderItem; Solution solution = CurrentNode.DataItem as Solution; GenerateMakefiles (entry, solution); } - internal static void GenerateMakefiles (SolutionItem entry, Solution solution) + internal static void GenerateMakefiles (SolutionFolderItem entry, Solution solution) { if (solution == null) { AlertButton generateMakefilesButton = new AlertButton (GettextCatalog.GetString ("_Generate Makefiles")); if (MessageService.AskQuestion (GettextCatalog.GetString ("Generating Makefiles is not supported for single projects. Do you want to generate them for the full solution - '{0}' ?", entry.ParentSolution.Name), AlertButton.Cancel, generateMakefilesButton) == generateMakefilesButton) - solution = ((SolutionItem)entry).ParentSolution; + solution = ((SolutionFolderItem)entry).ParentSolution; else return; } DeployContext ctx = null; - IProgressMonitor monitor = null; + ProgressMonitor monitor = null; GenerateMakefilesDialog dialog = new GenerateMakefilesDialog (solution); try { diff --git a/main/src/addins/MonoDevelop.Autotools/FileNodeBuilderExtension.cs b/main/src/addins/MonoDevelop.Autotools/FileNodeBuilderExtension.cs index c586f3681e..1c90564ec3 100644 --- a/main/src/addins/MonoDevelop.Autotools/FileNodeBuilderExtension.cs +++ b/main/src/addins/MonoDevelop.Autotools/FileNodeBuilderExtension.cs @@ -44,7 +44,7 @@ namespace MonoDevelop.Autotools } } - Set<SolutionEntityItem> projects = new Set<SolutionEntityItem> (); + Set<SolutionItem> projects = new Set<SolutionItem> (); foreach (ITreeNavigator node in CurrentNodes) { ProjectFile file = (ProjectFile) node.DataItem; @@ -57,7 +57,7 @@ namespace MonoDevelop.Autotools } } - IdeApp.ProjectOperations.Save (projects); + IdeApp.ProjectOperations.SaveAsync (projects); } [CommandUpdateHandler (Commands.SynchWithMakefile)] diff --git a/main/src/addins/MonoDevelop.Autotools/Handler.cs b/main/src/addins/MonoDevelop.Autotools/Handler.cs index ccf029a7bd..a8622a6c59 100644 --- a/main/src/addins/MonoDevelop.Autotools/Handler.cs +++ b/main/src/addins/MonoDevelop.Autotools/Handler.cs @@ -76,18 +76,18 @@ namespace MonoDevelop.Autotools set { defaultConfig = value; } } - public override bool CanBuild (SolutionItem entry) + public override bool CanBuild (SolutionFolderItem entry) { SolutionDeployer deployer = new SolutionDeployer (generateAutotools); return deployer.CanDeploy ( entry ); } - public override void InitializeSettings (SolutionItem entry) + public override void InitializeSettings (SolutionFolderItem entry) { if (string.IsNullOrEmpty (targetDir)) targetDir = entry.BaseDirectory; if (string.IsNullOrEmpty (defaultConfig)) { - SolutionEntityItem se = entry as SolutionEntityItem; + SolutionItem se = entry as SolutionItem; defaultConfig = se != null ? se.GetConfigurations () [0] : null; } if (File.Exists (Path.Combine (entry.BaseDirectory, "autogen.sh")) || @@ -99,18 +99,18 @@ namespace MonoDevelop.Autotools } - protected override bool OnBuild (IProgressMonitor monitor, DeployContext ctx) + protected override bool OnBuild (ProgressMonitor monitor, DeployContext ctx) { string tmpFolder = FileService.CreateTempDirectory (); Solution solution = null; - SolutionItem entry = RootSolutionItem; + SolutionFolderItem entry = RootSolutionItem; try { if (generateFiles) { List<string> childEntries = new List<string> (); if (entry is SolutionFolder) { - SolutionItem[] ents = GetChildEntries (); - foreach (SolutionItem it in ents) + SolutionFolderItem[] ents = GetChildEntries (); + foreach (SolutionFolderItem it in ents) childEntries.Add (it.ItemId); } else { @@ -123,22 +123,21 @@ namespace MonoDevelop.Autotools if (entry is SolutionFolder) sourceFile = entry.ParentSolution.FileName; else - sourceFile = ((SolutionEntityItem)entry).FileName; + sourceFile = ((SolutionItem)entry).FileName; - string efile = Services.ProjectService.Export (new FilteredProgressMonitor (monitor), sourceFile, childEntries.ToArray (), tmpFolder, null); + string efile = Services.ProjectService.Export (new FilteredProgressMonitor (monitor), sourceFile, childEntries.ToArray (), tmpFolder, null).Result; if (efile == null) { monitor.ReportError (GettextCatalog.GetString ("The project could not be exported."), null); return false; } - solution = Services.ProjectService.ReadWorkspaceItem (new NullProgressMonitor (), efile) as Solution; + solution = Services.ProjectService.ReadWorkspaceItem (new ProgressMonitor (), efile).Result as Solution; } else { solution = entry.ParentSolution; } - solution.Build (monitor, (SolutionConfigurationSelector) defaultConfig); - - if (monitor.IsCancelRequested || !monitor.AsyncOperation.Success) + var res = solution.Build (monitor, (SolutionConfigurationSelector) defaultConfig).Result; + if (res.HasErrors || monitor.CancellationToken.IsCancellationRequested) return false; SolutionDeployer deployer = new SolutionDeployer (generateAutotools); diff --git a/main/src/addins/MonoDevelop.Autotools/IMakefileHandler.cs b/main/src/addins/MonoDevelop.Autotools/IMakefileHandler.cs index ac4a8ed108..31c6b18ccc 100644 --- a/main/src/addins/MonoDevelop.Autotools/IMakefileHandler.cs +++ b/main/src/addins/MonoDevelop.Autotools/IMakefileHandler.cs @@ -29,9 +29,9 @@ namespace MonoDevelop.Autotools { public interface IMakefileHandler { - bool CanDeploy (SolutionItem entry, MakefileType type); + bool CanDeploy (SolutionFolderItem entry, MakefileType type); - Makefile Deploy (AutotoolsContext ctx, SolutionItem entry, IProgressMonitor monitor); + Makefile Deploy (AutotoolsContext ctx, SolutionFolderItem entry, ProgressMonitor monitor); } public enum MakefileType diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileData.cs b/main/src/addins/MonoDevelop.Autotools/MakefileData.cs index 8101bcfe67..01a6b1cb51 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileData.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileData.cs @@ -38,6 +38,7 @@ using MonoDevelop.Core.Serialization; using MonoDevelop.Projects; using MonoDevelop.Core.Assemblies; using MonoDevelop.Ide; +using System.Xml; namespace MonoDevelop.Autotools { @@ -70,6 +71,24 @@ namespace MonoDevelop.Autotools if (assemblyContext == null) integrationEnabled = false; } + + public static MakefileData Read (XmlElement ext) + { + XmlDataSerializer ser = new XmlDataSerializer (new DataContext ()); + return (MakefileData) ser.Deserialize (new XmlNodeReader (ext), typeof(MakefileData)); + } + + public XmlElement Write () + { + XmlDataSerializer ser = new XmlDataSerializer (new DataContext ()); + var sw = new StringWriter (); + ser.Serialize (new XmlTextWriter (sw), this); + XmlDocument doc = new XmlDocument (); + doc.LoadXml (sw.ToString ()); + var elem = doc.DocumentElement; + doc.RemoveChild (elem); + return elem; + } internal static IAssemblyContext GetMonoRuntimeContext () { @@ -613,7 +632,7 @@ namespace MonoDevelop.Autotools return customRegex [index]; } - IProgressMonitor monitor = null; + ProgressMonitor monitor = null; // VarName -> Encode filenames Eg. $(srcdir) Dictionary<string, bool> encodeValues; @@ -651,7 +670,7 @@ namespace MonoDevelop.Autotools } //use events.. - public void UpdateProject (IProgressMonitor monitor, bool promptForRemoval) + public void UpdateProject (ProgressMonitor monitor, bool promptForRemoval) { if (!IntegrationEnabled) return; @@ -1177,7 +1196,7 @@ namespace MonoDevelop.Autotools return pref; } - public static void ResolveProjectReferences (SolutionFolder folder, IProgressMonitor monitor) + public static void ResolveProjectReferences (SolutionFolder folder, ProgressMonitor monitor) { Dictionary<string, DotNetProject> projects = new Dictionary<string, DotNetProject> (); foreach (DotNetProject p in folder.GetAllItems<DotNetProject> ()) { @@ -1325,7 +1344,7 @@ namespace MonoDevelop.Autotools //Writing methods - public void UpdateMakefile (IProgressMonitor monitor) + public void UpdateMakefile (ProgressMonitor monitor) { //FIXME: AssemblyName & OutputDir diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileGeneratorTool.cs b/main/src/addins/MonoDevelop.Autotools/MakefileGeneratorTool.cs index 8c483aff93..76af27790c 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileGeneratorTool.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileGeneratorTool.cs @@ -50,7 +50,7 @@ namespace MonoDevelop.Autotools Console.WriteLine (GettextCatalog.GetString ("Loading solution file {0}", filename)); ConsoleProgressMonitor monitor = new ConsoleProgressMonitor (); - Solution solution = Services.ProjectService.ReadWorkspaceItem (monitor, filename) as Solution; + Solution solution = Services.ProjectService.ReadWorkspaceItem (monitor, filename).Result as Solution; if (solution == null) { Console.WriteLine (GettextCatalog.GetString ("Error: Makefile generation supported only for solutions.\n")); return 1; diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileIntegrationFeature.cs b/main/src/addins/MonoDevelop.Autotools/MakefileIntegrationFeature.cs index 8c08e1dc0f..df3511903f 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileIntegrationFeature.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileIntegrationFeature.cs @@ -17,7 +17,7 @@ namespace MonoDevelop.Autotools get { return string.Empty; } } - public FeatureSupportLevel GetSupportLevel (SolutionFolder parentCombine, SolutionItem entry) + public FeatureSupportLevel GetSupportLevel (SolutionFolder parentCombine, SolutionFolderItem entry) { if (entry is Project) return FeatureSupportLevel.SupportedByDefault; @@ -25,17 +25,17 @@ namespace MonoDevelop.Autotools return FeatureSupportLevel.NotSupported; } - public Widget CreateFeatureEditor (SolutionFolder parentCombine, SolutionItem entry) + public Widget CreateFeatureEditor (SolutionFolder parentCombine, SolutionFolderItem entry) { return new MakefileIntegrationFeatureWidget ((Project)entry); } - public void ApplyFeature (SolutionFolder parentCombine, SolutionItem entry, Widget editor) + public void ApplyFeature (SolutionFolder parentCombine, SolutionFolderItem entry, Widget editor) { ((MakefileIntegrationFeatureWidget)editor).Store (); } - public string Validate (SolutionFolder parentCombine, SolutionItem entry, Gtk.Widget editor) + public string Validate (SolutionFolder parentCombine, SolutionFolderItem entry, Gtk.Widget editor) { return null; } diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs b/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs index c003789327..447b16994e 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs @@ -268,7 +268,7 @@ namespace MonoDevelop.Autotools //FIXME: Do this only if there are changes b/w tmpData and Data project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] = tmpData; - using (IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor ( + using (ProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor ( GettextCatalog.GetString ("Updating project"), "gtk-run", true)) { tmpData.UpdateProject (monitor, oldData == null || (!oldData.IntegrationEnabled && tmpData.IntegrationEnabled)); diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs b/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs index 91dd984bd9..23a9125a6c 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs @@ -17,10 +17,10 @@ namespace MonoDevelop.Autotools conf.Name = name; return conf; } - - public override IEnumerable<string> GetProjectTypes () + + protected override void OnGetProjectTypes (HashSet<string> types) { - yield return "MakefileProject"; + types.Add ("MakefileProject"); } } diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs b/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs index 5c71be9a49..1ca531fbaa 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs @@ -38,15 +38,17 @@ using System.Collections.Generic; using System.IO; using System.Text; using System.Text.RegularExpressions; +using System.Linq; +using System.Threading.Tasks; namespace MonoDevelop.Autotools { public class MakefileProjectServiceExtension : ProjectServiceExtension { - public override WorkspaceItem LoadWorkspaceItem (IProgressMonitor monitor, string fileName) + public async override Task<WorkspaceItem> LoadWorkspaceItem (ProgressMonitor monitor, string fileName) { - WorkspaceItem item = base.LoadWorkspaceItem (monitor, fileName); - + WorkspaceItem item = await base.LoadWorkspaceItem (monitor, fileName); + Solution sol = item as Solution; if (sol != null) { //Resolve project references @@ -59,68 +61,65 @@ namespace MonoDevelop.Autotools "Error resolving Makefile based project references for solution {0}", sol.Name), e); } } - + return item; } + } - - protected override SolutionEntityItem LoadSolutionItem (IProgressMonitor monitor, string fileName) + [RegisterProjectModelExtension] + public class MakefileProjectExtension: ProjectExtension + { + MakefileData data; + + protected override void OnReadProject (ProgressMonitor monitor, MonoDevelop.Projects.Formats.MSBuild.MSBuildProject msproject) { - SolutionEntityItem entry = base.LoadSolutionItem (monitor, fileName); - if (entry == null) - return null; - - Project project = entry as Project; - if (project == null) - return entry; + base.OnReadProject (monitor, msproject); + var ext = msproject.GetMonoDevelopProjectExtension ("MonoDevelop.Autotools.MakefileInfo"); + if (ext == null) + return; - //Project - MakefileData data = entry.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; + data = MakefileData.Read (ext); if (data == null) - return entry; + return; monitor.BeginTask (GettextCatalog.GetString ("Updating project from Makefile"), 1); try { - data.OwnerProject = project;
+ 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); + "\tError loading Makefile for project {0}", Project.Name), e); } finally { monitor.EndTask (); } - return entry; } - public override void Save (IProgressMonitor monitor, SolutionEntityItem entry) + protected override void OnWriteProject (ProgressMonitor monitor, MonoDevelop.Projects.Formats.MSBuild.MSBuildProject msproject) { - base.Save (monitor, entry); - - Project project = entry as Project; - if (project == null) - return; - - MakefileData data = project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
+ base.OnWriteProject (monitor, msproject); + if (data == null || !data.SupportsIntegration) return; + msproject.SetProjectExtension ("MonoDevelop.Autotools.MakefileInfo", data.Write ()); + try { data.UpdateMakefile (monitor); } catch (Exception e) { LoggingService.LogError (GettextCatalog.GetString ("Error saving to Makefile ({0}) for project {1}", - data.AbsoluteMakefileName, project.Name, e)); + data.AbsoluteMakefileName, Project.Name, e)); monitor.ReportError (GettextCatalog.GetString ( - "Error saving to Makefile ({0}) for project {1}", data.AbsoluteMakefileName, project.Name), e); + "Error saving to Makefile ({0}) for project {1}", data.AbsoluteMakefileName, Project.Name), e); } }
- public override List<FilePath> GetItemFiles (SolutionEntityItem entry, bool includeReferencedFiles) + protected override IEnumerable<FilePath> OnGetItemFiles (bool includeReferencedFiles) {
- List<FilePath> col = base.GetItemFiles (entry, includeReferencedFiles); + List<FilePath> col = base.OnGetItemFiles (includeReferencedFiles).ToList (); - MakefileData data = entry.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
+ MakefileData data = Project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
if (data == null || !data.SupportsIntegration || string.IsNullOrEmpty (data.AbsoluteMakefileName)) return col; @@ -136,31 +135,21 @@ namespace MonoDevelop.Autotools } - //TODO - protected override bool GetNeedsBuilding (SolutionEntityItem entry, ConfigurationSelector configuration) - { - return base.GetNeedsBuilding (entry, configuration); - } - //FIXME: Check whether autogen.sh is required or not - protected override BuildResult Build (IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration) + protected async override Task<BuildResult> OnBuild (ProgressMonitor monitor, ConfigurationSelector configuration) { - Project project = entry as Project; - if (project == null) - return base.Build (monitor, entry, configuration); - - MakefileData data = project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
+ MakefileData data = Project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
if (data == null || !data.SupportsIntegration || String.IsNullOrEmpty (data.BuildTargetName)) - return base.Build (monitor, entry, configuration); + return await base.OnBuild (monitor, configuration); //FIXME: Gen autofoo ? autoreconf? string output = String.Empty; int exitCode = 0; - monitor.BeginTask (GettextCatalog.GetString ("Building {0}", project.Name), 1); + monitor.BeginTask (GettextCatalog.GetString ("Building {0}", Project.Name), 1); try { - string baseDir = project.BaseDirectory; + string baseDir = Project.BaseDirectory; string args = string.Format ("-j {0} {1}", data.ParallelProcesses, data.BuildTargetName); using (var swOutput = new StringWriter ()) { @@ -174,7 +163,8 @@ namespace MonoDevelop.Autotools chainedOutput, chainedOutput, null)) { - process.WaitForOutput (); + + await process.Task; chainedOutput.UnchainWriter (monitor.Log); chainedOutput.UnchainWriter (swOutput); @@ -200,7 +190,7 @@ namespace MonoDevelop.Autotools Regex regexError = data.GetErrorRegex (false); Regex regexWarning = data.GetWarningRegex (false); - BuildResult cr = ParseOutput (tf, output, project.BaseDirectory, regexError, regexWarning); + BuildResult cr = ParseOutput (tf, output, Project.BaseDirectory, regexError, regexWarning); if (exitCode != 0 && cr.FailedBuildCount == 0) cr.AddError (GettextCatalog.GetString ("Build failed. See Build Output panel.")); @@ -330,24 +320,17 @@ namespace MonoDevelop.Autotools return null; } - protected override void Clean (IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration) + protected async override Task<BuildResult> OnClean (ProgressMonitor monitor, ConfigurationSelector configuration) { - Project proj = entry as Project; - if (proj == null) { - base.Clean (monitor, entry, configuration); - return; - } - - MakefileData data = proj.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
+ MakefileData data = Project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
if (data == null || !data.SupportsIntegration || String.IsNullOrEmpty (data.CleanTargetName)) { - base.Clean (monitor, entry, configuration); - return; + return await base.OnClean (monitor, configuration); } monitor.BeginTask ( GettextCatalog.GetString( "Cleaning project"), 1); try { - string baseDir = proj.BaseDirectory; + string baseDir = Project.BaseDirectory; ProcessWrapper process = Runtime.ProcessService.StartProcess ( "make", data.CleanTargetName, @@ -355,7 +338,8 @@ namespace MonoDevelop.Autotools monitor.Log, monitor.Log, null ); - process.WaitForOutput (); + + await process.Task; if ( process.ExitCode > 0 ) throw new Exception ( GettextCatalog.GetString ("An unspecified error occurred while running '{0}'", "make " + data.CleanTargetName) ); @@ -365,52 +349,47 @@ namespace MonoDevelop.Autotools catch ( Exception e ) { monitor.ReportError ( GettextCatalog.GetString ("Project could not be cleaned: "), e ); - return; + var res = new BuildResult (); + res.AddError (GettextCatalog.GetString ("Project could not be cleaned: ") + e.Message); + return res; } finally { monitor.EndTask (); } monitor.ReportSuccess ( GettextCatalog.GetString ( "Project successfully cleaned")); + return BuildResult.Success; } - protected override bool CanExecute (SolutionEntityItem item, ExecutionContext context, ConfigurationSelector configuration) + protected override bool OnGetCanExecute (ExecutionContext context, ConfigurationSelector configuration) { - Project project = item as Project; - if (project != null) { - MakefileData data = project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
- if (data != null && data.SupportsIntegration && !String.IsNullOrEmpty (data.ExecuteTargetName)) - return true; - } - return base.CanExecute (item, context, configuration); + MakefileData data = Project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
+ if (data != null && data.SupportsIntegration && !String.IsNullOrEmpty (data.ExecuteTargetName)) + return true; + return base.OnGetCanExecute (context, configuration); } - protected override void Execute (IProgressMonitor monitor, SolutionEntityItem entry, ExecutionContext context, ConfigurationSelector configuration) + protected async override Task OnExecute (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) { - Project project = entry as Project; - if (project == null) { - base.Execute (monitor, entry, context, configuration); - return; - } - - MakefileData data = project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
+ MakefileData data = Project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
if (data == null || !data.SupportsIntegration || String.IsNullOrEmpty (data.ExecuteTargetName)) { - base.Execute (monitor, entry, context, configuration); + base.OnExecute (monitor, context, configuration); return; } IConsole console = context.ConsoleFactory.CreateConsole (true); - monitor.BeginTask (GettextCatalog.GetString ("Executing {0}", project.Name), 1); + monitor.BeginTask (GettextCatalog.GetString ("Executing {0}", Project.Name), 1); try { ProcessWrapper process = Runtime.ProcessService.StartProcess ("make", - data.ExecuteTargetName, - project.BaseDirectory, - console.Out, - console.Error, - null); - process.WaitForOutput (); + data.ExecuteTargetName, + Project.BaseDirectory, + console.Out, + console.Error, + null); + + await process.Task; monitor.Log.WriteLine (GettextCatalog.GetString ("The application exited with code: {0}", process.ExitCode)); monitor.Step (1); diff --git a/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.addin.xml b/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.addin.xml index 0ed738152b..2388eb28f7 100644 --- a/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.addin.xml +++ b/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.addin.xml @@ -29,6 +29,12 @@ </Condition> </Extension> + <Extension path = "/MonoDevelop/ProjectModel/ProjectModelExtensions"> + <Condition id="Platform" value="!windows"> + <ProjectExtension class = "MonoDevelop.Autotools.MakefileProjectExtension" id="MakefileProjectServiceExtension" insertafter="FinalStep"/> + </Condition> + </Extension> + <Extension path = "/MonoDevelop/Ide/Commands"> <Condition id="Platform" value="!windows"> <Category _name = "Autotools" id = "Autotools"> diff --git a/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.csproj b/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.csproj index 47387c921d..84c712ed90 100644 --- a/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.csproj +++ b/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.csproj @@ -85,6 +85,7 @@ <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> <SpecificVersion>False</SpecificVersion> </Reference> + <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="AssemblyInfo.cs" /> diff --git a/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs b/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs index 6f4d39496f..b3bc53e342 100644 --- a/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs +++ b/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs @@ -71,7 +71,7 @@ namespace MonoDevelop.Autotools // store all refs for easy access Set<SystemPackage> pkgs; - public bool CanDeploy (SolutionItem entry, MakefileType type) + public bool CanDeploy (SolutionFolderItem entry, MakefileType type) { Project project = entry as Project; if ( project == null ) return false; @@ -89,7 +89,7 @@ namespace MonoDevelop.Autotools return null; } - public Makefile Deploy (AutotoolsContext ctx, SolutionItem entry, IProgressMonitor monitor) + public Makefile Deploy (AutotoolsContext ctx, SolutionFolderItem entry, ProgressMonitor monitor) { generateAutotools = ctx.MakefileType == MakefileType.AutotoolsMakefile; @@ -324,7 +324,7 @@ namespace MonoDevelop.Autotools ctx.AddBuiltFile (Path.Combine (config.OutputDirectory, bfile)); DeployFileCollection deployFiles = DeployService.GetDeployFiles ( - ctx.DeployContext, new SolutionItem[] { project }, config.Selector); + ctx.DeployContext, new SolutionFolderItem[] { project }, config.Selector); ProcessDeployFilesForConfig (deployFiles, project, configSection, ctx, config); configSections.Add (configSection); @@ -677,7 +677,7 @@ endif", s.SwitchName.Replace ('-', '_').ToUpperInvariant (), s.Define)); return dir; } - void EmitCustomCommandTargets (CustomCommandCollection commands, Project project, StringBuilder builder, string configName, CustomCommandType[] types, IProgressMonitor monitor) + void EmitCustomCommandTargets (CustomCommandCollection commands, Project project, StringBuilder builder, string configName, CustomCommandType[] types, ProgressMonitor monitor) { bool warned = false; configName = configName.ToUpper (); @@ -735,7 +735,7 @@ endif", s.SwitchName.Replace ('-', '_').ToUpperInvariant (), s.Define)); } // Get the Project config corresponding to its @parentConfig - internal static SolutionItemConfiguration GetProjectConfig (string parentConfig, SolutionEntityItem entry, out bool enabled) + internal static SolutionItemConfiguration GetProjectConfig (string parentConfig, SolutionItem entry, out bool enabled) { enabled = false; SolutionConfiguration solutionConfig = entry.ParentSolution.Configurations [parentConfig] as SolutionConfiguration; diff --git a/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs b/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs index 3bb43a271b..16d1bd6081 100644 --- a/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs +++ b/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs @@ -71,14 +71,14 @@ namespace MonoDevelop.Autotools } } - public bool CanDeploy (SolutionItem entry) + public bool CanDeploy (SolutionFolderItem entry) { MakefileType mt = generateAutotools ? MakefileType.AutotoolsMakefile : MakefileType.SimpleMakefile; IMakefileHandler handler = AutotoolsContext.GetMakefileHandler (entry, mt); return handler != null; } - public bool GenerateFiles (DeployContext ctx, Solution solution, string defaultConf, IProgressMonitor monitor ) + public bool GenerateFiles (DeployContext ctx, Solution solution, string defaultConf, ProgressMonitor monitor ) { string filesString = generateAutotools ? "Autotools files" : "Makefiles"; monitor.BeginTask ( GettextCatalog.GetString ("Generating {0} for Solution {1}", filesString, solution.Name), 1 ); @@ -153,7 +153,7 @@ namespace MonoDevelop.Autotools return true; } - public bool Deploy ( DeployContext ctx, Solution solution, string defaultConf, string targetDir, bool generateFiles, IProgressMonitor monitor ) + public bool Deploy ( DeployContext ctx, Solution solution, string defaultConf, string targetDir, bool generateFiles, ProgressMonitor monitor ) { if (generateFiles) { if ( !GenerateFiles ( ctx, solution, defaultConf, monitor ) ) @@ -231,7 +231,7 @@ namespace MonoDevelop.Autotools if ( File.Exists ( file ) ) FileService.DeleteFile ( file ); } - void AddTopLevelMakefileVars ( Makefile makefile, IProgressMonitor monitor) + void AddTopLevelMakefileVars ( Makefile makefile, ProgressMonitor monitor) { monitor.Log.WriteLine ( GettextCatalog.GetString ("Adding variables to top-level Makefile") ); @@ -251,7 +251,7 @@ namespace MonoDevelop.Autotools // makefile.AppendToVariable ( "pkglib_DATA", "$(DLL_REFERENCES)" ); } - void CreateAutoGenDotSH (AutotoolsContext context, IProgressMonitor monitor) + void CreateAutoGenDotSH (AutotoolsContext context, ProgressMonitor monitor) { monitor.Log.WriteLine ( GettextCatalog.GetString ("Creating autogen.sh") ); @@ -278,7 +278,7 @@ namespace MonoDevelop.Autotools Syscall.chmod ( fileName , FilePermissions.S_IXOTH | FilePermissions.S_IROTH | FilePermissions.S_IRWXU | FilePermissions.S_IRWXG ); } - void CreateConfigureDotAC (Solution solution, string defaultConf, IProgressMonitor monitor, AutotoolsContext context) + void CreateConfigureDotAC (Solution solution, string defaultConf, ProgressMonitor monitor, AutotoolsContext context) { monitor.Log.WriteLine ( GettextCatalog.GetString ("Creating configure.ac") ); TemplateEngine templateEngine = new TemplateEngine(); @@ -394,7 +394,7 @@ AM_CONDITIONAL(ENABLE_{3}, test x$enable_{2} = xyes)", context.AddGeneratedFile (configureFileName); } - void CreateConfigureScript (Solution solution, string defaultConf, AutotoolsContext ctx, IProgressMonitor monitor) + void CreateConfigureScript (Solution solution, string defaultConf, AutotoolsContext ctx, ProgressMonitor monitor) { monitor.Log.WriteLine ( GettextCatalog.GetString ("Creating configure script") ); @@ -469,7 +469,7 @@ AM_CONDITIONAL(ENABLE_{3}, test x$enable_{2} = xyes)", return builder.ToString (); } - void CreateMakefileInclude (AutotoolsContext context, IProgressMonitor monitor) + void CreateMakefileInclude (AutotoolsContext context, ProgressMonitor monitor) { monitor.Log.WriteLine ( GettextCatalog.GetString ("Creating Makefile.include") ); diff --git a/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs b/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs index b31e5ddba0..ab70a6472d 100644 --- a/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs +++ b/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs @@ -33,12 +33,12 @@ namespace MonoDevelop.Autotools bool generateAutotools = true; // Recurses into children and tests if they are deployable. - public bool CanDeploy (SolutionItem entry, MakefileType type) + public bool CanDeploy (SolutionFolderItem entry, MakefileType type) { return entry is SolutionFolder; } - public Makefile Deploy (AutotoolsContext ctx, SolutionItem entry, IProgressMonitor monitor) + public Makefile Deploy (AutotoolsContext ctx, SolutionFolderItem entry, ProgressMonitor monitor) { generateAutotools = ctx.MakefileType == MakefileType.AutotoolsMakefile; @@ -78,10 +78,10 @@ namespace MonoDevelop.Autotools subdirs.Append (" SUBDIRS = "); - foreach (SolutionItem ce in CalculateSubDirOrder (ctx, solutionFolder, config)) + foreach (SolutionFolderItem ce in CalculateSubDirOrder (ctx, solutionFolder, config)) { string baseDirectory; - if (!(ce is SolutionEntityItem) && !(ce is SolutionFolder)) + if (!(ce is SolutionItem) && !(ce is SolutionFolder)) continue; // Ignore projects which can't be deployed @@ -118,7 +118,7 @@ namespace MonoDevelop.Autotools string includedProject = null; // deploy recursively - foreach (SolutionItem ce in children) + foreach (SolutionFolderItem ce in children) { IMakefileHandler handler = AutotoolsContext.GetMakefileHandler ( ce, ctx.MakefileType ); Makefile makefile; @@ -206,11 +206,11 @@ namespace MonoDevelop.Autotools } // utility function for finding the correct order to process directories - List<SolutionItem> CalculateSubDirOrder (AutotoolsContext ctx, SolutionFolder folder, SolutionConfiguration config) + List<SolutionFolderItem> CalculateSubDirOrder (AutotoolsContext ctx, SolutionFolder folder, SolutionConfiguration config) { - List<SolutionItem> resultOrder = new List<SolutionItem>(); - Set<SolutionItem> dependenciesMet = new Set<SolutionItem>(); - Set<SolutionItem> inResult = new Set<SolutionItem>(); + List<SolutionFolderItem> resultOrder = new List<SolutionFolderItem>(); + Set<SolutionFolderItem> dependenciesMet = new Set<SolutionFolderItem>(); + Set<SolutionFolderItem> inResult = new Set<SolutionFolderItem>(); // We don't have to worry about projects built in parent combines dependenciesMet.Union (ctx.GetBuiltProjects ()); @@ -222,24 +222,24 @@ namespace MonoDevelop.Autotools added = false; notMet = null; - List<SolutionItem> items = new List<SolutionItem> (); + List<SolutionFolderItem> items = new List<SolutionFolderItem> (); GetSubItems (items, folder); - foreach (SolutionItem item in items) + foreach (SolutionFolderItem item in items) { - Set<SolutionItem> references, provides; + Set<SolutionFolderItem> references, provides; if (inResult.Contains (item)) continue; - if (item is SolutionEntityItem) + if (item is SolutionItem) { - SolutionEntityItem entry = (SolutionEntityItem) item; + SolutionItem entry = (SolutionItem) item; if (!config.BuildEnabledForItem (entry)) continue; - references = new Set<SolutionItem> (); - provides = new Set<SolutionItem>(); + references = new Set<SolutionFolderItem> (); + provides = new Set<SolutionFolderItem>(); references.Union (entry.GetReferencedItems (config.Selector)); provides.Add (entry); } @@ -266,12 +266,12 @@ namespace MonoDevelop.Autotools return resultOrder; } - void GetSubItems (List<SolutionItem> list, SolutionFolder folder) + void GetSubItems (List<SolutionFolderItem> list, SolutionFolder folder) { // This method returns the subitems of a folder. // If a folder does not match a phisical folder, it will be ignored. - foreach (SolutionItem item in folder.Items) { + foreach (SolutionFolderItem item in folder.Items) { if (item is SolutionFolder) { if (item.BaseDirectory != folder.BaseDirectory) list.Add (item); @@ -290,25 +290,25 @@ namespace MonoDevelop.Autotools * returns a set of projects that a combine contains and a set of projects * that are referenced from combine projects but not part of the combine */ - void GetAllProjects (SolutionFolder folder, SolutionConfiguration config, out Set<SolutionItem> projects, out Set<SolutionItem> references) + void GetAllProjects (SolutionFolder folder, SolutionConfiguration config, out Set<SolutionFolderItem> projects, out Set<SolutionFolderItem> references) { - List<SolutionItem> subitems = new List<SolutionItem> (); + List<SolutionFolderItem> subitems = new List<SolutionFolderItem> (); GetSubItems (subitems, folder); - projects = (Set<SolutionItem>) combineProjects [folder]; + projects = (Set<SolutionFolderItem>) combineProjects [folder]; if (projects != null) { - references = (Set<SolutionItem>) combineReferences [folder]; + references = (Set<SolutionFolderItem>) combineReferences [folder]; return; } - projects = new Set<SolutionItem>(); - references = new Set<SolutionItem>(); + projects = new Set<SolutionFolderItem>(); + references = new Set<SolutionFolderItem>(); - foreach (SolutionItem item in subitems) + foreach (SolutionFolderItem item in subitems) { - if (item is SolutionEntityItem) + if (item is SolutionItem) { - SolutionEntityItem entry = (SolutionEntityItem) item; + SolutionItem entry = (SolutionItem) item; if (!config.BuildEnabledForItem (entry)) continue; projects.Add (entry); @@ -316,8 +316,8 @@ namespace MonoDevelop.Autotools } else if (item is SolutionFolder) { - Set<SolutionItem> subProjects; - Set<SolutionItem> subReferences; + Set<SolutionFolderItem> subProjects; + Set<SolutionFolderItem> subReferences; GetAllProjects ((SolutionFolder)item, config, out subProjects, out subReferences); projects.Union (subProjects); references.Union (subReferences); diff --git a/main/src/addins/MonoDevelop.Autotools/TarballBuilderEditorWidget.cs b/main/src/addins/MonoDevelop.Autotools/TarballBuilderEditorWidget.cs index edd2eebbdd..0ef6aaaf30 100644 --- a/main/src/addins/MonoDevelop.Autotools/TarballBuilderEditorWidget.cs +++ b/main/src/addins/MonoDevelop.Autotools/TarballBuilderEditorWidget.cs @@ -17,7 +17,7 @@ namespace MonoDevelop.Autotools alignment1.Xscale = 0.04f; this.target = target; - SolutionItem targetCombine = target.RootSolutionItem; + SolutionFolderItem targetCombine = target.RootSolutionItem; folderEntry.Path = target.TargetDir; if (string.IsNullOrEmpty (target.DefaultConfiguration)) { |