public SDConsoleLogger(IBuildFeedbackSink feedbackSink, LoggerVerbosity verbosity) : base(verbosity) { if (feedbackSink == null) throw new ArgumentNullException("feedbackSink"); this.feedbackSink = feedbackSink; this.ShowSummary = false; base.WriteHandler = Write; }
public override Task<bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor) { if (this.MinimumSolutionVersion == SolutionFormatVersion.VS2005) { return SD.MSBuildEngine.BuildAsync( this, options, feedbackSink, progressMonitor.CancellationToken, new [] { Path.Combine(FileUtility.ApplicationRootPath, @"bin\SharpDevelop.CheckMSBuild35Features.targets") }); } else { return base.BuildAsync(options, feedbackSink, progressMonitor); } }
internal MSBuildEngineWorker(IMSBuildEngine parentBuildEngine, IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, List<string> additionalTargetFiles) { this.parentBuildEngine = parentBuildEngine; this.project = project; this.projectFileName = project.FileName; this.projectMinimumSolutionVersion = project.MinimumSolutionVersion; this.options = options; this.feedbackSink = feedbackSink; this.additionalTargetFiles = additionalTargetFiles; }
public override void StartBuild(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink) { if (this.MinimumSolutionVersion == Solution.SolutionVersionVS2005) { MSBuildEngine.StartBuild(this, options, feedbackSink, MSBuildEngine.AdditionalTargetFiles.Concat( new [] { Path.Combine(MSBuildEngine.SharpDevelopBinPath, "SharpDevelop.CheckMSBuild35Features.targets") })); } else { base.StartBuild(options, feedbackSink); } }
public static void StartBuild(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IEnumerable<string> additionalTargetFiles) { if (project == null) throw new ArgumentNullException("project"); if (options == null) throw new ArgumentNullException("options"); if (feedbackSink == null) throw new ArgumentNullException("feedbackSink"); if (additionalTargetFiles == null) throw new ArgumentNullException("additionalTargetFiles"); MSBuildEngine engine = new MSBuildEngine(project, options, feedbackSink); engine.additionalTargetFiles = additionalTargetFiles; engine.StartBuild(); }
public Task<bool> BuildAsync(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, CancellationToken cancellationToken, IEnumerable<string> additionalTargetFiles) { if (project == null) throw new ArgumentNullException("project"); if (options == null) throw new ArgumentNullException("options"); if (feedbackSink == null) throw new ArgumentNullException("feedbackSink"); var additionalTargetFileList = additionalTargetFiles != null ? additionalTargetFiles.ToList() : new List<string>(); if (project.MinimumSolutionVersion >= SolutionFormatVersion.VS2010) { additionalTargetFileList.Add(Path.Combine(Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location), "SharpDevelop.TargetingPack.targets")); } var engine = new MSBuildEngineWorker(this, project, options, feedbackSink, additionalTargetFileList); return engine.RunBuildAsync(cancellationToken); }
/// <summary> /// Starts to run a build. /// </summary> /// <param name="project">The project/solution to build</param> /// <param name="options">The build options that should be used</param> /// <param name="buildFeedbackSink">The build feedback sink that receives the build output. /// The output is nearly sent "as it comes in": sometimes output must wait because the BuildEngine /// will ensure that output from two projects building in parallel isn't interleaved.</param> /// <param name="progressMonitor">The progress monitor that receives build progress. The monitor will be disposed /// when the build completes.</param> public static Task<BuildResults> BuildAsync(IBuildable project, BuildOptions options, IBuildFeedbackSink buildFeedbackSink, IProgressMonitor progressMonitor) { if (project == null) throw new ArgumentNullException("project"); if (options == null) throw new ArgumentNullException("options"); BuildEngine engine = new BuildEngine(options, project); engine.buildStart = DateTime.Now; engine.combinedBuildFeedbackSink = buildFeedbackSink; engine.progressMonitor = progressMonitor; try { engine.rootNode = engine.CreateBuildGraph(project); } catch (CyclicDependencyException ex) { BuildError error; if (ex.Project1 != null && ex.Project2 != null) error = new BuildError(null, "Cyclic dependency between " + ex.Project1.Name + " and " + ex.Project2.Name); else error = new BuildError(null, "Cyclic dependency"); engine.results.Add(error); if (engine.combinedBuildFeedbackSink != null) { engine.combinedBuildFeedbackSink.ReportError(error); engine.combinedBuildFeedbackSink.ReportMessage(error.ToRichText()); } engine.results.Result = BuildResultCode.BuildFileError; engine.ReportDone(); return engine.tcs.Task; } engine.workersToStart = options.ParallelProjectCount; if (engine.workersToStart < 1) engine.workersToStart = 1; engine.cancellationRegistration = engine.progressMonitor.CancellationToken.Register(engine.BuildCancelled); engine.ReportMessageLine("${res:MainWindow.CompilerMessages.BuildStarted}"); engine.StartBuildProjects(); engine.UpdateProgressTaskName(); return engine.tcs.Task; }
/// <summary> /// Starts to run a build. /// </summary> /// <param name="project">The project/solution to build</param> /// <param name="options">The build options that should be used</param> /// <param name="realtimeBuildFeedbackSink">The build feedback sink that receives the build output. /// The output is nearly sent "as it comes in": sometimes output must wait because the BuildEngine /// will ensure that output from two projects building in parallel isn't interleaved.</param> /// <param name="progressMonitor">The progress monitor that receives build progress. The monitor will be disposed /// when the build completes.</param> public static void StartBuild(IBuildable project, BuildOptions options, IBuildFeedbackSink realtimeBuildFeedbackSink) { if (project == null) throw new ArgumentNullException("solution"); if (options == null) throw new ArgumentNullException("options"); Solution solution = project.ParentSolution; if (solution == null) throw new ArgumentException("project.ParentSolution must not be null", "project"); if (string.IsNullOrEmpty(options.SolutionConfiguration)) options.SolutionConfiguration = solution.Preferences.ActiveConfiguration; if (string.IsNullOrEmpty(options.SolutionPlatform)) options.SolutionPlatform = solution.Preferences.ActivePlatform; BuildEngine engine = new BuildEngine(options, project); engine.buildStart = DateTime.Now; engine.combinedBuildFeedbackSink = realtimeBuildFeedbackSink; engine.progressMonitor = realtimeBuildFeedbackSink.ProgressMonitor; try { engine.rootNode = engine.CreateBuildGraph(project); } catch (CyclicDependencyException ex) { if (ex.Project1 != null && ex.Project2 != null) engine.results.Add(new BuildError(null, "Cyclic dependency between " + ex.Project1.Name + " and " + ex.Project2.Name)); else engine.results.Add(new BuildError(null, "Cyclic dependency")); engine.results.Result = BuildResultCode.BuildFileError; engine.ReportDone(); return; } engine.workersToStart = options.ParallelProjectCount; if (engine.workersToStart < 1) engine.workersToStart = 1; engine.cancellationRegistration = engine.progressMonitor.CancellationToken.Register(engine.BuildCancelled); engine.ReportMessageLine("${res:MainWindow.CompilerMessages.BuildStarted}"); engine.StartBuildProjects(); engine.UpdateProgressTaskName(); }
public void StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink) { }
public override void StartBuild(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink) { string productDir = GetPathFromRegistry(@"SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VC", "ProductDir"); string batFile = "vcvars32.bat"; if (options.Platform == "x64") { batFile = "vcvars64.bat"; } string commonTools = GetFile(productDir != null ? Path.Combine(productDir, "bin\\" + batFile) : null) ?? GetFile("%VS90COMNTOOLS%\\" + batFile) ?? GetFile("%VS80COMNTOOLS%\\" + batFile); Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.Arguments = "/C"; if (!string.IsNullOrEmpty(commonTools)) { p.StartInfo.Arguments += " call \"" + commonTools + "\" &&"; } p.StartInfo.Arguments += " vcbuild"; if (options.Target == BuildTarget.Build) { // OK } else if (options.Target == BuildTarget.Clean) { p.StartInfo.Arguments += " /clean"; } else if (options.Target == BuildTarget.Rebuild) { p.StartInfo.Arguments += " /rebuild"; } p.StartInfo.Arguments += " /showenv"; p.StartInfo.Arguments += " \"" + this.FileName + "\""; p.StartInfo.Arguments += " \"/error:Error: \""; p.StartInfo.Arguments += " \"/warning:Warning: \""; p.StartInfo.WorkingDirectory = this.Directory; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; p.StartInfo.UseShellExecute = false; p.StartInfo.EnvironmentVariables["VCBUILD_DEFAULT_CFG"] = options.Configuration + "|" + options.Platform; p.StartInfo.EnvironmentVariables["SolutionPath"] = ParentSolution.FileName; p.EnableRaisingEvents = true; p.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) { if (!string.IsNullOrEmpty(e.Data)) { BuildError error = ParseError(e.Data); if (error != null) feedbackSink.ReportError(error); else feedbackSink.ReportMessage(e.Data); } }; p.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e) { if (!string.IsNullOrEmpty(e.Data)) { BuildError error = ParseError(e.Data); if (error != null) feedbackSink.ReportError(error); else feedbackSink.ReportError(new BuildError(null, e.Data)); } }; p.Exited += delegate(object sender, EventArgs e) { p.CancelErrorRead(); p.CancelOutputRead(); feedbackSink.Done(p.ExitCode == 0); p.Dispose(); }; feedbackSink.ReportMessage("Building " + this.Name); feedbackSink.ReportMessage(p.StartInfo.FileName + " " + p.StartInfo.Arguments); p.Start(); p.BeginOutputReadLine(); p.BeginErrorReadLine(); }
public virtual void StartBuild(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink) { feedbackSink.ReportError(new BuildError { ErrorText = "Building project " + Name + " is not supported.", IsWarning = true }); // we don't know how to build anything, report that we're done. feedbackSink.Done(true); }
public async Task<bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor) { IProject p = wrapped as IProject; if (p == null) { return await wrapped.BuildAsync(options, feedbackSink, progressMonitor); } else { lock (service.unmodifiedProjects) { if (!service.unmodifiedProjects.TryGetValue(p, out lastCompilationPass)) { lastCompilationPass = null; } } if (lastCompilationPass != null && factory.Setting == BuildDetection.BuildModifiedAndDependent) { lock (cachedBuildDependencies) { var dependencies = options != null ? cachedBuildDependencies[options] : cachedBuildDependenciesForNullOptions; if (dependencies.OfType<Wrapper>().Any(w=>w.WasRecompiledAfter(lastCompilationPass))) { lastCompilationPass = null; } } } if (lastCompilationPass != null) { feedbackSink.ReportMessage( StringParser.Parse("${res:MainWindow.CompilerMessages.SkipProjectNoChanges}", new StringTagPair("Name", p.Name)) ); return true; } else { lastCompilationPass = factory.CurrentPass; var success = await wrapped.BuildAsync(options, feedbackSink, progressMonitor); if (success) { lock (service.unmodifiedProjects) { service.unmodifiedProjects[p] = factory.CurrentPass; } } return success; } } }
private MSBuildEngine(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink) { this.project = project; this.options = options; this.feedbackSink = feedbackSink; }
public Task<bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor) { // SharpDevelop already has built our dependencies, so we're done immediately. return Task.FromResult(true); }
public Task<BuildResults> BuildInBackgroundAsync(IBuildable buildable, BuildOptions options, IBuildFeedbackSink buildFeedbackSink, IProgressMonitor progressMonitor) { return BuildEngine.BuildAsync(buildable, options, buildFeedbackSink, progressMonitor); }
private MSBuildEngine(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink) { this.projectFileName = project.FileName; this.projectMinimumSolutionVersion = project.MinimumSolutionVersion; this.options = options; this.feedbackSink = feedbackSink; }
public void StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink) { IProject p = wrapped as IProject; if (p == null) { wrapped.StartBuild(buildOptions, feedbackSink); } else { lock (unmodifiedProjects) { if (!unmodifiedProjects.TryGetValue(p, out lastCompilationPass)) { lastCompilationPass = null; } } if (lastCompilationPass != null && Setting == BuildOnExecuteSetting.BuildModifiedAndDependent) { lock (cachedBuildDependencies) { var dependencies = buildOptions != null ? cachedBuildDependencies[buildOptions] : cachedBuildDependenciesForNullOptions; if (dependencies.OfType<Wrapper>().Any(w=>w.WasRecompiledAfter(lastCompilationPass))) { lastCompilationPass = null; } } } if (lastCompilationPass != null) { feedbackSink.ReportMessage( StringParser.Parse("${res:MainWindow.CompilerMessages.SkipProjectNoChanges}", new StringTagPair("Name", p.Name)) ); feedbackSink.Done(true); } else { lastCompilationPass = factory.CurrentPass; wrapped.StartBuild(buildOptions, new BuildFeedbackSink(p, feedbackSink, factory.CurrentPass)); } } }
public override Task<bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor) { return SD.MSBuildEngine.BuildAsync(this, options, feedbackSink, progressMonitor.CancellationToken); }
void IBuildable.StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink) { // building a solution finishes immediately: we only care for the dependencies feedbackSink.Done(true); }
public override Task<bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor) { bool success = false; if (!VB6Helper.GetIsVB6Available()) { feedbackSink.ReportError(new BuildError("", "Cannot locate VB6.EXE. Please make sure that you have entered the correct path to the VB6-directory under 'Tools -> VB6'.")); } else { feedbackSink.ReportMessage(new RichText("Building the project using VB6.EXE...")); var result = VB6Helper.MakeProject(_vbProject); string[] errors = result.Results; if (errors.Length == 0) { feedbackSink.ReportMessage(new RichText("Building with VB6.EXE completed successfully!")); success = true; } else { foreach (string error in errors) { if (!string.IsNullOrWhiteSpace(error)) { feedbackSink.ReportError(new BuildError("", error)); } } } } return Task.FromResult(success); }
public BuildFeedbackSink(IProject p, IBuildFeedbackSink sink, CompilationPass currentPass) { Debug.Assert(p != null); Debug.Assert(sink != null); Debug.Assert(currentPass != null); this.project = p; this.sink = sink; this.currentPass = currentPass; }
public void StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink) { throw new NotImplementedException(); }
public static void StartBuild(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IEnumerable<string> additionalTargetFiles) { if (project == null) throw new ArgumentNullException("project"); if (options == null) throw new ArgumentNullException("options"); if (feedbackSink == null) throw new ArgumentNullException("feedbackSink"); if (additionalTargetFiles == null) throw new ArgumentNullException("additionalTargetFiles"); MSBuildEngine engine = new MSBuildEngine(project, options, feedbackSink); engine.additionalTargetFiles = additionalTargetFiles.ToList(); if (project.MinimumSolutionVersion >= Solution.SolutionVersionVS2010) { engine.additionalTargetFiles.Add(Path.Combine(Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location), "SharpDevelop.TargetingPack.targets")); } engine.StartBuild(); }
public Task<bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor) { return Task.FromResult(true); }
public override void StartBuild(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink) { MSBuildEngine.StartBuild(this, options, feedbackSink, MSBuildEngine.AdditionalTargetFiles); }
public void StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink) { // SharpDevelop already has built our dependencies, so we're done immediately. feedbackSink.Done(true); }