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)); }
public virtual IEnumerable <IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { lock (SyncRoot) { List <IBuildable> result = new List <IBuildable>(); foreach (SolutionSection section in this.ProjectSections) { if (section.SectionName == "ProjectDependencies") { foreach (var entry in section) { Guid guid; if (Guid.TryParse(entry.Key, out guid)) { foreach (IProject p in ParentSolution.Projects) { if (p.IdGuid == guid) { result.Add(p); } } } } } } return(result); } }
public virtual ProjectBuildOptions CreateProjectBuildOptions(BuildOptions options, bool isRootBuildable) { if (options == null) { throw new ArgumentNullException("options"); } string solutionConfiguration = options.SolutionConfiguration ?? ParentSolution.ActiveConfiguration.Configuration; string solutionPlatform = options.SolutionPlatform ?? ParentSolution.ActiveConfiguration.Platform; // start of default implementation var projectConfig = this.ConfigurationMapping.GetProjectConfiguration(new ConfigurationAndPlatform(solutionConfiguration, solutionPlatform)); ProjectBuildOptions projectOptions = new ProjectBuildOptions(isRootBuildable ? options.ProjectTarget : options.TargetForDependencies); projectOptions.BuildOutputVerbosity = options.BuildOutputVerbosity; projectOptions.Configuration = projectConfig.Configuration; projectOptions.Platform = projectConfig.Platform; // copy global properties to project options foreach (var pair in options.GlobalAdditionalProperties) { projectOptions.Properties[pair.Key] = pair.Value; } if (isRootBuildable) { // copy properties for root project to project options foreach (var pair in options.ProjectAdditionalProperties) { projectOptions.Properties[pair.Key] = pair.Value; } } return(projectOptions); }
private MSBuildEngine(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink) { this.projectFileName = project.FileName; this.projectMinimumSolutionVersion = project.MinimumSolutionVersion; this.options = options; this.feedbackSink = 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.ToList(); if (project.MinimumSolutionVersion >= Solution.SolutionVersionVS2010) { engine.additionalTargetFiles.Add(Path.Combine(Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location), "SharpDevelop.TargetingPack.targets")); } engine.StartBuild(); }
public virtual Task <bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor) { feedbackSink.ReportError(new BuildError { ErrorText = StringParser.Parse("${res:MainWindow.CompilerMessages.BuildingProjectIsNotSupported}", new StringTagPair("Name", Name)), IsWarning = true }); // we don't know how to build anything, report that we're done. return(Task.FromResult(true)); }
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 virtual Task <bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor) { 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. return(Task.FromResult(true)); }
public static ProjectBuildOptions CreateProjectBuildOptions(this IBuildable buildable, BuildOptions options, bool isRootBuildable) { IBuildable2 buildable2 = buildable as IBuildable2; if (buildable2 != null) { return(buildable2.CreateProjectBuildOptions(options, isRootBuildable)); } // start of default implementation var configMatchings = buildable.ParentSolution.GetActiveConfigurationsAndPlatformsForProjects(options.SolutionConfiguration, options.SolutionPlatform); ProjectBuildOptions projectOptions = new ProjectBuildOptions(isRootBuildable ? options.ProjectTarget : options.TargetForDependencies); // Find the project configuration, and build an XML string containing all configurations from the solution StringWriter solutionConfigurationXml = new StringWriter(); using (XmlTextWriter solutionConfigurationWriter = new XmlTextWriter(solutionConfigurationXml)) { solutionConfigurationWriter.WriteStartElement("SolutionConfiguration", ""); foreach (var matching in configMatchings) { if (matching.Project == buildable) { projectOptions.Configuration = matching.Configuration; projectOptions.Platform = matching.Platform; } solutionConfigurationWriter.WriteStartElement("ProjectConfiguration"); solutionConfigurationWriter.WriteAttributeString("Project", matching.Project.IdGuid); solutionConfigurationWriter.WriteValue(matching.Configuration + "|" + MSBuildInternals.FixPlatformNameForProject(matching.Platform)); solutionConfigurationWriter.WriteEndElement(); } solutionConfigurationWriter.WriteEndElement(); } // fall back to solution config if we don't find any entries for the project if (string.IsNullOrEmpty(projectOptions.Configuration)) { projectOptions.Configuration = options.SolutionConfiguration; } if (string.IsNullOrEmpty(projectOptions.Platform)) { projectOptions.Platform = options.SolutionPlatform; } // copy properties to project options options.GlobalAdditionalProperties.ForEach(projectOptions.Properties.Add); if (isRootBuildable) { foreach (var pair in options.ProjectAdditionalProperties) { projectOptions.Properties[pair.Key] = pair.Value; } } // Set property for solution configuration. This allows MSBuild to know the correct configuration for project references, // which is necessary to resolve the referenced project's OutputPath. projectOptions.Properties["CurrentSolutionConfigurationContents"] = solutionConfigurationXml.ToString(); return(projectOptions); }
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 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 IEnumerable<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { List<IBuildable> result = new List<IBuildable>(); foreach (IBuildable b in wrapped.GetBuildDependencies(buildOptions)) { result.Add(factory.GetWrapper(b)); } lock (cachedBuildDependencies) { if (buildOptions != null) cachedBuildDependencies[buildOptions] = result; else cachedBuildDependenciesForNullOptions = result; } return result; }
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); } } }
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); }
public virtual ProjectBuildOptions CreateProjectBuildOptions(BuildOptions options, bool isRootBuildable) { if (options == null) { throw new ArgumentNullException("options"); } // start of default implementation var configMatchings = this.ParentSolution.GetActiveConfigurationsAndPlatformsForProjects(options.SolutionConfiguration, options.SolutionPlatform); ProjectBuildOptions projectOptions = new ProjectBuildOptions(isRootBuildable ? options.ProjectTarget : options.TargetForDependencies); projectOptions.BuildOutputVerbosity = options.BuildOutputVerbosity; // find the project configuration foreach (var matching in configMatchings) { if (matching.Project == this) { projectOptions.Configuration = matching.Configuration; projectOptions.Platform = matching.Platform; } } // fall back to solution config if we don't find any entries for the project if (string.IsNullOrEmpty(projectOptions.Configuration)) { projectOptions.Configuration = options.SolutionConfiguration; } if (string.IsNullOrEmpty(projectOptions.Platform)) { projectOptions.Platform = options.SolutionPlatform; } // copy global properties to project options foreach (var pair in options.GlobalAdditionalProperties) { projectOptions.Properties[pair.Key] = pair.Value; } if (isRootBuildable) { // copy properties for root project to project options foreach (var pair in options.ProjectAdditionalProperties) { projectOptions.Properties[pair.Key] = pair.Value; } } return(projectOptions); }
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)); } } }
public virtual ICollection <IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { lock (SyncRoot) { List <IBuildable> result = new List <IBuildable>(); foreach (ProjectSection section in this.ProjectSections) { if (section.Name == "ProjectDependencies") { foreach (SolutionItem item in section.Items) { foreach (IProject p in ParentSolution.Projects) { if (p.IdGuid == item.Name) { result.Add(p); } } } } } return(result); } }
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(); }
ICollection<IBuildable> IBuildable.GetBuildDependencies(ProjectBuildOptions buildOptions) { List<IBuildable> result = new List<IBuildable>(); foreach (IProject p in this.Projects) result.Add(p); return result; }
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 ICollection<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { return new IBuildable[0]; }
public ICollection<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { List<IBuildable> result = new List<IBuildable>(); foreach (IBuildable b in wrapped.GetBuildDependencies(buildOptions)) { result.Add(factory.GetWrapper(b)); } lock (cachedBuildDependencies) { if (buildOptions != null) cachedBuildDependencies[buildOptions] = result; else cachedBuildDependenciesForNullOptions = result; } return result; }
public virtual ProjectBuildOptions CreateProjectBuildOptions(BuildOptions options, bool isRootBuildable) { if (options == null) throw new ArgumentNullException("options"); // start of default implementation var configMatchings = this.ParentSolution.GetActiveConfigurationsAndPlatformsForProjects(options.SolutionConfiguration, options.SolutionPlatform); ProjectBuildOptions projectOptions = new ProjectBuildOptions(isRootBuildable ? options.ProjectTarget : options.TargetForDependencies); projectOptions.BuildOutputVerbosity = options.BuildOutputVerbosity; // find the project configuration foreach (var matching in configMatchings) { if (matching.Project == this) { projectOptions.Configuration = matching.Configuration; projectOptions.Platform = matching.Platform; } } // fall back to solution config if we don't find any entries for the project if (string.IsNullOrEmpty(projectOptions.Configuration)) projectOptions.Configuration = options.SolutionConfiguration; if (string.IsNullOrEmpty(projectOptions.Platform)) projectOptions.Platform = options.SolutionPlatform; // copy global properties to project options foreach (var pair in options.GlobalAdditionalProperties) projectOptions.Properties[pair.Key] = pair.Value; if (isRootBuildable) { // copy properties for root project to project options foreach (var pair in options.ProjectAdditionalProperties) { projectOptions.Properties[pair.Key] = pair.Value; } } return projectOptions; }
public override Task <bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor) { return(SD.MSBuildEngine.BuildAsync(this, options, feedbackSink, progressMonitor.CancellationToken)); }
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 override Task<bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor) { return SD.MSBuildEngine.BuildAsync(this, options, feedbackSink, progressMonitor.CancellationToken); }
public void StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink) { throw new NotImplementedException(); }
public override ICollection<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { ICollection<IBuildable> result = base.GetBuildDependencies(buildOptions); foreach (ProjectItem item in GetItemsOfType(ItemType.ProjectReference)) { ProjectReferenceProjectItem prpi = item as ProjectReferenceProjectItem; if (prpi != null && prpi.ReferencedProject != null) result.Add(prpi.ReferencedProject); } return result; }
private MSBuildEngine(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink) { this.project = project; this.options = options; this.feedbackSink = feedbackSink; }
void IBuildable.StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink) { // building a solution finishes immediately: we only care for the dependencies feedbackSink.Done(true); }
public override void StartBuild(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink) { MSBuildEngine.StartBuild(this, options, feedbackSink, MSBuildEngine.AdditionalTargetFiles); }
public IEnumerable<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { return Enumerable.Empty<IBuildable>(); }
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 Task<bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor) { return Task.FromResult(true); }
public virtual ICollection<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { lock (SyncRoot) { List<IBuildable> result = new List<IBuildable>(); foreach (ProjectSection section in this.ProjectSections) { if (section.Name == "ProjectDependencies") { foreach (SolutionItem item in section.Items) { foreach (IProject p in ParentSolution.Projects) { if (p.IdGuid == item.Name) { result.Add(p); } } } } } return result; } }
public IEnumerable <IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { return(projects); }
public static ProjectBuildOptions CreateProjectBuildOptions(this IBuildable buildable, BuildOptions options, bool isRootBuildable) { IBuildable2 buildable2 = buildable as IBuildable2; if (buildable2 != null) { return buildable2.CreateProjectBuildOptions(options, isRootBuildable); } // start of default implementation var configMatchings = buildable.ParentSolution.GetActiveConfigurationsAndPlatformsForProjects(options.SolutionConfiguration, options.SolutionPlatform); ProjectBuildOptions projectOptions = new ProjectBuildOptions(isRootBuildable ? options.ProjectTarget : options.TargetForDependencies); // Find the project configuration, and build an XML string containing all configurations from the solution StringWriter solutionConfigurationXml = new StringWriter(); using (XmlTextWriter solutionConfigurationWriter = new XmlTextWriter(solutionConfigurationXml)) { solutionConfigurationWriter.WriteStartElement("SolutionConfiguration", ""); foreach (var matching in configMatchings) { if (matching.Project == buildable) { projectOptions.Configuration = matching.Configuration; projectOptions.Platform = matching.Platform; } solutionConfigurationWriter.WriteStartElement("ProjectConfiguration"); solutionConfigurationWriter.WriteAttributeString("Project", matching.Project.IdGuid); solutionConfigurationWriter.WriteValue(matching.Configuration + "|" + MSBuildInternals.FixPlatformNameForProject(matching.Platform)); solutionConfigurationWriter.WriteEndElement(); } solutionConfigurationWriter.WriteEndElement(); } // fall back to solution config if we don't find any entries for the project if (string.IsNullOrEmpty(projectOptions.Configuration)) projectOptions.Configuration = options.SolutionConfiguration; if (string.IsNullOrEmpty(projectOptions.Platform)) projectOptions.Platform = options.SolutionPlatform; // copy properties to project options options.GlobalAdditionalProperties.ForEach(projectOptions.Properties.Add); if (isRootBuildable) { foreach (var pair in options.ProjectAdditionalProperties) { projectOptions.Properties[pair.Key] = pair.Value; } } // Set property for solution configuration. This allows MSBuild to know the correct configuration for project references, // which is necessary to resolve the referenced project's OutputPath. projectOptions.Properties["CurrentSolutionConfigurationContents"] = solutionConfigurationXml.ToString(); return projectOptions; }
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; } } }
public void StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink) { }
public ICollection <IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { return(new IBuildable[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 StringTagPair("Name", p.Name)) ); feedbackSink.Done(true); } else { lastCompilationPass = factory.CurrentPass; wrapped.StartBuild(buildOptions, new BuildFeedbackSink(p, feedbackSink, factory.CurrentPass)); } } }
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 IEnumerable<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { return projects; }
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 ICollection<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) { throw new NotImplementedException(); }