Browse Source

Allow AddIns to customize the MSBuild logger.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1590 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
c842399550
  1. 7
      src/AddIns/Misc/CodeAnalysis/CodeAnalysis.addin
  2. 2
      src/AddIns/Misc/CodeAnalysis/CodeAnalysis.csproj
  3. 100
      src/AddIns/Misc/CodeAnalysis/Src/FxCopLogger.cs
  4. 2
      src/Libraries/NRefactory/Project/NRefactory.csproj
  5. 10
      src/Libraries/NRefactory/Project/Src/Lexer/AbstractLexer.cs
  6. 8
      src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs
  7. 4
      src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs
  8. 14
      src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMOutputVisitor.cs
  9. 5
      src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMVerboseOutputGenerator.cs
  10. 2
      src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs
  11. 2
      src/Libraries/NRefactory/Project/Src/Parser/AST/Enums.cs
  12. 12
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs
  13. 12
      src/Libraries/NRefactory/Project/Src/Parser/Location.cs
  14. 675
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  15. 7
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  16. 29
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs
  17. 16
      src/Libraries/NRefactory/Project/Src/Parser/Visitors/CSharpConstructsVisitor.cs
  18. 14
      src/Libraries/NRefactory/Project/Src/Parser/Visitors/ToVBNetConvertVisitor.cs
  19. 3
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  20. 3
      src/Main/Base/Project/Src/Commands/BuildCommands.cs
  21. 10
      src/Main/Base/Project/Src/Gui/Pads/ErrorList/ErrorListPad.cs
  22. 15
      src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskView.cs
  23. 131
      src/Main/Base/Project/Src/Project/BuildError.cs
  24. 50
      src/Main/Base/Project/Src/Project/BuildResults.cs
  25. 164
      src/Main/Base/Project/Src/Project/MSBuildAdditionalLogger.cs
  26. 168
      src/Main/Base/Project/Src/Project/MSBuildEngine.cs
  27. 7
      src/Main/Base/Project/Src/Project/MSBuildProject.cs
  28. 7
      src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs
  29. 45
      src/Main/Base/Project/Src/Services/Tasks/Task.cs
  30. 3
      src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs
  31. 1
      src/Main/StartUp/Project/SharpDevelopMain.cs

7
src/AddIns/Misc/CodeAnalysis/CodeAnalysis.addin

@ -26,4 +26,11 @@ @@ -26,4 +26,11 @@
label = "${res:ICSharpCode.CodeAnalysis.CheckWithFxCop}"
class = "ICSharpCode.CodeAnalysis.CheckCurrentProjectCommand"/>
</Path>
<Path name = "/SharpDevelop/MSBuildEngine/AdditionalLoggers">
<TaskBoundAdditionalLogger
id = "FxCopLogger"
taskname = "FxCop"
class = "ICSharpCode.CodeAnalysis.FxCopLogger"/>
</Path>
</AddIn>

2
src/AddIns/Misc/CodeAnalysis/CodeAnalysis.csproj

@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Build.Framework" />
</ItemGroup>
<ItemGroup>
<None Include="CodeAnalysis.addin">
@ -61,6 +62,7 @@ @@ -61,6 +62,7 @@
<Compile Include="Src\FxCopWrapper.cs" />
<Compile Include="Src\FxCopRule.cs" />
<Compile Include="Src\CheckCurrentProjectCommand.cs" />
<Compile Include="Src\FxCopLogger.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">

100
src/AddIns/Misc/CodeAnalysis/Src/FxCopLogger.cs

