From 14182177ab22638f0f1e56e42e7927c6a2d344e6 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Thu, 1 Mar 2012 11:30:04 +0100 Subject: [PATCH] Port ICSharpCode.Build.Tasks to .NET 4.0 so that it works when .NET 2.0/3.5 is not installed. Moved ILAsm build task into ILAsmBinding. --- SharpDevelop.sln | 2 +- samples/ILAsmBinding/ILAsmBinding.sln | 8 ++- .../ILAsmBinding/ILAsmBuildTask}/ILAsm.cs | 17 ++++- .../ILAsmBuildTask/ILAsmBuildTask.csproj | 64 +++++++++++++++++++ .../ILAsmBuildTask/Properties/AssemblyInfo.cs | 31 +++++++++ .../SharpDevelop.Build.Common.targets | 4 +- .../SharpDevelop.Build.MSIL.targets | 6 +- .../ILAsmBinding/Project/ILAsmBinding.addin | 12 ++-- .../Project/Resources/ILAsm-Mode.xshd | 9 +-- .../ILAsmBinding/Project/Src/ILAsmProject.cs | 2 +- .../UsageDataCollector.csproj | 3 +- .../Project/Constants.cs | 13 ---- .../Project/ICSharpCode.Build.Tasks.csproj | 24 ++++--- .../ICSharpCode.Build.Tasks.csproj.user | 3 +- .../Project/MyToolTask.cs | 26 -------- src/Setup/Files.wxs | 4 +- 16 files changed, 150 insertions(+), 78 deletions(-) rename {src/Libraries/ICSharpCode.Build.Tasks/Project => samples/ILAsmBinding/ILAsmBuildTask}/ILAsm.cs (83%) create mode 100644 samples/ILAsmBinding/ILAsmBuildTask/ILAsmBuildTask.csproj create mode 100644 samples/ILAsmBinding/ILAsmBuildTask/Properties/AssemblyInfo.cs rename {src/Libraries/ICSharpCode.Build.Tasks/Project => samples/ILAsmBinding/ILAsmBuildTask}/SharpDevelop.Build.Common.targets (94%) rename {src/Libraries/ICSharpCode.Build.Tasks/Project => samples/ILAsmBinding/ILAsmBuildTask}/SharpDevelop.Build.MSIL.targets (84%) delete mode 100644 src/Libraries/ICSharpCode.Build.Tasks/Project/Constants.cs delete mode 100644 src/Libraries/ICSharpCode.Build.Tasks/Project/MyToolTask.cs diff --git a/SharpDevelop.sln b/SharpDevelop.sln index a608e1294b..299847edc1 100644 --- a/SharpDevelop.sln +++ b/SharpDevelop.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -# SharpDevelop 4.2.0.8267-alpha +# SharpDevelop 4.2.0.8590-beta Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}" ProjectSection(SolutionItems) = postProject EndProjectSection diff --git a/samples/ILAsmBinding/ILAsmBinding.sln b/samples/ILAsmBinding/ILAsmBinding.sln index 95ee6fcf36..5b05beedef 100644 --- a/samples/ILAsmBinding/ILAsmBinding.sln +++ b/samples/ILAsmBinding/ILAsmBinding.sln @@ -1,9 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -# SharpDevelop 4.0.0.6209 +# SharpDevelop 4.2.0.8590-beta Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILAsmBinding", "Project\ILAsmBinding.csproj", "{6e59af58-f635-459a-9a35-c9ac41c00339}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILAsmBuildTask", "ILAsmBuildTask\ILAsmBuildTask.csproj", "{77827AD7-1023-4352-A7E8-5CC3CE8FB133}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -20,5 +22,9 @@ Global {6E59AF58-F635-459A-9A35-C9AC41C00339}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6E59AF58-F635-459A-9A35-C9AC41C00339}.Release|Any CPU.Build.0 = Release|Any CPU {6E59AF58-F635-459A-9A35-C9AC41C00339}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77827AD7-1023-4352-A7E8-5CC3CE8FB133}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77827AD7-1023-4352-A7E8-5CC3CE8FB133}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77827AD7-1023-4352-A7E8-5CC3CE8FB133}.Release|Any CPU.Build.0 = Release|Any CPU + {77827AD7-1023-4352-A7E8-5CC3CE8FB133}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/Libraries/ICSharpCode.Build.Tasks/Project/ILAsm.cs b/samples/ILAsmBinding/ILAsmBuildTask/ILAsm.cs similarity index 83% rename from src/Libraries/ICSharpCode.Build.Tasks/Project/ILAsm.cs rename to samples/ILAsmBinding/ILAsmBuildTask/ILAsm.cs index db2636eabb..145a86c77e 100644 --- a/src/Libraries/ICSharpCode.Build.Tasks/Project/ILAsm.cs +++ b/samples/ILAsmBinding/ILAsmBuildTask/ILAsm.cs @@ -2,13 +2,14 @@ // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; +using System.Globalization; using System.IO; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; namespace ICSharpCode.Build.Tasks { - public sealed class ILAsm : MyToolTask + public sealed class ILAsm : ToolTask { ITaskItem outputAssembly; ITaskItem[] sources; @@ -116,6 +117,20 @@ namespace ICSharpCode.Build.Tasks } } + protected override string GenerateFullPathToTool() + { + string path = ToolLocationHelper.GetPathToDotNetFrameworkFile(ToolName, TargetDotNetFrameworkVersion.VersionLatest); + if (path == null) { + base.Log.LogErrorWithCodeFromResources("General.FrameworksFileNotFound", ToolName, ToolLocationHelper.GetDotNetFrameworkVersionFolderPrefix(TargetDotNetFrameworkVersion.VersionLatest)); + } + return path; + } + + void AppendIntegerSwitch(CommandLineBuilder commandLine, string @switch, int value) + { + commandLine.AppendSwitchUnquotedIfNotNull(@switch, value.ToString(NumberFormatInfo.InvariantInfo)); + } + protected override string GenerateCommandLineCommands() { CommandLineBuilder commandLine = new CommandLineBuilder(); diff --git a/samples/ILAsmBinding/ILAsmBuildTask/ILAsmBuildTask.csproj b/samples/ILAsmBinding/ILAsmBuildTask/ILAsmBuildTask.csproj new file mode 100644 index 0000000000..37cac7dd1e --- /dev/null +++ b/samples/ILAsmBinding/ILAsmBuildTask/ILAsmBuildTask.csproj @@ -0,0 +1,64 @@ + + + + {77827AD7-1023-4352-A7E8-5CC3CE8FB133} + Debug + AnyCPU + Library + ILAsmBuildTask + ILAsmBuildTask + v4.0 + Properties + ..\..\..\AddIns\Samples\ILAsmBinding\ + False + False + 4 + false + + + AnyCPU + False + Auto + 4194304 + 4096 + + + true + Full + False + True + DEBUG;TRACE + + + False + None + True + False + TRACE + + + + + + + 3.5 + + + + 3.5 + + + + + + + + + PreserveNewest + + + PreserveNewest + + + + \ No newline at end of file diff --git a/samples/ILAsmBinding/ILAsmBuildTask/Properties/AssemblyInfo.cs b/samples/ILAsmBinding/ILAsmBuildTask/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..bf4f803ef5 --- /dev/null +++ b/samples/ILAsmBinding/ILAsmBuildTask/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +#region Using directives + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +#endregion + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ILAsmBuildTask")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ILAsmBuildTask")] +[assembly: AssemblyCopyright("Copyright 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all the values or you can use the default the Revision and +// Build Numbers by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] diff --git a/src/Libraries/ICSharpCode.Build.Tasks/Project/SharpDevelop.Build.Common.targets b/samples/ILAsmBinding/ILAsmBuildTask/SharpDevelop.Build.Common.targets similarity index 94% rename from src/Libraries/ICSharpCode.Build.Tasks/Project/SharpDevelop.Build.Common.targets rename to samples/ILAsmBinding/ILAsmBuildTask/SharpDevelop.Build.Common.targets index 82d81441b7..77379b2630 100644 --- a/src/Libraries/ICSharpCode.Build.Tasks/Project/SharpDevelop.Build.Common.targets +++ b/samples/ILAsmBinding/ILAsmBuildTask/SharpDevelop.Build.Common.targets @@ -1,10 +1,10 @@ - + - $(MSBuildAllProjects);$(SharpDevelopBuildBinPath)\SharpDevelop.Build.Common.targets + $(MSBuildAllProjects);$(ILAsmAddInPath)\SharpDevelop.Build.Common.targets diff --git a/src/Libraries/ICSharpCode.Build.Tasks/Project/SharpDevelop.Build.MSIL.targets b/samples/ILAsmBinding/ILAsmBuildTask/SharpDevelop.Build.MSIL.targets similarity index 84% rename from src/Libraries/ICSharpCode.Build.Tasks/Project/SharpDevelop.Build.MSIL.targets rename to samples/ILAsmBinding/ILAsmBuildTask/SharpDevelop.Build.MSIL.targets index 2966172f34..bb0da554ee 100644 --- a/src/Libraries/ICSharpCode.Build.Tasks/Project/SharpDevelop.Build.MSIL.targets +++ b/samples/ILAsmBinding/ILAsmBuildTask/SharpDevelop.Build.MSIL.targets @@ -1,8 +1,8 @@ - + - $(MSBuildAllProjects);$(SharpDevelopBinPath)\SharpDevelop.Build.MSIL.targets + $(MSBuildAllProjects);$(ILAsmAddInPath)\SharpDevelop.Build.MSIL.targets .il ILAsm @@ -37,5 +37,5 @@ /> - + diff --git a/samples/ILAsmBinding/Project/ILAsmBinding.addin b/samples/ILAsmBinding/Project/ILAsmBinding.addin index a66cb8856e..36c6ab7154 100644 --- a/samples/ILAsmBinding/Project/ILAsmBinding.addin +++ b/samples/ILAsmBinding/Project/ILAsmBinding.addin @@ -28,6 +28,10 @@ extensions = "*.ilproj"/> + + + + @@ -59,9 +63,9 @@ + guid = "{12B76EC0-1D7B-4FA7-A7D0-C524288B48A1}" + supportedextensions = ".il" + projectfileextension = ".ilproj" + class = "ICSharpCode.ILAsmBinding.ILAsmProjectBinding" /> diff --git a/samples/ILAsmBinding/Project/Resources/ILAsm-Mode.xshd b/samples/ILAsmBinding/Project/Resources/ILAsm-Mode.xshd index 46da2a8b26..76fbc1afa0 100644 --- a/samples/ILAsmBinding/Project/Resources/ILAsm-Mode.xshd +++ b/samples/ILAsmBinding/Project/Resources/ILAsm-Mode.xshd @@ -1,9 +1,6 @@  - - - @@ -351,6 +348,7 @@ tls true false + strict .class @@ -506,11 +504,6 @@ " " - [\d\w_]+(?=(\s*\()) - \b0[xX][0-9a-fA-F]+|\b(\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)? - diff --git a/samples/ILAsmBinding/Project/Src/ILAsmProject.cs b/samples/ILAsmBinding/Project/Src/ILAsmProject.cs index 482459c0d2..cf81cc7deb 100644 --- a/samples/ILAsmBinding/Project/Src/ILAsmProject.cs +++ b/samples/ILAsmBinding/Project/Src/ILAsmProject.cs @@ -23,7 +23,7 @@ namespace ICSharpCode.ILAsmBinding public ILAsmProject(ProjectCreateInformation info) : base(info) { - this.AddImport(@"$(SharpDevelopBinPath)\SharpDevelop.Build.MSIL.Targets", null); + this.AddImport(@"$(ILAsmAddInPath)\SharpDevelop.Build.MSIL.Targets", null); } public override string Language { diff --git a/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataCollector.csproj b/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataCollector.csproj index 5276f5ee65..0a27e35c0e 100644 --- a/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataCollector.csproj +++ b/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataCollector.csproj @@ -7,7 +7,7 @@ Library ICSharpCode.UsageDataCollector UsageDataCollector - v3.5 + v4.0 ..\..\..\..\..\AddIns\Misc\UsageDataCollector\ False False @@ -15,6 +15,7 @@ false ..\..\..\..\..\AddIns\Misc\UsageDataCollector\UsageDataCollector.xml 1591 + Client AnyCPU diff --git a/src/Libraries/ICSharpCode.Build.Tasks/Project/Constants.cs b/src/Libraries/ICSharpCode.Build.Tasks/Project/Constants.cs deleted file mode 100644 index 5a19cd218f..0000000000 --- a/src/Libraries/ICSharpCode.Build.Tasks/Project/Constants.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) -// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) - -using System; -using Microsoft.Build.Utilities; - -namespace ICSharpCode.Build.Tasks -{ - public class Constants - { - public const TargetDotNetFrameworkVersion DefaultFramework = TargetDotNetFrameworkVersion.Version20; - } -} diff --git a/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj b/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj index 254d3b0f1b..a2ddde37c8 100644 --- a/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj +++ b/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj @@ -19,7 +19,9 @@ false False C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis - v2.0 + v4.0 + + ..\..\..\..\bin\ @@ -40,25 +42,21 @@ false + + + + 3.5 + - - - + + 3.5 + - - - PreserveNewest - - - PreserveNewest - - - GlobalAssemblyInfo.cs diff --git a/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj.user b/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj.user index 7ff3943f7c..3ea973d02f 100644 --- a/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj.user +++ b/src/Libraries/ICSharpCode.Build.Tasks/Project/ICSharpCode.Build.Tasks.csproj.user @@ -1 +1,2 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/src/Libraries/ICSharpCode.Build.Tasks/Project/MyToolTask.cs b/src/Libraries/ICSharpCode.Build.Tasks/Project/MyToolTask.cs deleted file mode 100644 index 60ea7ab149..0000000000 --- a/src/Libraries/ICSharpCode.Build.Tasks/Project/MyToolTask.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) -// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) - -using System; -using System.Globalization; -using Microsoft.Build.Utilities; - -namespace ICSharpCode.Build.Tasks -{ - public abstract class MyToolTask : ToolTask - { - protected override string GenerateFullPathToTool() - { - string path = ToolLocationHelper.GetPathToDotNetFrameworkFile(ToolName, Constants.DefaultFramework); - if (path == null) { - base.Log.LogErrorWithCodeFromResources("General.FrameworksFileNotFound", ToolName, ToolLocationHelper.GetDotNetFrameworkVersionFolderPrefix(Constants.DefaultFramework)); - } - return path; - } - - protected void AppendIntegerSwitch(CommandLineBuilder commandLine, string @switch, int value) - { - commandLine.AppendSwitchUnquotedIfNotNull(@switch, value.ToString(NumberFormatInfo.InvariantInfo)); - } - } -} diff --git a/src/Setup/Files.wxs b/src/Setup/Files.wxs index b5e79cffef..ef5ca480a8 100644 --- a/src/Setup/Files.wxs +++ b/src/Setup/Files.wxs @@ -153,9 +153,7 @@ - - - +