aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-02-25 18:18:35 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-02-25 18:18:35 +0200
commite112866a2cf44ddeb5b40e8ffc84614ecfe6abdf (patch)
tree48614b95fe9e3d549a465a7b381f432c21a0fef8 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish
parent08d9858ecd0d4adb0c9c6076d7d2b1216e8f64c3 (diff)
downloadTango-e112866a2cf44ddeb5b40e8ffc84614ecfe6abdf.tar.gz
Tango-e112866a2cf44ddeb5b40e8ffc84614ecfe6abdf.zip
Implemented auto installer release for machine studio and PPC.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs42
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs8
2 files changed, 49 insertions, 1 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs
index 3ee81f19b..fb5fbc27c 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs
@@ -6,7 +6,9 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
+using Tango.AdvancedInstaller;
using Tango.Core;
using Tango.Core.Cryptography;
using Tango.Core.Helpers;
@@ -127,6 +129,19 @@ namespace Tango.MachineStudio.Common.Publish
throw new FileNotFoundException($"Could not locate the machine studio executable at {appPath}.");
}
+ if (!String.IsNullOrWhiteSpace(Options.InstallerProject))
+ {
+ if (!File.Exists(Options.InstallerProject))
+ {
+ throw new FileNotFoundException($"Installer project not found at '{Options.InstallerProject}'.");
+ }
+
+ if (!Directory.Exists(Options.InstallerOutputFolder))
+ {
+ throw new DirectoryNotFoundException($"Installer output folder does not exists '{Options.InstallerOutputFolder}'.");
+ }
+ }
+
String tempFile = TemporaryManager.CreateFile();
return Task.Factory.StartNew(() =>
@@ -155,8 +170,33 @@ namespace Tango.MachineStudio.Common.Publish
{
Version = local_version,
Comments = Options.Comments,
+ WithInstaller = !String.IsNullOrWhiteSpace(Options.InstallerProject),
}).Result;
+ if (!String.IsNullOrWhiteSpace(Options.InstallerProject))
+ {
+ String output_folder = Options.InstallerOutputFolder;
+ OnPublishProgress(0, 100, $"Building installer project...");
+ InstallerBuilder installerBuilder = new InstallerBuilder(Options.InstallerProject);
+ String installer_name = $"Machine Studio Installer_v{Version.Parse(local_version).ToString(3)}.exe";
+ String output_file = Path.Combine(output_folder, installer_name);
+ installerBuilder.Build(local_version, output_file).Wait();
+
+ Thread.Sleep(5000);
+
+ OnPublishProgress(0, 100, $"Uploading installer '{installer_name}'...");
+
+ using (StorageBlobUploader uploader = new StorageBlobUploader(response.InstallerBlobAddress, output_file))
+ {
+ uploader.Progress += (x, e) =>
+ {
+ OnPublishProgress(e.Current, e.Total, $"Uploading installer {(((double)e.Current / (double)e.Total) * 100d).ToString("0.0")}%...", true);
+ };
+
+ uploader.Upload().Wait();
+ }
+ }
+
OnPublishProgress(0, 100, $"Starting version packaging...");
using (ZipFile zip = new ZipFile())
@@ -188,7 +228,7 @@ namespace Tango.MachineStudio.Common.Publish
{
uploader.Progress += (x, e) =>
{
- OnPublishProgress(e.Current, e.Total, $"Uploading to storage {(((double)e.Current / (double)e.Total) * 100d).ToString("0.0")}%...", true);
+ OnPublishProgress(e.Current, e.Total, $"Uploading version {(((double)e.Current / (double)e.Total) * 100d).ToString("0.0")}%...", true);
};
uploader.Upload().Wait();
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs
index 047d7c0b4..c5db355b1 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs
@@ -73,6 +73,14 @@ namespace Tango.MachineStudio.Common.Publish
set { _installerProject = value; RaisePropertyChangedAuto(); }
}
+ private String _installerOutputFolder;
+ [Option("installer-output-folder", HelpText = "Specifies where to save the installer application.", Required = false)]
+ public String InstallerOutputFolder
+ {
+ get { return _installerOutputFolder; }
+ set { _installerOutputFolder = value; RaisePropertyChangedAuto(); }
+ }
+
public PublishOptions()
{
BasePath = AppDomain.CurrentDomain.BaseDirectory + "..\\";