Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1157 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
29 changed files with 1315 additions and 473 deletions
@ -0,0 +1,5 @@
@@ -0,0 +1,5 @@
|
||||
<Categories> |
||||
<Category Name="VB"> |
||||
<Category Name="${res:Templates.File.Categories.WindowsApplications}" SortOrder="10"/> |
||||
</Category> |
||||
</Categories> |
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0"?> |
||||
<Template author="Matt Ward" version="1.0"> |
||||
|
||||
<Config |
||||
name = "${res:Templates.File.GtkSharpWindow.Name}" |
||||
icon = "VBNet.File.Form" |
||||
category = "VB" |
||||
subcategory = "Mono" |
||||
defaultname = "Window${Number}.vb" |
||||
language = "VB"/> |
||||
|
||||
<Description>${res:Templates.File.GtkSharpWindow.Description}</Description> |
||||
|
||||
<!-- |
||||
Special new file templates: |
||||
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension |
||||
${FullName} -> Full generated path name |
||||
${FileName} -> File name with extension |
||||
${FileNameWithoutExtension} -> File name without extension |
||||
${Extension} -> Extension in the form ".cs" |
||||
${Path} -> Full path of the file |
||||
${ClassName} -> Class name (generally FileNameWithoutExtension w/o 'bad' characters) |
||||
--> |
||||
<Files> |
||||
<File name="${FullName}" language="VBNet"><![CDATA[${StandardHeader.VBNET} |
||||
Imports Gtk |
||||
|
||||
Public Class ${ClassName} |
||||
Inherits Window |
||||
|
||||
Public Sub New |
||||
MyBase.New("${ClassName}") |
||||
End Sub |
||||
End Class |
||||
]]></File> |
||||
</Files> |
||||
|
||||
<AdditionalOptions/> |
||||
</Template> |
@ -0,0 +1,107 @@
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0"?> |
||||
<Template originator = "Matt Ward" |
||||
created = "15/02/2006" |
||||
lastModified = "15/02/2006"> |
||||
|
||||
<!-- Template Header --> |
||||
<TemplateConfiguration> |
||||
<Name>${res:Templates.Project.GtkSharpProject.Name}</Name> |
||||
<Category>VBNet</Category> |
||||
<Subcategory>Mono</Subcategory> |
||||
<Icon>VBNet.Project.Form</Icon> |
||||
<LanguageName>VBNet</LanguageName> |
||||
<Description>${res:Templates.Project.GtkSharpProject.Description}</Description> |
||||
</TemplateConfiguration> |
||||
|
||||
<!-- Actions --> |
||||
<Actions> |
||||
<Open filename = "MainWindow.vb"/> |
||||
</Actions> |
||||
|
||||
<Solution name = "${ProjectName}" directory = "."> |
||||
<Options> |
||||
<StartupProject>${ProjectName}</StartupProject> |
||||
</Options> |
||||
|
||||
<Project name = "${ProjectName}" directory = "."> |
||||
<Options OutputType = "WinExe"/> |
||||
|
||||
<PropertyGroup> |
||||
<TargetFrameworkVersion>Mono v1.1</TargetFrameworkVersion> |
||||
</PropertyGroup> |
||||
|
||||
<Imports clear="True"> |
||||
<Import Project="$(SharpDevelopBinPath)\SharpDevelop.Build.VisualBasic.targets" /> |
||||
</Imports> |
||||
|
||||
<ProjectItems> |
||||
<Reference Include="atk-sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
||||
<Reference Include="gdk-sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
||||
<Reference Include="glib-sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
||||
<Reference Include="gtk-sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
||||
<Reference Include="pango-sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
||||
<Reference Include="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> |
||||
|
||||
<Import Include="Microsoft.VisualBasic" /> |
||||
<Import Include="System" /> |
||||
<Import Include="System.Collections" /> |
||||
</ProjectItems> |
||||
|
||||
<Files> |
||||
<File name="MainWindow.vb"><![CDATA[${StandardHeader.VBNET} |
||||
Imports Gtk |
||||
Imports System |
||||
|
||||
Public Class MainWindow |
||||
Inherits Window |
||||
|
||||
Public Sub New |
||||
MyBase.New("MainWindow") |
||||
AddHandler MyBase.DeleteEvent, AddressOf MainWindowDelete |
||||
Me.ShowAll() |
||||
End Sub |
||||
|
||||
Public Shared Sub Main |
||||
Application.Init() |
||||
Dim mainWindow As New MainWindow |
||||
Application.Run() |
||||
End Sub |
||||
|
||||
Private Sub MainWindowDelete(ByVal o As Object, ByVal args As DeleteEventArgs) |
||||
Application.Quit() |
||||
args.RetVal = true |
||||
End Sub |
||||
End Class |
||||
]]></File> |
||||
<File name="AssemblyInfo.vb"> |
||||
<![CDATA[Imports System.Reflection |
||||
Imports 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("1.0.*")> |
||||
]]></File> |
||||
</Files> |
||||
</Project> |
||||
</Solution> |
||||
</Template> |
@ -0,0 +1,5 @@
@@ -0,0 +1,5 @@
|
||||
<Categories> |
||||
<Category Name="VBNet"> |
||||
<Category Name="${res:Templates.File.Categories.WindowsApplications}" SortOrder="10"/> |
||||
</Category> |
||||
</Categories> |
@ -1,8 +1,22 @@
@@ -1,8 +1,22 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00 |
||||
# SharpDevelop 2.0.0.546 |
||||
# SharpDevelop 2.0.0.1116 |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Build.Tasks", "Project\ICSharpCode.Build.Tasks.csproj", "{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Build.Tasks.Tests", "Test\ICSharpCode.Build.Tasks.Tests.csproj", "{B7C2A664-B454-4920-AC6E-318F5274B2EF}" |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
Debug|Any CPU = Debug|Any CPU |
||||
Release|Any CPU = Release|Any CPU |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
{B7C2A664-B454-4920-AC6E-318F5274B2EF}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{B7C2A664-B454-4920-AC6E-318F5274B2EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{B7C2A664-B454-4920-AC6E-318F5274B2EF}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{B7C2A664-B454-4920-AC6E-318F5274B2EF}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
EndGlobalSection |
||||
EndGlobal |
||||
|
@ -0,0 +1,142 @@
@@ -0,0 +1,142 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using Microsoft.Build.Framework; |
||||
using Microsoft.Build.Utilities; |
||||
using System; |
||||
using System.CodeDom.Compiler; |
||||
|
||||
namespace ICSharpCode.Build.Tasks |
||||
{ |
||||
/// <summary>
|
||||
/// MSBuild task for Mono's Visual Basic compiler Mbas.
|
||||
/// </summary>
|
||||
public class Mbas : MonoCompilerTask |
||||
{ |
||||
ITaskItem[] imports; |
||||
string optionCompare; |
||||
bool optionExplicit; |
||||
bool optionStrict; |
||||
bool noWarnings; |
||||
bool removeIntegerChecks; |
||||
string rootNamespace; |
||||
|
||||
public ITaskItem[] Imports { |
||||
get { |
||||
return imports; |
||||
} |
||||
set { |
||||
imports = value; |
||||
} |
||||
} |
||||
|
||||
public string OptionCompare { |
||||
get { |
||||
return optionCompare; |
||||
} |
||||
set { |
||||
optionCompare = value; |
||||
} |
||||
} |
||||
|
||||
public bool OptionExplicit { |
||||
get { |
||||
return optionExplicit; |
||||
} |
||||
set { |
||||
optionExplicit = value; |
||||
} |
||||
} |
||||
|
||||
public bool OptionStrict { |
||||
get { |
||||
return optionStrict; |
||||
} |
||||
set { |
||||
optionStrict = value; |
||||
} |
||||
} |
||||
|
||||
public bool NoWarnings { |
||||
get { |
||||
return noWarnings; |
||||
} |
||||
set { |
||||
noWarnings = value; |
||||
} |
||||
} |
||||
|
||||
public bool RemoveIntegerChecks { |
||||
get { |
||||
return removeIntegerChecks; |
||||
} |
||||
set { |
||||
removeIntegerChecks = value; |
||||
} |
||||
} |
||||
|
||||
public string RootNamespace { |
||||
get { |
||||
return rootNamespace; |
||||
} |
||||
set { |
||||
rootNamespace = value; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Command line arguments that will be passed to the compiler.
|
||||
/// </summary>
|
||||
protected override string GenerateCommandLineArguments() |
||||
{ |
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(); |
||||
|
||||
args.AppendFileNameIfNotNull("-out:", OutputAssembly); |
||||
if (IsWarningLevelSet) { |
||||
args.AppendSwitch("-wlevel:", WarningLevel.ToString()); |
||||
} |
||||
args.AppendTarget(TargetType); |
||||
args.AppendSwitchIfTrue("-debug", EmitDebugInformation); |
||||
args.AppendLowerCaseSwitchIfNotNull("-debug:", DebugType); |
||||
args.AppendSwitchIfTrue("-nologo", NoLogo); |
||||
args.AppendSwitchIfTrue("-nowarn", noWarnings); |
||||
args.AppendSwitchIfTrue("-unsafe", AllowUnsafeBlocks); |
||||
args.AppendSwitchIfTrue("-nostdlib", NoStandardLib); |
||||
args.AppendSwitchIfNotNull("-define:", DefineConstants); |
||||
args.AppendSwitchIfNotNull("-main:", MainEntryPoint); |
||||
args.AppendSwitchIfNotNull("-lib:", AdditionalLibPaths, ","); |
||||
args.AppendSwitchIfNotNull("-ignorewarn:", DisabledWarnings); |
||||
args.AppendSwitchIfTrue("-optionstrict", OptionStrict); |
||||
args.AppendSwitchIfTrue("-optionexplicit", OptionExplicit); |
||||
args.AppendSwitchIfTrue("-warnaserror", TreatWarningsAsErrors); |
||||
args.AppendSwitchIfTrue("-removeintchecks", removeIntegerChecks); |
||||
args.AppendSwitchIfNotNull("-rootnamespace:", rootNamespace); |
||||
args.AppendItemsIfNotNull("-imports:", Imports); |
||||
args.AppendReferencesIfNotNull(References); |
||||
args.AppendItemsIfNotNull("-resource:", Resources); |
||||
args.AppendFileNamesIfNotNull(Sources, " "); |
||||
|
||||
return args.ToString(); |
||||
} |
||||
|
||||
protected override ICompilerResultsParser GetCompilerResultsParser() |
||||
{ |
||||
return new MonoBasicCompilerResultsParser(); |
||||
} |
||||
|
||||
protected override string ToolName { |
||||
get { |
||||
return "Mbas.exe"; |
||||
} |
||||
} |
||||
|
||||
protected override string GenerateFullPathToTool() |
||||
{ |
||||
return MonoToolLocationHelper.GetPathToTool(ToolName); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.CodeDom.Compiler; |
||||
using System.IO; |
||||
using System.Text; |
||||
using System.Text.RegularExpressions; |
||||
|
||||
namespace ICSharpCode.Build.Tasks |
||||
{ |
||||
public class MonoBasicCompilerResultsParser : ICompilerResultsParser |
||||
{ |
||||
public const string NormalErrorPattern = @"(?<file>.*)\((?<line>\d+),(?<column>\d+)\)\s+(?<error>\w+)\s+(?<number>[\d\w]+):\s+(?<message>.*)"; |
||||
|
||||
Regex normalError = new Regex(NormalErrorPattern, RegexOptions.Compiled); |
||||
|
||||
public MonoBasicCompilerResultsParser() |
||||
{ |
||||
} |
||||
|
||||
public CompilerResults Parse(TempFileCollection tempFiles, string outputFileName, string errorFileName) |
||||
{ |
||||
CompilerResults results = new CompilerResults(tempFiles); |
||||
|
||||
StringBuilder compilerOutput = new StringBuilder(); |
||||
StreamReader resultsReader = File.OpenText(outputFileName); |
||||
|
||||
while (true) { |
||||
string curLine = resultsReader.ReadLine(); |
||||
compilerOutput.Append(curLine); |
||||
compilerOutput.Append('\n'); |
||||
if (curLine == null) { |
||||
break; |
||||
} |
||||
curLine = curLine.Trim(); |
||||
if (curLine.Length == 0) { |
||||
continue; |
||||
} |
||||
|
||||
CompilerError error = new CompilerError(); |
||||
|
||||
// try to match standard mono errors
|
||||
Match match = normalError.Match(curLine); |
||||
if (match.Success) { |
||||
error.Column = Int32.Parse(match.Result("${column}")); |
||||
error.Line = Int32.Parse(match.Result("${line}")); |
||||
error.FileName = Path.GetFullPath(match.Result("${file}")); |
||||
error.IsWarning = match.Result("${error}") == "warning"; |
||||
error.ErrorNumber = match.Result("${number}"); |
||||
error.ErrorText = match.Result("${message}"); |
||||
|
||||
results.Errors.Add(error); |
||||
} |
||||
} |
||||
resultsReader.Close(); |
||||
|
||||
return results; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,158 @@
@@ -0,0 +1,158 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.Build.Tasks |
||||
{ |
||||
/// <summary>
|
||||
/// Base class for the Mcs and Gmcs tasks.
|
||||
/// </summary>
|
||||
public abstract class MonoCSharpCompilerTask : MonoCompilerTask |
||||
{ |
||||
bool checkForOverflowUnderflow; |
||||
bool delaySign; |
||||
string documentationFile; |
||||
string keyContainer; |
||||
string keyFile; |
||||
string langVersion; |
||||
string moduleAssemblyName; |
||||
bool noConfig; |
||||
string win32Icon; |
||||
string win32Resource; |
||||
|
||||
public bool CheckForOverflowUnderflow { |
||||
get { |
||||
return checkForOverflowUnderflow; |
||||
} |
||||
set { |
||||
checkForOverflowUnderflow = value; |
||||
} |
||||
} |
||||
|
||||
public bool DelaySign { |
||||
get { |
||||
return delaySign; |
||||
} |
||||
|
||||
set { |
||||
delaySign = value; |
||||
} |
||||
} |
||||
|
||||
public string DocumentationFile { |
||||
get { |
||||
return documentationFile; |
||||
} |
||||
set { |
||||
documentationFile = value; |
||||
} |
||||
} |
||||
|
||||
public string KeyContainer { |
||||
get { |
||||
return keyContainer; |
||||
} |
||||
set { |
||||
keyContainer = value; |
||||
} |
||||
} |
||||
|
||||
public string KeyFile { |
||||
get { |
||||
return keyFile; |
||||
} |
||||
set { |
||||
keyFile = value; |
||||
} |
||||
} |
||||
|
||||
public string LangVersion { |
||||
get { |
||||
return langVersion; |
||||
} |
||||
set { |
||||
langVersion = value; |
||||
} |
||||
} |
||||
|
||||
public string ModuleAssemblyName { |
||||
get { |
||||
return moduleAssemblyName; |
||||
} |
||||
set { |
||||
moduleAssemblyName = value; |
||||
} |
||||
} |
||||
|
||||
public bool NoConfig { |
||||
get { |
||||
return noConfig; |
||||
} |
||||
set { |
||||
noConfig = value; |
||||
} |
||||
} |
||||
|
||||
public string Win32Icon { |
||||
get { |
||||
return win32Icon; |
||||
} |
||||
set { |
||||
win32Icon = value; |
||||
} |
||||
} |
||||
|
||||
public string Win32Resource { |
||||
get { |
||||
return win32Resource; |
||||
} |
||||
set { |
||||
win32Resource = value; |
||||
} |
||||
} |
||||
|
||||
protected override string GenerateCommandLineArguments() |
||||
{ |
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(); |
||||
args.AppendSwitchIfTrue("-noconfig", noConfig); |
||||
if (IsWarningLevelSet) { |
||||
args.AppendSwitch("-warn:", WarningLevel.ToString()); |
||||
} |
||||
args.AppendFileNameIfNotNull("-out:", OutputAssembly); |
||||
args.AppendTarget(TargetType); |
||||
args.AppendSwitchIfTrue("-debug", EmitDebugInformation); |
||||
args.AppendSwitchIfTrue("-optimize", Optimize); |
||||
args.AppendSwitchIfTrue("-nologo", NoLogo); |
||||
args.AppendSwitchIfTrue("-unsafe", AllowUnsafeBlocks); |
||||
args.AppendSwitchIfTrue("-nostdlib", NoStandardLib); |
||||
args.AppendSwitchIfTrue("-checked", checkForOverflowUnderflow); |
||||
args.AppendSwitchIfTrue("-delaysign", delaySign); |
||||
args.AppendSwitchIfNotNull("-langversion:", langVersion); |
||||
args.AppendSwitchIfNotNull("-keycontainer:", keyContainer); |
||||
args.AppendSwitchIfNotNull("-keyfile:", keyFile); |
||||
args.AppendSwitchIfNotNull("-define:", DefineConstants); |
||||
args.AppendSwitchIfTrue("-warnaserror", TreatWarningsAsErrors); |
||||
args.AppendSwitchIfNotNull("-nowarn:", DisabledWarnings); |
||||
args.AppendSwitchIfNotNull("-main:", MainEntryPoint); |
||||
args.AppendFileNameIfNotNull("-doc:", documentationFile); |
||||
args.AppendSwitchIfNotNull("-lib:", AdditionalLibPaths, ","); |
||||
args.AppendReferencesIfNotNull(References); |
||||
args.AppendItemsIfNotNull("-resource:", Resources); |
||||
args.AppendFileNameIfNotNull("-win32res:", win32Resource); |
||||
args.AppendFileNameIfNotNull("-win32icon:", win32Icon); |
||||
args.AppendFileNamesIfNotNull(Sources, " "); |
||||
|
||||
return args.ToString(); |
||||
} |
||||
|
||||
protected override ICompilerResultsParser GetCompilerResultsParser() |
||||
{ |
||||
return new MonoCSharpCompilerResultsParser(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,114 @@
@@ -0,0 +1,114 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||
|
||||
<Import Project="$(SharpDevelopBinPath)\SharpDevelop.Build.Common.targets" /> |
||||
|
||||
<UsingTask TaskName="ICSharpCode.Build.Tasks.Mbas" |
||||
AssemblyFile="$(SharpDevelopBinPath)\ICSharpCode.Build.Tasks.dll"/> |
||||
<UsingTask TaskName="ICSharpCode.Build.Tasks.GetMonoFrameworkPath" |
||||
AssemblyFile="$(SharpDevelopBinPath)\ICSharpCode.Build.Tasks.dll"/> |
||||
<UsingTask TaskName="ICSharpCode.Build.Tasks.GetMonoFrameworkSdkPath" |
||||
AssemblyFile="$(SharpDevelopBinPath)\ICSharpCode.Build.Tasks.dll"/> |
||||
<UsingTask TaskName="ICSharpCode.Build.Tasks.AddMonoAssemblySearchPaths" |
||||
AssemblyFile="$(SharpDevelopBinPath)\ICSharpCode.Build.Tasks.dll"/> |
||||
|
||||
<PropertyGroup> |
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(SharpDevelopBuildBinPath)\SharpDevelop.Build.Mono.Mbas.targets</MSBuildAllProjects> |
||||
<DefaultLanguageSourceExtension>.vb</DefaultLanguageSourceExtension> |
||||
<Language>VB</Language> |
||||
</PropertyGroup> |
||||
|
||||
<!-- Override AssemblySearchPaths property and remove Microsoft specific search paths --> |
||||
<PropertyGroup> |
||||
<AssemblySearchPaths> |
||||
{CandidateAssemblyFiles}; |
||||
$(ReferencePath); |
||||
{HintPathFromItem}; |
||||
{TargetFrameworkDirectory}; |
||||
{MonoGAC}; |
||||
{RawFileName}; |
||||
$(OutputPath) |
||||
</AssemblySearchPaths> |
||||
</PropertyGroup> |
||||
|
||||
<Target Name="GetFrameworkPaths"> |
||||
<!-- Get the path to the target Mono Framework directory. --> |
||||
<GetMonoFrameworkPath TargetFrameworkVersion="$(TargetFrameworkVersion)"> |
||||
<Output TaskParameter="Path" PropertyName="TargetFrameworkDirectory"/> |
||||
<Output TaskParameter="Path" ItemName="_TargetFrameworkDirectoryItem"/> |
||||
</GetMonoFrameworkPath> |
||||
|
||||
<!-- Get the path to the target the Mono SDK directory. --> |
||||
<GetMonoFrameworkSDKPath> |
||||
<Output TaskParameter="Path" PropertyName="TargetFrameworkSDKDirectory"/> |
||||
<Output TaskParameter="Path" ItemName="_TargetFrameworkSDKDirectoryItem"/> |
||||
</GetMonoFrameworkSDKPath> |
||||
</Target> |
||||
|
||||
<!-- Modify what the ResolveAssemblyReferences tasks depends on so the |
||||
AssemblySearchPaths can be modified to use the Mono GAC --> |
||||
<PropertyGroup> |
||||
<ResolveAssemblyReferencesDependsOn> |
||||
GetFrameworkPaths; |
||||
GetRedistLists; |
||||
PrepareForBuild; |
||||
AddMonoAssemblySearchPaths |
||||
</ResolveAssemblyReferencesDependsOn> |
||||
</PropertyGroup> |
||||
<Target Name="AddMonoAssemblySearchPaths"> |
||||
<AddMonoAssemblySearchPaths |
||||
Assemblies="@(Reference)" |
||||
Paths="$(AssemblySearchPaths)"> |
||||
|
||||
<Output TaskParameter="Paths" PropertyName="AssemblySearchPaths"/> |
||||
</AddMonoAssemblySearchPaths> |
||||
</Target> |
||||
|
||||
<Target |
||||
Name="CoreCompile" |
||||
Inputs="$(MSBuildAllProjects); |
||||
@(Compile); |
||||
@(ManifestResourceWithNoCulture); |
||||
$(ApplicationIcon); |
||||
$(AssemblyOriginatorKeyFile); |
||||
@(ManifestNonResxWithNoCultureOnDisk); |
||||
@(ReferencePath); |
||||
@(CompiledLicenseFile); |
||||
@(EmbeddedDocumentation); |
||||
@(CustomAdditionalCompileInputs)" |
||||
Outputs="@(DocFileItem); |
||||
@(IntermediateAssembly); |
||||
$(NonExistentFile); |
||||
@(CustomAdditionalCompileOutputs)" |
||||
DependsOnTargets="$(CoreCompileDependsOn)" |
||||
> |
||||
|
||||
<Mbas |
||||
AdditionalLibPaths="$(AdditionalLibPaths)" |
||||
AddModules="@(AddModules)" |
||||
CodePage="$(CodePage)" |
||||
DebugType="$(DebugType)" |
||||
DefineConstants="$(FinalDefineConstants)" |
||||
DisabledWarnings="$(NoWarn)" |
||||
EmitDebugInformation="$(DebugSymbols)" |
||||
Imports="@(Import)" |
||||
MainEntryPoint="$(StartupObject)" |
||||
NoStandardLib="$(NoStdLib)" |
||||
NoWarnings="$(_NoWarnings)" |
||||
OptionCompare="$(OptionCompare)" |
||||
OptionExplicit="$(OptionExplicit)" |
||||
OptionStrict="$(OptionStrict)" |
||||
OutputAssembly="@(IntermediateAssembly)" |
||||
References="@(ReferencePath)" |
||||
RemoveIntegerChecks="$(RemoveIntegerChecks)" |
||||
Resources="@(ManifestResourceWithNoCulture);@(ManifestNonResxWithNoCultureOnDisk);@(CompiledLicenseFile)" |
||||
ResponseFiles="$(CompilerResponseFile)" |
||||
RootNamespace="$(RootNamespace)" |
||||
Sources="@(Compile)" |
||||
TargetType="$(OutputType)" |
||||
ToolPath="$(MbasToolPath)" |
||||
TreatWarningsAsErrors="$(TreatWarningsAsErrors)" |
||||
WarningLevel="$(WarningLevel)" |
||||
/> |
||||
</Target> |
||||
|
||||
</Project> |
@ -1,273 +0,0 @@
@@ -1,273 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.Build.Tasks; |
||||
using NUnit.Framework; |
||||
using Microsoft.Build.Utilities; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.Build.Tasks.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class CompilerCommandLineTestFixture |
||||
{ |
||||
[Test] |
||||
public void NoArguments() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void OutputAssembly() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
string outputAssembly = @"obj\debug\test.exe"; |
||||
mcs.OutputAssembly = new TaskItem(outputAssembly); |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual(@"-warn:0 -out:obj\debug\test.exe", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void OutputAssemblyWithSpace() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
string outputAssembly = @"obj\debug\test this.exe"; |
||||
mcs.OutputAssembly = new TaskItem(outputAssembly); |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -out:\"obj\\debug\\test this.exe\"", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WinExeTarget() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.TargetType = "Exe"; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -target:exe", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void ModuleTarget() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.TargetType = "Module"; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -target:module", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void FullDebugging() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.DebugType = "Full"; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -debug", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Optimize() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.Optimize = true; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -optimize", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoLogo() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.NoLogo = true; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -nologo", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Unsafe() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.AllowUnsafeBlocks = true; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -unsafe", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoStandardLib() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.NoStandardLib = true; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -nostdlib", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void DelaySign() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.DelaySign = true; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -delaysign", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void DefineConstants() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.DefineConstants = "DEBUG;TRACE"; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -define:\"DEBUG;TRACE\"", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WarnAsError() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.TreatWarningsAsErrors = true; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -warnaserror", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoWarn() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.DisabledWarnings = "1234,5678"; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -nowarn:\"1234,5678\"", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void MainEntryPoint() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.MainEntryPoint = "Console.MainClass.Main"; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -main:Console.MainClass.Main", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void DocumentationFile() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.DocumentationFile = @"obj\debug test\test.exe.xml"; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -doc:\"obj\\debug test\\test.exe.xml\"", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void SingleSourceFile() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.Sources = new TaskItem[] { new TaskItem("proj src\\Main.cs") }; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 \"proj src\\Main.cs\"", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void MultipleSourceFiles() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.Sources = new TaskItem[] { new TaskItem("proj src\\Main.cs"), |
||||
new TaskItem("AssemblyInfo.cs") }; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 \"proj src\\Main.cs\" AssemblyInfo.cs", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void SingleReference() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.References = new TaskItem[] { new TaskItem("proj refs\\Test.dll") }; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -r:\"proj refs\\Test.dll\"", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void NetModuleReference() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.References = new TaskItem[] { new TaskItem("proj refs\\Test.dll"), |
||||
new TaskItem("proj refs\\Run.netmodule") }; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -r:\"proj refs\\Test.dll\" -addmodule:\"proj refs\\Run.netmodule\"", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void AdditionalLibPaths() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.AdditionalLibPaths = new string[] { "proj\\My libs", "proj\\My libs2" }; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -lib:\"proj\\My libs\",\"proj\\My libs2\"", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmbeddedResources() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.Resources = new TaskItem[] { new TaskItem("proj res\\Test.xml"), |
||||
new TaskItem("proj res\\Run.xml") }; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -resource:\"proj res\\Test.xml\" -resource:\"proj res\\Run.xml\"", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Win32Resource() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.Win32Resource = "Project Resources\\Test.res"; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -win32res:\"Project Resources\\Test.res\"", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Win32Icon() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.Win32Icon = "Project Icons\\app.ico"; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -win32icon:\"Project Icons\\app.ico\"", args.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Checked() |
||||
{ |
||||
Mcs mcs = new Mcs(); |
||||
mcs.CheckForOverflowUnderflow = true; |
||||
|
||||
CompilerCommandLineArguments args = new CompilerCommandLineArguments(mcs); |
||||
Assert.AreEqual("-warn:0 -checked", args.ToString()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.Build.Tasks; |
||||
using System; |
||||
|
||||
namespace ICSharpCode.Build.Tasks.Tests |
||||
{ |
||||
/// <summary>
|
||||
/// Helper class that allows us to test protected methods of the
|
||||
/// Mbas class.
|
||||
/// </summary>
|
||||
public class MockMbas : Mbas |
||||
{ |
||||
/// <summary>
|
||||
/// Generates the Mbas command line arguments via the protected
|
||||
/// GenerateCommandLineArguments method.
|
||||
/// </summary>
|
||||
public string GetCommandLine() |
||||
{ |
||||
return base.GenerateCommandLineArguments(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.Build.Tasks; |
||||
using System; |
||||
|
||||
namespace ICSharpCode.Build.Tasks.Tests |
||||
{ |
||||
/// <summary>
|
||||
/// Helper class that allows us to test protected methods of the
|
||||
/// MonoCSharpCompilerTask class.
|
||||
/// </summary>
|
||||
public class MockMonoCSharpCompilerTask : MonoCSharpCompilerTask |
||||
{ |
||||
/// <summary>
|
||||
/// Generates the MonoCSharpCompilerTask command line arguments via the
|
||||
/// protected GenerateCommandLineArguments method.
|
||||
/// </summary>
|
||||
public string GetCommandLine() |
||||
{ |
||||
return base.GenerateCommandLineArguments(); |
||||
} |
||||
|
||||
protected override string ToolName { |
||||
get { |
||||
return "MonoCSharp.exe"; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,206 @@
@@ -0,0 +1,206 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.Build.Tasks; |
||||
using NUnit.Framework; |
||||
using Microsoft.Build.Utilities; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.Build.Tasks.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class MonoBasicCommandLineTestFixture |
||||
{ |
||||
[Test] |
||||
public void NoArgs() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
Assert.AreEqual(String.Empty, mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoStandardLib() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.NoStandardLib = true; |
||||
Assert.AreEqual("-nostdlib", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void OutputAssembly() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
string outputAssembly = @"obj\debug\test.exe"; |
||||
mbas.OutputAssembly = new TaskItem(outputAssembly); |
||||
Assert.AreEqual(@"-out:obj\debug\test.exe", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Unsafe() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.AllowUnsafeBlocks = true; |
||||
Assert.AreEqual("-unsafe", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WarnAsError() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.TreatWarningsAsErrors = true; |
||||
Assert.AreEqual("-warnaserror", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WinExeTarget() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.TargetType = "Exe"; |
||||
Assert.AreEqual("-target:exe", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void FullDebugging() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.DebugType = "Full"; |
||||
Assert.AreEqual("-debug:full", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmitDebuggingInfo() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.EmitDebugInformation = true; |
||||
Assert.AreEqual("-debug", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoLogo() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.NoLogo = true; |
||||
Assert.AreEqual("-nologo", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void DefineConstants() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.DefineConstants = "DEBUG=1,TRACE=1"; |
||||
Assert.AreEqual("-define:\"DEBUG=1,TRACE=1\"", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void MainEntryPoint() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.MainEntryPoint = "Console.MainClass.Main"; |
||||
Assert.AreEqual("-main:Console.MainClass.Main", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void SingleSourceFile() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.Sources = new TaskItem[] { new TaskItem("proj src\\Main.vb") }; |
||||
Assert.AreEqual("\"proj src\\Main.vb\"", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void SingleReference() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.References = new TaskItem[] { new TaskItem("proj refs\\Test.dll") }; |
||||
Assert.AreEqual("-r:\"proj refs\\Test.dll\"", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void AdditionalLibPaths() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.AdditionalLibPaths = new string[] { "proj\\My libs", "proj\\My libs2" }; |
||||
Assert.AreEqual("-lib:\"proj\\My libs\",\"proj\\My libs2\"", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmbeddedResources() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.Resources = new TaskItem[] { new TaskItem("proj res\\Test.xml"), |
||||
new TaskItem("proj res\\Run.xml") }; |
||||
Assert.AreEqual("-resource:\"proj res\\Test.xml\" -resource:\"proj res\\Run.xml\"", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void OptionStrict() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.OptionStrict = true; |
||||
Assert.AreEqual("-optionstrict", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void OptionExplicit() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.OptionExplicit = true; |
||||
Assert.AreEqual("-optionexplicit", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void MultipleImports() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.Imports = new TaskItem[] { new TaskItem("System.IO"), |
||||
new TaskItem("Microsoft.VisualBasic") }; |
||||
Assert.AreEqual("-imports:System.IO -imports:Microsoft.VisualBasic", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void RemoveIntChecks() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.RemoveIntegerChecks = true; |
||||
Assert.AreEqual("-removeintchecks", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void RootNamespace() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.RootNamespace = "MyNamespace"; |
||||
Assert.AreEqual("-rootnamespace:MyNamespace", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WarningLevel() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.WarningLevel = 3; |
||||
Assert.AreEqual("-wlevel:3", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoWarnings() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.NoWarnings = true; |
||||
Assert.AreEqual("-nowarn", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void DisabledWarnings() |
||||
{ |
||||
MockMbas mbas = new MockMbas(); |
||||
mbas.DisabledWarnings = "1234,5678"; |
||||
Assert.AreEqual("-ignorewarn:\"1234,5678\"", mbas.GetCommandLine()); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,231 @@
@@ -0,0 +1,231 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.Build.Tasks; |
||||
using NUnit.Framework; |
||||
using Microsoft.Build.Utilities; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.Build.Tasks.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class MonoCSharpCompilerCommandLineTestFixture |
||||
{ |
||||
[Test] |
||||
public void NoArguments() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
Assert.AreEqual(String.Empty, mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void OutputAssembly() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
string outputAssembly = @"obj\debug\test.exe"; |
||||
mcs.OutputAssembly = new TaskItem(outputAssembly); |
||||
Assert.AreEqual(@"-out:obj\debug\test.exe", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void OutputAssemblyWithSpace() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
string outputAssembly = @"obj\debug\test this.exe"; |
||||
mcs.OutputAssembly = new TaskItem(outputAssembly); |
||||
Assert.AreEqual("-out:\"obj\\debug\\test this.exe\"", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WinExeTarget() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.TargetType = "Exe"; |
||||
Assert.AreEqual("-target:exe", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void ModuleTarget() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.TargetType = "Module"; |
||||
Assert.AreEqual("-target:module", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmitDebuggingInfo() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.EmitDebugInformation = true; |
||||
Assert.AreEqual("-debug", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Optimize() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.Optimize = true; |
||||
Assert.AreEqual("-optimize", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoLogo() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.NoLogo = true; |
||||
Assert.AreEqual("-nologo", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Unsafe() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.AllowUnsafeBlocks = true; |
||||
Assert.AreEqual("-unsafe", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoStandardLib() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.NoStandardLib = true; |
||||
Assert.AreEqual("-nostdlib", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void DelaySign() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.DelaySign = true; |
||||
Assert.AreEqual("-delaysign", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void DefineConstants() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.DefineConstants = "DEBUG;TRACE"; |
||||
Assert.AreEqual("-define:\"DEBUG;TRACE\"", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WarnAsError() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.TreatWarningsAsErrors = true; |
||||
Assert.AreEqual("-warnaserror", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void DisabledWarnings() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.DisabledWarnings = "1234,5678"; |
||||
Assert.AreEqual("-nowarn:\"1234,5678\"", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void MainEntryPoint() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.MainEntryPoint = "Console.MainClass.Main"; |
||||
Assert.AreEqual("-main:Console.MainClass.Main", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void DocumentationFile() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.DocumentationFile = @"obj\debug test\test.exe.xml"; |
||||
Assert.AreEqual("-doc:\"obj\\debug test\\test.exe.xml\"", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void SingleSourceFile() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.Sources = new TaskItem[] { new TaskItem("proj src\\Main.cs") }; |
||||
Assert.AreEqual("\"proj src\\Main.cs\"", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void MultipleSourceFiles() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.Sources = new TaskItem[] { new TaskItem("proj src\\Main.cs"), |
||||
new TaskItem("AssemblyInfo.cs") }; |
||||
Assert.AreEqual("\"proj src\\Main.cs\" AssemblyInfo.cs", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void SingleReference() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.References = new TaskItem[] { new TaskItem("proj refs\\Test.dll") }; |
||||
Assert.AreEqual("-r:\"proj refs\\Test.dll\"", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void NetModuleReference() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.References = new TaskItem[] { new TaskItem("proj refs\\Test.dll"), |
||||
new TaskItem("proj refs\\Run.netmodule") }; |
||||
Assert.AreEqual("-r:\"proj refs\\Test.dll\" -addmodule:\"proj refs\\Run.netmodule\"", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void AdditionalLibPaths() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.AdditionalLibPaths = new string[] { "proj\\My libs", "proj\\My libs2" }; |
||||
Assert.AreEqual("-lib:\"proj\\My libs\",\"proj\\My libs2\"", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmbeddedResources() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.Resources = new TaskItem[] { new TaskItem("proj res\\Test.xml"), |
||||
new TaskItem("proj res\\Run.xml") }; |
||||
Assert.AreEqual("-resource:\"proj res\\Test.xml\" -resource:\"proj res\\Run.xml\"", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Win32Resource() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.Win32Resource = "Project Resources\\Test.res"; |
||||
Assert.AreEqual("-win32res:\"Project Resources\\Test.res\"", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Win32Icon() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.Win32Icon = "Project Icons\\app.ico"; |
||||
Assert.AreEqual("-win32icon:\"Project Icons\\app.ico\"", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Checked() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.CheckForOverflowUnderflow = true; |
||||
Assert.AreEqual("-checked", mcs.GetCommandLine()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WarningLevel() |
||||
{ |
||||
MockMonoCSharpCompilerTask mcs = new MockMonoCSharpCompilerTask(); |
||||
mcs.WarningLevel = 3; |
||||
Assert.AreEqual("-warn:3", mcs.GetCommandLine()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using ICSharpCode.Build.Tasks; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.Text.RegularExpressions; |
||||
|
||||
namespace ICSharpCode.Build.Tasks.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class NormalMbasErrorParseTestFixture |
||||
{ |
||||
Match match; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void FixtureSetUp() |
||||
{ |
||||
string error = "Form1.vb(38,3) error BC30201: Expression expected"; |
||||
|
||||
Regex regex = new Regex(MonoBasicCompilerResultsParser.NormalErrorPattern, RegexOptions.Compiled); |
||||
match = regex.Match(error); |
||||
} |
||||
|
||||
[Test] |
||||
public void Column() |
||||
{ |
||||
Assert.AreEqual("3", match.Result("${column}")); |
||||
} |
||||
|
||||
[Test] |
||||
public void Line() |
||||
{ |
||||
Assert.AreEqual("38", match.Result("${line}")); |
||||
} |
||||
|
||||
[Test] |
||||
public void FileName() |
||||
{ |
||||
Assert.AreEqual("Form1.vb", match.Result("${file}")); |
||||
} |
||||
|
||||
[Test] |
||||
public void Warning() |
||||
{ |
||||
Assert.AreEqual("error", match.Result("${error}")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ErrorNumber() |
||||
{ |
||||
Assert.AreEqual("BC30201", match.Result("${number}")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ErrorText() |
||||
{ |
||||
Assert.AreEqual("Expression expected", match.Result("${message}")); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue