git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2757 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
@ -0,0 +1,32 @@ |
|||||||
|
using System.Reflection; |
||||||
|
using System.Runtime.CompilerServices; |
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("")] |
||||||
|
[assembly: AssemblyDescription("")] |
||||||
|
[assembly: AssemblyConfiguration("")] |
||||||
|
[assembly: AssemblyCompany("")] |
||||||
|
[assembly: AssemblyProduct("")] |
||||||
|
[assembly: AssemblyCopyright("")] |
||||||
|
[assembly: AssemblyTrademark("")] |
||||||
|
[assembly: AssemblyCulture("")] |
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("2.0.0.1")] |
||||||
|
|
||||||
|
// The following attributes specify the key for the sign of your assembly. See the
|
||||||
|
// .NET Framework documentation for more information about signing.
|
||||||
|
// This is not required, if you don't want signing let these attributes like they're.
|
||||||
|
[assembly: AssemblyDelaySign(false)] |
||||||
|
[assembly: AssemblyKeyFile("")] |
||||||
@ -0,0 +1,122 @@ |
|||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests that C# compiler errors/warnings are located in the NAnt console
|
||||||
|
/// output.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class CscNAntOutputTestFixture |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void ParseError085() |
||||||
|
{ |
||||||
|
TaskCollection tasks = NAntOutputParser.Parse(GetNAntCscErrorOutput()); |
||||||
|
|
||||||
|
Assert.AreEqual(3, tasks.Count, "Should be three tasks."); |
||||||
|
|
||||||
|
// First task.
|
||||||
|
Task task = tasks[0]; |
||||||
|
Assert.AreEqual("c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(33, task.Line, "Task line is incorrect."); |
||||||
|
Assert.AreEqual(3, task.Column, "Task column is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be error task."); |
||||||
|
Assert.AreEqual(@"Invalid expression term '/' (CS1525)", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
|
||||||
|
// Second task.
|
||||||
|
task = tasks[1]; |
||||||
|
Assert.AreEqual("c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(33, task.Line, "Task line is incorrect."); |
||||||
|
Assert.AreEqual(4, task.Column, "Task column is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be error task."); |
||||||
|
Assert.AreEqual(@"; expected (CS1002)", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
|
||||||
|
// Last task task.
|
||||||
|
task = tasks[2]; |
||||||
|
Assert.AreEqual(@"C:\Projects\dotnet\Test\corsavytest\corsavytest.build", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(47, task.Line, "Task line is incorrect."); |
||||||
|
Assert.AreEqual(5, task.Column, "Task column is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be error task."); |
||||||
|
Assert.AreEqual(@"External Program Failed: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.exe (return code was 1)", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ParseWarning085() |
||||||
|
{ |
||||||
|
TaskCollection tasks = NAntOutputParser.Parse(GetNAntCscWarningOutput()); |
||||||
|
|
||||||
|
Assert.AreEqual(1, tasks.Count, "Should be three tasks."); |
||||||
|
|
||||||
|
// First task.
|
||||||
|
Task task = tasks[0]; |
||||||
|
Assert.AreEqual("c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(38, task.Line, "Task line is incorrect."); |
||||||
|
Assert.AreEqual(11, task.Column, "Task column is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Warning, task.TaskType, "Should be error task."); |
||||||
|
Assert.AreEqual(@"The variable 'Test' is assigned but its value is never used (CS0219)", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
string GetNAntCscErrorOutput() |
||||||
|
{ |
||||||
|
return "Buildfile: file:///C:/Projects/dotnet/Test/corsavytest/corsavytest.build\r\n" + |
||||||
|
"Target(s) specified: build \r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"init.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"gacreferences.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"build.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
" [csc] Compiling 3 files to 'C:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.exe'.\r\n" + |
||||||
|
" [csc] c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs(34,4): error CS1525: Invalid expression term '/'\r\n" + |
||||||
|
" [csc] c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs(34,5): error CS1002: ; expected\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"BUILD FAILED\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build(48,6):\r\n" + |
||||||
|
"External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\csc.exe (return code was 1)\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"Total time: 0.5 seconds."; |
||||||
|
} |
||||||
|
|
||||||
|
string GetNAntCscWarningOutput() |
||||||
|
{ |
||||||
|
return "Buildfile: file:///C:/Projects/dotnet/Test/corsavytest/corsavytest.build\r\n" + |
||||||
|
"Target(s) specified: build \r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"init.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"gacreferences.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"build.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
" [csc] Compiling 3 files to 'C:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.exe'.\r\n" + |
||||||
|
" [csc] c:\\Projects\\dotnet\\Test\\corsavytest\\Foo.cs(39,12): warning CS0219: The variable 'Test' is assigned but its value is never used\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"build:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"BUILD SUCCEEDED\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"Total time: 0.4 seconds."; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,133 @@ |
|||||||
|
using NUnit.Framework; |
||||||
|
using ICSharpCode.NAnt; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests that fatal errors are parsed correctly.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class FatalErrorNAntOutputTestFixture |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void ParseCscError085() |
||||||
|
{ |
||||||
|
TaskCollection tasks = NAntOutputParser.Parse(GetNAntCscOutput()); |
||||||
|
|
||||||
|
Assert.AreEqual(2, tasks.Count, "Should be two tasks."); |
||||||
|
|
||||||
|
Task task = tasks[0]; |
||||||
|
|
||||||
|
Assert.AreEqual(String.Empty, task.FileName, "Task filename should be blank."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task."); |
||||||
|
Assert.AreEqual(0, task.Line, "Should be line number 0."); |
||||||
|
Assert.AreEqual(0, task.Column, "Should be col number 0"); |
||||||
|
Assert.AreEqual("fatal error CS0042: Unexpected error creating debug information file 'c:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.PDB' -- 'c:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.pdb: The process cannot access the file because it is being used by another process.", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
|
||||||
|
task = tasks[1]; |
||||||
|
Assert.AreEqual("C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task."); |
||||||
|
Assert.AreEqual(47, task.Line, "Incorrect line number."); |
||||||
|
Assert.AreEqual(5, task.Column, "Incorrect col number."); |
||||||
|
Assert.AreEqual("External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\csc.exe (return code was 1)", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ParseVBError085() |
||||||
|
{ |
||||||
|
TaskCollection tasks = NAntOutputParser.Parse(GetNAntVBOutput()); |
||||||
|
|
||||||
|
Assert.AreEqual(3, tasks.Count, "Should be three tasks."); |
||||||
|
|
||||||
|
Task task = tasks[0]; |
||||||
|
|
||||||
|
Assert.AreEqual(String.Empty, task.FileName, "Task filename should be blank."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task."); |
||||||
|
Assert.AreEqual(0, task.Line, "Should be line number 0."); |
||||||
|
Assert.AreEqual(0, task.Column, "Should be col number 0"); |
||||||
|
Assert.AreEqual("Unable to write to output file 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.exe': The process cannot access the file because it is being used by another process. (BC31019)", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
|
||||||
|
task = tasks[1]; |
||||||
|
Assert.AreEqual(String.Empty, task.FileName, "Task filename should be blank."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task."); |
||||||
|
Assert.AreEqual(0, task.Line, "Should be line number 0."); |
||||||
|
Assert.AreEqual(0, task.Column, "Should be col number 0"); |
||||||
|
Assert.AreEqual("Unable to write to output file 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.pdb': Access is denied. (BC31019)", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
|
||||||
|
task = tasks[2]; |
||||||
|
Assert.AreEqual("C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task."); |
||||||
|
Assert.AreEqual(47, task.Line, "Incorrect line number."); |
||||||
|
Assert.AreEqual(5, task.Column, "Incorrect col number."); |
||||||
|
Assert.AreEqual("External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\vbc.exe (return code was 1)", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
} |
||||||
|
|
||||||
|
string GetNAntCscOutput() |
||||||
|
{ |
||||||
|
return "Buildfile: file:///C:/Projects/dotnet/Test/corsavytest/corsavytest.build\r\n" + |
||||||
|
"Target(s) specified: build \r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"init.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"gacreferences.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"build.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
" [csc] Compiling 3 files to 'C:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.exe'.\r\n" + |
||||||
|
" [csc] fatal error CS0042: Unexpected error creating debug information file 'c:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.PDB' -- 'c:\\Projects\\dotnet\\Test\\corsavytest\\bin\\Debug\\corsavytest.pdb: The process cannot access the file because it is being used by another process.\r\n" + |
||||||
|
" [csc] \r\n" + |
||||||
|
" [csc] \r\n" + |
||||||
|
"\r\n" + |
||||||
|
"BUILD FAILED\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build(48,6):\r\n" + |
||||||
|
"External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\csc.exe (return code was 1)\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"Total time: 0.3 seconds.\r\n" + |
||||||
|
""; |
||||||
|
} |
||||||
|
|
||||||
|
string GetNAntVBOutput() |
||||||
|
{ |
||||||
|
return "Buildfile: file:///C:/Projects/dotnet/test/corsavyvbtest/corsavyvbtest.build\r\n" + |
||||||
|
"Target(s) specified: build \r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"init.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"gacreferences.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"build.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
" [vbc] Compiling 2 files to 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.exe'.\r\n" + |
||||||
|
" [vbc] vbc : error BC31019: Unable to write to output file 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.exe': The process cannot access the file because it is being used by another process. \r\n" + |
||||||
|
" [vbc] vbc : error BC31019: Unable to write to output file 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.pdb': Access is denied. \r\n" + |
||||||
|
"\r\n" + |
||||||
|
"BUILD FAILED - 0 non-fatal error(s), 1 warning(s)\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build(48,6):\r\n" + |
||||||
|
"External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\vbc.exe (return code was 1)\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"Total time: 0.4 seconds.\r\n" + |
||||||
|
""; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,35 @@ |
|||||||
|
using ICSharpCode.NAnt; |
||||||
|
using NUnit.Framework; |
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using System.Xml; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests the <see cref="NAntBuildFile"/> class.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class InvalidNAntBuildFileTestFixture |
||||||
|
{ |
||||||
|
NAntBuildFile buildFile; |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ReadFile() |
||||||
|
{ |
||||||
|
StringReader reader = new StringReader("<project>"); |
||||||
|
buildFile = new NAntBuildFile(reader); |
||||||
|
|
||||||
|
Assert.IsTrue(buildFile.HasError); |
||||||
|
|
||||||
|
NAntBuildFileError error = buildFile.Error; |
||||||
|
|
||||||
|
Assert.AreEqual("Unexpected end of file has occurred. The following elements are not closed: project. Line 1, position 10.", |
||||||
|
error.Message, |
||||||
|
"Error message is incorrect."); |
||||||
|
|
||||||
|
Assert.AreEqual(0, error.Line, "Error's line number is incorrect."); |
||||||
|
Assert.AreEqual(9, error.Column, "Error's column number is incorrect."); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,49 @@ |
|||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests that the NAnt text output indicating the build file xml is
|
||||||
|
/// invalid is parsed correctly.</summary>
|
||||||
|
[TestFixture] |
||||||
|
public class InvalidXmlNAntOutputTestFixture |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void Parse085() |
||||||
|
{ |
||||||
|
TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput()); |
||||||
|
|
||||||
|
Assert.AreEqual(1, tasks.Count, "Should be one task."); |
||||||
|
|
||||||
|
Task task = tasks[0]; |
||||||
|
Assert.AreEqual(@"C:\Projects\foo\foo.build", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(6, task.Line, "Task line is incorrect."); |
||||||
|
Assert.AreEqual(4, task.Column, "Task column is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be error task."); |
||||||
|
string description = "Error loading buildfile.\r\n The 'ifnot1' start tag on line '5' doesn't match the end tag of 'ifnot' in file 'file:///C:/Projects/foo/foo.build'. Line 7, position 5."; |
||||||
|
|
||||||
|
Assert.AreEqual(description, |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets NAnt output for an invalid xml in a 0.85 build file.</summary>
|
||||||
|
string GetNAntOutput() |
||||||
|
{ |
||||||
|
return "\r\n" + |
||||||
|
"BUILD FAILED\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"C:\\Projects\\foo\\foo.build(7,5):\r\n" + |
||||||
|
"Error loading buildfile.\r\n" + |
||||||
|
" The 'ifnot1' start tag on line '5' doesn't match the end tag of 'ifnot' in file 'file:///C:/Projects/foo/foo.build'. Line 7, position 5.\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"For more information regarding the cause of the build failure, run the build again in debug mode.\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"Try 'nant -help' for more information"; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,81 @@ |
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> |
||||||
|
<PropertyGroup> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<SchemaVersion>2.0</SchemaVersion> |
||||||
|
<ProjectGuid>{13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}</ProjectGuid> |
||||||
|
<RootNamespace>NAnt.AddIn.Tests</RootNamespace> |
||||||
|
<AssemblyName>NAnt.AddIn.Tests</AssemblyName> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
<NoStdLib>False</NoStdLib> |
||||||
|
<NoConfig>False</NoConfig> |
||||||
|
<RunPostBuildEvent>OnSuccessfulBuild</RunPostBuildEvent> |
||||||
|
<DebugType>Full</DebugType> |
||||||
|
<RegisterForComInterop>False</RegisterForComInterop> |
||||||
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||||
|
<BaseAddress>4194304</BaseAddress> |
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||||
|
<FileAlignment>4096</FileAlignment> |
||||||
|
<OutputPath>bin\</OutputPath> |
||||||
|
<DebugSymbols>true</DebugSymbols> |
||||||
|
<Optimize>False</Optimize> |
||||||
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="ICSharpCode.Core"> |
||||||
|
<HintPath>..\..\..\bin\ICSharpCode.Core.dll</HintPath> |
||||||
|
</Reference> |
||||||
|
<Reference Include="ICSharpCode.SharpDevelop"> |
||||||
|
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath> |
||||||
|
</Reference> |
||||||
|
<Reference Include="nunit.framework"> |
||||||
|
<HintPath>..\..\..\bin\Tools\NUnit\nunit.framework.dll</HintPath> |
||||||
|
</Reference> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Core"> |
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
<Reference Include="System.Data" /> |
||||||
|
<Reference Include="System.Data.DataSetExtensions"> |
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
<Reference Include="System.Drawing" /> |
||||||
|
<Reference Include="System.Windows.Forms" /> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
<Reference Include="System.Configuration" /> |
||||||
|
<Reference Include="System.Xml.Linq"> |
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="AssemblyInfo.cs" /> |
||||||
|
<Compile Include="ReadNAntBuildFileTestFixture.cs" /> |
||||||
|
<Compile Include="InvalidNAntBuildFileTestFixture.cs" /> |
||||||
|
<Compile Include="InvalidXmlNAntOutputTestFixture.cs" /> |
||||||
|
<Compile Include="CscNAntOutputTestFixture.cs" /> |
||||||
|
<Compile Include="TargetDoesNotExistNAntOutputTestFixture.cs" /> |
||||||
|
<Compile Include="NAntErrorAndWarningOutputTestFixture.cs" /> |
||||||
|
<Compile Include="VBErrorNAntOutputTestFixture.cs" /> |
||||||
|
<Compile Include="FatalErrorNAntOutputTestFixture.cs" /> |
||||||
|
<Compile Include="ReadOnlyPropertyNAntOutputTestFixture.cs" /> |
||||||
|
<Compile Include="NonFatalErrorNAntOutputTestFixture.cs" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ProjectReference Include="..\NAnt.AddIn\NAnt.AddIn.csproj"> |
||||||
|
<Project>{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}</Project> |
||||||
|
<Name>NAnt.AddIn</Name> |
||||||
|
</ProjectReference> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||||
|
</Project> |
||||||
@ -0,0 +1,64 @@ |
|||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests that the NAnt errors and warnings are parsed correctly.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class NAntErrorAndWarningOutputTestFixture |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void Parse085() |
||||||
|
{ |
||||||
|
TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput()); |
||||||
|
|
||||||
|
Assert.AreEqual(2, tasks.Count, "Should be two tasks."); |
||||||
|
|
||||||
|
Task task = tasks[0]; |
||||||
|
Assert.AreEqual("C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Warning, task.TaskType, "Should be a warning task."); |
||||||
|
Assert.AreEqual(4, task.Line, "Incorrect line number."); |
||||||
|
Assert.AreEqual(3, task.Column, "Incorrect col number."); |
||||||
|
Assert.AreEqual("Attribute 'propertyexists' for <ifnot ... /> is deprecated. Use <if test=\"${property::exists('propertyname')}\"> instead.", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
|
||||||
|
task = tasks[1]; |
||||||
|
Assert.AreEqual("C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task."); |
||||||
|
Assert.AreEqual(47, task.Line, "Incorrect line number."); |
||||||
|
Assert.AreEqual(5, task.Column, "Incorrect col number."); |
||||||
|
Assert.AreEqual("An empty string is not a valid value for attribute 'win32icon' of <csc ... />.", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
string GetNAntOutput() |
||||||
|
{ |
||||||
|
return "Buildfile: file:///C:/Projects/dotnet/Test/corsavytest/corsavytest.build\r\n" + |
||||||
|
"Target(s) specified: build \r\n" + |
||||||
|
"\r\n" + |
||||||
|
" [ifnot] C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build(5,4): Attribute 'propertyexists' for <ifnot ... /> is deprecated. Use <if test=\"${property::exists('propertyname')}\"> instead.\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"init.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"gacreferences.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"build.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"BUILD FAILED - 0 non-fatal error(s), 1 warning(s)\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"C:\\Projects\\dotnet\\Test\\corsavytest\\corsavytest.build(48,6):\r\n" + |
||||||
|
"An empty string is not a valid value for attribute 'win32icon' of <csc ... />.\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"Total time: 0.1 seconds."; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,50 @@ |
|||||||
|
using NUnit.Framework; |
||||||
|
using ICSharpCode.NAnt; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Tests |
||||||
|
{ |
||||||
|
[TestFixture] |
||||||
|
public class NonFatalErrorNAntOutputTestFixture |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void Parse085() |
||||||
|
{ |
||||||
|
TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput()); |
||||||
|
|
||||||
|
Assert.AreEqual(1, tasks.Count, "Should be one task."); |
||||||
|
|
||||||
|
Task task = tasks[0]; |
||||||
|
|
||||||
|
Assert.AreEqual("C:\\Projects\\dotnet\\Corsavy\\SharpDevelop\\src\\StandardAddIn.include", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be a warning task."); |
||||||
|
Assert.AreEqual(93, task.Line, "Incorrect line number."); |
||||||
|
Assert.AreEqual(4, task.Column, "Incorrect col number."); |
||||||
|
Assert.AreEqual("Cannot delete directory 'C:\\Projects\\dotnet\\Corsavy\\SharpDevelop\\AddIns\\AddIns\\Misc\\Debugger.AddIn'. The directory does not exist.", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
} |
||||||
|
|
||||||
|
string GetNAntOutput() |
||||||
|
{ |
||||||
|
return "[nant] C:\\Projects\\dotnet\\Corsavy\\SharpDevelop\\src\\AddIns\\Misc\\Debugger\\Debugger.Core\\Debugger.Core.build clean\r\n" + |
||||||
|
" Buildfile: file:///C:/Projects/dotnet/Corsavy/SharpDevelop/src/AddIns/Misc/Debugger/Debugger.Core/Debugger.Core.build\r\n" + |
||||||
|
" Target(s) specified: clean \r\n" + |
||||||
|
" \r\n" + |
||||||
|
" \r\n" + |
||||||
|
" clean:\r\n" + |
||||||
|
" \r\n" + |
||||||
|
" \r\n" + |
||||||
|
" SetProperties:\r\n" + |
||||||
|
" \r\n" + |
||||||
|
" [delete] C:\\Projects\\dotnet\\Corsavy\\SharpDevelop\\src\\StandardAddIn.include(94,5):\r\n" + |
||||||
|
" [delete] Cannot delete directory 'C:\\Projects\\dotnet\\Corsavy\\SharpDevelop\\AddIns\\AddIns\\Misc\\Debugger.AddIn'. The directory does not exist.\r\n" + |
||||||
|
" \r\n" + |
||||||
|
" BUILD SUCCEEDED - 1 non-fatal error(s), 0 warning(s)\r\n" + |
||||||
|
" \r\n" + |
||||||
|
" Total time: 0.3 seconds."; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,106 @@ |
|||||||
|
using ICSharpCode.NAnt; |
||||||
|
using NUnit.Framework; |
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests the <see cref="NAntBuildFile"/> class.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class ReadNAntBuildFileTestFixture |
||||||
|
{ |
||||||
|
NAntBuildFile buildFile; |
||||||
|
|
||||||
|
[SetUp] |
||||||
|
public void Init() |
||||||
|
{ |
||||||
|
StringReader reader = new StringReader(GetBuildFileXml()); |
||||||
|
buildFile = new NAntBuildFile(reader); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void ProjectName() |
||||||
|
{ |
||||||
|
Assert.AreEqual("Hello World", buildFile.Name, "Project name is wrong."); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void DefaultTarget() |
||||||
|
{ |
||||||
|
// Check the name.
|
||||||
|
Assert.IsNotNull(buildFile.DefaultTarget, "Should have a default target."); |
||||||
|
Assert.AreEqual("test", buildFile.DefaultTarget.Name, "Default target read from build file is wrong."); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void Targets() |
||||||
|
{ |
||||||
|
Assert.AreEqual(3, buildFile.Targets.Count, "Should have 3 targets."); |
||||||
|
|
||||||
|
NAntBuildTarget target = buildFile.Targets[0]; |
||||||
|
Assert.AreEqual("clean", target.Name, "Target name should be 'clean'."); |
||||||
|
Assert.IsFalse(target.IsDefault, "Clean target should not have default target flag set."); |
||||||
|
Assert.AreEqual(4, target.Line, "Clean target line number is incorrect."); |
||||||
|
Assert.AreEqual(5, target.Column, "Clean target column number is incorrect."); |
||||||
|
|
||||||
|
target = buildFile.Targets[1]; |
||||||
|
Assert.IsFalse(target.IsDefault, "Build target should not have default target flag set."); |
||||||
|
Assert.AreEqual("build", target.Name, "Target name should be 'build'."); |
||||||
|
Assert.AreEqual(13, target.Line, "Build target line number is incorrect."); |
||||||
|
Assert.AreEqual(5, target.Column, "Build target column number is incorrect."); |
||||||
|
|
||||||
|
target = buildFile.Targets[2]; |
||||||
|
Assert.AreEqual("test", target.Name, "Target name should be 'test'."); |
||||||
|
Assert.IsTrue(target.IsDefault, "Test target should have default target flag set."); |
||||||
|
Assert.AreEqual(31, target.Line, "Test target line number is incorrect."); |
||||||
|
Assert.AreEqual(5, target.Column, "Test target column number is incorrect."); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the build file xml that will be used in this
|
||||||
|
/// test fixture.
|
||||||
|
/// </summary>
|
||||||
|
string GetBuildFileXml() |
||||||
|
{ |
||||||
|
return "<project name=\"Hello World\" default=\"test\">\r\n" + |
||||||
|
" <property name=\"basename\" value=\"HelloWorld\"/>\r\n" + |
||||||
|
" <property name=\"debug\" value=\"true\"/>\r\n" + |
||||||
|
"\r\n" + |
||||||
|
" <target name=\"clean\">\r\n" + |
||||||
|
" <delete>\r\n" + |
||||||
|
" <fileset>\r\n" + |
||||||
|
" <includes name=\"${basename}-??.exe\"/>\r\n" + |
||||||
|
" <includes name=\"${basename}-??.pdb\"/>\r\n" + |
||||||
|
" </fileset>\r\n" + |
||||||
|
" </delete>\r\n" + |
||||||
|
" </target>\r\n" + |
||||||
|
"\r\n" + |
||||||
|
" <target name=\"build\">\r\n" + |
||||||
|
" <csc target=\"exe\" output=\"${basename}-cs.exe\" debug=\"${debug}\">\r\n" + |
||||||
|
" <sources>\r\n" + |
||||||
|
" <includes name=\"${basename}.cs\"/>\r\n" + |
||||||
|
" </sources>\r\n" + |
||||||
|
" </csc>\r\n" + |
||||||
|
" <jsc target=\"exe\" output=\"${basename}-js.exe\" debug=\"${debug}\">\r\n" + |
||||||
|
" <sources>\r\n" + |
||||||
|
" <includes name=\"${basename}.js\"/>\r\n" + |
||||||
|
" </sources>\r\n" + |
||||||
|
" </jsc>\r\n" + |
||||||
|
" <vbc target=\"exe\" output=\"${basename}-vb.exe\" debug=\"${debug}\">\r\n" + |
||||||
|
" <sources>\r\n" + |
||||||
|
" <includes name=\"${basename}.vb\"/>\r\n" + |
||||||
|
" </sources>\r\n" + |
||||||
|
" </vbc>\r\n" + |
||||||
|
" </target>\r\n" + |
||||||
|
"\r\n" + |
||||||
|
" <target name=\"test\" depends=\"build\">\r\n" + |
||||||
|
" <exec program=\"${basename}-cs.exe\" basedir=\".\"/>\r\n" + |
||||||
|
" <exec program=\"${basename}-js.exe\" basedir=\".\"/>\r\n" + |
||||||
|
" <exec program=\"${basename}-vb.exe\" basedir=\".\"/>\r\n" + |
||||||
|
" </target>\r\n" + |
||||||
|
"</project>"; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,41 @@ |
|||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Tests |
||||||
|
{ |
||||||
|
[TestFixture] |
||||||
|
public class ReadOnlyPropertyNAntOutputTestFixture |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void Parse085() |
||||||
|
{ |
||||||
|
TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput()); |
||||||
|
|
||||||
|
Assert.AreEqual(1, tasks.Count, "Should be one task."); |
||||||
|
|
||||||
|
Task task = tasks[0]; |
||||||
|
|
||||||
|
Assert.AreEqual(String.Empty, task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Warning, task.TaskType, "Should be a warning task."); |
||||||
|
Assert.AreEqual(0, task.Line, "Incorrect line number."); |
||||||
|
Assert.AreEqual(0, task.Column, "Incorrect col number."); |
||||||
|
Assert.AreEqual("Read-only property \"debug\" cannot be overwritten.", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
} |
||||||
|
|
||||||
|
string GetNAntOutput() |
||||||
|
{ |
||||||
|
return "Buildfile: file:///C:/Projects/dotnet/Corsavy/SharpDevelop/src/SharpDevelop.build\r\n" + |
||||||
|
"Target(s) specified: clean \r\n" + |
||||||
|
"\r\n" + |
||||||
|
" [property] Read-only property \"debug\" cannot be overwritten.\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"clean:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"CallBuildfiles"; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests that the "Target 'foo' does not exist" error is handled.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class TargetDoesNotExistNAntOutputTestFixture |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void Parse085() |
||||||
|
{ |
||||||
|
TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput()); |
||||||
|
|
||||||
|
Assert.AreEqual(1, tasks.Count, "Should be one task."); |
||||||
|
|
||||||
|
Task task = tasks[0]; |
||||||
|
Assert.AreEqual(String.Empty, task.FileName, "Should not have any filename information."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task."); |
||||||
|
Assert.AreEqual(0, task.Line, "Should be line number 0"); |
||||||
|
Assert.AreEqual(0, task.Column, "Should be col number 0"); |
||||||
|
Assert.AreEqual("Target 'abuild' does not exist in this project.", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
} |
||||||
|
|
||||||
|
string GetNAntOutput() |
||||||
|
{ |
||||||
|
return "Buildfile: file:///C:/Projects/dotnet/Test/corsavytest/corsavytest.build\r\n" + |
||||||
|
"Target(s) specified: abuild \r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"BUILD FAILED\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"Target 'abuild' does not exist in this project.\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"Total time: 0.1 seconds.\r\n" + |
||||||
|
""; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,81 @@ |
|||||||
|
using NUnit.Framework; |
||||||
|
using ICSharpCode.NAnt; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests that VB errors are parsed correctly.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class VBErrorNAntOutputTestFixture |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void Parse085() |
||||||
|
{ |
||||||
|
TaskCollection tasks = NAntOutputParser.Parse(GetNAntOutput()); |
||||||
|
|
||||||
|
Assert.AreEqual(3, tasks.Count, "Should be three tasks."); |
||||||
|
|
||||||
|
Task task = tasks[0]; |
||||||
|
|
||||||
|
Assert.AreEqual("C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Warning, task.TaskType, "Should be a warning task."); |
||||||
|
Assert.AreEqual(47, task.Line, "Incorrect line number."); |
||||||
|
Assert.AreEqual(5, task.Column, "Incorrect col number."); |
||||||
|
Assert.AreEqual("Attribute 'imports' for <vbc ... /> is deprecated. Use the <imports> element instead.", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
|
||||||
|
task = tasks[1]; |
||||||
|
Assert.AreEqual("C:\\Projects\\dotnet\\test\\corsavyvbtest\\MainForm.vb", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task."); |
||||||
|
Assert.AreEqual(13, task.Line, "Incorrect line number."); |
||||||
|
Assert.AreEqual(0, task.Column, "Should be col number 0"); |
||||||
|
Assert.AreEqual("Syntax error. (BC30035)", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
|
||||||
|
task = tasks[2]; |
||||||
|
Assert.AreEqual("C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build", task.FileName, "Task filename is incorrect."); |
||||||
|
Assert.AreEqual(TaskType.Error, task.TaskType, "Should be an error task."); |
||||||
|
Assert.AreEqual(47, task.Line, "Incorrect line number."); |
||||||
|
Assert.AreEqual(5, task.Column, "Incorrect col number."); |
||||||
|
Assert.AreEqual("External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\vbc.exe (return code was 1)", |
||||||
|
task.Description, |
||||||
|
"Task description is wrong."); |
||||||
|
} |
||||||
|
|
||||||
|
string GetNAntOutput() |
||||||
|
{ |
||||||
|
return "Buildfile: file:///C:/Projects/dotnet/test/corsavyvbtest/corsavyvbtest.build\r\n" + |
||||||
|
"Target(s) specified: build \r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"init.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"gacreferences.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"build.debug:\r\n" + |
||||||
|
"\r\n" + |
||||||
|
" [vbc] C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build(48,6): Attribute 'imports' for <vbc ... /> is deprecated. Use the <imports> element instead.\r\n" + |
||||||
|
" [vbc] Compiling 2 files to 'C:\\Projects\\dotnet\\test\\corsavyvbtest\\bin\\Debug\\corsavyvbtest.exe'.\r\n" + |
||||||
|
" [vbc] C:\\Projects\\dotnet\\test\\corsavyvbtest\\MainForm.vb(14) : error BC30035: Syntax error.\r\n" + |
||||||
|
" [vbc] \r\n" + |
||||||
|
" [vbc] /\r\n" + |
||||||
|
" [vbc] ~\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"BUILD FAILED - 0 non-fatal error(s), 1 warning(s)\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"C:\\Projects\\dotnet\\test\\corsavyvbtest\\corsavyvbtest.build(48,6):\r\n" + |
||||||
|
"External Program Failed: C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\vbc.exe (return code was 1)\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"Total time: 0.3 seconds.\r\n" + |
||||||
|
"\r\n"; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00 |
||||||
|
# Visual Studio 2008 |
||||||
|
# SharpDevelop 3.0.0.2745 |
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAnt.AddIn", "NAnt.AddIn\NAnt.AddIn.csproj", "{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}" |
||||||
|
EndProject |
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAnt.AddIn.Tests", "NAnt.AddIn.Tests\NAnt.AddIn.Tests.csproj", "{13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}" |
||||||
|
EndProject |
||||||
|
Global |
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||||
|
Debug|Any CPU = Debug|Any CPU |
||||||
|
Release|Any CPU = Release|Any CPU |
||||||
|
EndGlobalSection |
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||||
|
{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||||
|
{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||||
|
{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}.Release|Any CPU.Build.0 = Release|Any CPU |
||||||
|
{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||||
|
{13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||||
|
{13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||||
|
{13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}.Release|Any CPU.Build.0 = Release|Any CPU |
||||||
|
{13AB8351-39E5-4F9D-A59C-B30D60CF6B8C}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||||
|
EndGlobalSection |
||||||
|
EndGlobal |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
using System.Reflection; |
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("NAnt.AddIn")] |
||||||
|
[assembly: AssemblyDescription("NAnt AddIn for SharpDevelop")] |
||||||
|
[assembly: AssemblyConfiguration("")] |
||||||
|
[assembly: AssemblyCompany("")] |
||||||
|
[assembly: AssemblyProduct("SharpDevelop")] |
||||||
|
[assembly: AssemblyCopyright("")] |
||||||
|
[assembly: AssemblyTrademark("")] |
||||||
|
[assembly: AssemblyCulture("")] |
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")] |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
NAnt.AddIn.Icons.32x32.NAntBuildFileIcon = NAnt.AddIn.Icons.32x32.NAntBuildFileIcon.png |
||||||
|
NAnt.AddIn.Icons.16x16.BuildFile = NAnt.AddIn.Icons.16x16.BuildFile.png |
||||||
|
NAnt.AddIn.Icons.16x16.BuildFileError = NAnt.AddIn.Icons.16x16.BuildFileError.png |
||||||
|
NAnt.AddIn.Icons.16x16.BuildTarget = NAnt.AddIn.Icons.16x16.BuildTarget.png |
||||||
|
NAnt.AddIn.Icons.16x16.BuildTargetError = NAnt.AddIn.Icons.16x16.BuildTargetError.png |
||||||
|
NAnt.AddIn.Icons.16x16.DefaultBuildTarget = NAnt.AddIn.Icons.16x16.DefaultBuildTarget.png |
||||||
|
NAnt.AddIn.Icons.16x16.NAntPad = NAnt.AddIn.Icons.16x16.NAntPad.png |
||||||
|
NAnt.AddIn.Icons.16x16.NewBuildFile = NAnt.AddIn.Icons.16x16.NewBuildFile.png |
||||||
|
NAnt.AddIn.Icons.16x16.RunNAnt = NAnt.AddIn.Icons.16x16.RunNAnt.png |
||||||
|
NAnt.AddIn.Icons.16x16.RunNAntClean = NAnt.AddIn.Icons.16x16.RunNAntClean.png |
||||||
|
NAnt.AddIn.Icons.16x16.StopNAnt = NAnt.AddIn.Icons.16x16.StopNAnt.png |
||||||
|
Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 443 B |
|
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 546 B |
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 416 B After Width: | Height: | Size: 416 B |
|
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
|
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 330 B |
|
Before Width: | Height: | Size: 617 B After Width: | Height: | Size: 617 B |
|
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 442 B |
|
Before Width: | Height: | Size: 455 B After Width: | Height: | Size: 455 B |
|
Before Width: | Height: | Size: 438 B After Width: | Height: | Size: 438 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,3 @@ |
|||||||
|
..\..\..\..\..\SharpDevelopResources\BitmapResources\resasm BitmapResources.res |
||||||
|
move BitmapResources.resources ..\Resources\BitmapResources.resources |
||||||
|
pause |
||||||
@ -0,0 +1,103 @@ |
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> |
||||||
|
<PropertyGroup> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<SchemaVersion>2.0</SchemaVersion> |
||||||
|
<ProjectGuid>{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}</ProjectGuid> |
||||||
|
<RootNamespace>ICSharpCode.NAnt</RootNamespace> |
||||||
|
<AssemblyName>NAnt.AddIn</AssemblyName> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
<NoStdLib>False</NoStdLib> |
||||||
|
<NoConfig>False</NoConfig> |
||||||
|
<DebugType>Full</DebugType> |
||||||
|
<RegisterForComInterop>False</RegisterForComInterop> |
||||||
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||||
|
<BaseAddress>121634816</BaseAddress> |
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||||
|
<FileAlignment>4096</FileAlignment> |
||||||
|
<DebugSymbols>true</DebugSymbols> |
||||||
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||||
|
<Optimize>False</Optimize> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||||
|
<OutputPath>..\..\..\AddIns\Samples\NAnt.AddIn</OutputPath> |
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||||
|
<Optimize>True</Optimize> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||||
|
<OutputPath>..\..\..\AddIns\Samples\NAnt.AddIn</OutputPath> |
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="ICSharpCode.Core"> |
||||||
|
<HintPath>..\..\..\bin\ICSharpCode.Core.dll</HintPath> |
||||||
|
<Private>False</Private> |
||||||
|
</Reference> |
||||||
|
<Reference Include="ICSharpCode.SharpDevelop"> |
||||||
|
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath> |
||||||
|
<Private>False</Private> |
||||||
|
</Reference> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Core"> |
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
<Reference Include="System.Data" /> |
||||||
|
<Reference Include="System.Drawing" /> |
||||||
|
<Reference Include="System.Windows.Forms" /> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="Src\AddInOptions.cs" /> |
||||||
|
<Compile Include="Src\Commands\RunSelectedNAntCleanTargetCommand.cs" /> |
||||||
|
<Compile Include="Src\Gui\NAntAddInOptionPanel.cs" /> |
||||||
|
<Compile Include="Src\Commands\RunNAntCommand.cs" /> |
||||||
|
<Compile Include="Src\NAntAddInException.cs" /> |
||||||
|
<Compile Include="Src\NAntRunner.cs" /> |
||||||
|
<Compile Include="Src\NAntExitEventArgs.cs" /> |
||||||
|
<Compile Include="Src\Commands\RunNAntCleanTargetCommand.cs" /> |
||||||
|
<Compile Include="Src\Gui\NAntPadContent.cs" /> |
||||||
|
<Compile Include="Src\Gui\NAntPadTreeViewImageList.cs" /> |
||||||
|
<Compile Include="Src\Gui\NAntBuildFileTreeNode.cs" /> |
||||||
|
<Compile Include="Src\Gui\NAntBuildTargetTreeNode.cs" /> |
||||||
|
<Compile Include="Src\Gui\NAntPadTreeView.cs" /> |
||||||
|
<Compile Include="Src\Commands\RunSelectedNAntTargetCommand.cs" /> |
||||||
|
<Compile Include="Src\Commands\GoToTargetDefinitionCommand.cs" /> |
||||||
|
<Compile Include="Src\Commands\OpenNAntBuildFileCommand.cs" /> |
||||||
|
<Compile Include="Src\NAntBuildTargetCollection.cs" /> |
||||||
|
<Compile Include="Src\NAntBuildFile.cs" /> |
||||||
|
<Compile Include="Src\NAntBuildTarget.cs" /> |
||||||
|
<Compile Include="Src\NAntBuildFileError.cs" /> |
||||||
|
<Compile Include="Src\Gui\NAntBuildFileErrorTreeNode.cs" /> |
||||||
|
<Compile Include="Src\Commands\GoToErrorCommand.cs" /> |
||||||
|
<Compile Include="Src\Commands\AbstractRunNAntCommand.cs" /> |
||||||
|
<Compile Include="Src\NAntOutputParser.cs" /> |
||||||
|
<Compile Include="Src\TaskCollection.cs" /> |
||||||
|
<Compile Include="Src\NAntRunnerSingleton.cs" /> |
||||||
|
<Compile Include="Src\Commands\StopNAntCommand.cs" /> |
||||||
|
<None Include="Resources\BitmapResources.resources"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<EmbeddedResource Include="Resources\NAntAddInOptionPanel.xfrm" /> |
||||||
|
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||||
|
<None Include="NAnt.addin"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="Templates\EmptyNAntBuildFile.xft"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<Compile Include="Src\Commands\RefreshNantPadCommand.cs" /> |
||||||
|
<Compile Include="Src\IsNAntRunningCondition.cs" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Folder Include="Templates" /> |
||||||
|
<Folder Include="Src\Gui\" /> |
||||||
|
<Folder Include="Src\Commands\" /> |
||||||
|
<Folder Include="Resources" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||||
|
</Project> |
||||||
@ -0,0 +1,168 @@ |
|||||||
|
<AddIn name="NAnt AddIn" |
||||||
|
author="Matt Ward" |
||||||
|
copyright="prj:///doc/copyright.txt" |
||||||
|
description="NAnt integration for SharpDevelop."> |
||||||
|
|
||||||
|
<Manifest> |
||||||
|
<Identity name="NAnt.AddIn"/> |
||||||
|
</Manifest> |
||||||
|
|
||||||
|
<Runtime> |
||||||
|
<Import assembly="NAnt.AddIn.dll"> |
||||||
|
<ConditionEvaluator name="IsNAntRunning" class="ICSharpCode.NAnt.IsNAntRunningCondition"/> |
||||||
|
</Import> |
||||||
|
</Runtime> |
||||||
|
|
||||||
|
<!-- NAnt file filter --> |
||||||
|
<Path name = "/SharpDevelop/Workbench/FileFilter"> |
||||||
|
<FileFilter id="NAnt" |
||||||
|
insertbefore="AllFiles" |
||||||
|
name="NAnt Build Files (*.build;*.include)" |
||||||
|
extensions="*.build;*.include"/> |
||||||
|
</Path> |
||||||
|
|
||||||
|
<!-- Menu options --> |
||||||
|
<Path name="/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions"> |
||||||
|
<MenuItem id="NAnt" |
||||||
|
label="&NAnt" |
||||||
|
icon="NAnt.AddIn.Icons.16x16.NAntPad" |
||||||
|
type="Menu"> |
||||||
|
<ComplexCondition action="Disable"> |
||||||
|
<And> |
||||||
|
<Not> |
||||||
|
<Condition name="IsNAntRunning"/> |
||||||
|
</Not> |
||||||
|
</And> |
||||||
|
<MenuItem id="RunNAnt" |
||||||
|
icon="NAnt.AddIn.Icons.16x16.RunNAnt" |
||||||
|
label="Run Default &Target" |
||||||
|
description="Runs NAnt on the build file contained in a SharpDevelop project file." |
||||||
|
class="ICSharpCode.NAnt.Commands.RunNAntCommand" |
||||||
|
/> |
||||||
|
<MenuItem id="RunNAntCleanTarget" |
||||||
|
icon="NAnt.AddIn.Icons.16x16.RunNAntClean" |
||||||
|
insertafter="RunNAnt" |
||||||
|
label="Run &Clean Target" |
||||||
|
description="Runs the clean target on the build file." |
||||||
|
class="ICSharpCode.NAnt.Commands.RunNAntCleanTargetCommand" |
||||||
|
/> |
||||||
|
</ComplexCondition> |
||||||
|
<ComplexCondition action="Disable"> |
||||||
|
<And> |
||||||
|
<Condition name="IsNAntRunning"/> |
||||||
|
</And> |
||||||
|
<MenuItem id="StopNAnt" |
||||||
|
icon="NAnt.AddIn.Icons.16x16.StopNAnt" |
||||||
|
insertafter="RunNAntCleanTarget" |
||||||
|
label="&Stop NAnt" |
||||||
|
description="Stops the currently running build." |
||||||
|
class="ICSharpCode.NAnt.Commands.StopNAntCommand" |
||||||
|
/> |
||||||
|
</ComplexCondition> |
||||||
|
</MenuItem> |
||||||
|
</Path> |
||||||
|
|
||||||
|
<!-- Project browser icons --> |
||||||
|
<Path name="/Workspace/Icons"> |
||||||
|
<Icon id="NAntBuildFileIcon" |
||||||
|
extensions=".build" |
||||||
|
resource="NAnt.AddIn.Icons.16x16.BuildFile" /> |
||||||
|
<Icon id="NAntBuildIncludeFileIcon" |
||||||
|
extensions=".include" |
||||||
|
resource="NAnt.AddIn.Icons.16x16.BuildFile" /> |
||||||
|
</Path> |
||||||
|
|
||||||
|
<!-- Options panel --> |
||||||
|
<Path name="/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions"> |
||||||
|
<DialogPanel id="NAntAddInOptionPanel" |
||||||
|
label="NAnt" |
||||||
|
class="ICSharpCode.NAnt.Gui.NAntAddInOptionPanel"/> |
||||||
|
</Path> |
||||||
|
|
||||||
|
<!-- NAnt pad --> |
||||||
|
<Path name="/SharpDevelop/Workbench/Pads"> |
||||||
|
<Pad id="NAntPad" |
||||||
|
category="Tools" |
||||||
|
title="NAnt" |
||||||
|
icon="NAnt.AddIn.Icons.16x16.NAntPad" |
||||||
|
class="ICSharpCode.NAnt.Gui.NAntPadContent"/> |
||||||
|
</Path> |
||||||
|
|
||||||
|
<!-- NAnt pad toolbar --> |
||||||
|
<Path name="/SharpDevelop/Pads/NAntPad/Toolbar"> |
||||||
|
<ComplexCondition action="Disable"> |
||||||
|
<And> |
||||||
|
<Not> |
||||||
|
<Condition name="IsNAntRunning"/> |
||||||
|
</Not> |
||||||
|
</And> |
||||||
|
<ToolbarItem id="Run" |
||||||
|
icon="Icons.16x16.RunProgramIcon" |
||||||
|
tooltip="Runs the selected target" |
||||||
|
class="ICSharpCode.NAnt.Commands.RunSelectedNAntTargetCommand"/> |
||||||
|
</ComplexCondition> |
||||||
|
<ToolbarItem id="Refresh" |
||||||
|
icon="Icons.16x16.BrowserRefresh" |
||||||
|
tooltip="Reloads the build files" |
||||||
|
class="ICSharpCode.NAnt.Commands.RefreshNAntPadCommand"/> |
||||||
|
<ComplexCondition action="Disable"> |
||||||
|
<And> |
||||||
|
<Condition name="IsNAntRunning"/> |
||||||
|
</And> |
||||||
|
<ToolbarItem id="Stop" |
||||||
|
icon="Icons.16x16.Debug.StopProcess" |
||||||
|
tooltip="Stops the current build" |
||||||
|
class="ICSharpCode.NAnt.Commands.StopNAntCommand"/> |
||||||
|
</ComplexCondition> |
||||||
|
</Path> |
||||||
|
|
||||||
|
<!-- NAnt pad tree view context menu --> |
||||||
|
<Path name="/SharpDevelop/Pads/NAntPad/ContextMenu"> |
||||||
|
<Condition name="Ownerstate" ownerstate="BuildFileSelected"> |
||||||
|
<MenuItem id="RunDefaultTarget" |
||||||
|
icon="NAnt.AddIn.Icons.16x16.RunNAnt" |
||||||
|
label="Run Default &Target" |
||||||
|
class="ICSharpCode.NAnt.Commands.RunSelectedNAntTargetCommand"/> |
||||||
|
<MenuItem id="RunNAntCleanTarget" |
||||||
|
icon="NAnt.AddIn.Icons.16x16.RunNAntClean" |
||||||
|
label="Run &Clean Target" |
||||||
|
description="Runs the clean target on the build file." |
||||||
|
class="ICSharpCode.NAnt.Commands.RunSelectedNAntCleanTargetCommand"/> |
||||||
|
</Condition> |
||||||
|
<Condition name="Ownerstate" ownerstate="BuildFileSelected"> |
||||||
|
<MenuItem id="StopNAnt" |
||||||
|
icon="NAnt.AddIn.Icons.16x16.StopNAnt" |
||||||
|
label="&Stop NAnt" |
||||||
|
description="Stops the currently running build." |
||||||
|
class="ICSharpCode.NAnt.Commands.StopNAntCommand"/> |
||||||
|
</Condition> |
||||||
|
<Condition name="Ownerstate" ownerstate="TargetSelected"> |
||||||
|
<MenuItem id="RunTarget" |
||||||
|
icon="Icons.16x16.RunProgramIcon" |
||||||
|
label="Run &Target" |
||||||
|
class="ICSharpCode.NAnt.Commands.RunSelectedNAntTargetCommand"/> |
||||||
|
</Condition> |
||||||
|
<MenuItem id="OpenBuildFile" |
||||||
|
icon="Icons.16x16.OpenFileIcon" |
||||||
|
label="Open" |
||||||
|
class="ICSharpCode.NAnt.Commands.OpenNAntBuildFileCommand"/> |
||||||
|
<Condition name="Ownerstate" ownerstate="TargetSelected"> |
||||||
|
<MenuItem id="GoToTargetDefinition" |
||||||
|
label="&Goto Definition" |
||||||
|
class="ICSharpCode.NAnt.Commands.GoToTargetDefinitionCommand"/> |
||||||
|
</Condition> |
||||||
|
<Condition name="Ownerstate" ownerstate="ErrorSelected"> |
||||||
|
<MenuItem id="GoToError" |
||||||
|
label="&Goto Error" |
||||||
|
class="ICSharpCode.NAnt.Commands.GoToErrorCommand"/> |
||||||
|
</Condition> |
||||||
|
</Path> |
||||||
|
|
||||||
|
<!-- NAnt templates --> |
||||||
|
<Path name="/SharpDevelop/BackendBindings/Templates"> |
||||||
|
<Directory id="NAnt" path="./Templates"/> |
||||||
|
</Path> |
||||||
|
|
||||||
|
<!-- Bitmap resources --> |
||||||
|
<BitmapResources file="Resources\BitmapResources.resources" /> |
||||||
|
</AddIn> |
||||||
@ -0,0 +1,93 @@ |
|||||||
|
<Components version="1.0"> |
||||||
|
<System.Windows.Forms.UserControl> |
||||||
|
<Name value="NAntAddInOptionPanel" /> |
||||||
|
<ClientSize value="{Width=464, Height=344}" /> |
||||||
|
<Controls> |
||||||
|
<System.Windows.Forms.GroupBox> |
||||||
|
<Name value="nantConfigurationGroupBox" /> |
||||||
|
<Location value="{X=3,Y=3}" /> |
||||||
|
<Text value="NAnt Configuration" /> |
||||||
|
<Size value="{Width=448, Height=192}" /> |
||||||
|
<TabIndex value="2" /> |
||||||
|
<Anchor value="Top, Left, Right" /> |
||||||
|
<Controls> |
||||||
|
<System.Windows.Forms.CheckBox> |
||||||
|
<Name value="debugModeCheckBox" /> |
||||||
|
<CheckAlign value="MiddleRight" /> |
||||||
|
<Location value="{X=8,Y=160}" /> |
||||||
|
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
||||||
|
<Text value="&Debug" /> |
||||||
|
<TabIndex value="9" /> |
||||||
|
<Size value="{Width=120, Height=24}" /> |
||||||
|
</System.Windows.Forms.CheckBox> |
||||||
|
<System.Windows.Forms.CheckBox> |
||||||
|
<Name value="quietCheckBox" /> |
||||||
|
<CheckAlign value="MiddleRight" /> |
||||||
|
<Location value="{X=8,Y=88}" /> |
||||||
|
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
||||||
|
<Text value="&Quiet" /> |
||||||
|
<TabIndex value="6" /> |
||||||
|
<Size value="{Width=120, Height=24}" /> |
||||||
|
</System.Windows.Forms.CheckBox> |
||||||
|
<System.Windows.Forms.CheckBox> |
||||||
|
<Name value="verboseCheckBox" /> |
||||||
|
<CheckAlign value="MiddleRight" /> |
||||||
|
<Location value="{X=8,Y=136}" /> |
||||||
|
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
||||||
|
<Text value="Ver&bose" /> |
||||||
|
<TabIndex value="8" /> |
||||||
|
<Size value="{Width=120, Height=24}" /> |
||||||
|
</System.Windows.Forms.CheckBox> |
||||||
|
<System.Windows.Forms.CheckBox> |
||||||
|
<Name value="showLogoCheckBox" /> |
||||||
|
<CheckAlign value="MiddleRight" /> |
||||||
|
<Location value="{X=8,Y=112}" /> |
||||||
|
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
||||||
|
<Text value="Show &Logo" /> |
||||||
|
<TabIndex value="7" /> |
||||||
|
<Size value="{Width=120, Height=24}" /> |
||||||
|
</System.Windows.Forms.CheckBox> |
||||||
|
<System.Windows.Forms.Button> |
||||||
|
<Name value="browseButton" /> |
||||||
|
<Location value="{X=408,Y=36}" /> |
||||||
|
<Text value="..." /> |
||||||
|
<Size value="{Width=32, Height=23}" /> |
||||||
|
<Anchor value="Top, Right" /> |
||||||
|
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
||||||
|
<TabIndex value="3" /> |
||||||
|
</System.Windows.Forms.Button> |
||||||
|
<System.Windows.Forms.TextBox> |
||||||
|
<Name value="argumentsTextBox" /> |
||||||
|
<TabIndex value="5" /> |
||||||
|
<Anchor value="Top, Left, Right" /> |
||||||
|
<Size value="{Width=328, Height=21}" /> |
||||||
|
<Location value="{X=112,Y=64}" /> |
||||||
|
</System.Windows.Forms.TextBox> |
||||||
|
<System.Windows.Forms.Label> |
||||||
|
<Name value="nantArgumentsLabel" /> |
||||||
|
<Location value="{X=8,Y=64}" /> |
||||||
|
<Text value="&Arguments" /> |
||||||
|
<TextAlign value="MiddleLeft" /> |
||||||
|
<Size value="{Width=64, Height=16}" /> |
||||||
|
<TabIndex value="4" /> |
||||||
|
</System.Windows.Forms.Label> |
||||||
|
<System.Windows.Forms.TextBox> |
||||||
|
<Name value="nantCommandTextBox" /> |
||||||
|
<TabIndex value="2" /> |
||||||
|
<Anchor value="Top, Left, Right" /> |
||||||
|
<Size value="{Width=288, Height=21}" /> |
||||||
|
<Location value="{X=112,Y=36}" /> |
||||||
|
</System.Windows.Forms.TextBox> |
||||||
|
<System.Windows.Forms.Label> |
||||||
|
<Name value="nantCommandLabel" /> |
||||||
|
<Location value="{X=8,Y=34}" /> |
||||||
|
<Text value="&Command" /> |
||||||
|
<TextAlign value="MiddleLeft" /> |
||||||
|
<Size value="{Width=56, Height=16}" /> |
||||||
|
<TabIndex value="1" /> |
||||||
|
</System.Windows.Forms.Label> |
||||||
|
</Controls> |
||||||
|
</System.Windows.Forms.GroupBox> |
||||||
|
</Controls> |
||||||
|
</System.Windows.Forms.UserControl> |
||||||
|
</Components> |
||||||
@ -0,0 +1,153 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Diagnostics; |
||||||
|
using ICSharpCode.Core; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// The NAnt add-in options.
|
||||||
|
/// </summary>
|
||||||
|
public class AddInOptions |
||||||
|
{ |
||||||
|
public static readonly string OptionsProperty = "NAntAddIn.Options"; |
||||||
|
|
||||||
|
#region Property names
|
||||||
|
public static readonly string NAntFileNameProperty = "NAntFileName"; |
||||||
|
public static readonly string NAntArgumentsProperty = "NAntArguments"; |
||||||
|
public static readonly string VerboseProperty = "Verbose"; |
||||||
|
public static readonly string ShowLogoProperty = "ShowLogo"; |
||||||
|
public static readonly string QuietProperty = "Quiet"; |
||||||
|
public static readonly string DebugModeProperty = "DebugMode"; |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Property defaults
|
||||||
|
public static readonly string DefaultNAntFileName = "nant.exe"; |
||||||
|
#endregion
|
||||||
|
|
||||||
|
static Properties properties; |
||||||
|
|
||||||
|
static AddInOptions() |
||||||
|
{ |
||||||
|
properties = PropertyService.Get(OptionsProperty, new Properties()); |
||||||
|
} |
||||||
|
|
||||||
|
static Properties Properties { |
||||||
|
get { |
||||||
|
Debug.Assert(properties != null); |
||||||
|
return properties; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the NAnt executable filename.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is either the full filename including path
|
||||||
|
/// or just the name of the executable (nant.exe) in which
|
||||||
|
/// case it is assumed that NAnt is on the path.
|
||||||
|
/// </remarks>
|
||||||
|
public static string NAntFileName { |
||||||
|
get { |
||||||
|
return (string)Properties.Get(NAntFileNameProperty, DefaultNAntFileName); |
||||||
|
} |
||||||
|
set { |
||||||
|
if (String.IsNullOrEmpty(value)) { |
||||||
|
Properties.Set(NAntFileNameProperty, DefaultNAntFileName); |
||||||
|
} else { |
||||||
|
Properties.Set(NAntFileNameProperty, value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the NAnt command line arguments.
|
||||||
|
/// </summary>
|
||||||
|
public static string NAntArguments { |
||||||
|
get { |
||||||
|
return (string)Properties.Get(NAntArgumentsProperty, String.Empty); |
||||||
|
} |
||||||
|
set { |
||||||
|
Properties.Set(NAntArgumentsProperty, value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the NAnt -verbose setting.
|
||||||
|
/// </summary>
|
||||||
|
public static bool Verbose { |
||||||
|
get { |
||||||
|
return (bool)Properties.Get(VerboseProperty, false); |
||||||
|
} |
||||||
|
set { |
||||||
|
Properties.Set(VerboseProperty, value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the NAnt show logo setting.
|
||||||
|
/// </summary>
|
||||||
|
public static bool ShowLogo { |
||||||
|
get { |
||||||
|
return (bool)Properties.Get(ShowLogoProperty, false); |
||||||
|
} |
||||||
|
set { |
||||||
|
Properties.Set(ShowLogoProperty, value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the NAnt -quiet setting.
|
||||||
|
/// </summary>
|
||||||
|
public static bool Quiet { |
||||||
|
get { |
||||||
|
return (bool)Properties.Get(QuietProperty, false); |
||||||
|
} |
||||||
|
set { |
||||||
|
Properties.Set(QuietProperty, value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the NAnt -debug setting.
|
||||||
|
/// </summary>
|
||||||
|
public static bool DebugMode { |
||||||
|
get { |
||||||
|
return (bool)Properties.Get(DebugModeProperty, false); |
||||||
|
} |
||||||
|
set { |
||||||
|
Properties.Set(DebugModeProperty, value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,338 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.IO; |
||||||
|
|
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.NAnt.Gui; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
using ICSharpCode.SharpDevelop.Util; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// The base class for all commands that run NAnt.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class AbstractRunNAntCommand : AbstractMenuCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// The default NAnt build filename.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string DefaultBuildFileName = "default.build"; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The default NAnt build file extension.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string NAntBuildFileExtension = ".build"; |
||||||
|
|
||||||
|
const int Win32FileNotFoundErrorCode = 2; |
||||||
|
const int Win32PathNotFoundErrorCode = 3; |
||||||
|
|
||||||
|
static MessageViewCategory category; |
||||||
|
static NAntRunner runner; |
||||||
|
|
||||||
|
public AbstractRunNAntCommand() |
||||||
|
{ |
||||||
|
if (runner == null) { |
||||||
|
runner = NAntRunnerSingleton.Runner; |
||||||
|
runner.NAntExited += new NAntExitEventHandler(NAntExited); |
||||||
|
runner.OutputLineReceived += new LineReceivedEventHandler(OutputLineReceived); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public static bool IsActiveConfigurationDebug { |
||||||
|
get { |
||||||
|
|
||||||
|
bool isDebug = false; |
||||||
|
|
||||||
|
IProject project = ProjectService.CurrentProject; |
||||||
|
if (project != null) { |
||||||
|
if (String.Compare(project.ActiveConfiguration, "debug", true) == 0) { |
||||||
|
isDebug = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return isDebug; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the NAnt build filename from the selected project.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>The basic logic is:</para>
|
||||||
|
/// <para>Look for a file called "default.build".</para>
|
||||||
|
/// <para>Look for a file named after the project
|
||||||
|
/// "<projectName>.build".</para>
|
||||||
|
/// <para>Look for the first ".build" file in the project.</para>
|
||||||
|
/// <para>If multiple ".build" files exist then, like NAnt,
|
||||||
|
/// this is an error, but currently we ignore this.</para>
|
||||||
|
/// <para>Note that this does not look in the project folder
|
||||||
|
/// for a .build file that is not added to the project.
|
||||||
|
/// </para>
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>The build filename for the project.</returns>
|
||||||
|
protected string GetProjectBuildFileName() |
||||||
|
{ |
||||||
|
string fileName = String.Empty; |
||||||
|
|
||||||
|
IProject project = ProjectService.CurrentProject; |
||||||
|
|
||||||
|
// Look for "default.build".
|
||||||
|
string projectFileName = project.FileName; |
||||||
|
|
||||||
|
string buildFileName = Path.Combine(Path.GetDirectoryName(projectFileName), DefaultBuildFileName); |
||||||
|
if (project.IsFileInProject(buildFileName)) { |
||||||
|
fileName = buildFileName; |
||||||
|
} else { |
||||||
|
|
||||||
|
// Look for <projectname>.build
|
||||||
|
buildFileName = Path.ChangeExtension(projectFileName, NAntBuildFileExtension); |
||||||
|
if (project.IsFileInProject(buildFileName)) { |
||||||
|
fileName = buildFileName; |
||||||
|
} else { |
||||||
|
|
||||||
|
// Look for the first matching .build file.
|
||||||
|
ProjectItem projectItem = GetFirstMatchingFile(project, NAntBuildFileExtension); |
||||||
|
if (projectItem != null) { |
||||||
|
fileName = projectItem.FileName; |
||||||
|
} else { |
||||||
|
throw new NAntAddInException("Project does not contain a '.build' file."); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return fileName; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Runs any pre-build steps such as saving changed files.
|
||||||
|
/// </summary>
|
||||||
|
protected void RunPreBuildSteps() |
||||||
|
{ |
||||||
|
//ProjectService.DoBeforeCompileAction();
|
||||||
|
TaskService.ClearExceptCommentTasks(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Runs the default target in the NAnt build.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="buildFileName">The build file to run.</param>
|
||||||
|
/// <param name="workingDirectory">The working folder for NAnt.</param>
|
||||||
|
/// <param name="debug">Flag indicating whether to set the NAnt debug property.</param>
|
||||||
|
protected void RunBuild(string buildFileName, string workingDirectory, bool debug) |
||||||
|
{ |
||||||
|
RunBuild(buildFileName, workingDirectory, debug, String.Empty, String.Empty); |
||||||
|
} |
||||||
|
|
||||||
|
protected void RunBuild(string buildFileName, string workingDirectory, bool debug, string target) |
||||||
|
{ |
||||||
|
RunBuild(buildFileName, workingDirectory, debug, target, String.Empty); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Runs the specified target in the NAnt build.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="buildFileName">The build file to run.</param>
|
||||||
|
/// <param name="workingDirectory">The working folder for NAnt.</param>
|
||||||
|
/// <param name="debug">Flag indicating whether to set the NAnt debug property.</param>
|
||||||
|
/// <param name="target">The NAnt target to run.</param>
|
||||||
|
/// <param name="args">Command line arguments to pass to NAnt.</param>
|
||||||
|
protected void RunBuild(string buildFileName, string workingDirectory, bool debug, string target, string args) |
||||||
|
{ |
||||||
|
if (IsBuildRunning) { |
||||||
|
throw new NAntAddInException("A NAnt build is currently running."); |
||||||
|
} |
||||||
|
|
||||||
|
Category.ClearText(); |
||||||
|
ShowOutputPad(); |
||||||
|
|
||||||
|
runner.BuildFileName = buildFileName; |
||||||
|
runner.NAntFileName = AddInOptions.NAntFileName; |
||||||
|
runner.Verbose = AddInOptions.Verbose; |
||||||
|
runner.WorkingDirectory = workingDirectory; |
||||||
|
runner.Quiet = AddInOptions.Quiet; |
||||||
|
runner.ShowLogo = AddInOptions.ShowLogo; |
||||||
|
runner.DebugMode = AddInOptions.DebugMode; |
||||||
|
|
||||||
|
if (debug) { |
||||||
|
runner.Arguments = String.Concat("-D:debug=true ", AddInOptions.NAntArguments, " ", args, " ", target); |
||||||
|
} else { |
||||||
|
runner.Arguments = String.Concat(AddInOptions.NAntArguments, " ", args, " ", target); |
||||||
|
} |
||||||
|
|
||||||
|
CategoryWriteLine(StringParser.Parse("Running NAnt.")); |
||||||
|
CategoryWriteLine(runner.CommandLine); |
||||||
|
|
||||||
|
try { |
||||||
|
runner.Start(); |
||||||
|
} catch (Win32Exception ex) { |
||||||
|
if (ex.NativeErrorCode == Win32FileNotFoundErrorCode || ex.NativeErrorCode == Win32PathNotFoundErrorCode) { |
||||||
|
throw new NAntAddInException(GetNAntNotFoundErrorMessage(AddInOptions.NAntFileName), ex); |
||||||
|
} else { |
||||||
|
throw; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets any extra arguments from the NAnt pad's text box.
|
||||||
|
/// </summary>
|
||||||
|
protected string GetPadTextBoxArguments() |
||||||
|
{ |
||||||
|
string arguments = String.Empty; |
||||||
|
|
||||||
|
IWorkbench Workbench = ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.Workbench; |
||||||
|
PadDescriptor padDescriptor = Workbench.GetPad(typeof(NAntPadContent)); |
||||||
|
|
||||||
|
if (padDescriptor != null && padDescriptor.PadContent != null) { |
||||||
|
arguments = ((NAntPadContent)padDescriptor.PadContent).Arguments; |
||||||
|
} |
||||||
|
|
||||||
|
return arguments; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stops the currently running build.
|
||||||
|
/// </summary>
|
||||||
|
protected void StopBuild() |
||||||
|
{ |
||||||
|
if (IsBuildRunning) { |
||||||
|
if (MessageService.AskQuestion(StringParser.Parse("This will terminate the NAnt process. Are you sure?"))) { |
||||||
|
runner.Stop(); |
||||||
|
CategoryWriteLine(StringParser.Parse("NAnt build stopped.")); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected bool IsBuildRunning { |
||||||
|
get { |
||||||
|
return runner.IsRunning; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the NAnt message view output window.
|
||||||
|
/// </summary>
|
||||||
|
MessageViewCategory Category { |
||||||
|
get { |
||||||
|
if (category == null) { |
||||||
|
category = new MessageViewCategory("NAnt"); |
||||||
|
CompilerMessageView cmv = (CompilerMessageView)WorkbenchSingleton.Workbench.GetPad(typeof(CompilerMessageView)).PadContent; |
||||||
|
cmv.AddCategory(category); |
||||||
|
} |
||||||
|
|
||||||
|
return category; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes a line of text to the output window.
|
||||||
|
/// </summary>
|
||||||
|
void CategoryWriteLine(string message) |
||||||
|
{ |
||||||
|
Category.AppendText(String.Concat(message, Environment.NewLine)); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brings output pad to the front.
|
||||||
|
/// </summary>
|
||||||
|
void ShowOutputPad() |
||||||
|
{ |
||||||
|
WorkbenchSingleton.Workbench.GetPad(typeof(CompilerMessageView)).BringPadToFront(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks for the first file that matches the specified
|
||||||
|
/// file extension.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="extension">A filename extension.</param>
|
||||||
|
/// <returns>A ProjectItem that has the specified extension,
|
||||||
|
/// or null.</returns>
|
||||||
|
ProjectItem GetFirstMatchingFile(IProject project, string extension) |
||||||
|
{ |
||||||
|
foreach (ProjectItem projectItem in project.Items) { |
||||||
|
string projectFileNameExtension = Path.GetExtension(projectItem.FileName); |
||||||
|
if (String.Compare(projectFileNameExtension, extension, true) == 0) { |
||||||
|
return projectItem; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Displays the output from NAnt after it has exited.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">The event source.</param>
|
||||||
|
/// <param name="e">The NAnt exit event arguments.</param>
|
||||||
|
void NAntExited(object sender, NAntExitEventArgs e) |
||||||
|
{ |
||||||
|
// Update output window.
|
||||||
|
string outputText = String.Empty; |
||||||
|
|
||||||
|
System.Diagnostics.Debug.Assert(e.Error.Length == 0); |
||||||
|
|
||||||
|
outputText = String.Concat(outputText, e.Output); |
||||||
|
|
||||||
|
// Update task list.
|
||||||
|
TaskCollection tasks = NAntOutputParser.Parse(outputText); |
||||||
|
foreach (Task task in tasks) { |
||||||
|
WorkbenchSingleton.SafeThreadAsyncCall(TaskService.Add, task); |
||||||
|
} |
||||||
|
|
||||||
|
// Bring task list to front.
|
||||||
|
if (tasks.Count > 0 && ErrorListPad.ShowAfterBuild) { |
||||||
|
IWorkbench workbench = ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.Workbench; |
||||||
|
PadDescriptor padDescriptor = workbench.GetPad(typeof(ErrorListPad)); |
||||||
|
if (padDescriptor != null) { |
||||||
|
WorkbenchSingleton.SafeThreadAsyncCall(padDescriptor.BringPadToFront); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void OutputLineReceived(object sender, LineReceivedEventArgs e) |
||||||
|
{ |
||||||
|
CategoryWriteLine(e.Line); |
||||||
|
} |
||||||
|
|
||||||
|
string GetNAntNotFoundErrorMessage(string fileName) |
||||||
|
{ |
||||||
|
string formatString = "Unable to find NAnt '{0}'.\r\n\r\n" + |
||||||
|
"Please configure the NAnt executable's location in the SharpDevelop Options."; |
||||||
|
|
||||||
|
return String.Format(formatString, fileName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,57 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.NAnt.Gui; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Opens up a NAnt build file and goes to the line of the
|
||||||
|
/// error.
|
||||||
|
/// </summary>
|
||||||
|
public class GoToErrorCommand : AbstractMenuCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs the <see cref="GoToErrorCommand"/>.
|
||||||
|
/// </summary>
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
NAntPadTreeView padTreeView = (NAntPadTreeView)Owner; |
||||||
|
|
||||||
|
NAntBuildFile buildFile = padTreeView.SelectedBuildFile; |
||||||
|
|
||||||
|
if (buildFile != null) { |
||||||
|
string fileName = Path.Combine(buildFile.Directory, buildFile.FileName); |
||||||
|
FileService.JumpToFilePosition(fileName, buildFile.Error.Line, buildFile.Error.Column); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,61 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.NAnt.Gui; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Opens up a NAnt build file and goes to the line of the
|
||||||
|
/// target selected.
|
||||||
|
/// </summary>
|
||||||
|
public class GoToTargetDefinitionCommand : AbstractMenuCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs the <see cref="GoToDefinitionCommand"/>.
|
||||||
|
/// </summary>
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
NAntPadTreeView padTreeView = (NAntPadTreeView)Owner; |
||||||
|
|
||||||
|
NAntBuildFile buildFile = padTreeView.SelectedBuildFile; |
||||||
|
|
||||||
|
if (buildFile != null) { |
||||||
|
NAntBuildTarget target = padTreeView.SelectedTarget; |
||||||
|
|
||||||
|
if (target != null) { |
||||||
|
string fileName = Path.Combine(buildFile.Directory, buildFile.FileName); |
||||||
|
FileService.JumpToFilePosition(fileName, target.Line, target.Column); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,56 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.NAnt.Gui; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Opens the build file selected in the NAnt pad view.
|
||||||
|
/// </summary>
|
||||||
|
public class OpenNAntBuildFileCommand : AbstractMenuCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs the <see cref="OpenNAntBuildFile"/>.
|
||||||
|
/// </summary>
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
NAntPadTreeView padTreeView = (NAntPadTreeView)Owner; |
||||||
|
|
||||||
|
NAntBuildFile buildFile = padTreeView.SelectedBuildFile; |
||||||
|
|
||||||
|
if (buildFile != null) { |
||||||
|
string fileName = Path.Combine(buildFile.Directory, buildFile.FileName); |
||||||
|
FileService.OpenFile(fileName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,43 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.NAnt.Gui; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Refreshes the NAnt pad.
|
||||||
|
/// </summary>
|
||||||
|
public class RefreshNAntPadCommand : AbstractRunNAntCommand |
||||||
|
{ |
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
NAntPadContent.Instance.Refresh(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,59 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using ICSharpCode.Core; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs the NAnt "clean" target on the project's build file.
|
||||||
|
/// </summary>
|
||||||
|
public class RunNAntCleanTargetCommand : AbstractRunNAntCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs the <see cref="RunNAntCleanTargetCommand"/>.
|
||||||
|
/// </summary>
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
try { |
||||||
|
string buildFileName = GetProjectBuildFileName(); |
||||||
|
|
||||||
|
RunPreBuildSteps(); |
||||||
|
|
||||||
|
RunBuild(Path.GetFileName(buildFileName), |
||||||
|
Path.GetDirectoryName(buildFileName), |
||||||
|
IsActiveConfigurationDebug, |
||||||
|
"clean"); |
||||||
|
|
||||||
|
} catch (NAntAddInException ex) { |
||||||
|
MessageService.ShowMessage(ex.Message); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,58 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using ICSharpCode.Core; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents the command that runs NAnt on the project's build file.
|
||||||
|
/// </summary>
|
||||||
|
public class RunNAntCommand : AbstractRunNAntCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs the <see cref="RunNAntCommand"/>.
|
||||||
|
/// </summary>
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
try { |
||||||
|
string buildFileName = GetProjectBuildFileName(); |
||||||
|
|
||||||
|
RunPreBuildSteps(); |
||||||
|
|
||||||
|
RunBuild(Path.GetFileName(buildFileName), |
||||||
|
Path.GetDirectoryName(buildFileName), |
||||||
|
IsActiveConfigurationDebug); |
||||||
|
|
||||||
|
} catch (NAntAddInException ex) { |
||||||
|
MessageService.ShowMessage(ex.Message); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,59 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.NAnt.Gui; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs the NAnt clean target for the file selected in the NAnt Pad view.
|
||||||
|
/// </summary>
|
||||||
|
public class RunSelectedNAntCleanTargetCommand : AbstractRunNAntCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs the <see cref="RunSelectedNAntCleanTargetCommand"/>.
|
||||||
|
/// </summary>
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
try { |
||||||
|
NAntBuildFile buildFile = NAntPadContent.Instance.SelectedBuildFile; |
||||||
|
if (buildFile != null) { |
||||||
|
RunPreBuildSteps(); |
||||||
|
RunBuild(buildFile.FileName, |
||||||
|
buildFile.Directory, |
||||||
|
IsActiveConfigurationDebug, |
||||||
|
"clean", |
||||||
|
GetPadTextBoxArguments()); |
||||||
|
} |
||||||
|
} catch (Exception ex) { |
||||||
|
MessageService.ShowMessage(ex.Message); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,69 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.NAnt.Gui; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs the NAnt target selected in the NAnt Pad view.
|
||||||
|
/// </summary>
|
||||||
|
public class RunSelectedNAntTargetCommand : AbstractRunNAntCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs the <see cref="RunSelectedNAntTargetCommand"/>.
|
||||||
|
/// </summary>
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
try { |
||||||
|
NAntBuildFile buildFile = NAntPadContent.Instance.SelectedBuildFile; |
||||||
|
|
||||||
|
if (buildFile != null) { |
||||||
|
NAntBuildTarget target = NAntPadContent.Instance.SelectedTarget; |
||||||
|
|
||||||
|
string targetName = String.Empty; |
||||||
|
if (target != null) { |
||||||
|
targetName = target.Name; |
||||||
|
} |
||||||
|
|
||||||
|
RunPreBuildSteps(); |
||||||
|
|
||||||
|
RunBuild(buildFile.FileName, |
||||||
|
buildFile.Directory, |
||||||
|
IsActiveConfigurationDebug, |
||||||
|
targetName, |
||||||
|
GetPadTextBoxArguments()); |
||||||
|
} |
||||||
|
|
||||||
|
} catch (Exception ex) { |
||||||
|
MessageService.ShowMessage(ex.Message); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,45 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents the command that stops the currently running NAnt process.
|
||||||
|
/// </summary>
|
||||||
|
public class StopNAntCommand : AbstractRunNAntCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs the <see cref="StopNAntCommand"/>.
|
||||||
|
/// </summary>
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
StopBuild(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,90 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Gui |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Options panel for the NAnt add-in.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntAddInOptionPanel : AbstractOptionPanel |
||||||
|
{ |
||||||
|
static readonly string commandTextBoxName = "nantCommandTextBox"; |
||||||
|
static readonly string argumentsTextBoxName = "argumentsTextBox"; |
||||||
|
static readonly string verboseCheckBoxName = "verboseCheckBox"; |
||||||
|
static readonly string browseButtonName = "browseButton"; |
||||||
|
static readonly string showLogoCheckBoxName = "showLogoCheckBox"; |
||||||
|
static readonly string quietCheckBoxName = "quietCheckBox"; |
||||||
|
static readonly string debugModeCheckBoxName = "debugModeCheckBox"; |
||||||
|
|
||||||
|
public override void LoadPanelContents() |
||||||
|
{ |
||||||
|
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.NAnt.Resources.NAntAddInOptionPanel.xfrm")); |
||||||
|
|
||||||
|
ControlDictionary[commandTextBoxName].Text = AddInOptions.NAntFileName; |
||||||
|
ControlDictionary[argumentsTextBoxName].Text = AddInOptions.NAntArguments; |
||||||
|
((CheckBox)ControlDictionary[verboseCheckBoxName]).Checked = AddInOptions.Verbose; |
||||||
|
((CheckBox)ControlDictionary[showLogoCheckBoxName]).Checked = AddInOptions.ShowLogo; |
||||||
|
((CheckBox)ControlDictionary[quietCheckBoxName]).Checked = AddInOptions.Quiet; |
||||||
|
((CheckBox)ControlDictionary[debugModeCheckBoxName]).Checked = AddInOptions.DebugMode; |
||||||
|
|
||||||
|
ControlDictionary[browseButtonName].Click += new EventHandler(OnBrowse); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool StorePanelContents() |
||||||
|
{ |
||||||
|
AddInOptions.NAntFileName = ControlDictionary[commandTextBoxName].Text; |
||||||
|
AddInOptions.NAntArguments = ControlDictionary[argumentsTextBoxName].Text; |
||||||
|
AddInOptions.Verbose = ((CheckBox)ControlDictionary[verboseCheckBoxName]).Checked; |
||||||
|
AddInOptions.ShowLogo = ((CheckBox)ControlDictionary[showLogoCheckBoxName]).Checked; |
||||||
|
AddInOptions.Quiet = ((CheckBox)ControlDictionary[quietCheckBoxName]).Checked; |
||||||
|
AddInOptions.DebugMode = ((CheckBox)ControlDictionary[debugModeCheckBoxName]).Checked; |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows the user to browse for the NAnt executable.
|
||||||
|
/// </summary>
|
||||||
|
void OnBrowse(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
using (OpenFileDialog openFileDialog = new OpenFileDialog()) { |
||||||
|
|
||||||
|
openFileDialog.CheckFileExists = true; |
||||||
|
openFileDialog.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe|${res:SharpDevelop.FileFilter.AllFiles}|*.*"); |
||||||
|
|
||||||
|
if (openFileDialog.ShowDialog() == DialogResult.OK) { |
||||||
|
ControlDictionary[commandTextBoxName].Text = openFileDialog.FileName; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Gui |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents a <see cref="NAntBuildFile"/> error in the
|
||||||
|
/// <see cref="NAntPadTreeView"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntBuildFileErrorTreeNode : TreeNode |
||||||
|
{ |
||||||
|
NAntBuildFileError buildFileError; |
||||||
|
public NAntBuildFileErrorTreeNode(NAntBuildFileError error) |
||||||
|
{ |
||||||
|
this.Text = error.Message; |
||||||
|
this.ImageIndex = NAntPadTreeViewImageList.TargetErrorImage; |
||||||
|
this.SelectedImageIndex = NAntPadTreeViewImageList.TargetErrorImage; |
||||||
|
this.buildFileError = error; |
||||||
|
} |
||||||
|
|
||||||
|
public NAntBuildFileError Error { |
||||||
|
get { |
||||||
|
return buildFileError; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,170 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Gui |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents a NAnt build file in the <see cref="NAntPadTreeView"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntBuildFileTreeNode : TreeNode |
||||||
|
{ |
||||||
|
NAntBuildFile buildFile; |
||||||
|
string projectName = String.Empty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance of the <see cref="NAntBuildFileTreeNode"/>
|
||||||
|
/// class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="buildFile">The <see cref="NAntBuildFile"/>
|
||||||
|
/// associated with this tree node.</param>
|
||||||
|
public NAntBuildFileTreeNode(string projectName, NAntBuildFile buildFile) |
||||||
|
{ |
||||||
|
this.projectName = projectName; |
||||||
|
this.buildFile = buildFile; |
||||||
|
|
||||||
|
UpdateNode(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the <see cref="NAntBuildFile"/> associated with
|
||||||
|
/// this node.
|
||||||
|
/// </summary>
|
||||||
|
public NAntBuildFile BuildFile { |
||||||
|
get { |
||||||
|
return buildFile; |
||||||
|
} |
||||||
|
|
||||||
|
set { |
||||||
|
SetBuildFile(value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the build file's filename.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Called when the build file has been renamed.</remarks>
|
||||||
|
public string FileName { |
||||||
|
get { |
||||||
|
return buildFile.FileName; |
||||||
|
} |
||||||
|
|
||||||
|
set { |
||||||
|
buildFile.FileName = value; |
||||||
|
SetNodeText(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the node text.
|
||||||
|
/// </summary>
|
||||||
|
void SetNodeText() |
||||||
|
{ |
||||||
|
StringBuilder nodeText = new StringBuilder(); |
||||||
|
|
||||||
|
if (projectName.Length > 0) { |
||||||
|
nodeText.Append(projectName); |
||||||
|
nodeText.Append(Path.DirectorySeparatorChar); |
||||||
|
} |
||||||
|
nodeText.Append(buildFile.FileName); |
||||||
|
|
||||||
|
if (buildFile.DefaultTarget != null) { |
||||||
|
nodeText.Append(" ["); |
||||||
|
nodeText.Append(buildFile.DefaultTarget.Name); |
||||||
|
nodeText.Append("]"); |
||||||
|
} |
||||||
|
|
||||||
|
this.Text = nodeText.ToString(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the targets to the node.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="targets">A collection of NAntBuildTargets.</param>
|
||||||
|
void AddTargets(NAntBuildTargetCollection targets) |
||||||
|
{ |
||||||
|
foreach (NAntBuildTarget target in targets) { |
||||||
|
AddTarget(this, target); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a NAnt build target to the tree.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="node">The parent tree node.</param>
|
||||||
|
/// <param name="target">The NAnt build target.</param>
|
||||||
|
void AddTarget(TreeNode node, NAntBuildTarget target) |
||||||
|
{ |
||||||
|
NAntBuildTargetTreeNode targetNode = new NAntBuildTargetTreeNode(target); |
||||||
|
node.Nodes.Add(targetNode); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds an error node to the tree.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="node">The parent tree node.</param>
|
||||||
|
void AddBuildFileError(TreeNode node, NAntBuildFileError buildFileError) |
||||||
|
{ |
||||||
|
NAntBuildFileErrorTreeNode errorNode = new NAntBuildFileErrorTreeNode(buildFileError); |
||||||
|
node.Nodes.Add(errorNode); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the display since the build file has changed.
|
||||||
|
/// </summary>
|
||||||
|
void SetBuildFile(NAntBuildFile buildFile) |
||||||
|
{ |
||||||
|
Nodes.Clear(); |
||||||
|
this.buildFile = buildFile; |
||||||
|
UpdateNode(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the node's image, text and adds target nodes.
|
||||||
|
/// </summary>
|
||||||
|
void UpdateNode() |
||||||
|
{ |
||||||
|
this.ImageIndex = NAntPadTreeViewImageList.BuildFileImage; |
||||||
|
this.SelectedImageIndex = NAntPadTreeViewImageList.BuildFileImage; |
||||||
|
|
||||||
|
if (buildFile.HasError) { |
||||||
|
this.ImageIndex = NAntPadTreeViewImageList.BuildFileErrorImage; |
||||||
|
this.SelectedImageIndex = NAntPadTreeViewImageList.BuildFileErrorImage; |
||||||
|
AddBuildFileError(this, buildFile.Error); |
||||||
|
} else { |
||||||
|
AddTargets(buildFile.Targets); |
||||||
|
} |
||||||
|
|
||||||
|
SetNodeText(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,68 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Drawing; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Gui |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents a <see cref="NAntBuildTarget"/> in the
|
||||||
|
/// <see cref="NAntPadTreeView"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntBuildTargetTreeNode : TreeNode |
||||||
|
{ |
||||||
|
NAntBuildTarget target; |
||||||
|
|
||||||
|
public NAntBuildTargetTreeNode(NAntBuildTarget target) |
||||||
|
{ |
||||||
|
if (target.IsDefault) { |
||||||
|
this.Text = String.Concat(target.Name, " [default]"); |
||||||
|
this.ImageIndex = NAntPadTreeViewImageList.DefaultTargetImage; |
||||||
|
this.SelectedImageIndex = NAntPadTreeViewImageList.DefaultTargetImage; |
||||||
|
this.ForeColor = Color.Blue; |
||||||
|
} else { |
||||||
|
this.Text = target.Name; |
||||||
|
this.ImageIndex = NAntPadTreeViewImageList.TargetImage; |
||||||
|
this.SelectedImageIndex = NAntPadTreeViewImageList.TargetImage; |
||||||
|
} |
||||||
|
|
||||||
|
this.target = target; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the <see cref="NAntBuildTarget"/>
|
||||||
|
/// associated with this node.
|
||||||
|
/// </summary>
|
||||||
|
public NAntBuildTarget Target { |
||||||
|
get { |
||||||
|
return target; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,331 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Gui |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// The NAnt pad.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntPadContent : AbstractPadContent |
||||||
|
{ |
||||||
|
Panel contentPanel; |
||||||
|
NAntPadTreeView treeView; |
||||||
|
TextBox textBox; |
||||||
|
ToolStrip toolStrip; |
||||||
|
bool disposed; |
||||||
|
|
||||||
|
public NAntPadContent() |
||||||
|
{ |
||||||
|
LoggingService.Debug("NAntPadContent.ctor"); |
||||||
|
// Create main panel.
|
||||||
|
contentPanel = new Panel(); |
||||||
|
|
||||||
|
// Initialise treeview.
|
||||||
|
treeView = new NAntPadTreeView(); |
||||||
|
treeView.Dock = DockStyle.Fill; |
||||||
|
|
||||||
|
// Create ToolStrip.
|
||||||
|
toolStrip = ToolbarService.CreateToolStrip(this, "/SharpDevelop/Pads/NAntPad/Toolbar"); |
||||||
|
toolStrip.GripStyle = ToolStripGripStyle.Hidden; |
||||||
|
|
||||||
|
// Create text box.
|
||||||
|
textBox = new TextBox(); |
||||||
|
textBox.WordWrap = false; |
||||||
|
textBox.Dock = DockStyle.Bottom; |
||||||
|
|
||||||
|
// Tooltip.
|
||||||
|
ToolTip toolTip = new ToolTip(); |
||||||
|
toolTip.SetToolTip(textBox, StringParser.Parse("Enter NAnt properties.")); |
||||||
|
|
||||||
|
contentPanel.Controls.Add(treeView); |
||||||
|
contentPanel.Controls.Add(toolStrip); |
||||||
|
contentPanel.Controls.Add(textBox); |
||||||
|
|
||||||
|
ProjectService.SolutionLoaded += SolutionLoaded; |
||||||
|
ProjectService.SolutionClosed += SolutionClosed; |
||||||
|
ProjectService.ProjectItemRemoved += ProjectItemRemoved; |
||||||
|
ProjectService.ProjectItemAdded += ProjectItemAdded; |
||||||
|
WorkbenchSingleton.Workbench.ViewOpened += WorkbenchViewOpened; |
||||||
|
WorkbenchSingleton.Workbench.ViewClosed += WorkbenchViewClosed; |
||||||
|
FileService.FileRenamed += FileRenamed; |
||||||
|
FileService.FileRemoved += FileRemoved; |
||||||
|
FileUtility.FileSaved += FileSaved; |
||||||
|
|
||||||
|
NAntRunnerSingleton.Runner.NAntStarted += NAntStarted; |
||||||
|
NAntRunnerSingleton.Runner.NAntStopped += NAntStopped; |
||||||
|
NAntRunnerSingleton.Runner.NAntExited += NAntExited; |
||||||
|
|
||||||
|
// Due to lazy loading we have missed the solution loaded event
|
||||||
|
// so add it now.
|
||||||
|
Refresh(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets any extra command line arguments entered in the pad's text box.
|
||||||
|
/// </summary>
|
||||||
|
public string Arguments { |
||||||
|
get { |
||||||
|
return textBox.Text; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static NAntPadContent Instance { |
||||||
|
get { |
||||||
|
PadDescriptor descriptor = WorkbenchSingleton.Workbench.GetPad(typeof(NAntPadContent)); |
||||||
|
return (NAntPadContent)descriptor.PadContent; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refreshes the contents NAnt pad.
|
||||||
|
/// </summary>
|
||||||
|
public void Refresh() |
||||||
|
{ |
||||||
|
treeView.Clear(); |
||||||
|
|
||||||
|
Solution solution = ProjectService.OpenSolution; |
||||||
|
if (solution != null) { |
||||||
|
treeView.AddSolution(solution); |
||||||
|
} |
||||||
|
foreach (IViewContent view in WorkbenchSingleton.Workbench.ViewContentCollection) { |
||||||
|
if (IsStandaloneNAntBuildFile(view.PrimaryFileName)) { |
||||||
|
treeView.AddBuildFile(String.Empty, view.PrimaryFileName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the currently selected <see cref="NAntBuildFile"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This will return a NAntBuildFile if
|
||||||
|
/// a target node is selected.</remarks>
|
||||||
|
public NAntBuildFile SelectedBuildFile { |
||||||
|
get { |
||||||
|
return treeView.SelectedBuildFile; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the current selected <see cref="NAntBuildTarget"/>
|
||||||
|
/// </summary>
|
||||||
|
public NAntBuildTarget SelectedTarget { |
||||||
|
get { |
||||||
|
return treeView.SelectedTarget; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#region AbstractPadContent requirements
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
|
||||||
|
/// </summary>
|
||||||
|
public override Control Control { |
||||||
|
get { |
||||||
|
return contentPanel; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Refreshes the pad
|
||||||
|
/// </summary>
|
||||||
|
public override void RedrawContent() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cleans up all used resources
|
||||||
|
/// </summary>
|
||||||
|
public override void Dispose() |
||||||
|
{ |
||||||
|
if (!disposed) { |
||||||
|
disposed = true; |
||||||
|
|
||||||
|
treeView.Dispose(); |
||||||
|
contentPanel.Dispose(); |
||||||
|
|
||||||
|
ProjectService.SolutionLoaded -= SolutionLoaded; |
||||||
|
ProjectService.SolutionClosed -= SolutionClosed; |
||||||
|
ProjectService.ProjectItemRemoved -= ProjectItemRemoved; |
||||||
|
ProjectService.ProjectItemAdded -= ProjectItemAdded; |
||||||
|
WorkbenchSingleton.Workbench.ViewOpened -= WorkbenchViewOpened; |
||||||
|
WorkbenchSingleton.Workbench.ViewClosed -= WorkbenchViewClosed; |
||||||
|
FileService.FileRenamed -= FileRenamed; |
||||||
|
FileService.FileRemoved -= FileRemoved; |
||||||
|
FileUtility.FileSaved -= FileSaved; |
||||||
|
|
||||||
|
NAntRunnerSingleton.Runner.NAntStarted -= NAntStarted; |
||||||
|
NAntRunnerSingleton.Runner.NAntStopped -= NAntStopped; |
||||||
|
NAntRunnerSingleton.Runner.NAntExited -= NAntExited; |
||||||
|
|
||||||
|
base.Dispose(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
void SolutionClosed(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
LoggingService.Debug("SolutionClosed."); |
||||||
|
treeView.Clear(); |
||||||
|
} |
||||||
|
|
||||||
|
void SolutionLoaded(object sender, SolutionEventArgs e) |
||||||
|
{ |
||||||
|
LoggingService.Debug("SolutionLoaded."); |
||||||
|
AddSolutionToPad(e.Solution); |
||||||
|
} |
||||||
|
|
||||||
|
void AddSolutionToPad(Solution solution) |
||||||
|
{ |
||||||
|
if (solution != null) { |
||||||
|
treeView.AddSolution(solution); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void UpdateToolbar() |
||||||
|
{ |
||||||
|
ToolbarService.UpdateToolbar(toolStrip); |
||||||
|
} |
||||||
|
|
||||||
|
void FileRenamed(object sender, FileRenameEventArgs e) |
||||||
|
{ |
||||||
|
if (!e.IsDirectory) { |
||||||
|
// source and target are populated.
|
||||||
|
|
||||||
|
if (NAntBuildFile.IsBuildFile(e.SourceFile) && NAntBuildFile.IsBuildFile(e.TargetFile)) { |
||||||
|
treeView.RenameBuildFile(e.SourceFile, e.TargetFile); |
||||||
|
} else if (NAntBuildFile.IsBuildFile(e.SourceFile)) { |
||||||
|
treeView.RemoveBuildFile(e.SourceFile); |
||||||
|
} else { |
||||||
|
AddBuildFile(e.TargetFile); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void AddBuildFile(string fileName) |
||||||
|
{ |
||||||
|
if (ProjectService.OpenSolution == null) return; |
||||||
|
IProject project = ProjectService.OpenSolution.FindProjectContainingFile(fileName); |
||||||
|
if (project != null) { |
||||||
|
treeView.AddBuildFile(project.Name, fileName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void ProjectItemAdded(object sender, ProjectItemEventArgs e) |
||||||
|
{ |
||||||
|
LoggingService.Debug("ProjectItemAdded."); |
||||||
|
if (e.ProjectItem.ItemType != ItemType.Folder) { |
||||||
|
if (NAntBuildFile.IsBuildFile(e.ProjectItem.FileName)) { |
||||||
|
treeView.AddBuildFile(e.Project.Name, e.ProjectItem.FileName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void ProjectItemRemoved(object sender, ProjectItemEventArgs e) |
||||||
|
{ |
||||||
|
LoggingService.Debug("ProjectItemRemoved."); |
||||||
|
if (e.ProjectItem.ItemType != ItemType.Folder) { |
||||||
|
if (NAntBuildFile.IsBuildFile(e.ProjectItem.FileName)) { |
||||||
|
treeView.RemoveBuildFile(e.ProjectItem.FileName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void WorkbenchViewOpened(object sender, ViewContentEventArgs e) |
||||||
|
{ |
||||||
|
if (IsStandaloneNAntBuildFile(e.Content.PrimaryFileName)) { |
||||||
|
treeView.UpdateBuildFile(e.Content.PrimaryFileName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void WorkbenchViewClosed(object sender, ViewContentEventArgs e) |
||||||
|
{ |
||||||
|
if (IsStandaloneNAntBuildFile(e.Content.PrimaryFileName)) { |
||||||
|
treeView.RemoveBuildFile(e.Content.PrimaryFileName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
bool IsStandaloneNAntBuildFile(string fileName) |
||||||
|
{ |
||||||
|
if (fileName != null) { |
||||||
|
return NAntBuildFile.IsBuildFile(fileName) && !IsInProject(fileName); |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
bool IsInProject(string fileName) |
||||||
|
{ |
||||||
|
Solution solution = ProjectService.OpenSolution; |
||||||
|
if (solution != null) { |
||||||
|
foreach (IProject project in solution.Projects) { |
||||||
|
if (project.IsFileInProject(fileName)) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
void FileSaved(object sender, FileNameEventArgs e) |
||||||
|
{ |
||||||
|
LoggingService.Debug("FileSaved."); |
||||||
|
if (NAntBuildFile.IsBuildFile(e.FileName)) { |
||||||
|
treeView.UpdateBuildFile(e.FileName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void FileRemoved(object sender, FileEventArgs e) |
||||||
|
{ |
||||||
|
LoggingService.Debug("FileRemoved."); |
||||||
|
if (NAntBuildFile.IsBuildFile(e.FileName)) { |
||||||
|
treeView.RemoveBuildFile(e.FileName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void NAntStarted(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
UpdateToolbar(); |
||||||
|
} |
||||||
|
|
||||||
|
void NAntStopped(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
UpdateToolbar(); |
||||||
|
} |
||||||
|
|
||||||
|
void NAntExited(object sender, NAntExitEventArgs e) |
||||||
|
{ |
||||||
|
WorkbenchSingleton.SafeThreadAsyncCall(UpdateToolbar); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,400 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.IO; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Gui |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// NAnt pad's tree view. Shows a high level view of build file in
|
||||||
|
/// a set of projects.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntPadTreeView : System.Windows.Forms.UserControl, IOwnerState |
||||||
|
{ |
||||||
|
private System.Windows.Forms.TreeView treeView; |
||||||
|
const string ContextMenuAddInTreePath = "/SharpDevelop/Pads/NAntPad/ContextMenu"; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The possible states of the tree view.
|
||||||
|
/// </summary>
|
||||||
|
public enum NAntPadTreeViewState { |
||||||
|
Nothing = 0, |
||||||
|
BuildFileSelected = 1, |
||||||
|
TargetSelected = 2, |
||||||
|
ErrorSelected = 4 |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current state of the tree view.
|
||||||
|
/// </summary>
|
||||||
|
NAntPadTreeViewState state = NAntPadTreeViewState.Nothing; |
||||||
|
|
||||||
|
delegate void AddSolutionInvoker(Solution solution); |
||||||
|
|
||||||
|
public NAntPadTreeView() |
||||||
|
{ |
||||||
|
//
|
||||||
|
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||||
|
//
|
||||||
|
InitializeComponent(); |
||||||
|
|
||||||
|
treeView.Sorted = true; |
||||||
|
treeView.HideSelection = false; |
||||||
|
treeView.ImageList = NAntPadTreeViewImageList.GetImageList(); |
||||||
|
treeView.ContextMenuStrip = MenuService.CreateContextMenu(this, ContextMenuAddInTreePath); |
||||||
|
treeView.DoubleClick += new EventHandler(TreeViewDoubleClick); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the "ownerstate" condition.
|
||||||
|
/// </summary>
|
||||||
|
public Enum InternalState { |
||||||
|
get { |
||||||
|
return state; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clears all items from the tree view.
|
||||||
|
/// </summary>
|
||||||
|
public void Clear() |
||||||
|
{ |
||||||
|
if (InvokeRequired) { |
||||||
|
MethodInvoker invoker = new MethodInvoker(Clear); |
||||||
|
Invoke(invoker); |
||||||
|
} else { |
||||||
|
treeView.Nodes.Clear(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds items to the tree view for each build file that exists
|
||||||
|
/// in all the solution's subprojects.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="solution">A solution containing projects.</param>
|
||||||
|
public void AddSolution(Solution solution) |
||||||
|
{ |
||||||
|
if (InvokeRequired) { |
||||||
|
AddSolutionInvoker invoker = new AddSolutionInvoker(AddSolution); |
||||||
|
Invoke(invoker); |
||||||
|
} else { |
||||||
|
foreach (IProject project in solution.Projects) { |
||||||
|
AddProject(project); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds items to the tree view for each build file that exist
|
||||||
|
/// in a project.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="project">A SharpDevelop project.</param>
|
||||||
|
public void AddProject(IProject project) |
||||||
|
{ |
||||||
|
Debug.Assert(!InvokeRequired, "AddProject InvokeRequired"); |
||||||
|
|
||||||
|
foreach (ProjectItem projectItem in project.Items) { |
||||||
|
if (NAntBuildFile.IsBuildFile(projectItem.FileName)) { |
||||||
|
AddBuildFile(project.Name, projectItem.FileName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes the specified build file from the
|
||||||
|
/// tree view.</summary>
|
||||||
|
public void RemoveBuildFile(string fileName) |
||||||
|
{ |
||||||
|
Debug.Assert(!InvokeRequired, "RemoveBuildFile InvokeRequired"); |
||||||
|
|
||||||
|
NAntBuildFileTreeNode node = FindMatchingNode(fileName); |
||||||
|
if (node != null) { |
||||||
|
node.Remove(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Renames the build file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="oldFileName">The filename to update.</param>
|
||||||
|
/// <param name="newFileName">The updated filename.</param>
|
||||||
|
public void RenameBuildFile(string oldFileName, string newFileName) |
||||||
|
{ |
||||||
|
Debug.Assert(!InvokeRequired, "RenameBuildFile InvokeRequired"); |
||||||
|
|
||||||
|
NAntBuildFileTreeNode node = FindMatchingNode(oldFileName); |
||||||
|
|
||||||
|
if (node != null) { |
||||||
|
node.FileName = Path.GetFileName(newFileName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the build file in the tree view.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName">The build file name.</param>
|
||||||
|
public void UpdateBuildFile(string fileName) |
||||||
|
{ |
||||||
|
Debug.Assert(!InvokeRequired, "UpdateBuildFile InvokeRequired"); |
||||||
|
|
||||||
|
NAntBuildFileTreeNode node = FindMatchingNode(fileName); |
||||||
|
|
||||||
|
if (node != null) { |
||||||
|
NAntBuildFile buildFile = new NAntBuildFile(fileName); |
||||||
|
node.BuildFile = buildFile; |
||||||
|
} else { |
||||||
|
AddBuildFile(String.Empty, fileName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a build file to the tree.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="projectName">The name of the project.</param>
|
||||||
|
/// <param name="fileName">The build file name.</param>
|
||||||
|
/// <param name="debug"><see langword="true"/> if the project's
|
||||||
|
/// active configuration is debug; <see langword="false"/>
|
||||||
|
/// otherwise.</param>
|
||||||
|
public void AddBuildFile(string projectName, string fileName) |
||||||
|
{ |
||||||
|
Debug.Assert(!InvokeRequired, "AddBuildFile InvokeRequired"); |
||||||
|
|
||||||
|
if (File.Exists(fileName)) { |
||||||
|
NAntBuildFile buildFile = new NAntBuildFile(fileName); |
||||||
|
NAntBuildFileTreeNode node = new NAntBuildFileTreeNode(projectName, buildFile); |
||||||
|
treeView.Nodes.Add(node); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the currently selected <see cref="NAntBuildFile"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This will return a NAntBuildFile if
|
||||||
|
/// a target node is selected.</remarks>
|
||||||
|
public NAntBuildFile SelectedBuildFile { |
||||||
|
get { |
||||||
|
NAntBuildFile buildFile = null; |
||||||
|
|
||||||
|
TreeNode selectedNode = treeView.SelectedNode; |
||||||
|
if (selectedNode is NAntBuildFileTreeNode) { |
||||||
|
NAntBuildFileTreeNode buildNode = (NAntBuildFileTreeNode)selectedNode; |
||||||
|
buildFile = buildNode.BuildFile; |
||||||
|
} else if(selectedNode is NAntBuildTargetTreeNode) { |
||||||
|
NAntBuildTargetTreeNode targetNode = (NAntBuildTargetTreeNode)selectedNode; |
||||||
|
NAntBuildFileTreeNode buildNode = (NAntBuildFileTreeNode)targetNode.Parent; |
||||||
|
buildFile = buildNode.BuildFile; |
||||||
|
} else if(selectedNode is NAntBuildFileErrorTreeNode) { |
||||||
|
NAntBuildFileErrorTreeNode errorNode = (NAntBuildFileErrorTreeNode)selectedNode; |
||||||
|
NAntBuildFileTreeNode buildNode = (NAntBuildFileTreeNode)errorNode.Parent; |
||||||
|
buildFile = buildNode.BuildFile; |
||||||
|
} |
||||||
|
|
||||||
|
return buildFile; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the current selected <see cref="NAntBuildTarget"/>
|
||||||
|
/// </summary>
|
||||||
|
public NAntBuildTarget SelectedTarget { |
||||||
|
get { |
||||||
|
NAntBuildTarget target = null; |
||||||
|
|
||||||
|
NAntBuildTargetTreeNode targetNode = treeView.SelectedNode as NAntBuildTargetTreeNode; |
||||||
|
|
||||||
|
if (targetNode != null) { |
||||||
|
target = targetNode.Target; |
||||||
|
} |
||||||
|
|
||||||
|
return target; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the current selected <see cref="NAntBuildFileError"/>
|
||||||
|
/// </summary>
|
||||||
|
public NAntBuildFileError SelectedError { |
||||||
|
get { |
||||||
|
NAntBuildFileError error = null; |
||||||
|
|
||||||
|
NAntBuildFileErrorTreeNode errorNode = treeView.SelectedNode as NAntBuildFileErrorTreeNode; |
||||||
|
|
||||||
|
if (errorNode != null) { |
||||||
|
error = errorNode.Error; |
||||||
|
} |
||||||
|
|
||||||
|
return error; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether a target is selected.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsTargetSelected { |
||||||
|
get { |
||||||
|
bool isSelected = false; |
||||||
|
|
||||||
|
if (SelectedTarget != null) { |
||||||
|
isSelected = true; |
||||||
|
} |
||||||
|
|
||||||
|
return isSelected; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#region Windows Forms Designer generated code
|
||||||
|
/// <summary>
|
||||||
|
/// This method is required for Windows Forms designer support.
|
||||||
|
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||||
|
/// not be able to load this method if it was changed manually.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent() { |
||||||
|
this.treeView = new System.Windows.Forms.TreeView(); |
||||||
|
this.SuspendLayout(); |
||||||
|
//
|
||||||
|
// treeView
|
||||||
|
//
|
||||||
|
this.treeView.Dock = System.Windows.Forms.DockStyle.Fill; |
||||||
|
this.treeView.ImageIndex = -1; |
||||||
|
this.treeView.Location = new System.Drawing.Point(0, 0); |
||||||
|
this.treeView.Name = "treeView"; |
||||||
|
this.treeView.SelectedImageIndex = -1; |
||||||
|
this.treeView.Size = new System.Drawing.Size(292, 266); |
||||||
|
this.treeView.TabIndex = 0; |
||||||
|
this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TreeViewMouseDown); |
||||||
|
//
|
||||||
|
// NAntPadTreeView
|
||||||
|
//
|
||||||
|
this.Controls.Add(this.treeView); |
||||||
|
this.Name = "NAntPadTreeView"; |
||||||
|
this.Size = new System.Drawing.Size(292, 266); |
||||||
|
this.ResumeLayout(false); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// User clicked the tree view.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">The event source.</param>
|
||||||
|
/// <param name="e">The event arguments.</param>
|
||||||
|
void TreeViewMouseDown(object sender, MouseEventArgs e) |
||||||
|
{ |
||||||
|
TreeNode node = treeView.GetNodeAt(e.X, e.Y); |
||||||
|
|
||||||
|
treeView.SelectedNode = node; |
||||||
|
|
||||||
|
state = NAntPadTreeViewState.Nothing; |
||||||
|
if (IsBuildFileNodeSelected) { |
||||||
|
state = NAntPadTreeViewState.BuildFileSelected; |
||||||
|
} |
||||||
|
|
||||||
|
if (IsBuildTargetNodeSelected) { |
||||||
|
state = NAntPadTreeViewState.TargetSelected; |
||||||
|
} |
||||||
|
|
||||||
|
if (IsBuildFileErrorNodeSelected) { |
||||||
|
state = NAntPadTreeViewState.ErrorSelected; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether a build file is selected.
|
||||||
|
/// </summary>
|
||||||
|
bool IsBuildFileNodeSelected { |
||||||
|
get { |
||||||
|
return treeView.SelectedNode is NAntBuildFileTreeNode; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether a target is selected.
|
||||||
|
/// </summary>
|
||||||
|
bool IsBuildTargetNodeSelected { |
||||||
|
get { |
||||||
|
return treeView.SelectedNode is NAntBuildTargetTreeNode; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether a build file error is selected.
|
||||||
|
/// </summary>
|
||||||
|
bool IsBuildFileErrorNodeSelected { |
||||||
|
get { |
||||||
|
return treeView.SelectedNode is NAntBuildFileErrorTreeNode; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Double clicking a node on the tree view opens the corresponding
|
||||||
|
/// file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">The event source.</param>
|
||||||
|
/// <param name="e">The event arguments.</param>
|
||||||
|
void TreeViewDoubleClick(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
NAntBuildFile buildFile = SelectedBuildFile; |
||||||
|
if (buildFile != null) { |
||||||
|
|
||||||
|
string fileName = Path.Combine(buildFile.Directory, buildFile.FileName); |
||||||
|
|
||||||
|
if (IsBuildTargetNodeSelected) { |
||||||
|
FileService.JumpToFilePosition(fileName, SelectedTarget.Line, SelectedTarget.Column); |
||||||
|
} else if (IsBuildFileErrorNodeSelected) { |
||||||
|
FileService.JumpToFilePosition(fileName, SelectedError.Line, SelectedError.Column); |
||||||
|
} else { |
||||||
|
FileService.OpenFile(fileName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks for the tree node that is displaying the specified
|
||||||
|
/// build file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName">The build file to look for.</param>
|
||||||
|
/// <returns>The matching tree node if the build file exists
|
||||||
|
/// in the tree; otherwise <see langword="null"/>.</returns>
|
||||||
|
NAntBuildFileTreeNode FindMatchingNode(string fileName) |
||||||
|
{ |
||||||
|
foreach (NAntBuildFileTreeNode node in treeView.Nodes) { |
||||||
|
string nodeFileName = Path.Combine(node.BuildFile.Directory, node.BuildFile.FileName); |
||||||
|
if (String.Compare(Path.GetFullPath(fileName), Path.GetFullPath(nodeFileName), true) == 0) { |
||||||
|
return node; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,84 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Gui |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents the images that are used in the
|
||||||
|
/// <see cref="NAntPadTreeView"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntPadTreeViewImageList |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// The NAnt build file image index.
|
||||||
|
/// </summary>
|
||||||
|
public static int BuildFileImage = 0; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The NAnt build target image index.
|
||||||
|
/// </summary>
|
||||||
|
public static int TargetImage = 1; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The NAnt default build target image index.
|
||||||
|
/// </summary>
|
||||||
|
public static int DefaultTargetImage = 2; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error icon displayed when the build file has errors.
|
||||||
|
/// </summary>
|
||||||
|
public static int BuildFileErrorImage = 3; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error icon displayed as the first target when the build file has errors.
|
||||||
|
/// </summary>
|
||||||
|
public static int TargetErrorImage = 4; |
||||||
|
|
||||||
|
NAntPadTreeViewImageList() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an image list to be used in the
|
||||||
|
/// <see cref="NAntPadTreeView"/>.</summary>
|
||||||
|
public static ImageList GetImageList() |
||||||
|
{ |
||||||
|
ImageList imageList = new ImageList(); |
||||||
|
imageList.Images.Add(IconService.GetBitmap("NAnt.AddIn.Icons.16x16.BuildFile")); |
||||||
|
imageList.Images.Add(IconService.GetBitmap("NAnt.AddIn.Icons.16x16.BuildTarget")); |
||||||
|
imageList.Images.Add(IconService.GetBitmap("NAnt.AddIn.Icons.16x16.DefaultBuildTarget")); |
||||||
|
imageList.Images.Add(IconService.GetBitmap("NAnt.AddIn.Icons.16x16.BuildFileError")); |
||||||
|
imageList.Images.Add(IconService.GetBitmap("NAnt.AddIn.Icons.16x16.BuildTargetError")); |
||||||
|
|
||||||
|
return imageList; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,43 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.Core; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Determines whether #develop is currently running NAnt.
|
||||||
|
/// </summary>
|
||||||
|
public class IsNAntRunningCondition : IConditionEvaluator |
||||||
|
{ |
||||||
|
public bool IsValid(object caller, Condition condition) |
||||||
|
{ |
||||||
|
return NAntRunnerSingleton.Runner.IsRunning; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,57 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Runtime.Serialization; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// The exception that is thrown when a non-fatal
|
||||||
|
/// error occurs in the NAnt add-in.
|
||||||
|
/// </summary>
|
||||||
|
[Serializable()] |
||||||
|
public class NAntAddInException : ApplicationException |
||||||
|
{ |
||||||
|
public NAntAddInException() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public NAntAddInException(string message) |
||||||
|
: base(message) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public NAntAddInException(string message, Exception innerException) : base(message, innerException) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
protected NAntAddInException(SerializationInfo info, StreamingContext context) : base(info, context) |
||||||
|
{ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,380 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using System.Xml; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents a NAnt Build File.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntBuildFile |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Standard NAnt build file's extension.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string BuildFileNameExtension = ".build"; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Standard NAnt include file's extension.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string IncludeFileNameExtension = ".include"; |
||||||
|
|
||||||
|
static readonly string TargetElementName = "target"; |
||||||
|
static readonly string ProjectElementName = "project"; |
||||||
|
|
||||||
|
static readonly string NameAttributeName = "name"; |
||||||
|
static readonly string DefaultAttributeName = "default"; |
||||||
|
|
||||||
|
string directory = String.Empty; |
||||||
|
string fileName = String.Empty; |
||||||
|
string name = String.Empty; |
||||||
|
string defaultTargetName = String.Empty; |
||||||
|
NAntBuildFileError buildFileError; |
||||||
|
|
||||||
|
NAntBuildTargetCollection targets = new NAntBuildTargetCollection(); |
||||||
|
NAntBuildTarget defaultTarget; |
||||||
|
|
||||||
|
enum ParseState |
||||||
|
{ |
||||||
|
Nothing = 0, |
||||||
|
WaitingForProjectName = 1, |
||||||
|
WaitingForTargetName = 2 |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance of the <see cref="NAntBuildFile"/>
|
||||||
|
/// class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName">The build filename.</param>
|
||||||
|
public NAntBuildFile(string fileName) |
||||||
|
{ |
||||||
|
this.directory = Path.GetDirectoryName(fileName); |
||||||
|
this.fileName = Path.GetFileName(fileName); |
||||||
|
|
||||||
|
ReadBuildFile(fileName); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance of the <see cref="NAntBuildFile"/>
|
||||||
|
/// class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reader">The <see cref="TextReader"/> used to
|
||||||
|
/// feed the XML data into the <see cref="NAntBuildFile"/>
|
||||||
|
/// object.</param>
|
||||||
|
public NAntBuildFile(TextReader reader) |
||||||
|
{ |
||||||
|
ParseBuildFile(reader); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the filename without the path information.
|
||||||
|
/// </summary>
|
||||||
|
public string FileName { |
||||||
|
get { |
||||||
|
return fileName; |
||||||
|
} |
||||||
|
|
||||||
|
set { |
||||||
|
fileName = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the build file's path information.
|
||||||
|
/// </summary>
|
||||||
|
public string Directory { |
||||||
|
get { |
||||||
|
return directory; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the project name.
|
||||||
|
/// </summary>
|
||||||
|
public string Name { |
||||||
|
get { |
||||||
|
return name; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks the build file is a NAnt build file.
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsBuildFile(string fileName) |
||||||
|
{ |
||||||
|
bool isBuildFile = false; |
||||||
|
|
||||||
|
string extension = Path.GetExtension(fileName); |
||||||
|
|
||||||
|
if (String.Compare(extension, BuildFileNameExtension, true) == 0) { |
||||||
|
isBuildFile = true; |
||||||
|
} else if (String.Compare(extension, IncludeFileNameExtension, true) == 0) { |
||||||
|
isBuildFile = true; |
||||||
|
} |
||||||
|
|
||||||
|
return isBuildFile; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the NAnt build targets.
|
||||||
|
/// </summary>
|
||||||
|
public NAntBuildTargetCollection Targets { |
||||||
|
get { |
||||||
|
return targets; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the default NAnt target.
|
||||||
|
/// </summary>
|
||||||
|
public NAntBuildTarget DefaultTarget { |
||||||
|
get { |
||||||
|
return defaultTarget; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether there is an error with this build file.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasError { |
||||||
|
get { |
||||||
|
return (buildFileError != null); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the error associated with the build file.
|
||||||
|
/// </summary>
|
||||||
|
public NAntBuildFileError Error { |
||||||
|
get { |
||||||
|
return buildFileError; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reads the NAnt build file and extracts target names.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName">The name of the build file.</param>
|
||||||
|
void ReadBuildFile(string fileName) |
||||||
|
{ |
||||||
|
StreamReader reader = new StreamReader(fileName, true); |
||||||
|
ParseBuildFile(reader); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the default target's name or returns an empty string.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="root">The root node of the build file.</param>
|
||||||
|
/// <returns>The default target's name or an empty string if
|
||||||
|
/// it does not exist.</returns>
|
||||||
|
string GetDefaultTargetName(XmlElement root) |
||||||
|
{ |
||||||
|
string defaultTargetName = String.Empty; |
||||||
|
|
||||||
|
XmlAttribute nameAttribute = root.Attributes["default"]; |
||||||
|
|
||||||
|
if (nameAttribute != null) { |
||||||
|
defaultTargetName = nameAttribute.Value; |
||||||
|
} |
||||||
|
|
||||||
|
return defaultTargetName; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the build file's project name or returns an empty string.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="root">The root node of the build file.</param>
|
||||||
|
/// <returns>The project name or an empty string if
|
||||||
|
/// it does not exist.</returns>
|
||||||
|
string GetProjectName(XmlElement root) |
||||||
|
{ |
||||||
|
string projectName = String.Empty; |
||||||
|
|
||||||
|
XmlAttribute nameAttribute = root.Attributes["name"]; |
||||||
|
|
||||||
|
if (nameAttribute != null) { |
||||||
|
projectName = nameAttribute.Value; |
||||||
|
} |
||||||
|
|
||||||
|
return projectName; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests whether <paramref name="name"/> matches the
|
||||||
|
/// default target name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="defaultTargetName">The default target
|
||||||
|
/// name.</param>
|
||||||
|
/// <param name="targetName">A target's name.</param>
|
||||||
|
/// <returns><see langword="true"/> if the target name matches
|
||||||
|
/// the default; otherwise <see langword="false"/>.</returns>
|
||||||
|
bool IsDefaultTargetName(string defaultTargetName, string targetName) |
||||||
|
{ |
||||||
|
bool isDefault = false; |
||||||
|
|
||||||
|
if (defaultTargetName.Length > 0) { |
||||||
|
if (String.Compare(defaultTargetName, targetName, true) == 0) { |
||||||
|
isDefault = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return isDefault; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parse the NAnt build file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textReader">A TextReader from which to read
|
||||||
|
/// the build file.</param>
|
||||||
|
void ParseBuildFile(TextReader textReader) |
||||||
|
{ |
||||||
|
XmlTextReader xmlReader = new XmlTextReader(textReader); |
||||||
|
|
||||||
|
try |
||||||
|
{ |
||||||
|
ParseState state = ParseState.WaitingForProjectName; |
||||||
|
|
||||||
|
while(xmlReader.Read()) |
||||||
|
{ |
||||||
|
if (state == ParseState.WaitingForProjectName) { |
||||||
|
if (IsProjectElement(xmlReader)) { |
||||||
|
ParseProjectElement(xmlReader); |
||||||
|
state = ParseState.WaitingForTargetName; |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (IsTargetElement(xmlReader)) { |
||||||
|
ParseTargetElement(xmlReader); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} catch(XmlException ex) { |
||||||
|
buildFileError = new NAntBuildFileError(ex.Message, ex.LineNumber - 1, ex.LinePosition - 1); |
||||||
|
} finally { |
||||||
|
xmlReader.Close(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses the current XmlTextReader node if it
|
||||||
|
/// is the NAnt Project element.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="xmlReader">An XmlTextReader currently being
|
||||||
|
/// read.</param>
|
||||||
|
void ParseProjectElement(XmlTextReader xmlReader) |
||||||
|
{ |
||||||
|
name = GetAttribute(xmlReader, NameAttributeName); |
||||||
|
defaultTargetName = GetAttribute(xmlReader, DefaultAttributeName); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests whether the current element is the project element.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="xmlReader"></param>
|
||||||
|
/// <returns><see langword="true"/> if the current
|
||||||
|
/// element is the project element;
|
||||||
|
/// <see langword="false"/> otherwise</returns>
|
||||||
|
bool IsProjectElement(XmlTextReader xmlReader) |
||||||
|
{ |
||||||
|
bool isProjectElement = false; |
||||||
|
|
||||||
|
if (xmlReader.NodeType == XmlNodeType.Element) { |
||||||
|
if (xmlReader.Name == ProjectElementName) { |
||||||
|
isProjectElement = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return isProjectElement; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests whether the current element is a target element.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="xmlReader">An xml text reader currently
|
||||||
|
/// reading the build file xml.</param>
|
||||||
|
/// <returns><see langword="true"/> if the current
|
||||||
|
/// element is a target element;
|
||||||
|
/// <see langword="false"/> otherwise</returns>
|
||||||
|
bool IsTargetElement(XmlTextReader xmlReader) |
||||||
|
{ |
||||||
|
bool isTargetElement = false; |
||||||
|
|
||||||
|
if (xmlReader.NodeType == XmlNodeType.Element) { |
||||||
|
if (xmlReader.Name == TargetElementName) { |
||||||
|
isTargetElement = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return isTargetElement; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses the current XmlTextReader node if it
|
||||||
|
/// is the NAnt Target element.
|
||||||
|
/// </summary>
|
||||||
|
void ParseTargetElement(XmlTextReader xmlReader) |
||||||
|
{ |
||||||
|
// Take off one for line/col since SharpDevelop is zero based.
|
||||||
|
int line = xmlReader.LineNumber - 1; |
||||||
|
int col = xmlReader.LinePosition - 1; |
||||||
|
|
||||||
|
string targetName = GetAttribute(xmlReader, NameAttributeName); |
||||||
|
|
||||||
|
bool isDefaultTarget = IsDefaultTargetName(defaultTargetName, targetName); |
||||||
|
|
||||||
|
NAntBuildTarget target = |
||||||
|
new NAntBuildTarget(targetName, isDefaultTarget, line, col); |
||||||
|
|
||||||
|
targets.Add(target); |
||||||
|
|
||||||
|
if (isDefaultTarget) { |
||||||
|
defaultTarget = target; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the named attribute's value.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The attribute's value or an empty string if
|
||||||
|
/// it was not found.
|
||||||
|
/// </returns>
|
||||||
|
string GetAttribute(XmlTextReader xmlReader, string name) |
||||||
|
{ |
||||||
|
string attributeValue = String.Empty; |
||||||
|
|
||||||
|
if (xmlReader.MoveToAttribute(name)) { |
||||||
|
if (xmlReader.Value != null) { |
||||||
|
attributeValue = xmlReader.Value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return attributeValue; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,72 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents an error found in the NAnt build file.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntBuildFileError |
||||||
|
{ |
||||||
|
string message = String.Empty; |
||||||
|
int line; |
||||||
|
int column; |
||||||
|
|
||||||
|
public NAntBuildFileError(string message, int line, int column) |
||||||
|
{ |
||||||
|
this.message = message; |
||||||
|
this.line = line; |
||||||
|
this.column = column; |
||||||
|
} |
||||||
|
|
||||||
|
public string Message { |
||||||
|
get { |
||||||
|
return message; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int Column { |
||||||
|
get { |
||||||
|
return column; |
||||||
|
} |
||||||
|
set { |
||||||
|
column = value; |
||||||
|
} |
||||||
|
} |
||||||
|
public int Line { |
||||||
|
get { |
||||||
|
return line; |
||||||
|
} |
||||||
|
set { |
||||||
|
line = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,104 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents a NAnt build target.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntBuildTarget |
||||||
|
{ |
||||||
|
string name = String.Empty; |
||||||
|
bool isDefault; |
||||||
|
int line; |
||||||
|
int column; |
||||||
|
|
||||||
|
public NAntBuildTarget() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance of the <see cref="NAntBuildTarget"/>
|
||||||
|
/// with the specified name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The target name.</param>
|
||||||
|
/// <param name="isDefault"><see langword="true"/> if the
|
||||||
|
/// target is the default target; otherwise
|
||||||
|
/// <see langword="false"/>.</param>
|
||||||
|
/// <param name="line">The line number of the target element
|
||||||
|
/// in the build file.</param>
|
||||||
|
/// <param name="col">The column number of the target element
|
||||||
|
/// in the build file.</param>
|
||||||
|
public NAntBuildTarget(string name, bool isDefault, int line, int col) |
||||||
|
{ |
||||||
|
this.name = name; |
||||||
|
this.isDefault = isDefault; |
||||||
|
this.line = line; |
||||||
|
this.column = col; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name of the target.
|
||||||
|
/// </summary>
|
||||||
|
public string Name { |
||||||
|
get { |
||||||
|
return name; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether this is the default target.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDefault { |
||||||
|
get { |
||||||
|
return isDefault; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the line in the build file where this
|
||||||
|
/// target can be found.
|
||||||
|
/// </summary>
|
||||||
|
public int Line { |
||||||
|
get { |
||||||
|
return line; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the column in the build file where this
|
||||||
|
/// target can be found.
|
||||||
|
/// </summary>
|
||||||
|
public int Column { |
||||||
|
get { |
||||||
|
return column; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,272 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// A collection that stores <see cref='NAntBuildTarget'/> objects.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref='NAntBuildTargetCollection'/>
|
||||||
|
[Serializable()] |
||||||
|
public class NAntBuildTargetCollection : CollectionBase { |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Initializes a new instance of <see cref='NAntBuildTargetCollection'/>.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
public NAntBuildTargetCollection() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Initializes a new instance of <see cref='NAntBuildTargetCollection'/> based on another <see cref='NAntBuildTargetCollection'/>.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>
|
||||||
|
/// A <see cref='NAntBuildTargetCollection'/> from which the contents are copied
|
||||||
|
/// </param>
|
||||||
|
public NAntBuildTargetCollection(NAntBuildTargetCollection val) |
||||||
|
{ |
||||||
|
this.AddRange(val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Initializes a new instance of <see cref='NAntBuildTargetCollection'/> containing any array of <see cref='NAntBuildTarget'/> objects.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>
|
||||||
|
/// A array of <see cref='NAntBuildTarget'/> objects with which to intialize the collection
|
||||||
|
/// </param>
|
||||||
|
public NAntBuildTargetCollection(NAntBuildTarget[] val) |
||||||
|
{ |
||||||
|
this.AddRange(val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Represents the entry at the specified index of the <see cref='NAntBuildTarget'/>.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
|
||||||
|
/// <value>
|
||||||
|
/// <para> The entry at the specified index of the collection.</para>
|
||||||
|
/// </value>
|
||||||
|
/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
|
||||||
|
public NAntBuildTarget this[int index] { |
||||||
|
get { |
||||||
|
return ((NAntBuildTarget)(List[index])); |
||||||
|
} |
||||||
|
set { |
||||||
|
List[index] = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Adds a <see cref='NAntBuildTarget'/> with the specified value to the
|
||||||
|
/// <see cref='NAntBuildTargetCollection'/> .</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>The <see cref='NAntBuildTarget'/> to add.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>The index at which the new element was inserted.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <seealso cref='NAntBuildTargetCollection.AddRange'/>
|
||||||
|
public int Add(NAntBuildTarget val) |
||||||
|
{ |
||||||
|
return List.Add(val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Copies the elements of an array to the end of the <see cref='NAntBuildTargetCollection'/>.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>
|
||||||
|
/// An array of type <see cref='NAntBuildTarget'/> containing the objects to add to the collection.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>None.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <seealso cref='NAntBuildTargetCollection.Add'/>
|
||||||
|
public void AddRange(NAntBuildTarget[] val) |
||||||
|
{ |
||||||
|
for (int i = 0; i < val.Length; i++) { |
||||||
|
this.Add(val[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Adds the contents of another <see cref='NAntBuildTargetCollection'/> to the end of the collection.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>
|
||||||
|
/// A <see cref='NAntBuildTargetCollection'/> containing the objects to add to the collection.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>None.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <seealso cref='NAntBuildTargetCollection.Add'/>
|
||||||
|
public void AddRange(NAntBuildTargetCollection val) |
||||||
|
{ |
||||||
|
for (int i = 0; i < val.Count; i++) |
||||||
|
{ |
||||||
|
this.Add(val[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Gets a value indicating whether the
|
||||||
|
/// <see cref='NAntBuildTargetCollection'/> contains the specified <see cref='NAntBuildTarget'/>.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>The <see cref='NAntBuildTarget'/> to locate.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para><see langword='true'/> if the <see cref='NAntBuildTarget'/> is contained in the collection;
|
||||||
|
/// otherwise, <see langword='false'/>.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <seealso cref='NAntBuildTargetCollection.IndexOf'/>
|
||||||
|
public bool Contains(NAntBuildTarget val) |
||||||
|
{ |
||||||
|
return List.Contains(val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Copies the <see cref='NAntBuildTargetCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
|
||||||
|
/// specified index.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='NAntBuildTargetCollection'/> .</para></param>
|
||||||
|
/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>None.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='NAntBuildTargetCollection'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception>
|
||||||
|
/// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
|
||||||
|
/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
|
||||||
|
/// <seealso cref='System.Array'/>
|
||||||
|
public void CopyTo(NAntBuildTarget[] array, int index) |
||||||
|
{ |
||||||
|
List.CopyTo(array, index); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Returns the index of a <see cref='NAntBuildTarget'/> in
|
||||||
|
/// the <see cref='NAntBuildTargetCollection'/> .</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>The <see cref='NAntBuildTarget'/> to locate.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>The index of the <see cref='NAntBuildTarget'/> of <paramref name='val'/> in the
|
||||||
|
/// <see cref='NAntBuildTargetCollection'/>, if found; otherwise, -1.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <seealso cref='NAntBuildTargetCollection.Contains'/>
|
||||||
|
public int IndexOf(NAntBuildTarget val) |
||||||
|
{ |
||||||
|
return List.IndexOf(val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Inserts a <see cref='NAntBuildTarget'/> into the <see cref='NAntBuildTargetCollection'/> at the specified index.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
|
||||||
|
/// <param name='val'>The <see cref='NAntBuildTarget'/> to insert.</param>
|
||||||
|
/// <returns><para>None.</para></returns>
|
||||||
|
/// <seealso cref='NAntBuildTargetCollection.Add'/>
|
||||||
|
public void Insert(int index, NAntBuildTarget val) |
||||||
|
{ |
||||||
|
List.Insert(index, val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Returns an enumerator that can iterate through
|
||||||
|
/// the <see cref='NAntBuildTargetCollection'/> .</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><para>None.</para></returns>
|
||||||
|
/// <seealso cref='System.Collections.IEnumerator'/>
|
||||||
|
public new NAntBuildTargetEnumerator GetEnumerator() |
||||||
|
{ |
||||||
|
return new NAntBuildTargetEnumerator(this); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para> Removes a specific <see cref='NAntBuildTarget'/> from the
|
||||||
|
/// <see cref='NAntBuildTargetCollection'/> .</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>The <see cref='NAntBuildTarget'/> to remove from the <see cref='NAntBuildTargetCollection'/> .</param>
|
||||||
|
/// <returns><para>None.</para></returns>
|
||||||
|
/// <exception cref='System.ArgumentException'><paramref name='val'/> is not found in the Collection. </exception>
|
||||||
|
public void Remove(NAntBuildTarget val) |
||||||
|
{ |
||||||
|
List.Remove(val); |
||||||
|
} |
||||||
|
|
||||||
|
public class NAntBuildTargetEnumerator : IEnumerator |
||||||
|
{ |
||||||
|
IEnumerator baseEnumerator; |
||||||
|
IEnumerable temp; |
||||||
|
|
||||||
|
public NAntBuildTargetEnumerator(NAntBuildTargetCollection mappings) |
||||||
|
{ |
||||||
|
this.temp = ((IEnumerable)(mappings)); |
||||||
|
this.baseEnumerator = temp.GetEnumerator(); |
||||||
|
} |
||||||
|
|
||||||
|
public NAntBuildTarget Current { |
||||||
|
get { |
||||||
|
return ((NAntBuildTarget)(baseEnumerator.Current)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
object IEnumerator.Current { |
||||||
|
get { |
||||||
|
return baseEnumerator.Current; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool MoveNext() |
||||||
|
{ |
||||||
|
return baseEnumerator.MoveNext(); |
||||||
|
} |
||||||
|
|
||||||
|
bool IEnumerator.MoveNext() |
||||||
|
{ |
||||||
|
return baseEnumerator.MoveNext(); |
||||||
|
} |
||||||
|
|
||||||
|
public void Reset() |
||||||
|
{ |
||||||
|
baseEnumerator.Reset(); |
||||||
|
} |
||||||
|
|
||||||
|
void IEnumerator.Reset() |
||||||
|
{ |
||||||
|
baseEnumerator.Reset(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,79 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents the method that will handle the
|
||||||
|
/// <see cref="NAntRunner.NAntExit"/> event.
|
||||||
|
/// </summary>
|
||||||
|
public delegate void NAntExitEventHandler(object sender, NAntExitEventArgs e); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="NAntRunner.NAntExit"/> event arguments.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntExitEventArgs : EventArgs |
||||||
|
{ |
||||||
|
string output; |
||||||
|
int exitCode; |
||||||
|
string error; |
||||||
|
|
||||||
|
public NAntExitEventArgs(string output, string error, int exitCode) |
||||||
|
{ |
||||||
|
this.output = output; |
||||||
|
this.error = error; |
||||||
|
this.exitCode = exitCode; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the command line output from NAnt.
|
||||||
|
/// </summary>
|
||||||
|
public string Output { |
||||||
|
get { |
||||||
|
return output; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string Error { |
||||||
|
get { |
||||||
|
return error; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the NAnt exit code.
|
||||||
|
/// </summary>
|
||||||
|
public int ExitCode { |
||||||
|
get { |
||||||
|
return exitCode; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,344 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using System.Text.RegularExpressions; |
||||||
|
|
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Utility class that parses the console output from NAnt.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntOutputParser |
||||||
|
{ |
||||||
|
NAntOutputParser() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses the NAnt console output and extracts a set of
|
||||||
|
/// Tasks.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="output">The NAnt console output to parse.</param>
|
||||||
|
/// <returns>A <see cref="TaskCollection"/>.</returns>
|
||||||
|
public static TaskCollection Parse(string output) |
||||||
|
{ |
||||||
|
TaskCollection tasks = new TaskCollection(); |
||||||
|
|
||||||
|
output = output.Replace("\r\n", "\n"); |
||||||
|
|
||||||
|
// Look for errors on a per line basis.
|
||||||
|
Task task = null; |
||||||
|
StringReader reader = new StringReader(output); |
||||||
|
while (reader.Peek() != -1) { |
||||||
|
|
||||||
|
string currentLine = reader.ReadLine(); |
||||||
|
if (currentLine.StartsWith("BUILD FAILED")) { |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
task = ParseLine(currentLine); |
||||||
|
if (task != null) { |
||||||
|
tasks.Add(task); |
||||||
|
} |
||||||
|
} |
||||||
|
reader.Close(); |
||||||
|
|
||||||
|
// Look for multiline build errors.
|
||||||
|
task = ParseMultilineBuildError(output); |
||||||
|
if (task != null) { |
||||||
|
tasks.Add(task); |
||||||
|
} |
||||||
|
|
||||||
|
// Look for NAnt build failed.
|
||||||
|
task = ParseNAntBuildFailedError(output); |
||||||
|
if (task != null) { |
||||||
|
tasks.Add(task); |
||||||
|
} |
||||||
|
|
||||||
|
return tasks; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses a single line of text looking for errors.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textLine">A NAnt output line.</param>
|
||||||
|
/// <returns>A <see cref="Task"/> if the line contains an error or
|
||||||
|
/// a warning; otherwise <see langword="null"/>.</returns>
|
||||||
|
static Task ParseLine(string textLine) |
||||||
|
{ |
||||||
|
Task task = null; |
||||||
|
|
||||||
|
task = ParseCSharpError(textLine); |
||||||
|
|
||||||
|
if (task == null) { |
||||||
|
task = ParseVBError(textLine); |
||||||
|
} |
||||||
|
|
||||||
|
if (task == null) { |
||||||
|
task = ParseFatalError(textLine); |
||||||
|
} |
||||||
|
|
||||||
|
if (task == null) { |
||||||
|
task = ParseVBFatalError(textLine); |
||||||
|
} |
||||||
|
|
||||||
|
if (task == null) { |
||||||
|
task = ParseNAntWarning(textLine); |
||||||
|
} |
||||||
|
if (task == null) { |
||||||
|
task = ParseNAntError(textLine); |
||||||
|
} |
||||||
|
|
||||||
|
return task; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks for errors of the form
|
||||||
|
/// "C:/MyProject/MyProject.build(40,3): error CS1000: An error occurred."
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textLine">The line of text to parse.</param>
|
||||||
|
/// <returns>A <see cref="Task"/> if an error was found; otherwise
|
||||||
|
/// <see langword="null"/>.</returns>
|
||||||
|
static Task ParseCSharpError(string textLine) |
||||||
|
{ |
||||||
|
Task task = null; |
||||||
|
Match match = Regex.Match(textLine, @"^.*?(\w+:[/\\].*?)\(([\d]*),([\d]*)\): (.*?) (.*?): (.*?)$"); |
||||||
|
if (match.Success) { |
||||||
|
try { |
||||||
|
// Take off 1 for line/col since SharpDevelop is zero index based.
|
||||||
|
int line = Convert.ToInt32(match.Groups[2].Value) - 1; |
||||||
|
int col = Convert.ToInt32(match.Groups[3].Value) - 1; |
||||||
|
string description = String.Concat(match.Groups[6].Value, " (", match.Groups[5], ")"); |
||||||
|
|
||||||
|
TaskType taskType = TaskType.Error; |
||||||
|
if (String.Compare(match.Groups[4].Value, "warning", true) == 0) { |
||||||
|
taskType = TaskType.Warning; |
||||||
|
} |
||||||
|
task = new Task(match.Groups[1].Value, description, col, line, taskType); |
||||||
|
} catch (Exception) { |
||||||
|
// Ignore.
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return task; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks for errors of the form
|
||||||
|
/// "C:/MyProject/MyProject.build(40,3): ifnot is deprecated."
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textLine">The line of text to parse.</param>
|
||||||
|
/// <returns>A <see cref="Task"/> if an error was found; otherwise
|
||||||
|
/// <see langword="null"/>.</returns>
|
||||||
|
static Task ParseNAntError(string textLine) |
||||||
|
{ |
||||||
|
Task task = null; |
||||||
|
|
||||||
|
Match match = Regex.Match(textLine, @"^.*?(\w+:[/\\].*?)\(([\d]*),([\d]*)\): (.*?)$"); |
||||||
|
if (match.Success) { |
||||||
|
try { |
||||||
|
// Take off 1 for line/col since SharpDevelop is zero index based.
|
||||||
|
int line = Convert.ToInt32(match.Groups[2].Value) - 1; |
||||||
|
int col = Convert.ToInt32(match.Groups[3].Value) - 1; |
||||||
|
|
||||||
|
task = new Task(match.Groups[1].Value, match.Groups[4].Value, col, line, TaskType.Warning); |
||||||
|
} catch (Exception) { |
||||||
|
// Ignore.
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return task; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks for errors of the form
|
||||||
|
/// "C:/MyProject/MyProject.build(40): error CS1000: An error occurred."
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This should handle C++ errors too.</remarks>
|
||||||
|
/// <param name="textLine">The line of text to parse.</param>
|
||||||
|
/// <returns>A <see cref="Task"/> if an error was found; otherwise
|
||||||
|
/// <see langword="null"/>.</returns>
|
||||||
|
static Task ParseVBError(string textLine) |
||||||
|
{ |
||||||
|
Task task = null; |
||||||
|
Match match = Regex.Match(textLine, @"^.*?(\w+:[/\\].*?)\(([\d]*)\) : (.*?) (.*?): (.*?)$"); |
||||||
|
if (match.Success) { |
||||||
|
try { |
||||||
|
// Take off 1 for line/col since SharpDevelop is zero index based.
|
||||||
|
int line = Convert.ToInt32(match.Groups[2].Value) - 1; |
||||||
|
string description = String.Concat(match.Groups[5].Value, " (", match.Groups[4], ")"); |
||||||
|
|
||||||
|
TaskType taskType = TaskType.Error; |
||||||
|
if (String.Compare(match.Groups[3].Value, "warning", true) == 0) { |
||||||
|
taskType = TaskType.Warning; |
||||||
|
} |
||||||
|
task = new Task(match.Groups[1].Value, description, 0, line, taskType); |
||||||
|
} catch (Exception) { |
||||||
|
// Ignore.
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return task; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks for errors of the form
|
||||||
|
/// "fatal error CS00042: An error occurred."
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textLine">The line of text to parse.</param>
|
||||||
|
/// <returns>A <see cref="Task"/> if an error was found; otherwise
|
||||||
|
/// <see langword="null"/>.</returns>
|
||||||
|
static Task ParseFatalError(string textLine) |
||||||
|
{ |
||||||
|
Task task = null; |
||||||
|
Match match = Regex.Match(textLine, @"^.*?(fatal error .*?: .*?)$"); |
||||||
|
if (match.Success) { |
||||||
|
try { |
||||||
|
task = new Task(String.Empty, match.Groups[1].Value, 0, 0, TaskType.Error); |
||||||
|
} catch (Exception) { |
||||||
|
// Ignore.
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return task; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks for errors of the form
|
||||||
|
/// "vbc : error BC31019: Unable to write to output file."
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textLine">The line of text to parse.</param>
|
||||||
|
/// <returns>A <see cref="Task"/> if an error was found; otherwise
|
||||||
|
/// <see langword="null"/>.</returns>
|
||||||
|
static Task ParseVBFatalError(string textLine) |
||||||
|
{ |
||||||
|
Task task = null; |
||||||
|
Match match = Regex.Match(textLine, @"^.*?vbc : error (.*?): (.*?)$"); |
||||||
|
if (match.Success) { |
||||||
|
try { |
||||||
|
string description = String.Concat(match.Groups[2].Value, " (", match.Groups[1].Value, ")"); |
||||||
|
task = new Task(String.Empty, description, 0, 0, TaskType.Error); |
||||||
|
} catch (Exception) { |
||||||
|
// Ignore.
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return task; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks for errors of the form
|
||||||
|
/// "fatal error CS00042: An error occurred."
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textLine">The line of text to parse.</param>
|
||||||
|
/// <returns>A <see cref="Task"/> if a warning was found; otherwise
|
||||||
|
/// <see langword="null"/>.</returns>
|
||||||
|
static Task ParseNAntWarning(string textLine) |
||||||
|
{ |
||||||
|
Task task = null; |
||||||
|
Match match = Regex.Match(textLine, @"^.*?(Read-only property .*? cannot be overwritten.)$"); |
||||||
|
if (match.Success) { |
||||||
|
try { |
||||||
|
task = new Task(String.Empty, match.Groups[1].Value, 0, 0, TaskType.Warning); |
||||||
|
} catch (Exception) { |
||||||
|
// Ignore.
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return task; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks for errors of the form
|
||||||
|
/// "BUILD FAILED"
|
||||||
|
/// "[csc] C:/foo/foo.cs(5,5):"
|
||||||
|
/// "Something bad happened."
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textLine">The line of text to parse.</param>
|
||||||
|
/// <returns>A <see cref="Task"/> if an error was found; otherwise
|
||||||
|
/// <see langword="null"/>.</returns>
|
||||||
|
static Task ParseNAntBuildFailedError(string output) |
||||||
|
{ |
||||||
|
Task task = null; |
||||||
|
|
||||||
|
Match match = Regex.Match(output, @"^BUILD FAILED.*?$\n^$\n^(\w+:[/\\].*?)\(([\d]*),([\d]*)\):$\n^(.*?)$\n^(.*?)$", RegexOptions.Multiline); |
||||||
|
|
||||||
|
if (match.Success) { |
||||||
|
|
||||||
|
try { |
||||||
|
// Take off 1 for line/col since SharpDevelop is zero index based.
|
||||||
|
int line = Convert.ToInt32(match.Groups[2].Value) - 1; |
||||||
|
int col = Convert.ToInt32(match.Groups[3].Value) - 1; |
||||||
|
string description = String.Concat(match.Groups[4], Environment.NewLine, match.Groups[5]); |
||||||
|
task = new Task(match.Groups[1].Value, description, col, line, TaskType.Error); |
||||||
|
} catch(Exception) { }; |
||||||
|
} else { |
||||||
|
|
||||||
|
match = Regex.Match(output, @"^BUILD FAILED$\n^$\n^(.*?)$", RegexOptions.Multiline); |
||||||
|
|
||||||
|
if (match.Success) { |
||||||
|
task = new Task(String.Empty, match.Groups[1].Value, 0, 0, TaskType.Error); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return task; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses errors of the form.
|
||||||
|
/// "[delete] C:\foo\foo.build(94,5):"
|
||||||
|
/// "[delete] Cannot delete directory 'C:\foo\bin'. The directory does not exist."
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textLine">The line of text to parse.</param>
|
||||||
|
/// <returns>A <see cref="Task"/> if an error was found; otherwise
|
||||||
|
/// <see langword="null"/>.</returns>
|
||||||
|
static Task ParseMultilineBuildError(string output) |
||||||
|
{ |
||||||
|
Task task = null; |
||||||
|
|
||||||
|
Match match = Regex.Match(output, @"^.*?\[delete\] (\w+:[/\\].*?)\(([\d]*),([\d]*)\):$\n^.*?\[delete\] (.*?)$", RegexOptions.Multiline); |
||||||
|
|
||||||
|
if (match.Success) { |
||||||
|
|
||||||
|
try { |
||||||
|
// Take off 1 for line/col since SharpDevelop is zero index based.
|
||||||
|
int line = Convert.ToInt32(match.Groups[2].Value) - 1; |
||||||
|
int col = Convert.ToInt32(match.Groups[3].Value) - 1; |
||||||
|
string description = String.Concat(match.Groups[4]); |
||||||
|
task = new Task(match.Groups[1].Value, description, col, line, TaskType.Error); |
||||||
|
} catch(Exception) { }; |
||||||
|
} |
||||||
|
|
||||||
|
return task; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,304 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Text; |
||||||
|
using ICSharpCode.SharpDevelop.Util; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Runs NAnt.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntRunner |
||||||
|
{ |
||||||
|
string arguments = String.Empty; |
||||||
|
string buildFileName = String.Empty; |
||||||
|
string nantFileName = String.Empty; |
||||||
|
string workingDirectory = String.Empty; |
||||||
|
bool verbose; |
||||||
|
bool quiet; |
||||||
|
bool showLogo; |
||||||
|
bool debugMode; |
||||||
|
ProcessRunner runner; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Triggered when NAnt exits.
|
||||||
|
/// </summary>
|
||||||
|
public event NAntExitEventHandler NAntExited; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The NAnt runner was started.
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler NAntStarted; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The NAnt runner was stopped. Being stopped is not the
|
||||||
|
/// same as NAnt exiting.
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler NAntStopped; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Triggered when an output line is received from NAnt.
|
||||||
|
/// </summary>
|
||||||
|
public event LineReceivedEventHandler OutputLineReceived; |
||||||
|
|
||||||
|
public NAntRunner() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the NAnt -buildfile parameter.
|
||||||
|
/// </summary>
|
||||||
|
public string BuildFileName { |
||||||
|
get { |
||||||
|
return buildFileName; |
||||||
|
} |
||||||
|
|
||||||
|
set { |
||||||
|
buildFileName = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the NAnt executable path.
|
||||||
|
/// </summary>
|
||||||
|
public string NAntFileName { |
||||||
|
get { |
||||||
|
return nantFileName; |
||||||
|
} |
||||||
|
|
||||||
|
set { |
||||||
|
nantFileName = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string WorkingDirectory { |
||||||
|
get { |
||||||
|
return workingDirectory; |
||||||
|
} |
||||||
|
|
||||||
|
set { |
||||||
|
workingDirectory = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the NAnt -verbose option.
|
||||||
|
/// </summary>
|
||||||
|
public bool Verbose { |
||||||
|
get { |
||||||
|
return verbose; |
||||||
|
} |
||||||
|
|
||||||
|
set { |
||||||
|
verbose = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string Arguments { |
||||||
|
get { |
||||||
|
return arguments; |
||||||
|
} |
||||||
|
|
||||||
|
set { |
||||||
|
arguments = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the NAnt -quiet option.
|
||||||
|
/// </summary>
|
||||||
|
public bool Quiet { |
||||||
|
get { |
||||||
|
return quiet; |
||||||
|
} |
||||||
|
|
||||||
|
set { |
||||||
|
quiet = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maps to the NAnt -nologo option.
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowLogo { |
||||||
|
get { |
||||||
|
return showLogo; |
||||||
|
} |
||||||
|
|
||||||
|
set { |
||||||
|
showLogo = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the NAnt -debug option.
|
||||||
|
/// </summary>
|
||||||
|
public bool DebugMode { |
||||||
|
get { |
||||||
|
return debugMode; |
||||||
|
} |
||||||
|
|
||||||
|
set { |
||||||
|
debugMode = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the full NAnt command line that will be used by
|
||||||
|
/// the runner.
|
||||||
|
/// </summary>
|
||||||
|
public string CommandLine { |
||||||
|
get { |
||||||
|
return String.Concat(nantFileName, " ", GetArguments()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether the NAnt runner is currently running.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRunning { |
||||||
|
get { |
||||||
|
bool isRunning = false; |
||||||
|
|
||||||
|
if (runner != null) { |
||||||
|
isRunning = runner.IsRunning; |
||||||
|
} |
||||||
|
|
||||||
|
return isRunning; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void Start() |
||||||
|
{ |
||||||
|
string arguments = GetArguments(); |
||||||
|
|
||||||
|
runner = new ProcessRunner(); |
||||||
|
runner.WorkingDirectory = workingDirectory; |
||||||
|
runner.ProcessExited += new EventHandler(ProcessExited); |
||||||
|
|
||||||
|
if (OutputLineReceived != null) { |
||||||
|
runner.OutputLineReceived += new LineReceivedEventHandler(OnOutputLineReceived); |
||||||
|
runner.ErrorLineReceived += new LineReceivedEventHandler(OnOutputLineReceived); |
||||||
|
} |
||||||
|
runner.Start(nantFileName, arguments); |
||||||
|
OnNAntStarted(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stops the currently running NAnt instance.
|
||||||
|
/// </summary>
|
||||||
|
public void Stop() |
||||||
|
{ |
||||||
|
if (runner != null) { |
||||||
|
runner.Kill(); |
||||||
|
OnNAntStopped(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected void OnNAntExited(string output, string error, int exitCode) |
||||||
|
{ |
||||||
|
if (NAntExited != null) { |
||||||
|
NAntExited(this, new NAntExitEventArgs(output, error, exitCode)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected void OnNAntStarted() |
||||||
|
{ |
||||||
|
if (NAntStarted != null) { |
||||||
|
NAntStarted(this, new EventArgs()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected void OnNAntStopped() |
||||||
|
{ |
||||||
|
if (NAntStopped != null) { |
||||||
|
NAntStopped(this, new EventArgs()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raises the <see cref="OutputLineReceived"/> event.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">The event source.</param>
|
||||||
|
/// <param name="e">The event arguments.</param>
|
||||||
|
protected void OnOutputLineReceived(object sender, LineReceivedEventArgs e) |
||||||
|
{ |
||||||
|
if (OutputLineReceived != null) { |
||||||
|
OutputLineReceived(this, e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles the NAnt process exit event.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">The event source.</param>
|
||||||
|
/// <param name="e">The event arguments.</param>
|
||||||
|
void ProcessExited(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
ProcessRunner runner = (ProcessRunner)sender; |
||||||
|
OnNAntExited(runner.StandardOutput, runner.StandardError, runner.ExitCode); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds extra command line arguments to those specified
|
||||||
|
/// by the user in the <see cref="Arguments"/> string.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
string GetArguments() |
||||||
|
{ |
||||||
|
StringBuilder nantArguments = new StringBuilder(); |
||||||
|
|
||||||
|
if (!showLogo) { |
||||||
|
nantArguments.Append("-nologo "); |
||||||
|
} |
||||||
|
|
||||||
|
if (verbose) { |
||||||
|
nantArguments.Append("-v "); |
||||||
|
} |
||||||
|
|
||||||
|
if (quiet) { |
||||||
|
nantArguments.Append("-q "); |
||||||
|
} |
||||||
|
|
||||||
|
if (debugMode) { |
||||||
|
nantArguments.Append("-debug "); |
||||||
|
} |
||||||
|
|
||||||
|
if (buildFileName.Length > 0) { |
||||||
|
nantArguments.Append("-buildfile:"); |
||||||
|
nantArguments.Append(buildFileName); |
||||||
|
nantArguments.Append(" "); |
||||||
|
} |
||||||
|
|
||||||
|
nantArguments.Append(this.arguments); |
||||||
|
|
||||||
|
return nantArguments.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,59 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Single NAntRunner that is used by all commands.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// The NAnt add-in only allows one build to be run at a time.
|
||||||
|
/// </remarks>
|
||||||
|
public class NAntRunnerSingleton |
||||||
|
{ |
||||||
|
static NAntRunner runner; |
||||||
|
|
||||||
|
NAntRunnerSingleton() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the <see cref="NAntRunner"/> instance.
|
||||||
|
/// </summary>
|
||||||
|
public static NAntRunner Runner { |
||||||
|
get { |
||||||
|
if (runner == null) { |
||||||
|
runner = new NAntRunner(); |
||||||
|
} |
||||||
|
|
||||||
|
return runner; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,273 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2007, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// A collection that stores <see cref='Task'/> objects.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref='TaskCollection'/>
|
||||||
|
[Serializable()] |
||||||
|
public class TaskCollection : CollectionBase { |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Initializes a new instance of <see cref='TaskCollection'/>.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
public TaskCollection() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Initializes a new instance of <see cref='TaskCollection'/> based on another <see cref='TaskCollection'/>.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>
|
||||||
|
/// A <see cref='TaskCollection'/> from which the contents are copied
|
||||||
|
/// </param>
|
||||||
|
public TaskCollection(TaskCollection val) |
||||||
|
{ |
||||||
|
this.AddRange(val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Initializes a new instance of <see cref='TaskCollection'/> containing any array of <see cref='Task'/> objects.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>
|
||||||
|
/// A array of <see cref='Task'/> objects with which to intialize the collection
|
||||||
|
/// </param>
|
||||||
|
public TaskCollection(Task[] val) |
||||||
|
{ |
||||||
|
this.AddRange(val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Represents the entry at the specified index of the <see cref='Task'/>.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='index'><para>The zero-based index of the entry to locate in the collection.</para></param>
|
||||||
|
/// <value>
|
||||||
|
/// <para> The entry at the specified index of the collection.</para>
|
||||||
|
/// </value>
|
||||||
|
/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='index'/> is outside the valid range of indexes for the collection.</exception>
|
||||||
|
public Task this[int index] { |
||||||
|
get { |
||||||
|
return ((Task)(List[index])); |
||||||
|
} |
||||||
|
set { |
||||||
|
List[index] = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Adds a <see cref='Task'/> with the specified value to the
|
||||||
|
/// <see cref='TaskCollection'/> .</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>The <see cref='Task'/> to add.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>The index at which the new element was inserted.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <seealso cref='TaskCollection.AddRange'/>
|
||||||
|
public int Add(Task val) |
||||||
|
{ |
||||||
|
return List.Add(val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Copies the elements of an array to the end of the <see cref='TaskCollection'/>.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>
|
||||||
|
/// An array of type <see cref='Task'/> containing the objects to add to the collection.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>None.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <seealso cref='TaskCollection.Add'/>
|
||||||
|
public void AddRange(Task[] val) |
||||||
|
{ |
||||||
|
for (int i = 0; i < val.Length; i++) { |
||||||
|
this.Add(val[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>
|
||||||
|
/// Adds the contents of another <see cref='TaskCollection'/> to the end of the collection.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>
|
||||||
|
/// A <see cref='TaskCollection'/> containing the objects to add to the collection.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>None.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <seealso cref='TaskCollection.Add'/>
|
||||||
|
public void AddRange(TaskCollection val) |
||||||
|
{ |
||||||
|
for (int i = 0; i < val.Count; i++) |
||||||
|
{ |
||||||
|
this.Add(val[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Gets a value indicating whether the
|
||||||
|
/// <see cref='TaskCollection'/> contains the specified <see cref='Task'/>.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>The <see cref='Task'/> to locate.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para><see langword='true'/> if the <see cref='Task'/> is contained in the collection;
|
||||||
|
/// otherwise, <see langword='false'/>.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <seealso cref='TaskCollection.IndexOf'/>
|
||||||
|
public bool Contains(Task val) |
||||||
|
{ |
||||||
|
return List.Contains(val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Copies the <see cref='TaskCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
|
||||||
|
/// specified index.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='TaskCollection'/> .</para></param>
|
||||||
|
/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>None.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='TaskCollection'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception>
|
||||||
|
/// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
|
||||||
|
/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
|
||||||
|
/// <seealso cref='System.Array'/>
|
||||||
|
public void CopyTo(Task[] array, int index) |
||||||
|
{ |
||||||
|
List.CopyTo(array, index); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Returns the index of a <see cref='Task'/> in
|
||||||
|
/// the <see cref='TaskCollection'/> .</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>The <see cref='Task'/> to locate.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <para>The index of the <see cref='Task'/> of <paramref name='val'/> in the
|
||||||
|
/// <see cref='TaskCollection'/>, if found; otherwise, -1.</para>
|
||||||
|
/// </returns>
|
||||||
|
/// <seealso cref='TaskCollection.Contains'/>
|
||||||
|
public int IndexOf(Task val) |
||||||
|
{ |
||||||
|
return List.IndexOf(val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Inserts a <see cref='Task'/> into the <see cref='TaskCollection'/> at the specified index.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='index'>The zero-based index where <paramref name='val'/> should be inserted.</param>
|
||||||
|
/// <param name='val'>The <see cref='Task'/> to insert.</param>
|
||||||
|
/// <returns><para>None.</para></returns>
|
||||||
|
/// <seealso cref='TaskCollection.Add'/>
|
||||||
|
public void Insert(int index, Task val) |
||||||
|
{ |
||||||
|
List.Insert(index, val); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>Returns an enumerator that can iterate through
|
||||||
|
/// the <see cref='TaskCollection'/> .</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><para>None.</para></returns>
|
||||||
|
/// <seealso cref='System.Collections.IEnumerator'/>
|
||||||
|
public new TaskEnumerator GetEnumerator() |
||||||
|
{ |
||||||
|
return new TaskEnumerator(this); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para> Removes a specific <see cref='Task'/> from the
|
||||||
|
/// <see cref='TaskCollection'/> .</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='val'>The <see cref='Task'/> to remove from the <see cref='TaskCollection'/> .</param>
|
||||||
|
/// <returns><para>None.</para></returns>
|
||||||
|
/// <exception cref='System.ArgumentException'><paramref name='val'/> is not found in the Collection. </exception>
|
||||||
|
public void Remove(Task val) |
||||||
|
{ |
||||||
|
List.Remove(val); |
||||||
|
} |
||||||
|
|
||||||
|
public class TaskEnumerator : IEnumerator |
||||||
|
{ |
||||||
|
IEnumerator baseEnumerator; |
||||||
|
IEnumerable temp; |
||||||
|
|
||||||
|
public TaskEnumerator(TaskCollection mappings) |
||||||
|
{ |
||||||
|
this.temp = ((IEnumerable)(mappings)); |
||||||
|
this.baseEnumerator = temp.GetEnumerator(); |
||||||
|
} |
||||||
|
|
||||||
|
public Task Current { |
||||||
|
get { |
||||||
|
return ((Task)(baseEnumerator.Current)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
object IEnumerator.Current { |
||||||
|
get { |
||||||
|
return baseEnumerator.Current; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool MoveNext() |
||||||
|
{ |
||||||
|
return baseEnumerator.MoveNext(); |
||||||
|
} |
||||||
|
|
||||||
|
bool IEnumerator.MoveNext() |
||||||
|
{ |
||||||
|
return baseEnumerator.MoveNext(); |
||||||
|
} |
||||||
|
|
||||||
|
public void Reset() |
||||||
|
{ |
||||||
|
baseEnumerator.Reset(); |
||||||
|
} |
||||||
|
|
||||||
|
void IEnumerator.Reset() |
||||||
|
{ |
||||||
|
baseEnumerator.Reset(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||