From 789497a7171649749032bd37fc02200d2e9dd3b3 Mon Sep 17 00:00:00 2001 From: "shannon@ShandemVaio.home" Date: Wed, 27 Jun 2012 21:26:38 +0400 Subject: [PATCH] Added Umbraco.MSBuild.Tasks to separate solution and configured to build to correct /lib path. --- build/Build.proj | 3 + .../Umbraco.MSBuild.Tasks.Targets | 12 +++ .../Umbraco.MSBuild.Tasks.dll | Bin 0 -> 7168 bytes src/Umbraco.MSBuild.Tasks.sln | 20 +++++ .../GetAssemblyFileVersion.cs | 53 +++++++++++++ .../Properties/AssemblyInfo.cs | 36 +++++++++ src/Umbraco.MSBuild.Tasks/TimestampOffset.cs | 45 +++++++++++ .../Umbraco.MSBuild.Tasks.Targets | 12 +++ .../Umbraco.MSBuild.Tasks.csproj | 72 ++++++++++++++++++ 9 files changed, 253 insertions(+) create mode 100644 lib/Umbraco/UmbracoMSBuildTasks/Umbraco.MSBuild.Tasks.Targets create mode 100644 lib/Umbraco/UmbracoMSBuildTasks/Umbraco.MSBuild.Tasks.dll create mode 100644 src/Umbraco.MSBuild.Tasks.sln create mode 100644 src/Umbraco.MSBuild.Tasks/GetAssemblyFileVersion.cs create mode 100644 src/Umbraco.MSBuild.Tasks/Properties/AssemblyInfo.cs create mode 100644 src/Umbraco.MSBuild.Tasks/TimestampOffset.cs create mode 100644 src/Umbraco.MSBuild.Tasks/Umbraco.MSBuild.Tasks.Targets create mode 100644 src/Umbraco.MSBuild.Tasks/Umbraco.MSBuild.Tasks.csproj diff --git a/build/Build.proj b/build/Build.proj index 17f1d1d52e..a2d5123376 100644 --- a/build/Build.proj +++ b/build/Build.proj @@ -56,6 +56,9 @@ + + + diff --git a/lib/Umbraco/UmbracoMSBuildTasks/Umbraco.MSBuild.Tasks.Targets b/lib/Umbraco/UmbracoMSBuildTasks/Umbraco.MSBuild.Tasks.Targets new file mode 100644 index 0000000000..2015db188e --- /dev/null +++ b/lib/Umbraco/UmbracoMSBuildTasks/Umbraco.MSBuild.Tasks.Targets @@ -0,0 +1,12 @@ + + + + + $(MSBuildProjectDirectory)\Lib\UmbracoMSBuildTasks + $(UmbracoMSBuildTasksPath)\Umbraco.MSBuild.Tasks.dll + + + + + + diff --git a/lib/Umbraco/UmbracoMSBuildTasks/Umbraco.MSBuild.Tasks.dll b/lib/Umbraco/UmbracoMSBuildTasks/Umbraco.MSBuild.Tasks.dll new file mode 100644 index 0000000000000000000000000000000000000000..fe502087503d292c7c2abe6892ccd60c4ddd8c2d GIT binary patch literal 7168 zcmeHLYit}>6+Sb&JG)-To2>2FdGxVqlH%C$%8s27Cu!nmoUQywvv!hFtI6zoyq;ut zXEQUK+KrmJlml^NNT>wr168UZv_Oj}szNGI0HLbT3bjy_@|`=g z_9p8@0rdwznBDpAJ&$|tx#ymH=g#zh>Ot}lkr($z9}%5G$yd9;%fl4Jp=+NF(TTFt z%T7ssrsBOZ8YxrFM3QPYYuJ&57BTbLh@Opf55^-IV^oV)R0LPJrnmPH^+_J8 z?)=MOp|`UnFDsVu!hbGl3OD$Cd8qv!q6OkVTe_s9 zLifS0=(wHeX%582*IuG|;Qe(C(N!1AE=Na*FoKyY0D9XDMHIEQ2^;hussNCQvATYP z5?6$1Z`8ERBq-rqJ1RU;HMoneb_679YH0(C>?`fX&9;`{F1p%@I*UkAeU9Ubi+z*H zN7c)T-keV)3GROmRZS9=qZ!(VtxRzOw?Z}hm*5%ChC_q`RFX#g9uY~ zP(EBq6s*Ibkq2@eOehv277RArN@XU<+_h`#kS4)$zp)TS&3UQHANDtHA-{nr15K-Mh=G)T2VdjZKVS9H{XmWqMk1y@#7pO*?YkI|XNDldh-#!`rc zW9AbuUt=LLf>l1b4n8VjpK&!vqBHnclL7;x55HnuBlvGpZI#kMVWnOY2{oTS^9VIw zhmgrMpH93eGJy(l@`yMBXXC`gOdR1b;tZUXGf{tyTz4(Ho6++LJ>aY!6EkwS4m-eE zITM%<550o<@I%fsP=O(?Uf`6+^qTWBqQhbIg?$^2L9d`wrPNgU8**VK?0+nXXkvW9 zI^>p^At*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~ytvZ19zD>a9uF9@9`jNAFOVtYgks1;u!B)qp7*f4XVk4cP31*Hk|{jivXU7W#j zkD(9trUq>a-gZON5;{686#F(THevQWiMCPdhmW0RjTT=d8-okJ0rj}ws4{O#~;(cbfMn*YD8|Lq9;8x8zKp#T5? literal 0 HcmV?d00001 diff --git a/src/Umbraco.MSBuild.Tasks.sln b/src/Umbraco.MSBuild.Tasks.sln new file mode 100644 index 0000000000..464c644a45 --- /dev/null +++ b/src/Umbraco.MSBuild.Tasks.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.MSBuild.Tasks", "Umbraco.MSBuild.Tasks\Umbraco.MSBuild.Tasks.csproj", "{68AC9679-2439-4DA9-86BC-E36579594EFB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {68AC9679-2439-4DA9-86BC-E36579594EFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {68AC9679-2439-4DA9-86BC-E36579594EFB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {68AC9679-2439-4DA9-86BC-E36579594EFB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {68AC9679-2439-4DA9-86BC-E36579594EFB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Umbraco.MSBuild.Tasks/GetAssemblyFileVersion.cs b/src/Umbraco.MSBuild.Tasks/GetAssemblyFileVersion.cs new file mode 100644 index 0000000000..ff4b6dec13 --- /dev/null +++ b/src/Umbraco.MSBuild.Tasks/GetAssemblyFileVersion.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using System.Text.RegularExpressions; +using Microsoft.Build.Framework; + +namespace Umbraco.MSBuild.Tasks +{ + public class GetAssemblyFileVersion : ITask + { + [Required] + public string strFilePathAssemblyInfo { get; set; } + + [Output] + public string strAssemblyFileVersion { get; set; } + + public bool Execute() + { + StreamReader streamreaderAssemblyInfo = null; + Match matchVersion; + Group groupVersion; + string strLine; + strAssemblyFileVersion = String.Empty; + try + { + streamreaderAssemblyInfo = new StreamReader(strFilePathAssemblyInfo); + while ((strLine = streamreaderAssemblyInfo.ReadLine()) != null) + { + matchVersion = Regex.Match(strLine, @"(?:AssemblyFileVersion\("")(?(\d*)\.(\d*)(\.(\d*)(\.(\d*))?)?)(?:""\))", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.ExplicitCapture); + if (matchVersion.Success) + { + groupVersion = matchVersion.Groups["ver"]; + if ((groupVersion.Success) && (!String.IsNullOrEmpty(groupVersion.Value))) + { + strAssemblyFileVersion = groupVersion.Value; + break; + } + } + } + } + catch (Exception e) + { + BuildMessageEventArgs args = new BuildMessageEventArgs(e.Message, string.Empty, "GetAssemblyFileVersion", MessageImportance.High); + BuildEngine.LogMessageEvent(args); + } + finally { if (streamreaderAssemblyInfo != null) streamreaderAssemblyInfo.Close(); } + return (true); + } + + public IBuildEngine BuildEngine { get; set; } + + public ITaskHost HostObject { get; set; } + } +} diff --git a/src/Umbraco.MSBuild.Tasks/Properties/AssemblyInfo.cs b/src/Umbraco.MSBuild.Tasks/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..fe7739861c --- /dev/null +++ b/src/Umbraco.MSBuild.Tasks/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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("Umbraco.MSBuild.Tasks")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Umbraco.MSBuild.Tasks")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a4741c02-d938-4b29-a9b3-66ade85c95b5")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Umbraco.MSBuild.Tasks/TimestampOffset.cs b/src/Umbraco.MSBuild.Tasks/TimestampOffset.cs new file mode 100644 index 0000000000..e1569ad1f8 --- /dev/null +++ b/src/Umbraco.MSBuild.Tasks/TimestampOffset.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using System.Xml; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using System.Text.RegularExpressions; + +namespace Umbraco.MSBuild.Tasks +{ + public class TimestampOffset : Task + { + [Required] + public int Offset { get; set; } + + public ITaskItem[] Files { get; set; } + + public override bool Execute() + { + try + { + if (Files != null && Files.Length > 0) + { + foreach (var file in Files) + { + if (File.Exists(file.ItemSpec)) + { + var creationDate = File.GetCreationTimeUtc(file.ItemSpec); + var modifiedDate = File.GetLastWriteTimeUtc(file.ItemSpec); + + File.SetCreationTimeUtc(file.ItemSpec, creationDate.AddHours(Offset)); + File.SetLastWriteTimeUtc(file.ItemSpec, modifiedDate.AddHours(Offset)); + } + } + } + + return true; + } + catch(Exception e) + { + Log.LogErrorFromException(e); + return false; + } + } + } +} diff --git a/src/Umbraco.MSBuild.Tasks/Umbraco.MSBuild.Tasks.Targets b/src/Umbraco.MSBuild.Tasks/Umbraco.MSBuild.Tasks.Targets new file mode 100644 index 0000000000..2015db188e --- /dev/null +++ b/src/Umbraco.MSBuild.Tasks/Umbraco.MSBuild.Tasks.Targets @@ -0,0 +1,12 @@ + + + + + $(MSBuildProjectDirectory)\Lib\UmbracoMSBuildTasks + $(UmbracoMSBuildTasksPath)\Umbraco.MSBuild.Tasks.dll + + + + + + diff --git a/src/Umbraco.MSBuild.Tasks/Umbraco.MSBuild.Tasks.csproj b/src/Umbraco.MSBuild.Tasks/Umbraco.MSBuild.Tasks.csproj new file mode 100644 index 0000000000..1a4cd2bc49 --- /dev/null +++ b/src/Umbraco.MSBuild.Tasks/Umbraco.MSBuild.Tasks.csproj @@ -0,0 +1,72 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {68AC9679-2439-4DA9-86BC-E36579594EFB} + Library + Properties + Umbraco.MSBuild.Tasks + Umbraco.MSBuild.Tasks + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + Always + Designer + + + + + robocopy "$(TargetDir) " "$(SolutionDir)..\lib\Umbraco\UmbracoMSBuildTasks " "*Umbraco.MSBuild.Tasks.dll" "*Umbraco.MSBuild.Tasks.targets" /NP /NJS +if errorlevel 4 goto BuildEventFailed +if errorlevel 0 goto end +:BuildEventFailed echo FILECOPY for $(ProjectName) FAILED +exit 1 +:end echo FILECOPY for $(ProjectName) COMPLETED OK +exit 0 + + + \ No newline at end of file