@ -0,0 +1,100 @@ @@ -0,0 +1,100 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 16.07.2006
* Time: 20:29
*/
using System;
using Microsoft.Build.Framework;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.CodeAnalysis
{
public class FxCopLogger : IMSBuildAdditionalLogger
{
public ILogger CreateLogger(MSBuildEngine engine)
{
return new FxCopLoggerImpl(engine);
}
private class FxCopLoggerImpl : ILogger
{
MSBuildEngine engine;
public FxCopLoggerImpl(MSBuildEngine engine)
{
this.engine = engine;
}
public LoggerVerbosity Verbosity {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public string Parameters {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
IEventSource eventSource;
public void Initialize(IEventSource eventSource)
{
this.eventSource = eventSource;
engine.MessageView.AppendText("Running FxCop...\r\n");
eventSource.ErrorRaised += OnError;
eventSource.WarningRaised += OnWarning;
}
public void Shutdown()
{
if (eventSource != null) {
eventSource.ErrorRaised -= OnError;
eventSource.WarningRaised -= OnWarning;
eventSource = null;
}
}
void OnError(object sender, BuildErrorEventArgs e)
{
AppendError(e.File, e.LineNumber, e.ColumnNumber, e.Code, e.Message, false);
}
void OnWarning(object sender, BuildWarningEventArgs e)
{
AppendError(e.File, e.LineNumber, e.ColumnNumber, e.Code, e.Message, true);
}
void AppendError(string file, int lineNumber, int columnNumber, string code, string message, bool isWarning)
{
BuildError err = engine.CurrentErrorOrWarning;
if (file.StartsWith("positionof#")) {
string memberName = file.Substring(11);
file = "";
IProject project = ProjectService.GetProject(engine.CurrentProjectFile);
if (project != null) {
IProjectContent pc = ParserService.GetProjectContent(project);
if (pc != null) {
Position pos = pc.GetPosition(memberName);
if (pos != null && pos.Cu != null) {
err.FileName = pos.Cu.FileName ?? "";
err.Line = pos.Line;
err.Column = pos.Column;
}
}
}
}
}
}
}
}

2
src/Libraries/NRefactory/Project/NRefactory.csproj

@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
<FileAlignment>4096</FileAlignment>
<PreBuildEvent>..\src\Tools\UpdateAssemblyInfo\bin\Debug\UpdateAssemblyInfo.exe</PreBuildEvent>
<RunCodeAnalysis>False</RunCodeAnalysis>
<CodeAnalysisRules>-Microsoft.Design#CA1002;-Microsoft.Design#CA1051;-Microsoft.Design#CA1062;-Microsoft.Globalization#CA1303;-Microsoft.Globalization#CA1305;-Microsoft.Naming#CA1704;-Microsoft.Performance#CA1805;-Microsoft.Usage#CA2211;-Microsoft.Usage#CA2227</CodeAnalysisRules>
<CodeAnalysisRules>-Microsoft.Design#CA1002;-Microsoft.Design#CA1051;-Microsoft.Design#CA1062;-Microsoft.Globalization#CA1303;-Microsoft.Globalization#CA1305;-Microsoft.Naming#CA1704;-Microsoft.Performance#CA1800;-Microsoft.Performance#CA1805;-Microsoft.Usage#CA2211;-Microsoft.Usage#CA2227</CodeAnalysisRules>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Optimize>False</Optimize>

10
src/Libraries/NRefactory/Project/Src/Lexer/AbstractLexer.cs

@ -131,7 +131,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -131,7 +131,7 @@ namespace ICSharpCode.NRefactory.Parser
/// <summary>
/// Constructor for the abstract lexer class.
/// </summary>
public AbstractLexer(TextReader reader)
protected AbstractLexer(TextReader reader)
{
this.reader = reader;
}
@ -201,14 +201,14 @@ namespace ICSharpCode.NRefactory.Parser @@ -201,14 +201,14 @@ namespace ICSharpCode.NRefactory.Parser
protected abstract Token Next();
protected bool IsIdentifierPart(int ch)
protected static bool IsIdentifierPart(int ch)
{
if (ch == 95) return true; // 95 = '_'
if (ch == -1) return false;
return char.IsLetterOrDigit((char)ch); // accept unicode letters
}
protected bool IsHex(char digit)
protected static bool IsHex(char digit)
{
return Char.IsDigit(digit) || ('A' <= digit && digit <= 'F') || ('a' <= digit && digit <= 'f');
}
@ -252,7 +252,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -252,7 +252,7 @@ namespace ICSharpCode.NRefactory.Parser
return false;
}
protected void SkipToEOL()
protected void SkipToEndOfLine()
{
int nextChar;
while ((nextChar = reader.Read()) != -1) {
@ -262,7 +262,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -262,7 +262,7 @@ namespace ICSharpCode.NRefactory.Parser
}
}
protected string ReadToEOL()
protected string ReadToEndOfLine()
{
sb.Length = 0;
int nextChar;

8
src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs

@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -25,7 +25,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
{
Location start = new Location(Col - 1, Line);
string directive = ReadIdent('#');
string argument = ReadToEOL();
string argument = ReadToEndOfLine();
this.specialTracker.AddPreProcessingDirective(directive, argument.Trim(), start, new Location(start.X + directive.Length + argument.Length, start.Y));
}
@ -715,7 +715,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -715,7 +715,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
string ReadCommentToEOL()
{
if (specialCommentHash == null) {
return ReadToEOL();
return ReadToEndOfLine();
}
sb.Length = 0;
StringBuilder curWord = new StringBuilder();
@ -736,7 +736,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -736,7 +736,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
curWord.Length = 0;
if (specialCommentHash.ContainsKey(tag)) {
Location p = new Location(Col, Line);
string comment = ch + ReadToEOL();
string comment = ch + ReadToEndOfLine();
tagComments.Add(new TagComment(tag, comment, p, new Location(Col, Line)));
sb.Append(comment);
break;
@ -749,7 +749,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -749,7 +749,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
void ReadSingleLineComment(CommentType commentType)
{
if (skipAllComments) {
SkipToEOL();
SkipToEndOfLine();
} else {
specialTracker.StartComment(commentType, new Location(Col, Line));
specialTracker.AddString(ReadCommentToEOL());

4
src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs

@ -474,7 +474,7 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -474,7 +474,7 @@ namespace ICSharpCode.NRefactory.Parser.VB
{
Location start = new Location(Col - 1, Line);
string directive = ReadIdent('#');
string argument = ReadToEOL();
string argument = ReadToEndOfLine();
this.specialTracker.AddPreProcessingDirective(directive, argument.Trim(), start, new Location(start.X + directive.Length + argument.Length, start.Y));
}
@ -563,7 +563,7 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -563,7 +563,7 @@ namespace ICSharpCode.NRefactory.Parser.VB
curWord.Length = 0;
if (specialCommentHash.ContainsKey(tag)) {
Location p = new Location(Col, Line);
string comment = ch + ReadToEOL();
string comment = ch + ReadToEndOfLine();
tagComments.Add(new TagComment(tag, comment, p, new Location(Col, Line)));
sb.Append(comment);
break;

14
src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMOutputVisitor.cs

@ -47,7 +47,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -47,7 +47,7 @@ namespace ICSharpCode.NRefactory.Parser
if (type == null) {
throw new ArgumentNullException("type");
}
if (type.SystemType == "") {
if (string.IsNullOrEmpty(type.SystemType)) {
throw new InvalidOperationException("empty type");
}
@ -72,18 +72,8 @@ namespace ICSharpCode.NRefactory.Parser @@ -72,18 +72,8 @@ namespace ICSharpCode.NRefactory.Parser
}
}
void AddStmt(CodeExpression expr)
{
if (codeStack.Count == 0)
return;
CodeStatementCollection stmtCollection = codeStack.Peek();
if (stmtCollection != null) {
stmtCollection.Add(expr);
}
}
// FIXME: map all modifiers correctly
MemberAttributes ConvMemberAttributes(Modifier modifier)
static MemberAttributes ConvMemberAttributes(Modifier modifier)
{
MemberAttributes attr = (MemberAttributes)0;

5
src/Libraries/NRefactory/Project/Src/Output/CodeDOM/CodeDOMVerboseOutputGenerator.cs

@ -9,12 +9,11 @@ using System; @@ -9,12 +9,11 @@ using System;
using System.IO;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Security.Permissions;
namespace ICSharpCode.NRefactory.Parser
{
/// <summary>
/// Description of CodeDOMVerboseOutputGenerator.
/// </summary>
[PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
public class CodeDOMVerboseOutputGenerator : System.CodeDom.Compiler.CodeGenerator
{
#region System.CodeDom.Compiler.CodeGenerator abstract class implementation

2
src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs

@ -1154,7 +1154,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1154,7 +1154,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.Unicode);
outputFormatter.Space();
break;
case CharsetModifier.ANSI:
case CharsetModifier.Ansi:
outputFormatter.PrintToken(Tokens.Ansi);
outputFormatter.Space();
break;

2
src/Libraries/NRefactory/Project/Src/Parser/AST/Enums.cs

@ -340,7 +340,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -340,7 +340,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
None,
Auto,
Unicode,
ANSI
Ansi
}
///<summary>

12
src/Libraries/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs

@ -21,15 +21,8 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -21,15 +21,8 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
this.lexer = (Lexer)lexer;
}
string assemblyName = null;
StringBuilder qualidentBuilder = new StringBuilder();
public string ContainingAssembly {
set {
assemblyName = value;
}
}
Token t {
[System.Diagnostics.DebuggerStepThrough]
get {
@ -323,8 +316,6 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -323,8 +316,6 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
(peek == Tokens.Comma || peek == Tokens.CloseSquareBracket);
}
bool IsDims () { return LBrackAndCommaOrRBrack(); }
/* True, if "[" is followed by "," or "]" */
/* or if the current token is "*" */
bool TimesOrLBrackAndCommaOrRBrack () {
@ -417,9 +408,6 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -417,9 +408,6 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
return la.kind == Tokens.Identifier && la.val == "remove";
}
bool IsNotYieldStatement () {
return !IsYieldStatement();
}
/* True, if lookahead ident is "yield" and than follows a break or return */
bool IsYieldStatement () {
return la.kind == Tokens.Identifier && la.val == "yield" && (Peek(1).kind == Tokens.Return || Peek(1).kind == Tokens.Break);

12
src/Libraries/NRefactory/Project/Src/Parser/Location.cs

@ -12,7 +12,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -12,7 +12,7 @@ namespace ICSharpCode.NRefactory.Parser
/// <summary>
/// Description of Position.
/// </summary>
public struct Location
public struct Location : IComparable<Location>
{
public static readonly Location Empty = new Location(-1, -1);
@ -103,5 +103,15 @@ namespace ICSharpCode.NRefactory.Parser @@ -103,5 +103,15 @@ namespace ICSharpCode.NRefactory.Parser
{
return !(a < b);
}
public int CompareTo(Location other)
{
if (this == other)
return 0;
if (this < other)
return -1;
else
return 1;
}
}
}

675
src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs

File diff suppressed because it is too large Load Diff

7
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

@ -1422,7 +1422,7 @@ ArrayInitializer<out Expression outExpr> @@ -1422,7 +1422,7 @@ ArrayInitializer<out Expression outExpr>
Charset<out CharsetModifier charsetModifier>
(. charsetModifier = CharsetModifier.None; .) =
| "Ansi" (. charsetModifier = CharsetModifier.ANSI; .)
| "Ansi" (. charsetModifier = CharsetModifier.Ansi; .)
| "Auto" (. charsetModifier = CharsetModifier.Auto; .)
| "Unicode" (. charsetModifier = CharsetModifier.Unicode; .)
.
@ -2002,8 +2002,9 @@ AttributeArguments<List<Expression> positional, List<NamedArgumentExpression> na @@ -2002,8 +2002,9 @@ AttributeArguments<List<Expression> positional, List<NamedArgumentExpression> na
[":"] "="
] Expr<out expr>
(.
if (expr != null) { if(name == "") positional.Add(expr);
else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
if (expr != null) {
if (string.IsNullOrEmpty(name)) { positional.Add(expr); }
else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
}
.)
{

29
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs

@ -38,17 +38,6 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -38,17 +38,6 @@ namespace ICSharpCode.NRefactory.Parser.VB
}
}
/* Return the n-th token after the current lookahead token */
void StartPeek()
{
lexer.StartPeek();
}
Token Peek()
{
return lexer.Peek();
}
Token Peek (int n)
{
lexer.StartPeek();
@ -98,17 +87,6 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -98,17 +87,6 @@ namespace ICSharpCode.NRefactory.Parser.VB
return la.kind != Tokens.CloseParenthesis;
}
/*
True, if ident is followed by "="
*/
bool IdentAndAsgn () {
if(la.kind == Tokens.Identifier) {
if(Peek(1).kind == Tokens.Assign) return true;
if(Peek(1).kind == Tokens.Colon && Peek(2).kind == Tokens.Assign) return true;
}
return false;
}
/*
True, if ident is followed by "=" or by ":" and "="
*/
@ -199,12 +177,7 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -199,12 +177,7 @@ namespace ICSharpCode.NRefactory.Parser.VB
return la.kind == Tokens.Colon && Peek(1).kind == Tokens.EOL;
}
bool IsAssignment ()
{
return IdentAndAsgn();
}
bool IsMustOverride(Modifiers m)
static bool IsMustOverride(Modifiers m)
{
return m.Contains(Modifier.Abstract);
}

16
src/Libraries/NRefactory/Project/Src/Parser/Visitors/CSharpConstructsVisitor.cs

@ -77,13 +77,13 @@ namespace ICSharpCode.NRefactory.Parser @@ -77,13 +77,13 @@ namespace ICSharpCode.NRefactory.Parser
}
public override object Visit(IfElseStatement ifStatement, object data)
public override object Visit(IfElseStatement ifElseStatement, object data)
{
base.Visit(ifStatement, data);
BinaryOperatorExpression boe = ifStatement.Condition as BinaryOperatorExpression;
if (ifStatement.ElseIfSections.Count == 0
&& ifStatement.FalseStatement.Count == 0
&& ifStatement.TrueStatement.Count == 1
base.Visit(ifElseStatement, data);
BinaryOperatorExpression boe = ifElseStatement.Condition as BinaryOperatorExpression;
if (ifElseStatement.ElseIfSections.Count == 0
&& ifElseStatement.FalseStatement.Count == 0
&& ifElseStatement.TrueStatement.Count == 1
&& boe != null
&& boe.Op == BinaryOperatorType.ReferenceInequality
&& (IsNullLiteralExpression(boe.Left) || IsNullLiteralExpression(boe.Right))
@ -92,9 +92,9 @@ namespace ICSharpCode.NRefactory.Parser @@ -92,9 +92,9 @@ namespace ICSharpCode.NRefactory.Parser
IdentifierExpression ident = boe.Left as IdentifierExpression;
if (ident == null)
ident = boe.Right as IdentifierExpression;
StatementExpression se = ifStatement.TrueStatement[0] as StatementExpression;
StatementExpression se = ifElseStatement.TrueStatement[0] as StatementExpression;
if (se == null) {
BlockStatement block = ifStatement.TrueStatement[0] as BlockStatement;
BlockStatement block = ifElseStatement.TrueStatement[0] as BlockStatement;
if (block != null && block.Children.Count == 1) {
se = block.Children[0] as StatementExpression;
}

14
src/Libraries/NRefactory/Project/Src/Parser/Visitors/ToVBNetConvertVisitor.cs

@ -54,21 +54,21 @@ namespace ICSharpCode.NRefactory.Parser @@ -54,21 +54,21 @@ namespace ICSharpCode.NRefactory.Parser
TypeDeclaration currentType;
public override object Visit(TypeDeclaration td, object data)
public override object Visit(TypeDeclaration typeDeclaration, object data)
{
TypeDeclaration outerType = currentType;
currentType = td;
currentType = typeDeclaration;
// Conflicting field/property names -> m_field
List<string> properties = new List<string>();
foreach (object o in td.Children) {
foreach (object o in typeDeclaration.Children) {
PropertyDeclaration pd = o as PropertyDeclaration;
if (pd != null) {
properties.Add(pd.Name);
}
}
List<VariableDeclaration> conflicts = new List<VariableDeclaration>();
foreach (object o in td.Children) {
foreach (object o in typeDeclaration.Children) {
FieldDeclaration fd = o as FieldDeclaration;
if (fd != null) {
foreach (VariableDeclaration var in fd.Fields) {
@ -81,8 +81,8 @@ namespace ICSharpCode.NRefactory.Parser @@ -81,8 +81,8 @@ namespace ICSharpCode.NRefactory.Parser
}
}
}
new PrefixFieldsVisitor(conflicts, "m_").Run(td);
base.Visit(td, data);
new PrefixFieldsVisitor(conflicts, "m_").Run(typeDeclaration);
base.Visit(typeDeclaration, data);
currentType = outerType;
return null;
@ -243,7 +243,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -243,7 +243,7 @@ namespace ICSharpCode.NRefactory.Parser
charSet = CharsetModifier.Auto;
break;
case "Ansi":
charSet = CharsetModifier.ANSI;
charSet = CharsetModifier.Ansi;
break;
default:
return false;

3
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -783,6 +783,9 @@ @@ -783,6 +783,9 @@
<Compile Include="Src\Commands\NavigationCommands.cs" />
<Compile Include="Src\Internal\ConditionEvaluators\NavigationConditionEvaluators.cs" />
<Compile Include="Src\TextEditor\Gui\Editor\TextNavigationPoint.cs" />
<Compile Include="Src\Project\BuildResults.cs" />
<Compile Include="Src\Project\BuildError.cs" />
<Compile Include="Src\Project\MSBuildAdditionalLogger.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj">

3
src/Main/Base/Project/Src/Commands/BuildCommands.cs

@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.CodeDom.Compiler;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Gui;
@ -53,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -53,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
}
}
protected void CallbackMethod(CompilerResults results)
protected void CallbackMethod(BuildResults results)
{
MSBuildEngine.ShowResults(results);
AfterBuild();

10
src/Main/Base/Project/Src/Gui/Pads/ErrorList/ErrorListPad.cs

@ -1,17 +1,13 @@ @@ -1,17 +1,13 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using System.Drawing;
using System.CodeDom.Compiler;
using System.Collections;
using System.IO;
using System.Diagnostics;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
@ -139,7 +135,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -139,7 +135,7 @@ namespace ICSharpCode.SharpDevelop.Gui
UpdateToolstripStatus();
}
public CompilerResults CompilerResults = null;
public BuildResults BuildResults = null;
void AddTask(Task task)
{

15
src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskView.cs

@ -165,22 +165,15 @@ namespace ICSharpCode.Core @@ -165,22 +165,15 @@ namespace ICSharpCode.Core
public void AddTask(Task task)
{
string tmpPath;
if (task.Project != null && task.FileName != null) {
tmpPath = FileUtility.GetRelativePath(task.Project.Directory, task.FileName);
} else {
tmpPath = task.FileName;
}
string fileName = tmpPath;
string path = tmpPath;
string fileName = task.FileName;
string path = task.FileName;
try {
fileName = Path.GetFileName(tmpPath);
fileName = Path.GetFileName(fileName);
} catch (Exception) {}
try {
path = Path.GetDirectoryName(tmpPath);
path = Path.GetDirectoryName(path);
} catch (Exception) {}
ListViewItem item = new ListViewItem(new string[] {

131
src/Main/Base/Project/Src/Project/BuildError.cs

@ -0,0 +1,131 @@ @@ -0,0 +1,131 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Globalization;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Project
{
public class BuildError
{
public BuildError()
{
this.line = 0;
this.column = 0;
this.errorCode = string.Empty;
this.errorText = string.Empty;
this.fileName = string.Empty;
}
public BuildError(string fileName, int line, int column, string errorCode, string errorText)
{
this.line = line;
this.column = column;
this.errorCode = errorCode;
this.errorText = errorText;
this.fileName = fileName;
}
int column;
string errorCode;
string errorText;
string fileName;
int line;
bool warning;
object tag;
string contextMenuAddInTreeEntry;
public int Column {
get {
return column;
}
set {
column = value;
}
}
public string ErrorCode {
get {
return errorCode;
}
set {
errorCode = value;
}
}
public string ErrorText {
get {
return errorText;
}
set {
errorText = value;
}
}
public string FileName {
get {
return fileName;
}
set {
fileName = value;
}
}
public int Line {
get {
return line;
}
set {
line = value;
}
}
public bool IsWarning {
get {
return warning;
}
set {
warning = value;
}
}
public object Tag {
get {
return tag;
}
set {
tag = value;
}
}
public string ContextMenuAddInTreeEntry {
get {
return contextMenuAddInTreeEntry;
}
set {
contextMenuAddInTreeEntry = value;
}
}
public override string ToString()
{
if (string.IsNullOrEmpty(this.FileName)) {
return string.Format(CultureInfo.CurrentCulture,
"{0} {1}: {2}",
StringParser.Parse(this.IsWarning ? "${res:Global.WarningText}" : "${res:Global.ErrorText}"),
this.ErrorCode, this.ErrorText);
} else {
return string.Format(CultureInfo.CurrentCulture,
"{0}({1},{2}) : {3} {4}: {5}",
this.FileName, this.Line, this.Column,
StringParser.Parse(this.IsWarning ? "${res:Global.WarningText}" : "${res:Global.ErrorText}"),
this.ErrorCode, this.ErrorText);
}
}
}
}

50
src/Main/Base/Project/Src/Project/BuildResults.cs

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Project
{
public enum BuildResultCode
{
None,
/// <summary>Build finished successful.</summary>
Success,
/// <summary>A build error occurred, see BuildResults.Error collection</summary>
Error,
/// <summary>A project build file is not valid</summary>
BuildFileError,
/// <summary>Build was not executed because another build is running</summary>
MSBuildAlreadyRunning
}
/// <summary>
/// Class wrapping the results of a build run.
/// </summary>
public class BuildResults
{
List<BuildError> errors = new List<BuildError>();
BuildResultCode result;
public List<BuildError> Errors {
get {
return errors;
}
}
public BuildResultCode Result {
get {
return result;
}
set {
result = value;
}
}
}
}

164
src/Main/Base/Project/Src/Project/MSBuildAdditionalLogger.cs

@ -0,0 +1,164 @@ @@ -0,0 +1,164 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 16.07.2006
* Time: 19:51
*/
using System;
using ICSharpCode.Core;
using Microsoft.Build.Framework;
namespace ICSharpCode.SharpDevelop.Project
{
/// <summary>
/// Interface for elements in /SharpDevelop/MSBuildEngine/AdditionalLoggers
/// </summary>
public interface IMSBuildAdditionalLogger
{
ILogger CreateLogger(MSBuildEngine engine);
}
/// <summary>
/// Creates <see cref="IMSBuildAdditionalLogger"/> objects that are only
/// activated when a specific MSBuild task is running.
/// </summary>
/// <attribute name="class" use="required">
/// Name of the IMSBuildAdditionalLogger class.
/// </attribute>
/// <attribute name="taskname" use="required">
/// Specifies the name of the MSBuild task that must be running for
/// this logger to be active.
/// </attribute>
/// <example>
/// &lt;TaskBoundAdditionalLogger
/// id = "FxCopLogger"
/// taskname = "FxCop"
/// class = "ICSharpCode.CodeAnalysis.FxCopLogger"/&gt;
/// </example>
/// <usage>Only in /SharpDevelop/MSBuildEngine/AdditionalLoggers</usage>
/// <returns>
/// A IMSBuildAdditionalLogger object that lazy-loads the specified
/// IMSBuildAdditionalLogger when the specified task is running.
/// </returns>
public class TaskBoundAdditionalLoggerDoozer : IDoozer
{
public bool HandleConditions {
get {
return false;
}
}
public object BuildItem(object caller, Codon codon, System.Collections.ArrayList subItems)
{
return new TaskBoundAdditionalLoggerDescriptor(codon);
}
private class TaskBoundAdditionalLoggerDescriptor : IMSBuildAdditionalLogger
{
internal string taskname;
internal string classname;
internal AddIn addIn;
public TaskBoundAdditionalLoggerDescriptor(Codon codon)
{
classname = codon.Properties["class"];
taskname = codon.Properties["taskname"];
addIn = codon.AddIn;
}
public ILogger CreateLogger(MSBuildEngine engine)
{
return new TaskBoundAdditionalLogger(this, engine);
}
}
private class TaskBoundAdditionalLogger : ILogger
{
TaskBoundAdditionalLoggerDescriptor desc;
MSBuildEngine engine;
ILogger baseLogger;
bool isActive;
public TaskBoundAdditionalLogger(TaskBoundAdditionalLoggerDescriptor desc, MSBuildEngine engine)
{
this.desc = desc;
this.engine = engine;
}
void CreateBaseLogger()
{
if (baseLogger == null) {
object obj = desc.addIn.CreateObject(desc.classname);
baseLogger = obj as ILogger;
IMSBuildAdditionalLogger addLog = obj as IMSBuildAdditionalLogger;
if (addLog != null) {
baseLogger = addLog.CreateLogger(engine);
}
}
}
void OnTaskStarted(object sender, TaskStartedEventArgs e)
{
if (desc.taskname.Equals(e.TaskName, StringComparison.InvariantCultureIgnoreCase)) {
CreateBaseLogger();
if (baseLogger != null) {
baseLogger.Initialize(eventSource);
isActive = true;
}
}
}
void OnTaskFinished(object sender, TaskFinishedEventArgs e)
{
if (isActive) {
baseLogger.Shutdown();
isActive = false;
}
}
#region ILogger interface implementation
LoggerVerbosity verbosity = LoggerVerbosity.Minimal;
public LoggerVerbosity Verbosity {
get {
return verbosity;
}
set {
verbosity = value;
}
}
string parameters;
public string Parameters {
get {
return parameters;
}
set {
parameters = value;
}
}
IEventSource eventSource;
public void Initialize(IEventSource eventSource)
{
this.eventSource = eventSource;
eventSource.TaskStarted += OnTaskStarted;
eventSource.TaskFinished += OnTaskFinished;
}
public void Shutdown()
{
OnTaskFinished(null, null);
if (eventSource != null) {
eventSource.TaskStarted -= OnTaskStarted;
eventSource.TaskFinished -= OnTaskFinished;
eventSource = null;
}
}
#endregion
}
}
}

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

@ -7,19 +7,17 @@ @@ -7,19 +7,17 @@
using System;
using System.Collections.Generic;
using System.CodeDom.Compiler;
using System.IO;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using Microsoft.Build.Framework;
using Microsoft.Build.BuildEngine;
using Microsoft.Build.Framework;
namespace ICSharpCode.SharpDevelop.Project
{
public delegate void MSBuildEngineCallback(CompilerResults results);
public delegate void MSBuildEngineCallback(BuildResults results);
/// <summary>
/// Class responsible for building a project using MSBuild.
@ -29,8 +27,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -29,8 +27,8 @@ namespace ICSharpCode.SharpDevelop.Project
{
/// <summary>
/// Gets a list of the task names that cause a "Compiling ..." log message.
/// The contents of the list can be changed by addins.
/// All names must be in lower case!
/// You can add items to this list by putting strings into
/// "/SharpDevelop/MSBuildEngine/CompileTaskNames".
/// </summary>
public static readonly List<string> CompileTaskNames;
@ -41,9 +39,18 @@ namespace ICSharpCode.SharpDevelop.Project @@ -41,9 +39,18 @@ namespace ICSharpCode.SharpDevelop.Project
/// <summary>
/// Gets a list of additional target files that are automatically loaded into all projects.
/// You can add items into this list by putting strings into
/// "/SharpDevelop/MSBuildEngine/AdditionalTargetFiles"
/// </summary>
public static readonly List<string> AdditionalTargetFiles;
/// <summary>
/// Gets a list of additional MSBuild loggers.
/// You can register your loggers by putting them into
/// "/SharpDevelop/MSBuildEngine/AdditionalLoggers"
/// </summary>
public static readonly List<IMSBuildAdditionalLogger> AdditionalMSBuildLoggers;
static MSBuildEngine()
{
CompileTaskNames = AddInTree.BuildItems<string>("/SharpDevelop/MSBuildEngine/CompileTaskNames", null, false);
@ -51,6 +58,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -51,6 +58,8 @@ namespace ICSharpCode.SharpDevelop.Project
CompileTaskNames[i] = CompileTaskNames[i].ToLowerInvariant();
}
AdditionalTargetFiles = AddInTree.BuildItems<string>("/SharpDevelop/MSBuildEngine/AdditionalTargetFiles", null, false);
AdditionalMSBuildLoggers = AddInTree.BuildItems<IMSBuildAdditionalLogger>("/SharpDevelop/MSBuildEngine/AdditionalLoggers", null, false);
MSBuildProperties = new SortedList<string, string>();
MSBuildProperties.Add("SharpDevelopBinPath", Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location));
}
@ -59,13 +68,13 @@ namespace ICSharpCode.SharpDevelop.Project @@ -59,13 +68,13 @@ namespace ICSharpCode.SharpDevelop.Project
public static int LastErrorCount;
public static int LastWarningCount;
public static void ShowResults(CompilerResults results)
public static void ShowResults(BuildResults results)
{
if (results != null) {
LastErrorCount = 0;
LastWarningCount = 0;
TaskService.InUpdate = true;
foreach (CompilerError error in results.Errors) {
foreach (BuildError error in results.Errors) {
TaskService.Add(new Task(error));
if (error.IsWarning)
LastWarningCount++;
@ -147,6 +156,40 @@ namespace ICSharpCode.SharpDevelop.Project @@ -147,6 +156,40 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
BuildError currentErrorOrWarning;
/// <summary>
/// Gets the last build error/warning created by the default
/// SharpDevelop logger.
/// </summary>
public BuildError CurrentErrorOrWarning {
get {
return currentErrorOrWarning;
}
}
Stack<string> projectFiles = new Stack<string>();
/// <summary>
/// Gets the name of the currently building project file.
/// </summary>
public string CurrentProjectFile {
get {
if (projectFiles.Count == 0)
return null;
else
return projectFiles.Peek();
}
}
BuildResults currentResults;
public BuildResults CurrentResults {
get {
return currentResults;
}
}
public void Run(string buildFile, MSBuildEngineCallback callback)
{
Run(buildFile, null, callback);
@ -157,9 +200,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -157,9 +200,9 @@ namespace ICSharpCode.SharpDevelop.Project
public void Run(string buildFile, string[] targets, MSBuildEngineCallback callback)
{
if (isRunning) {
CompilerResults results = new CompilerResults(null);
results.NativeCompilerReturnValue = -42;
results.Errors.Add(new CompilerError(null, 0, 0, null, ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning")));
BuildResults results = new BuildResults();
results.Result = BuildResultCode.MSBuildAlreadyRunning;
results.Errors.Add(new BuildError(null, 0, 0, null, ResourceService.GetString("MainWindow.CompilerMessages.MSBuildAlreadyRunning")));
callback(results);
} else {
isRunning = true;
@ -171,7 +214,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -171,7 +214,6 @@ namespace ICSharpCode.SharpDevelop.Project
class ThreadStarter
{
CompilerResults results;
string buildFile;
string[] targets;
MSBuildEngine engine;
@ -179,8 +221,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -179,8 +221,7 @@ namespace ICSharpCode.SharpDevelop.Project
public ThreadStarter(string buildFile, string[] targets, MSBuildEngine engine, MSBuildEngineCallback callback)
{
results = new CompilerResults(null);
results.NativeCompilerReturnValue = -1;
engine.currentResults = new BuildResults();
this.buildFile = buildFile;
this.targets = targets;
this.engine = engine;
@ -190,6 +231,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -190,6 +231,7 @@ namespace ICSharpCode.SharpDevelop.Project
[STAThread]
public void Run()
{
BuildResults results = this.engine.currentResults;
LoggingService.Debug("Run MSBuild on " + buildFile);
Engine engine = new Engine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory());
@ -206,8 +248,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -206,8 +248,11 @@ namespace ICSharpCode.SharpDevelop.Project
engine.GlobalProperties.SetProperty(entry.Key, entry.Value);
}
SharpDevelopLogger logger = new SharpDevelopLogger(this.engine, results);
SharpDevelopLogger logger = new SharpDevelopLogger(this.engine);
engine.RegisterLogger(logger);
foreach (IMSBuildAdditionalLogger loggerProvider in MSBuildEngine.AdditionalMSBuildLoggers) {
engine.RegisterLogger(loggerProvider.CreateLogger(this.engine));
}
Microsoft.Build.BuildEngine.Project project = engine.CreateNewProject();
try {
@ -218,35 +263,38 @@ namespace ICSharpCode.SharpDevelop.Project @@ -218,35 +263,38 @@ namespace ICSharpCode.SharpDevelop.Project
}
if (engine.BuildProject(project, targets))
results.NativeCompilerReturnValue = 0;
results.Result = BuildResultCode.Success;
else
results.NativeCompilerReturnValue = 1;
results.Result = BuildResultCode.Error;
} catch (ArgumentException ex) {
results.NativeCompilerReturnValue = -2;
results.Errors.Add(new CompilerError(null, -1, -1, "", ex.Message));
results.Result = BuildResultCode.BuildFileError;
results.Errors.Add(new BuildError(null, -1, -1, "", ex.Message));
} catch (InvalidProjectFileException ex) {
results.NativeCompilerReturnValue = -2;
results.Errors.Add(new CompilerError(ex.ProjectFile, ex.LineNumber, ex.ColumnNumber, ex.ErrorCode, ex.Message));
results.Result = BuildResultCode.BuildFileError;
results.Errors.Add(new BuildError(ex.ProjectFile, ex.LineNumber, ex.ColumnNumber, ex.ErrorCode, ex.Message));
}
logger.FlushCurrentError();
LoggingService.Debug("MSBuild finished");
MSBuildEngine.isRunning = false;
if (callback != null) {
WorkbenchSingleton.MainForm.BeginInvoke(callback, results);
}
engine.UnloadAllProjects();
this.engine.currentResults = null;
}
}
class SharpDevelopLogger : ILogger
{
MSBuildEngine engine;
CompilerResults results;
BuildResults results;
public SharpDevelopLogger(MSBuildEngine engine, CompilerResults results)
public SharpDevelopLogger(MSBuildEngine engine)
{
this.engine = engine;
this.results = results;
this.results = engine.currentResults;
}
void AppendText(string text)
@ -254,6 +302,14 @@ namespace ICSharpCode.SharpDevelop.Project @@ -254,6 +302,14 @@ namespace ICSharpCode.SharpDevelop.Project
engine.MessageView.AppendText(text + "\r\n");
}
internal void FlushCurrentError()
{
if (engine.currentErrorOrWarning != null) {
AppendText(engine.currentErrorOrWarning.ToString());
engine.currentErrorOrWarning = null;
}
}
void OnBuildStarted(object sender, BuildStartedEventArgs e)
{
AppendText("${res:MainWindow.CompilerMessages.BuildStarted}");
@ -270,32 +326,21 @@ namespace ICSharpCode.SharpDevelop.Project @@ -270,32 +326,21 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
Stack<string> projectFiles = new Stack<string>();
void OnProjectStarted(object sender, ProjectStartedEventArgs e)
{
projectFiles.Push(e.ProjectFile);
engine.projectFiles.Push(e.ProjectFile);
StatusBarService.SetMessage("${res:MainWindow.CompilerMessages.BuildVerb} " + Path.GetFileNameWithoutExtension(e.ProjectFile) + "...");
}
void OnProjectFinished(object sender, ProjectFinishedEventArgs e)
{
projectFiles.Pop();
if (projectFiles.Count > 0) {
StatusBarService.SetMessage("${res:MainWindow.CompilerMessages.BuildVerb} " + Path.GetFileNameWithoutExtension(projectFiles.Peek()) + "...");
FlushCurrentError();
engine.projectFiles.Pop();
if (engine.projectFiles.Count > 0) {
StatusBarService.SetMessage("${res:MainWindow.CompilerMessages.BuildVerb} " + Path.GetFileNameWithoutExtension(engine.CurrentProjectFile) + "...");
}
}
void OnTargetStarted(object sender, TargetStartedEventArgs e)
{
// do not display
}
void OnTargetFinished(object sender, TargetFinishedEventArgs e)
{
// do not display
}
string activeTaskName;
void OnTaskStarted(object sender, TaskStartedEventArgs e)
@ -308,7 +353,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -308,7 +353,7 @@ namespace ICSharpCode.SharpDevelop.Project
void OnTaskFinished(object sender, TaskFinishedEventArgs e)
{
// do not display
FlushCurrentError();
}
void OnError(object sender, BuildErrorEventArgs e)
@ -325,45 +370,20 @@ namespace ICSharpCode.SharpDevelop.Project @@ -325,45 +370,20 @@ namespace ICSharpCode.SharpDevelop.Project
{
if (string.Equals(file, activeTaskName, StringComparison.InvariantCultureIgnoreCase)) {
file = "";
} else if (file.StartsWith("positionof#")) {
string memberName = file.Substring(11);
file = "";
IProject project = ProjectService.GetProject(projectFiles.Peek());
if (project != null) {
IProjectContent pc = ParserService.GetProjectContent(project);
if (pc != null) {
Position pos = pc.GetPosition(memberName);
if (pos != null && pos.Cu != null) {
file = pos.Cu.FileName ?? "";
lineNumber = pos.Line;
columnNumber = pos.Column;
}
}
}
} else {
bool isShortFileName = file == Path.GetFileNameWithoutExtension(file);
if (projectFiles.Count > 0) {
file = Path.Combine(Path.GetDirectoryName(projectFiles.Peek()), file);
if (engine.CurrentProjectFile != null) {
file = Path.Combine(Path.GetDirectoryName(engine.CurrentProjectFile), file);
}
if (isShortFileName && !File.Exists(file)) {
file = "";
}
}
CompilerError error = new CompilerError(file, lineNumber, columnNumber, code, message);
FlushCurrentError();
BuildError error = new BuildError(file, lineNumber, columnNumber, code, message);
error.IsWarning = isWarning;
AppendText(error.ToString());
results.Errors.Add(error);
}
void OnMessage(object sender, BuildMessageEventArgs e)
{
//if (e.Importance == MessageImportance.High)
// AppendText(e.Message);
}
void OnCustomEvent(object sender, CustomBuildEventArgs e)
{
//AppendText(e.Message);
engine.currentErrorOrWarning = error;
}
#region ILogger interface implementation
@ -395,15 +415,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -395,15 +415,11 @@ namespace ICSharpCode.SharpDevelop.Project
eventSource.BuildFinished += new BuildFinishedEventHandler(OnBuildFinished);
eventSource.ProjectStarted += new ProjectStartedEventHandler(OnProjectStarted);
eventSource.ProjectFinished += new ProjectFinishedEventHandler(OnProjectFinished);
eventSource.TargetStarted += new TargetStartedEventHandler(OnTargetStarted);
eventSource.TargetFinished += new TargetFinishedEventHandler(OnTargetFinished);
eventSource.TaskStarted += new TaskStartedEventHandler(OnTaskStarted);
eventSource.TaskFinished += new TaskFinishedEventHandler(OnTaskFinished);
eventSource.ErrorRaised += new BuildErrorEventHandler(OnError);
eventSource.WarningRaised += new BuildWarningEventHandler(OnWarning);
eventSource.MessageRaised += new BuildMessageEventHandler(OnMessage);
eventSource.CustomEventRaised += new CustomBuildEventHandler(OnCustomEvent);
}
public void Shutdown()

7
src/Main/Base/Project/Src/Project/MSBuildProject.cs

@ -6,18 +6,17 @@ @@ -6,18 +6,17 @@
// </file>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Globalization;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Xsl;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Internal.Templates;
namespace ICSharpCode.SharpDevelop.Project
{

7
src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

@ -496,13 +496,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -496,13 +496,6 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
// TODO: Remove me in Serralongue
[Obsolete("Use RaiseEventEndBuild instead")]
public static void OnEndBuild()
{
RaiseEventEndBuild();
}
public static void RemoveSolutionFolder(string guid)
{
if (OpenSolution == null) {

45
src/Main/Base/Project/Src/Services/Tasks/Task.cs

@ -1,14 +1,13 @@ @@ -1,14 +1,13 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Collections;
using System.CodeDom.Compiler;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Gui;
@ -27,10 +26,10 @@ namespace ICSharpCode.Core @@ -27,10 +26,10 @@ namespace ICSharpCode.Core
string description;
string fileName;
TaskType type;
IProject project;
int line;
int column;
object contextMenuOwner;
string contextMenuAddInTreeEntry;
public override string ToString()
{
@ -41,13 +40,7 @@ namespace ICSharpCode.Core @@ -41,13 +40,7 @@ namespace ICSharpCode.Core
type,
description);
}
public IProject Project {
get {
return project;
}
}
/// <summary>
/// The line number of the task. Zero-based (text editor coordinate)
/// </summary>
@ -87,10 +80,22 @@ namespace ICSharpCode.Core @@ -87,10 +80,22 @@ namespace ICSharpCode.Core
}
}
public Task(string fileName, string description, int column, int line, TaskType type, IProject project)
: this(fileName, description, column, line, type)
{
this.project = project;
public object ContextMenuOwner {
get {
return contextMenuOwner;
}
set {
contextMenuOwner = value;
}
}
public string ContextMenuAddInTreeEntry {
get {
return contextMenuAddInTreeEntry;
}
set {
contextMenuAddInTreeEntry = value;
}
}
public Task(string fileName, string description, int column, int line, TaskType type)
@ -102,13 +107,19 @@ namespace ICSharpCode.Core @@ -102,13 +107,19 @@ namespace ICSharpCode.Core
this.line = line;
}
public Task(CompilerError error)
public Task(BuildError error)
{
type = error.IsWarning ? TaskType.Warning : TaskType.Error;
column = Math.Max(error.Column - 1, 0);
line = Math.Max(error.Line - 1, 0);
description = error.ErrorText + "(" + error.ErrorNumber + ")";
fileName = error.FileName;
if (string.IsNullOrEmpty(error.ErrorCode)) {
description = error.ErrorText;
} else {
description = error.ErrorText + "(" + error.ErrorCode + ")";
}
contextMenuAddInTreeEntry = error.ContextMenuAddInTreeEntry;
contextMenuOwner = error;
}
public void JumpToPosition()

3
src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs

@ -47,7 +47,8 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands @@ -47,7 +47,8 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
List<ToolStripItem> list = new List<ToolStripItem>();
if (!FindReferencesAndRenameHelper.IsReadOnly(c)) {
if (!c.Name.Equals(Path.GetFileNameWithoutExtension(c.CompilationUnit.FileName),
if (c.DeclaringType == null &&
!c.Name.Equals(Path.GetFileNameWithoutExtension(c.CompilationUnit.FileName),
StringComparison.InvariantCultureIgnoreCase))
{
// File name does not match class name

1
src/Main/StartUp/Project/SharpDevelopMain.cs

@ -273,6 +273,7 @@ namespace ICSharpCode.SharpDevelop @@ -273,6 +273,7 @@ namespace ICSharpCode.SharpDevelop
AddInTree.Doozers.Add("CodeCompletionBinding", new ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.CodeCompletionBindingDoozer());
AddInTree.Doozers.Add("Debugger", new DebuggerDoozer());
AddInTree.Doozers.Add("Directory", new DirectoryDoozer());
AddInTree.Doozers.Add("TaskBoundAdditionalLogger", new TaskBoundAdditionalLoggerDoozer());
MenuCommand.LinkCommandCreator = delegate(string link) { return new LinkCommand(link); };
}

Loading…
Cancel
Save