本文整理汇总了C#中MonoDevelop.Core.ProgressMonitor.ReportSuccess方法的典型用法代码示例。如果您正苦于以下问题:C# ProgressMonitor.ReportSuccess方法的具体用法?C# ProgressMonitor.ReportSuccess怎么用?C# ProgressMonitor.ReportSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Core.ProgressMonitor
的用法示例。
在下文中一共展示了ProgressMonitor.ReportSuccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CleanDone
void CleanDone (ProgressMonitor monitor, IBuildTarget entry, ITimeTracker tt)
{
tt.Trace ("Begin reporting clean result");
try {
monitor.Log.WriteLine ();
monitor.Log.WriteLine (GettextCatalog.GetString ("---------------------- Done ----------------------"));
tt.Trace ("Reporting result");
monitor.ReportSuccess (GettextCatalog.GetString ("Clean successful."));
OnEndClean (monitor, tt);
} finally {
monitor.Dispose ();
tt.End ();
}
}
示例2: BuildDone
void BuildDone (ProgressMonitor monitor, BuildResult result, IBuildTarget entry, ITimeTracker tt)
{
TaskListEntry[] tasks = null;
tt.Trace ("Begin reporting build result");
try {
if (result != null) {
lastResult = result;
monitor.Log.WriteLine ();
monitor.Log.WriteLine (GettextCatalog.GetString ("---------------------- Done ----------------------"));
tt.Trace ("Updating task service");
tasks = new TaskListEntry [result.Errors.Count];
for (int n=0; n<tasks.Length; n++) {
tasks [n] = new TaskListEntry (result.Errors [n]);
tasks [n].Owner = this;
}
TaskService.Errors.AddRange (tasks);
TaskService.Errors.ResetLocationList ();
IdeApp.Workbench.ActiveLocationList = TaskService.Errors;
tt.Trace ("Reporting result");
string errorString = GettextCatalog.GetPluralString("{0} error", "{0} errors", result.ErrorCount, result.ErrorCount);
string warningString = GettextCatalog.GetPluralString("{0} warning", "{0} warnings", result.WarningCount, result.WarningCount);
if (monitor.CancellationToken.IsCancellationRequested) {
monitor.ReportError (GettextCatalog.GetString ("Build canceled."), null);
} else if (result.ErrorCount == 0 && result.WarningCount == 0 && lastResult.FailedBuildCount == 0) {
monitor.ReportSuccess (GettextCatalog.GetString ("Build successful."));
} else if (result.ErrorCount == 0 && result.WarningCount > 0) {
monitor.ReportWarning(GettextCatalog.GetString("Build: ") + errorString + ", " + warningString);
} else if (result.ErrorCount > 0) {
monitor.ReportError(GettextCatalog.GetString("Build: ") + errorString + ", " + warningString, null);
} else {
monitor.ReportError(GettextCatalog.GetString("Build failed."), null);
}
tt.Trace ("End build event");
OnEndBuild (monitor, lastResult.FailedBuildCount == 0, lastResult, entry as SolutionFolderItem);
} else {
tt.Trace ("End build event");
OnEndBuild (monitor, false);
}
tt.Trace ("Showing results pad");
try {
Pad errorsPad = IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> ();
switch (IdeApp.Preferences.ShowErrorPadAfterBuild.Value) {
case BuildResultStates.Always:
if (!errorsPad.Visible)
errorsPad.IsOpenedAutomatically = true;
errorsPad.Visible = true;
errorsPad.BringToFront ();
break;
case BuildResultStates.Never:
break;
case BuildResultStates.OnErrors:
if (TaskService.Errors.Any (task => task.Severity == TaskSeverity.Error))
goto case BuildResultStates.Always;
goto case BuildResultStates.Never;
case BuildResultStates.OnErrorsOrWarnings:
if (TaskService.Errors.Any (task => task.Severity == TaskSeverity.Error || task.Severity == TaskSeverity.Warning))
goto case BuildResultStates.Always;
goto case BuildResultStates.Never;
}
} catch {}
if (tasks != null) {
TaskListEntry jumpTask = null;
switch (IdeApp.Preferences.JumpToFirstErrorOrWarning.Value) {
case JumpToFirst.Error:
jumpTask = tasks.FirstOrDefault (t => t.Severity == TaskSeverity.Error && TaskStore.IsProjectTaskFile (t));
break;
case JumpToFirst.ErrorOrWarning:
jumpTask = tasks.FirstOrDefault (t => (t.Severity == TaskSeverity.Error || t.Severity == TaskSeverity.Warning) && TaskStore.IsProjectTaskFile (t));
break;
}
if (jumpTask != null) {
tt.Trace ("Jumping to first result position");
jumpTask.JumpToPosition ();
}
}
} finally {
monitor.Dispose ();
tt.End ();
}
}
示例3: UpdateCompleted
static bool UpdateCompleted (ProgressMonitor monitor,
ProjectFile file, ProjectFile genFile, SingleFileCustomToolResult result,
bool runMultipleFiles)
{
monitor.EndTask ();
if (monitor.CancellationToken.IsCancellationRequested) {
monitor.ReportError (GettextCatalog.GetString ("Cancelled"), null);
monitor.Dispose ();
return false;
}
string genFileName;
try {
bool broken = false;
if (result.UnhandledException != null) {
broken = true;
string msg = GettextCatalog.GetString ("The '{0}' code generator crashed", file.Generator);
result.Errors.Add (new CompilerError (file.Name, 0, 0, "", msg + ": " + result.UnhandledException.Message));
monitor.ReportError (msg, result.UnhandledException);
LoggingService.LogError (msg, result.UnhandledException);
}
genFileName = result.GeneratedFilePath.IsNullOrEmpty?
null : result.GeneratedFilePath.ToRelative (file.FilePath.ParentDirectory);
if (!string.IsNullOrEmpty (genFileName)) {
bool validName = genFileName.IndexOfAny (new [] { '/', '\\' }) < 0
&& FileService.IsValidFileName (genFileName);
if (!broken && !validName) {
broken = true;
string msg = GettextCatalog.GetString ("The '{0}' code generator output invalid filename '{1}'",
file.Generator, result.GeneratedFilePath);
result.Errors.Add (new CompilerError (file.Name, 0, 0, "", msg));
monitor.ReportError (msg, null);
}
}
if (result.Errors.Count > 0) {
DispatchService.GuiDispatch (delegate {
foreach (CompilerError err in result.Errors)
TaskService.Errors.Add (new TaskListEntry (file.FilePath, err.ErrorText, err.Column, err.Line,
err.IsWarning? TaskSeverity.Warning : TaskSeverity.Error,
TaskPriority.Normal, file.Project.ParentSolution, file));
});
}
if (broken)
return true;
if (!runMultipleFiles) {
if (result.Success)
monitor.ReportSuccess ("Generated file successfully.");
else if (result.SuccessWithWarnings)
monitor.ReportSuccess ("Warnings in file generation.");
else
monitor.ReportError ("Errors in file generation.", null);
}
} finally {
if (!runMultipleFiles)
monitor.Dispose ();
}
if (result.GeneratedFilePath.IsNullOrEmpty || !File.Exists (result.GeneratedFilePath))
return true;
// broadcast a change event so text editors etc reload the file
FileService.NotifyFileChanged (result.GeneratedFilePath);
// add file to project, update file properties, etc
Gtk.Application.Invoke (async delegate {
bool projectChanged = false;
if (genFile == null) {
genFile = file.Project.AddFile (result.GeneratedFilePath, result.OverrideBuildAction);
projectChanged = true;
} else if (result.GeneratedFilePath != genFile.FilePath) {
genFile.Name = result.GeneratedFilePath;
projectChanged = true;
}
if (file.LastGenOutput != genFileName) {
file.LastGenOutput = genFileName;
projectChanged = true;
}
if (genFile.DependsOn != file.FilePath.FileName) {
genFile.DependsOn = file.FilePath.FileName;
projectChanged = true;
}
if (projectChanged)
await IdeApp.ProjectOperations.SaveAsync (file.Project);
});
return true;
}
示例4: RestorePackages
void RestorePackages (ProgressMonitor progressMonitor, ProgressMonitorStatusMessage progressMessage)
{
var msbuildTargetsMonitor = new MSBuildTargetsRestoredMonitor (packageManagementEvents);
using (msbuildTargetsMonitor) {
var action = new RestorePackagesAction (solution, packageManagementEvents);
if (project != null) {
action.Project = project;
}
action.Execute ();
}
RefreshProjectReferences (msbuildTargetsMonitor.AnyMSBuildTargetsRestored);
ForceCreationOfSharedRepositoriesConfigFile ();
progressMonitor.ReportSuccess (progressMessage.Success);
packageManagementEvents.OnPackagesRestored ();
}
示例5: Push
public void Push (ProgressMonitor monitor, string remote, string remoteBranch)
{
bool success = true;
var branch = RootRepository.Head;
if (branch.TrackedBranch == null) {
RootRepository.Branches.Update (branch, b => b.TrackedBranch = "refs/remotes/" + remote + "/" + remoteBranch);
}
RetryUntilSuccess (monitor, credType =>
RootRepository.Network.Push (RootRepository.Network.Remotes [remote], "refs/heads/" + remoteBranch, new PushOptions {
OnPushStatusError = pushStatusErrors => success = false,
CredentialsProvider = (url, userFromUrl, types) => GitCredentials.TryGet (url, userFromUrl, types, credType)
})
);
if (!success)
return;
monitor.ReportSuccess (GettextCatalog.GetString ("Push operation successfully completed."));
}
示例6: WriteSummaryResults
static void WriteSummaryResults (ProgressMonitor monitor, int succeeded, int warnings, int errors)
{
monitor.Log.WriteLine ();
int total = succeeded + warnings + errors;
//this might not be correct for languages where pluralization affects the other arguments
//but gettext doesn't really have an answer for sentences with multiple plurals
monitor.Log.WriteLine (
GettextCatalog.GetPluralString (
"{0} file processed total. {1} generated successfully, {2} with warnings, {3} with errors",
"{0} files processed total. {1} generated successfully, {2} with warnings, {3} with errors",
total,
total, succeeded, warnings, errors)
);
//ends the root task
monitor.EndTask ();
if (errors > 0)
monitor.ReportError (GettextCatalog.GetString ("Errors in file generation."), null);
else if (warnings > 0)
monitor.ReportSuccess (GettextCatalog.GetString ("Warnings in file generation."));
else
monitor.ReportSuccess (GettextCatalog.GetString ("Generated files successfully."));
monitor.Dispose ();
}
示例7: AddXwtFromGithubAsync
//.........这里部分代码省略.........
monitor.Step (1);
var xwt_gtk3_proj = solution.FindProjectByName ("Xwt.Gtk3") ??
await IdeApp.ProjectOperations.AddSolutionItem (
xwt_folder,
xwt_path.Combine ("Xwt.Gtk", "Xwt.Gtk3.csproj")
) as DotNetProject;
monitor.Step (1);
var xwt_wpf_proj = solution.FindProjectByName ("Xwt.WPF") ??
await IdeApp.ProjectOperations.AddSolutionItem (
xwt_folder,
xwt_path.Combine ("Xwt.WPF", "Xwt.WPF.csproj")
) as DotNetProject;
monitor.Step (1);
var xwt_mac_proj = solution.FindProjectByName ("Xwt.Mac") ??
await IdeApp.ProjectOperations.AddSolutionItem (
xwt_folder,
xwt_path.Combine ("Xwt.Mac", "Xwt.Mac.csproj")
) as DotNetProject;
monitor.Step (1);
var xwt_xammac_proj = solution.FindProjectByName ("Xwt.XamMac") ??
await IdeApp.ProjectOperations.AddSolutionItem (
xwt_folder,
xwt_path.Combine ("Xwt.XamMac", "Xwt.XamMac.csproj")
) as DotNetProject;
monitor.EndTask ();
monitor.Step (1);
monitor.BeginTask ("Adding Xwt References...", solution.Items.Count);
foreach (var item in solution.Items) {
var project = item as DotNetProject;
if (project != null) {
if (project.Name == newProjectName ||
project.Name.StartsWith (newProjectName + ".", StringComparison.Ordinal))
project.References.Add (ProjectReference.CreateProjectReference (xwt_proj));
if (project.Name == newProjectName + ".Desktop") {
if (Platform.IsWindows) {
project.References.Add (ProjectReference.CreateProjectReference (xwt_wpf_proj));
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_proj));
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_win_proj));
} else if (Platform.IsLinux) {
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_proj));
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk3_proj));
} else if (Platform.IsMac) {
project.References.Add (ProjectReference.CreateProjectReference (xwt_xammac_proj));
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_proj));
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_mac_proj));
}
}
if (project.Name == newProjectName + ".Gtk2") {
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_proj));
if (Platform.IsWindows) {
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_win_proj));
} else if (Platform.IsMac) {
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_mac_proj));
}
}
if (project.Name == newProjectName + ".Wpf") {
project.References.Add (ProjectReference.CreateProjectReference (xwt_wpf_proj));
}
if (project.Name == newProjectName + ".Gtk3") {
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk3_proj));
}
if (project.Name == newProjectName + ".Mac") {
project.References.Add (ProjectReference.CreateProjectReference (xwt_mac_proj));
}
if (project.Name == newProjectName + ".XamMac") {
project.References.Add (ProjectReference.CreateProjectReference (xwt_xammac_proj));
}
}
monitor.Step (1);
}
monitor.EndTask ();
monitor.EndTask ();
monitor.ReportSuccess ("Xwt Repository initialized successfully");
await IdeApp.Workspace.SaveAsync (monitor);
} catch (Exception e) {
string msg = GettextCatalog.GetString ("Adding Xwt reference failed: ");
monitor.ReportError (msg, e);
MessageService.ShowError (msg, e);
} finally {
monitor.Dispose ();
}
}
示例8: OnClean
protected async override Task<BuildResult> OnClean (ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext)
{
if (data == null || !data.SupportsIntegration || String.IsNullOrEmpty (data.CleanTargetName)) {
return await base.OnClean (monitor, configuration, operationContext);
}
monitor.BeginTask ( GettextCatalog.GetString( "Cleaning project"), 1);
try
{
string baseDir = Project.BaseDirectory;
ProcessWrapper process = Runtime.ProcessService.StartProcess ( "make",
data.CleanTargetName,
baseDir,
monitor.Log,
monitor.Log,
null );
await process.Task;
if ( process.ExitCode > 0 )
throw new Exception ( GettextCatalog.GetString ("An unspecified error occurred while running '{0}'", "make " + data.CleanTargetName) );
monitor.Step ( 1 );
}
catch ( Exception e )
{
monitor.ReportError ( GettextCatalog.GetString ("Project could not be cleaned: "), e );
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.CreateSuccess ();
}
示例9: BuildDone
void BuildDone (ProgressMonitor monitor, BuildResult result, IBuildTarget entry, ITimeTracker tt)
{
TaskListEntry[] tasks = null;
tt.Trace ("Begin reporting build result");
try {
if (result != null) {
lastResult = result;
monitor.Log.WriteLine ();
monitor.Log.WriteLine (GettextCatalog.GetString ("---------------------- Done ----------------------"));
tt.Trace ("Updating task service");
tasks = ReportErrors (result);
tt.Trace ("Reporting result");
string errorString = GettextCatalog.GetPluralString("{0} error", "{0} errors", result.ErrorCount, result.ErrorCount);
string warningString = GettextCatalog.GetPluralString("{0} warning", "{0} warnings", result.WarningCount, result.WarningCount);
if (monitor.CancellationToken.IsCancellationRequested) {
monitor.ReportError (GettextCatalog.GetString ("Build canceled."), null);
} else if (result.ErrorCount == 0 && result.WarningCount == 0 && lastResult.FailedBuildCount == 0) {
monitor.ReportSuccess (GettextCatalog.GetString ("Build successful."));
} else if (result.ErrorCount == 0 && result.WarningCount > 0) {
monitor.ReportWarning(GettextCatalog.GetString("Build: ") + errorString + ", " + warningString);
} else if (result.ErrorCount > 0) {
monitor.ReportError(GettextCatalog.GetString("Build: ") + errorString + ", " + warningString, null);
} else {
monitor.ReportError(GettextCatalog.GetString("Build failed."), null);
}
tt.Trace ("End build event");
OnEndBuild (monitor, lastResult.FailedBuildCount == 0, lastResult, entry as SolutionFolderItem);
} else {
tt.Trace ("End build event");
OnEndBuild (monitor, false);
}
tt.Trace ("Showing results pad");
ShowErrorsPadIfNecessary ();
if (tasks != null) {
TaskListEntry jumpTask = null;
switch (IdeApp.Preferences.JumpToFirstErrorOrWarning.Value) {
case JumpToFirst.Error:
jumpTask = tasks.FirstOrDefault (t => t.Severity == TaskSeverity.Error && TaskStore.IsProjectTaskFile (t));
break;
case JumpToFirst.ErrorOrWarning:
jumpTask = tasks.FirstOrDefault (t => (t.Severity == TaskSeverity.Error || t.Severity == TaskSeverity.Warning) && TaskStore.IsProjectTaskFile (t));
break;
}
if (jumpTask != null) {
tt.Trace ("Jumping to first result position");
jumpTask.JumpToPosition ();
}
}
} finally {
monitor.Dispose ();
tt.End ();
}
}
示例10: CheckForPackageUpdates
void CheckForPackageUpdates (
ProgressMonitor progressMonitor,
ProgressMonitorStatusMessage progressMessage,
PackageUpdatesEventMonitor eventMonitor)
{
updatedPackagesInSolution.CheckForUpdates ();
if (updatedPackagesInSolution.AnyUpdates ()) {
progressMonitor.ReportSuccess (GettextCatalog.GetString ("Package updates are available."));
} else if (eventMonitor.WarningReported) {
progressMonitor.ReportWarning (progressMessage.Warning);
} else {
progressMonitor.ReportSuccess (progressMessage.Success);
}
}
示例11: CleanDone
void CleanDone (ProgressMonitor monitor, BuildResult result, IBuildTarget entry, ITimeTracker tt)
{
tt.Trace ("Begin reporting clean result");
try {
if (result != null) {
monitor.Log.WriteLine ();
monitor.Log.WriteLine (GettextCatalog.GetString ("---------------------- Done ----------------------"));
tt.Trace ("Updating task service");
ReportErrors (result);
tt.Trace ("Reporting result");
string errorString = GettextCatalog.GetPluralString ("{0} error", "{0} errors", result.ErrorCount, result.ErrorCount);
string warningString = GettextCatalog.GetPluralString ("{0} warning", "{0} warnings", result.WarningCount, result.WarningCount);
if (monitor.CancellationToken.IsCancellationRequested) {
monitor.ReportError (GettextCatalog.GetString ("Clean canceled."), null);
} else if (result.ErrorCount == 0 && result.WarningCount == 0 && result.FailedBuildCount == 0) {
monitor.ReportSuccess (GettextCatalog.GetString ("Clean successful."));
} else if (result.ErrorCount == 0 && result.WarningCount > 0) {
monitor.ReportWarning (GettextCatalog.GetString ("Clean: ") + errorString + ", " + warningString);
} else if (result.ErrorCount > 0) {
monitor.ReportError (GettextCatalog.GetString ("Clean: ") + errorString + ", " + warningString, null);
} else {
monitor.ReportError (GettextCatalog.GetString ("Clean failed."), null);
}
}
OnEndClean (monitor, tt);
tt.Trace ("Showing results pad");
ShowErrorsPadIfNecessary ();
} finally {
monitor.Dispose ();
tt.End ();
}
}
示例12: AddNewTranslation
public Translation AddNewTranslation (string isoCode, ProgressMonitor monitor)
{
try {
Translation tr = new Translation (this, isoCode);
translations.Add (tr);
string templateFile = Path.Combine (this.BaseDirectory, "messages.po");
string translationFile = GetFileName (isoCode);
if (!File.Exists (templateFile))
CreateDefaultCatalog (monitor);
File.Copy (templateFile, translationFile);
monitor.ReportSuccess (String.Format (GettextCatalog.GetString ("Language '{0}' successfully added."), isoCode));
monitor.Step (1);
SaveAsync (monitor);
return tr;
} catch (Exception e) {
monitor.ReportError (String.Format ( GettextCatalog.GetString ("Language '{0}' could not be added: "), isoCode), e);
return null;
} finally {
monitor.EndTask ();
}
}
示例13: SaveModule
public void SaveModule(FilePath file, ProgressMonitor monitor)
{
try {
monitor.BeginTask ("Saving module " + latestModuleInfo.Name + "...", 1);
monitor.BeginStep();
if (this.SingleStartup) {
latestModuleInfo.DefaultStartupProject = this.StartupItem.Name;
}
appDomain.SaveModule (latestModuleInfo);
}
catch (Exception ex) {
monitor.ReportError ("Failed to save module " + latestModuleInfo.Name, ex);
throw;
}
finally {
monitor.ReportSuccess ("Saved module " + latestModuleInfo.Name);
monitor.EndTask ();
}
DefinitionOrModuleSaved();
}
示例14: GenerateFiles
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 );
try
{
solution_dir = Path.GetDirectoryName(solution.FileName);
string[] configs = new string [ solution.Configurations.Count ];
for (int ii=0; ii < configs.Length; ii++ )
configs [ii] = solution.Configurations[ii].Id;
MakefileType mt = generateAutotools ? MakefileType.AutotoolsMakefile : MakefileType.SimpleMakefile;
context = new AutotoolsContext ( ctx, solution_dir, configs, mt );
context.TargetSolution = solution;
context.Switches = switchs;
IMakefileHandler handler = AutotoolsContext.GetMakefileHandler (solution.RootFolder, mt);
if (handler == null)
throw new Exception (string.Format (
"{0} does not currently support generating {1} for one (or more) child projects.",
filesString, BrandingService.ApplicationName
));
solution_name = solution.Name;
solution_version = AutotoolsContext.EscapeStringForAutoconf (solution.Version, true);
if (string.IsNullOrEmpty (solution_version))
solution_version = "0.1";
Makefile makefile = handler.Deploy ( context, solution.RootFolder, monitor );
string path = Path.Combine (solution_dir, "Makefile");
if (generateAutotools) {
context.AddAutoconfFile (path);
CreateAutoGenDotSH (context, monitor);
CreateConfigureDotAC (solution, defaultConf, monitor, context);
CreateMacros ();
} else {
CreateConfigureScript (solution, defaultConf, context, monitor);
monitor.Log.WriteLine ( GettextCatalog.GetString ("Creating rules.make"));
string rules_make_path = Path.Combine (solution_dir, "rules.make");
File.Copy (Path.Combine (context.TemplateDir, "rules.make"), rules_make_path, true);
context.AddGeneratedFile (rules_make_path);
}
CreateMakefileInclude ( context, monitor );
AddTopLevelMakefileVars ( makefile, monitor );
if (generateAutotools)
path = path + ".am";
StreamWriter writer = new StreamWriter (path);
makefile.Write ( writer );
writer.Close ();
context.AddGeneratedFile (path);
monitor.ReportSuccess ( GettextCatalog.GetString ("{0} were successfully generated.", filesString ) );
monitor.Step (1);
}
catch ( Exception e )
{
monitor.ReportError ( GettextCatalog.GetString ("{0} could not be generated: ", filesString ), e );
LoggingService.LogError (GettextCatalog.GetString ("{0} could not be generated: ", filesString ), e);
DeleteGeneratedFiles ( context );
return false;
}
finally
{
monitor.EndTask ();
}
return true;
}
示例15: Deploy
public bool Deploy ( DeployContext ctx, Solution solution, string defaultConf, string targetDir, bool generateFiles, ProgressMonitor monitor )
{
if (generateFiles) {
if ( !GenerateFiles ( ctx, solution, defaultConf, monitor ) )
return false;
}
monitor.BeginTask ( GettextCatalog.GetString( "Deploying Solution to Tarball" ) , 3 );
try
{
string baseDir = Path.GetDirectoryName ( solution.FileName);
ProcessWrapper ag_process = Runtime.ProcessService.StartProcess ( "sh",
generateAutotools ? "autogen.sh" : "configure",
baseDir,
monitor.Log,
monitor.Log,
null );
ag_process.WaitForOutput ();
if ( ag_process.ExitCode > 0 )
throw new Exception ( GettextCatalog.GetString ("An unspecified error occurred while running '{0}'", generateAutotools ? "autogen.sh" : "configure") );
monitor.Step ( 1 );
using (var sw = new StringWriter ()) {
using (var chainedOutput = new LogTextWriter ()) {
chainedOutput.ChainWriter (monitor.Log);
chainedOutput.ChainWriter (sw);
using (ProcessWrapper process = Runtime.ProcessService.StartProcess ("make",
"dist",
baseDir,
chainedOutput,
monitor.Log,
null)) {
process.WaitForOutput ();
chainedOutput.UnchainWriter (monitor.Log);
chainedOutput.UnchainWriter (sw);
if ( process.ExitCode > 0 )
throw new Exception ( GettextCatalog.GetString ("An unspecified error occurred while running '{0}'", "make dist") );
}
monitor.Step ( 1 );
// FIXME: hackish way to get the created tarball's filename
string output = sw.ToString();
int targz = output.LastIndexOf ( "tar.gz" );
int begin = output.LastIndexOf ( '>', targz );
string filename = output.Substring ( begin + 1, (targz - begin) + 5 ).Trim ();
FileService.CopyFile (Path.Combine (baseDir, filename), Path.Combine (targetDir, filename));
monitor.Step ( 1 );
}
}
}
catch ( Exception e )
{
monitor.ReportError ( GettextCatalog.GetString ("Solution could not be deployed: "), e );
return false;
}
finally
{
monitor.EndTask ();
}
monitor.ReportSuccess (GettextCatalog.GetString ("Solution was successfully deployed."));
return true;
}