From 63e31e34b22a559cb142cfbb68ca3ed7852eaad1 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Tue, 5 Oct 2010 07:00:54 +0000 Subject: [PATCH] Consolidated DateStamp and AssemblyInfo generation. --- Documentation/Todo.txt | 2 ++ Source/Build.Tasks/DateStamp.cs | 7 ++++++- Source/Build.Tasks/GenerateAssemblyInfo.cs | 11 +++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Documentation/Todo.txt b/Documentation/Todo.txt index 1ab65ec1..48a7e737 100644 --- a/Documentation/Todo.txt +++ b/Documentation/Todo.txt @@ -2,6 +2,8 @@ - Make a release from trunk. [Short term] +- Move Documentation generation to obj directory. +- Completely clean bin and obj directories on Clean command? - Automate uploads of nightly builds. - Modify buildbot to generate zip package from the nsis installer. - Implement GL3.3 and 4.1. diff --git a/Source/Build.Tasks/DateStamp.cs b/Source/Build.Tasks/DateStamp.cs index 1e2b1060..009dcafd 100644 --- a/Source/Build.Tasks/DateStamp.cs +++ b/Source/Build.Tasks/DateStamp.cs @@ -53,7 +53,12 @@ namespace Build.Tasks { try { - Date = DateTime.Now.ToString("yyMMdd", CultureInfo.InvariantCulture); + // Build number is defined as the number of days since 1/1/2010. + // Revision number is defined as the fraction of the current day, expressed in seconds. + double timespan = DateTime.UtcNow.Subtract(new DateTime(2010, 1, 1)).TotalDays; + string build = ((int)timespan).ToString(); + string revision = ((int)((timespan - (int)timespan) * UInt16.MaxValue)).ToString(); + Date = String.Format("{0}.{1}", build, revision); } catch (Exception e) { diff --git a/Source/Build.Tasks/GenerateAssemblyInfo.cs b/Source/Build.Tasks/GenerateAssemblyInfo.cs index a29064a0..1e7d77b7 100644 --- a/Source/Build.Tasks/GenerateAssemblyInfo.cs +++ b/Source/Build.Tasks/GenerateAssemblyInfo.cs @@ -44,16 +44,11 @@ namespace Build.Tasks public string Major { get; set; } public string Minor { get; set; } - string Build { get; set; } - string Revision { get; set; } + string Date { get; set; } public GenerateAssemblyInfo() { - // Build number is defined as the number of days since 1/1/2010. - // Revision number is defined as the fraction of the current day, expressed in seconds. - double timespan = DateTime.UtcNow.Subtract(new DateTime(2010, 1, 1)).TotalDays; - Build = ((int)timespan).ToString(); - Revision = ((int)((timespan - (int)timespan) * UInt16.MaxValue)).ToString(); + Date = new DateStamp().Date; Major = Major ?? "0"; Minor = Minor ?? "0"; } @@ -80,7 +75,7 @@ namespace Build.Tasks sw.WriteLine("[assembly: AssemblyCopyright(\"{0}\")]", AssemblyCopyright ?? ""); sw.WriteLine("[assembly: AssemblyTrademark(\"{0}\")]", AssemblyTrademark ?? ""); sw.WriteLine("[assembly: AssemblyVersion(\"{0}.{1}.0.0\")]", Major, Minor); - sw.WriteLine("[assembly: AssemblyFileVersion(\"{0}.{1}.{2}.{3}\")]", Major, Minor, Build, Revision); + sw.WriteLine("[assembly: AssemblyFileVersion(\"{0}.{1}.{2}\")]", Major, Minor, Date); sw.Flush(); sw.Close();