protected override bool OnBuild(ProgressMonitor monitor, DeployContext ctx)
        {
            string             sourceFile;
            SolutionFolderItem entry = RootSolutionItem;

            if (entry is SolutionFolder)
            {
                sourceFile = entry.ParentSolution.FileName;
            }
            else
            {
                sourceFile = ((SolutionItem)entry).FileName;
            }

            AggregatedProgressMonitor mon = new AggregatedProgressMonitor();

            mon.AddSlaveMonitor(monitor, MonitorAction.WriteLog | MonitorAction.ReportError | MonitorAction.ReportWarning | MonitorAction.ReportSuccess);

            string tmpFolder = FileService.CreateTempDirectory();

            try {
                string tf = Path.GetFileNameWithoutExtension(targetFile);
                if (tf.EndsWith(".tar"))
                {
                    tf = Path.GetFileNameWithoutExtension(tf);
                }

                string folder = FileService.GetFullPath(Path.Combine(tmpFolder, tf));
                Directory.CreateDirectory(folder);

                // Export the project

                SolutionFolderItem[] ents   = GetChildEntries();
                string[]             epaths = new string [ents.Length];
                for (int n = 0; n < ents.Length; n++)
                {
                    epaths [n] = ents [n].ItemId;
                }

                var r = Services.ProjectService.Export(mon, sourceFile, epaths, folder, FileFormat).Result;
                if (string.IsNullOrEmpty(r))
                {
                    return(false);
                }

                // Create the archive
                string td = Path.GetDirectoryName(targetFile);
                if (!Directory.Exists(td))
                {
                    Directory.CreateDirectory(td);
                }
                DeployService.CreateArchive(mon, tmpFolder, targetFile);
            }
            finally {
                Directory.Delete(tmpFolder, true);
            }
            monitor.Log.WriteLine(GettextCatalog.GetString("Created file: {0}", targetFile));
            return(true);
        }
Example #2
0
        private ProgressMonitor GetBuildProgressMonitor(string statusText)
        {
            Pad          pad              = IdeApp.Workbench.GetPad <ErrorListPad> ();
            ErrorListPad errorPad         = (ErrorListPad)pad.Content;
            AggregatedProgressMonitor mon = new AggregatedProgressMonitor(errorPad.GetBuildProgressMonitor());

            mon.AddSlaveMonitor(GetStatusProgressMonitor(statusText, Stock.StatusBuild, false, true, false, pad));
            return(mon);
        }
Example #3
0
        public IProgressMonitor GetBuildProgressMonitor()
        {
            Pad          pad              = IdeApp.Workbench.GetPad <ErrorListPad> ();
            ErrorListPad errorPad         = (ErrorListPad)pad.Content;
            AggregatedProgressMonitor mon = new AggregatedProgressMonitor(errorPad.GetBuildProgressMonitor());

            mon.AddSlaveMonitor(GetStatusProgressMonitor(GettextCatalog.GetString("Building..."), Stock.BuildCombine, false, true, false, pad));
            return(mon);
        }
Example #4
0
        public static IProgressMonitor GetProgressMonitor(string operation)
        {
            IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor("MonoDevelop.VersionControlOutput", "Version Control", "md-version-control", false, true);
            Pad outPad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor(monitor);

            AggregatedProgressMonitor mon = new AggregatedProgressMonitor(monitor);

            mon.AddSlaveMonitor(IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor(operation, "md-version-control", true, true, false, outPad));
            return(mon);
        }
