From 84080586ca95c900a51bc1656e27aeeb7d77d6c2 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Thu, 19 Apr 2012 21:25:53 +0400 Subject: [PATCH] Builder no longer uses svn revision number for version detection --- Builder/IISMainHandler/product.wxs | 6 +++--- Builder/Program.cs | 31 ++++-------------------------- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/Builder/IISMainHandler/product.wxs b/Builder/IISMainHandler/product.wxs index 986e293..2595d78 100644 --- a/Builder/IISMainHandler/product.wxs +++ b/Builder/IISMainHandler/product.wxs @@ -1,13 +1,13 @@ + Version='{shortversion}.0' Manufacturer='inga-lovinde' UpgradeCode='3981e346-b07f-45aa-bb8e-263a01dee3f{targetId}' > - + - + diff --git a/Builder/Program.cs b/Builder/Program.cs index 2c73f60..e0a4f90 100644 --- a/Builder/Program.cs +++ b/Builder/Program.cs @@ -30,7 +30,6 @@ namespace Builder { try { string WIXPATH = ConfigurationManager.AppSettings["WiXPath"]; - string SVNPATH = ConfigurationManager.AppSettings["SVNPath"]; if(args.Length < 1) throw new ApplicationException("You should specify project name first"); @@ -78,33 +77,11 @@ namespace Builder { } } } - int buildNumber; - using(StreamReader reader = new StreamReader(buildNumberFile)) { - buildNumber = int.Parse(reader.ReadToEnd()); - } - buildNumber++; //NO CONCURRENCY HERE - using(StreamWriter writer = new StreamWriter(buildNumberFile)) { - writer.Write(buildNumber); - } - int revNumber; - ProcessStartInfo svnInfo = new ProcessStartInfo(SVNPATH + "svn"); - svnInfo.WorkingDirectory = (new DirectoryInfo(".")).Parent.FullName; - svnInfo.UseShellExecute = false; - svnInfo.RedirectStandardOutput = true; - svnInfo.Arguments = "up --depth=empty"; - using(Process svn = Process.Start(svnInfo)) { - svn.WaitForExit(); - } - svnInfo.Arguments = "info --xml"; - using(Process svn = Process.Start(svnInfo)) { - svn.WaitForExit(); - XmlDocument document = new XmlDocument(); - document.Load(svn.StandardOutput); - revNumber = int.Parse(document.GetElementsByTagName("entry")[0].Attributes["revision"].Value); - } + DateTime now = DateTime.UtcNow; + string version = string.Format("{0:D2}{1}.{2}{3:D2}.{4:D2}{5:D2}{6}", now.Year % 100, (int)(now.Month / 2), now.Month % 2, now.Day, now.Hour, now.Minute, (int)(now.Second / 10)); - Console.WriteLine("Version number: 1." + revNumber + "." + buildNumber + ".0"); + Console.WriteLine("Version number: {0}.0", version); using(TempFile tempFile = new TempFile()) { @@ -112,7 +89,7 @@ namespace Builder { using(StreamReader sourceReader = new StreamReader(sourceFile)) { wxsData = sourceReader.ReadToEnd(); } - wxsData = wxsData.Replace("{rev}", revNumber.ToString()).Replace("{build}", buildNumber.ToString()).Replace("{target}", target).Replace("{targetId}", targetId); + wxsData = wxsData.Replace("{shortversion}", version).Replace("{target}", target).Replace("{targetId}", targetId); using(StreamWriter tempWriter = tempFile.getWriter()) { tempWriter.Write(wxsData);