diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-25 18:18:35 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-25 18:18:35 +0200 |
| commit | e112866a2cf44ddeb5b40e8ffc84614ecfe6abdf (patch) | |
| tree | 48614b95fe9e3d549a465a7b381f432c21a0fef8 /Software/Visual_Studio/PPC/Tango.PPC.Common/Publish | |
| parent | 08d9858ecd0d4adb0c9c6076d7d2b1216e8f64c3 (diff) | |
| download | Tango-e112866a2cf44ddeb5b40e8ffc84614ecfe6abdf.tar.gz Tango-e112866a2cf44ddeb5b40e8ffc84614ecfe6abdf.zip | |
Implemented auto installer release for machine studio and PPC.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Publish')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs | 43 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs | 24 |
2 files changed, 58 insertions, 9 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs index 65709d46f..7c6113829 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs @@ -5,7 +5,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.Helpers; using Tango.PPC.Common.Web; @@ -136,6 +138,19 @@ namespace Tango.PPC.Common.Publish throw new FileNotFoundException($"Could not locate the PPC 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}'."); + } + } + return Task.Factory.StartNew(() => { String tempFile = TemporaryManager.CreateFile(".zip"); @@ -165,8 +180,34 @@ namespace Tango.PPC.Common.Publish Comments = Options.Comments, Version = local_version, MachineVersionGuid = Options.MachineVersionGuid, + 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 = $"PPC 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(); + } + } + CreateTupPackage(tempFile).Wait(); OnPublishProgress(0, 100, $"Starting version upload..."); @@ -177,7 +218,7 @@ namespace Tango.PPC.Common.Publish { InvokeUINow(() => { - 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); }); }; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs index fa04d8331..4c40acb44 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs @@ -66,14 +66,6 @@ namespace Tango.PPC.Common.Publish set { _environment = value; RaisePropertyChangedAuto(); EnvironmentChanged?.Invoke(this, new EventArgs()); } } - private String _installerProject; - [Option("installer-project-file", HelpText = "Specifies the advanced installer project file to build and upload.", Required = false)] - public String InstallerProject - { - get { return _installerProject; } - set { _installerProject = value; RaisePropertyChangedAuto(); } - } - private String _machineVersionGuid; [Option("machine-version-guid", HelpText = "Specifies the machine version id for which to upload the PPC version.", Required = true)] public String MachineVersionGuid @@ -90,6 +82,22 @@ namespace Tango.PPC.Common.Publish set { _tfpPath = value; RaisePropertyChangedAuto(); } } + private String _installerProject; + [Option("installer-project-file", HelpText = "Specifies the advanced installer project file to build and upload.", Required = false)] + public String InstallerProject + { + get { return _installerProject; } + 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(); } + } + private SynchronizationOptions _synchronization; public SynchronizationOptions Synchronization { |
