Browse Source

Fixed bug in MSBuildEngine that caused "Check with FxCop" to fail in some circumstances.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5025 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
18f32ada97
  1. 2
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs
  2. 2
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/Project/VBNetProject.cs
  3. 2
      src/AddIns/Misc/CodeAnalysis/CodeAnalysis.addin
  4. 2
      src/AddIns/Misc/Profiler/Controller/Data/Linq/SQLiteQueryProvider.cs
  5. 2
      src/Main/Base/Project/Src/Commands/CustomStringTagProvider.cs
  6. 37
      src/Main/Base/Project/Src/Project/MSBuildEngine/MSBuildEngine.cs
  7. 5
      src/Main/Base/Project/Src/Project/MSBuildEngine/ParallelMSBuildManager.cs
  8. 2
      src/Main/Core/Project/Src/Services/StringParser/StringParser.cs

2
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs

@ -87,7 +87,7 @@ namespace CSharpBinding @@ -87,7 +87,7 @@ namespace CSharpBinding
options,
feedbackSink,
MSBuildEngine.AdditionalTargetFiles.Concat(
new [] { "$(SharpDevelopBinPath)/SharpDevelop.CheckMSBuild35Features.targets" }));
new [] { Path.Combine(MSBuildEngine.SharpDevelopBinPath, "SharpDevelop.CheckMSBuild35Features.targets") }));
} else {
base.StartBuild(buildServices, options, feedbackSink);
}

2
src/AddIns/BackendBindings/VBNetBinding/Project/Src/Project/VBNetProject.cs

@ -109,7 +109,7 @@ namespace VBNetBinding @@ -109,7 +109,7 @@ namespace VBNetBinding
options,
feedbackSink,
MSBuildEngine.AdditionalTargetFiles.Concat(
new [] { "$(SharpDevelopBinPath)/SharpDevelop.CheckMSBuild35Features.targets" }));
new [] { Path.Combine(MSBuildEngine.SharpDevelopBinPath, "SharpDevelop.CheckMSBuild35Features.targets") }));
} else {
base.StartBuild(buildServices, options, feedbackSink);
}

2
src/AddIns/Misc/CodeAnalysis/CodeAnalysis.addin

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
<Path name = "/SharpDevelop/MSBuildEngine/AdditionalProperties">
<!-- Replace the MS CodeAnalysis targets with our own -->
<String id="CodeAnalysisTargets" text = "$(SharpDevelopBinPath)/SharpDevelop.CodeAnalysis.targets"/>
<String id="CodeAnalysisTargets" text = "${SharpDevelopBinPath}/SharpDevelop.CodeAnalysis.targets"/>
<!-- Tell our FxCop task where FxCop can be found -->
<String id="FxCopDir" text = "${property:CodeAnalysis.FxCopPath}"/>
</Path>

2
src/AddIns/Misc/Profiler/Controller/Data/Linq/SQLiteQueryProvider.cs

