Consolidated DateStamp and AssemblyInfo generation.

This commit is contained in:
the_fiddler 2010-10-05 07:00:54 +00:00
parent 08da770c7d
commit 63e31e34b2
3 changed files with 11 additions and 9 deletions

View file

@ -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.

View file

@ -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)
{

View file

@ -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();