Builder no longer uses svn revision number for version detection

main
Inga 🏳‍🌈 13 years ago
parent 7981efe612
commit 84080586ca
  1. 6
      Builder/IISMainHandler/product.wxs
  2. 31
      Builder/Program.cs

@ -1,13 +1,13 @@
<?xml version='1.0'?> <?xml version='1.0'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'> <Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Id='*' Name='FLocal IISMainHandler {target}' Language='1033' <Product Id='*' Name='FLocal IISMainHandler {target}' Language='1033'
Version='1.255.{build}.0' Manufacturer='inga-lovinde' UpgradeCode='3981e346-b07f-45aa-bb8e-263a01dee3f{targetId}' > Version='{shortversion}.0' Manufacturer='inga-lovinde' UpgradeCode='3981e346-b07f-45aa-bb8e-263a01dee3f{targetId}' >
<Package Description='FLocal IISMainHandler {target}' Comments='FLocal IISMainHandler {target}' Manufacturer='inga-lovinde' InstallerVersion='300' Compressed='yes' Platform="x64" /> <Package Description='FLocal IISMainHandler {target}' Comments='FLocal IISMainHandler {target}' Manufacturer='inga-lovinde' InstallerVersion='300' Compressed='yes' Platform="x64" />
<Upgrade Id="3981e346-b07f-45aa-bb8e-263a01dee3f{targetId}"> <Upgrade Id="3981e346-b07f-45aa-bb8e-263a01dee3f{targetId}">
<UpgradeVersion Minimum="1.0.0" IncludeMinimum="yes" Maximum="1.255.{build}" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED" /> <UpgradeVersion Minimum="1.0.0" IncludeMinimum="yes" Maximum="{shortversion}" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED" />
</Upgrade> </Upgrade>
<Upgrade Id="3981e346-b07f-45aa-bb8e-263a01dee3f{targetId}"> <Upgrade Id="3981e346-b07f-45aa-bb8e-263a01dee3f{targetId}">
<UpgradeVersion Minimum="1.255.{build}" IncludeMinimum="no" Property="NEWERVERSIONDETECTED" /> <UpgradeVersion Minimum="{shortversion}" IncludeMinimum="no" Property="NEWERVERSIONDETECTED" />
</Upgrade> </Upgrade>
<InstallExecuteSequence> <InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize"/> <RemoveExistingProducts After="InstallInitialize"/>

@ -30,7 +30,6 @@ namespace Builder {
try { try {
string WIXPATH = ConfigurationManager.AppSettings["WiXPath"]; string WIXPATH = ConfigurationManager.AppSettings["WiXPath"];
string SVNPATH = ConfigurationManager.AppSettings["SVNPath"];
if(args.Length < 1) throw new ApplicationException("You should specify project name first"); 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; DateTime now = DateTime.UtcNow;
ProcessStartInfo svnInfo = new ProcessStartInfo(SVNPATH + "svn"); 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));
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);
}
Console.WriteLine("Version number: 1." + revNumber + "." + buildNumber + ".0"); Console.WriteLine("Version number: {0}.0", version);
using(TempFile tempFile = new TempFile()) { using(TempFile tempFile = new TempFile()) {
@ -112,7 +89,7 @@ namespace Builder {
using(StreamReader sourceReader = new StreamReader(sourceFile)) { using(StreamReader sourceReader = new StreamReader(sourceFile)) {
wxsData = sourceReader.ReadToEnd(); 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()) { using(StreamWriter tempWriter = tempFile.getWriter()) {
tempWriter.Write(wxsData); tempWriter.Write(wxsData);

Loading…
Cancel
Save