Example #5
0
        protected internal override void OnExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            if (SingleStartup)
            {
                if (StartupItem == null)
                {
                    monitor.ReportError(GettextCatalog.GetString("Startup item not set"), null);
                    return;
                }
                StartupItem.Execute(monitor, context, configuration);
            }
            else
            {
                List <IAsyncOperation> list = new List <IAsyncOperation> ();
                monitor.BeginTask("Executing projects", 1);

                SynchronizedProgressMonitor syncMonitor = new SynchronizedProgressMonitor(monitor);

                foreach (SolutionEntityItem it in MultiStartupItems)
                {
                    if (!it.CanExecute(context, configuration))
                    {
                        continue;
                    }
                    AggregatedProgressMonitor mon = new AggregatedProgressMonitor();
                    mon.AddSlaveMonitor(syncMonitor, MonitorAction.ReportError | MonitorAction.ReportWarning | MonitorAction.SlaveCancel);
                    list.Add(mon.AsyncOperation);
                    SolutionEntityItem cit = it;

                    Thread t = new Thread(delegate()
                    {
                        try
                        {
                            using (mon)
                            {
                                cit.Execute(mon, context, configuration);
                            }
                        }
                        catch (Exception ex)
                        {
                            LoggingService.LogError("Project execution failed", ex);
                        }
                    });
                    t.Name         = "Project execution";
                    t.IsBackground = true;
                    t.Start();
                }
                foreach (IAsyncOperation op in list)
                {
                    op.WaitForCompleted();
                }

                monitor.EndTask();
            }
        }
 public static IProgressMonitor GetInstrumentedMonitor(IProgressMonitor monitor, TimerCounter counter)
 {
     if (enabled)
     {
         AggregatedProgressMonitor mon = new AggregatedProgressMonitor(monitor);
         mon.AddSlaveMonitor(new IntrumentationMonitor(counter), MonitorAction.Tasks | MonitorAction.WriteLog);
         return(mon);
     }
     else
     {
         return(monitor);
     }
 }
    public static void ShowManager ()
    {
        IProgressMonitor m = Instance != null ? Instance.updateMonitor : null;
        if (m != null && !m.AsyncOperation.IsCompleted)
        {
            AggregatedProgressMonitor monitor = new AggregatedProgressMonitor (m);
            monitor.AddSlaveMonitor (new MessageDialogProgressMonitor (true, true, false));
            monitor.AsyncOperation.WaitForCompleted ();
        }
        HideAlert ();

        AddinManagerWindow.Run (IdeApp.Workbench.RootWindow);
    }
Example #8
0
        public async static void ShowManager()
        {
            Task t = Instance != null ? Instance.currentTask : null;

            if (t != null && t.IsCompleted)
            {
                AggregatedProgressMonitor monitor = new AggregatedProgressMonitor(Instance.updateMonitor);
                monitor.AddSlaveMonitor(new MessageDialogProgressMonitor(true, true, false));
                await t;
            }
            HideAlert();

            AddinManagerWindow.Run(IdeApp.Workbench.RootWindow);
        }
Example #9
0
        /*protected virtual*/ async Task OnExecute(ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            if (SingleStartup)
            {
                if (StartupItem == null)
                {
                    monitor.ReportError(GettextCatalog.GetString("Startup item not set"), null);
                    return;
                }
                await StartupItem.Execute(monitor, context, configuration);
            }
            else
            {
                var tasks    = new List <Task> ();
                var monitors = new List <AggregatedProgressMonitor> ();
                monitor.BeginTask("Executing projects", 1);

                foreach (SolutionItem it in MultiStartupItems)
                {
                    if (!it.CanExecute(context, configuration))
                    {
                        continue;
                    }
                    AggregatedProgressMonitor mon = new AggregatedProgressMonitor();
                    mon.AddSlaveMonitor(monitor, MonitorAction.ReportError | MonitorAction.ReportWarning | MonitorAction.SlaveCancel);
                    monitors.Add(mon);
                    tasks.Add(it.Execute(mon, context, configuration));
                }
                try {
                    await Task.WhenAll(tasks);
                } catch (Exception ex) {
                    LoggingService.LogError("Project execution failed", ex);
                } finally {
                    foreach (var m in monitors)
                    {
                        m.Dispose();
                    }
                }

                monitor.EndTask();
            }
        }
Example #10
0
        public static IProgressMonitor GetProgressMonitor(string operation, VersionControlOperationType op)
        {
            IconId icon;

            switch (op)
            {
            case VersionControlOperationType.Pull: icon = Stock.StatusDownload; break;

            case VersionControlOperationType.Push: icon = Stock.StatusUpload; break;

            default: icon = "md-version-control"; break;
            }

            IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor("MonoDevelop.VersionControlOutput", "Version Control", "md-version-control", false, true);
            Pad outPad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor(monitor);

            AggregatedProgressMonitor mon = new AggregatedProgressMonitor(monitor);

            mon.AddSlaveMonitor(IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor(operation, icon, true, true, false, outPad));
            return(mon);
        }