Пример #1
0
        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));
        }
Пример #2
0
 void ReportMessageInternal(string message)
 {
     if (combinedBuildFeedbackSink != null)
     {
         combinedBuildFeedbackSink.ReportMessage(message);
     }
 }
            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);
                    }
                }
            }
Пример #4
0
            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 string[, ] {
                            { "Name", p.Name }
                        })
                            );
                        feedbackSink.Done(true);
                    }
                    else
                    {
                        lastCompilationPass = factory.CurrentPass;
                        wrapped.StartBuild(buildOptions, new BuildFeedbackSink(p, feedbackSink, factory.CurrentPass));
                    }
                }
            }
Пример #5
0
        void Write(string text)
        {
            // ReportMessage takes full lines, so we have to put stuff into a buffer until we get a whole line
            int sendUpTo        = text.LastIndexOf('\n');
            int oldBufferLength = buffer.Length;

            buffer.Append(text);
            if (sendUpTo >= 0)
            {
                sendUpTo += oldBufferLength;
                Debug.Assert(buffer[sendUpTo] == '\n');
                int terminatorLength = 1;
                if (sendUpTo > 0 && buffer[sendUpTo - 1] == '\r')
                {
                    sendUpTo--;
                    terminatorLength++;
                }
                feedbackSink.ReportMessage(buffer.ToString(0, sendUpTo));
                buffer.Remove(0, sendUpTo + terminatorLength);
            }
        }
			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));
					}
				}
			}
Пример #7
0
		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 void ReportMessage(string message)
 {
     sink.ReportMessage(message);
 }
			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;
					}
				}
			}
Пример #10
0
 public void OutputText(string message)
 {
     feedbackSink.ReportMessage(message);
 }
Пример #11
0
        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);
        }
Пример #12
0
        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();
        }