@ -314,6 +314,8 @@ namespace ICSharpCode.Profiler.Controller.Data.Linq @@ -314,6 +314,8 @@ namespace ICSharpCode.Profiler.Controller.Data.Linq
{
MethodCallExpression mc = (MethodCallExpression)expr;
// TODO: accept StartsWith on any object (not only NameMapping.Name)
// accept NameMapping.Name also in other contexts
if (IsMemberOnNameMappingOnParameter(mc.Object, KnownMembers.NameMapping_Name)) {
if (mc.Arguments[0].NodeType == ExpressionType.Constant && mc.Arguments[1].NodeType == ExpressionType.Constant) {
StringComparison cmp = (StringComparison)GetConstantValue(mc.Arguments[1]);

2
src/Main/Base/Project/Src/Commands/CustomStringTagProvider.cs

@ -147,6 +147,8 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -147,6 +147,8 @@ namespace ICSharpCode.SharpDevelop.Commands
return Path.GetFileName(ProjectService.OpenSolution.FileName);
} catch (Exception) {}
break;
case "SHARPDEVELOPBINPATH":
return Path.GetDirectoryName(typeof(SharpDevelopStringTagProvider).Assembly.Location);
case "STARTUPPATH":
return Application.StartupPath;
}

37
src/Main/Base/Project/Src/Project/MSBuildEngine/MSBuildEngine.cs

@ -10,8 +10,11 @@ using System.Collections.Generic; @@ -10,8 +10,11 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using Microsoft.Build.Construction;
@ -60,6 +63,12 @@ namespace ICSharpCode.SharpDevelop.Project @@ -60,6 +63,12 @@ namespace ICSharpCode.SharpDevelop.Project
/// </summary>
public static readonly IList<IMSBuildAdditionalLogger> AdditionalMSBuildLoggers;
public static string SharpDevelopBinPath {
get {
return Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location);
}
}
static MSBuildEngine()
{
CompileTaskNames = new Set<string>(
@ -70,7 +79,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -70,7 +79,7 @@ namespace ICSharpCode.SharpDevelop.Project
AdditionalMSBuildLoggers = AddInTree.BuildItems<IMSBuildAdditionalLogger>(AdditionalLoggersPath, null, false);
MSBuildProperties = new SortedList<string, string>();
MSBuildProperties.Add("SharpDevelopBinPath", Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location));
MSBuildProperties.Add("SharpDevelopBinPath", SharpDevelopBinPath);
// 'BuildingInsideVisualStudio' tells MSBuild that we took care of building a project's dependencies
// before trying to build the project itself. This speeds up compilation because it prevents MSBuild from
// repeatedly looking if a project needs to be rebuilt.
@ -189,7 +198,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -189,7 +198,7 @@ namespace ICSharpCode.SharpDevelop.Project
List<ILogger> loggers = new List<ILogger> {
new SharpDevelopLogger(this),
//new BuildLogFileLogger(fileName + ".log", LoggerVerbosity.Diagnostic)
//new BuildLogFileLogger(project.FileName + ".log", LoggerVerbosity.Diagnostic)
};
foreach (IMSBuildAdditionalLogger loggerProvider in MSBuildEngine.AdditionalMSBuildLoggers) {
loggers.Add(loggerProvider.CreateLogger(this));
@ -206,11 +215,14 @@ namespace ICSharpCode.SharpDevelop.Project @@ -206,11 +215,14 @@ namespace ICSharpCode.SharpDevelop.Project
// Using projects with in-memory modifications doesn't work with parallel build.
// As a work-around, we'll write our modifications to a file and force MSBuild to include that file using a custom property.
temporaryFileName = Path.GetTempFileName();
using (StreamWriter w = new StreamWriter(temporaryFileName)) {
w.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
using (XmlWriter w = new XmlTextWriter(temporaryFileName, Encoding.UTF8)) {
const string xmlNamespace = "http://schemas.microsoft.com/developer/msbuild/2003";
w.WriteStartElement("Project", xmlNamespace);
foreach (string import in additionalTargetFiles) {
w.WriteLine(" <Import Project=\"" + import + "\" />");
w.WriteStartElement("Import", xmlNamespace);
w.WriteAttributeString("Project", MSBuildInternals.Escape(import));
w.WriteEndElement();
}
if (globalProperties.ContainsKey("BuildingInsideVisualStudio")) {
@ -219,7 +231,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -219,7 +231,9 @@ namespace ICSharpCode.SharpDevelop.Project
// We override the target '_ComputeNonExistentFileProperty' which is responsible
// for recompiling each time - our _ComputeNonExistentFileProperty does nothing,
// which re-enables the MSBuild's usual change detection.
w.WriteLine(" <Target Name=\"_ComputeNonExistentFileProperty\" />");
w.WriteStartElement("Target", xmlNamespace);
w.WriteAttributeString("Name", "_ComputeNonExistentFileProperty");
w.WriteEndElement();
}
// 'MsTestToolsTargets' is preferred because it's at the end of the MSBuild 3.5 and 4.0 target file,
@ -230,14 +244,21 @@ namespace ICSharpCode.SharpDevelop.Project @@ -230,14 +244,21 @@ namespace ICSharpCode.SharpDevelop.Project
// because we'll replace the hijackedProperty, manually write the corresponding include
if (globalProperties.ContainsKey(hijackedProperty)) {
w.WriteLine(" <Import Project=\"" + globalProperties[hijackedProperty] + "\" />");
// we need to escape the project name because properties passed to MSBuild will not be evaluated
w.WriteStartElement("Import", xmlNamespace);
w.WriteAttributeString("Project", MSBuildInternals.Escape(globalProperties[hijackedProperty]));
w.WriteEndElement();
}
w.WriteLine("</Project>");
w.WriteEndElement();
// inject our imports at the end of 'Microsoft.Common.Targets' by replacing the hijackedProperty.
globalProperties[hijackedProperty] = temporaryFileName;
}
#if DEBUG
LoggingService.Debug(File.ReadAllText(temporaryFileName));
#endif
string fileName = project.FileName;
string[] targets = { options.Target.TargetName };
BuildRequestData requestData = new BuildRequestData(fileName, globalProperties, null, targets, new HostServices());

5
src/Main/Base/Project/Src/Project/MSBuildEngine/ParallelMSBuildManager.cs

@ -88,10 +88,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -88,10 +88,7 @@ namespace ICSharpCode.SharpDevelop.Project
LoggingService.Info("ParallelMSBuildManager: got start permisson, starting...");
BuildParameters parameters = new BuildParameters(this.ProjectCollection);
parameters.Loggers = new ILogger[] {
new CentralLogger(this),
#if DEBUG
new ConsoleLogger(LoggerVerbosity.Normal),
#endif
new CentralLogger(this)
};
parameters.EnableNodeReuse = false;
parameters.MaxNodeCount = BuildOptions.DefaultParallelProjectCount;

2
src/Main/Core/Project/Src/Services/StringParser/StringParser.cs

@ -53,7 +53,7 @@ namespace ICSharpCode.Core @@ -53,7 +53,7 @@ namespace ICSharpCode.Core
/// <summary>
/// Parses an array and replaces the elements in the existing array.
/// </summary>
[Obsolete("Call Parse(string) in a loop / consider suing LINQ Select instead")]
[Obsolete("Call Parse(string) in a loop / consider using LINQ Select instead")]
public static void Parse(string[] inputs)
{
for (int i = 0; i < inputs.Length; ++i) {

Loading…
Cancel
Save