diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-10-30 16:31:07 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-10-30 16:31:07 +0200 |
| commit | 2f91af8a799782b821acf4e66c84ea7aefa27048 (patch) | |
| tree | 06b4cd65f41aa3180d0a93adc4e8d45b72d3462b /Software/Visual_Studio/PPC | |
| parent | d9f518d92d3a8e51d0edb90b1b9fd419a518b302 (diff) | |
| download | Tango-2f91af8a799782b821acf4e66c84ea7aefa27048.tar.gz Tango-2f91af8a799782b821acf4e66c84ea7aefa27048.zip | |
Added firmware version to TANGO_VERSIONS.
Added total version info to TUP file as 'version.json'.
Diffstat (limited to 'Software/Visual_Studio/PPC')
6 files changed, 70 insertions, 3 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 5131522e0..526d4465a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Tango.AdvancedInstaller; using Tango.Core; using Tango.Core.Helpers; +using Tango.PMR.FirmwareUpgrade; using Tango.PPC.Common.Web; using Tango.SQLExaminer; using Tango.Transport.Web; @@ -181,6 +182,7 @@ namespace Tango.PPC.Common.Publish Version = local_version, MachineVersionGuid = Options.MachineVersionGuid, WithInstaller = !String.IsNullOrWhiteSpace(Options.InstallerProject), + FirmwareVersion = GetVersionInfoFromTFP(Options.TfpPath).FileDescriptors.SingleOrDefault(x => x.Destination == VersionFileDestination.Mcu).Version, }).Result; @@ -289,6 +291,15 @@ namespace Tango.PPC.Common.Publish { zip.AddFile(Options.TfpPath, "/").FileName = "firmware_package.tfp"; + PublishInfo versionInfo = new PublishInfo(); + versionInfo.ApplicationVersion = GetLocalVersion(); + versionInfo.Comments = Options.Comments; + versionInfo.Firmware = GetVersionInfoFromTFP(Options.TfpPath); + + var versionInfoFile = TemporaryManager.CreateImaginaryFile(); + File.WriteAllText(versionInfoFile, versionInfo.ToJson()); + zip.AddFile(versionInfoFile, "/").FileName = "version.json"; + String provision_dir = "Provision Scripts"; zip.AddDirectoryByName(provision_dir); @@ -379,6 +390,20 @@ namespace Tango.PPC.Common.Publish } /// <summary> + /// Gets the version information from a TFP file. + /// </summary> + /// <param name="tfpFile">The TFP file.</param> + /// <returns></returns> + private VersionPackageDescriptor GetVersionInfoFromTFP(String tfpFile) + { + using (ZipFile zip = ZipFile.Read(tfpFile)) + { + var reader = zip.Entries.SingleOrDefault(x => x.FileName == "package.cfg").OpenReader(); + return VersionPackageDescriptor.Parser.ParseFrom(reader); + } + } + + /// <summary> /// Raises the publish progress event. /// </summary> /// <param name="progress">The progress.</param> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishInfo.cs new file mode 100644 index 000000000..77717254e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishInfo.cs @@ -0,0 +1,32 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.FirmwareUpgrade; + +namespace Tango.PPC.Common.Publish +{ + public class PublishInfo + { + public String ApplicationVersion { get; set; } + public VersionPackageDescriptor Firmware { get; set; } + public String Comments { get; set; } + + public PublishInfo() + { + Firmware = new VersionPackageDescriptor(); + } + + public String ToJson() + { + return JsonConvert.SerializeObject(this); + } + + public PublishInfo FromJson(String json) + { + return JsonConvert.DeserializeObject<PublishInfo>(json); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 37885628d..21aad41f4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -73,6 +73,9 @@ <Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> <Reference Include="Microsoft.SqlServer.AzureStorageEnum, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL" /> <Reference Include="Microsoft.WindowsAzure.Storage, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> + <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> @@ -117,6 +120,7 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="ApplicationStates.cs" /> + <Compile Include="Backup\IBackupManager.cs" /> <Compile Include="Connection\DefaultMachineProvider.cs" /> <Compile Include="Connection\IMachineProvider.cs" /> <Compile Include="Connection\MachineOperatorChangedEventArgs.cs" /> @@ -144,6 +148,7 @@ <Compile Include="MachineSetup\MachineSetupProgress.cs" /> <Compile Include="MachineSetup\MachineSetupResult.cs" /> <Compile Include="Publish\PPCPublisher.cs" /> + <Compile Include="Publish\PublishInfo.cs" /> <Compile Include="Publish\PublishOptions.cs" /> <Compile Include="Publish\PublishProgressEventArgs.cs" /> <Compile Include="Publish\SequenceItem.cs" /> @@ -279,7 +284,9 @@ <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> - <None Include="app.config" /> + <None Include="app.config"> + <SubType>Designer</SubType> + </None> <None Include="packages.config" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> @@ -377,7 +384,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadVersionRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadVersionRequest.cs index 29d533043..eaf2c2002 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadVersionRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Web/UploadVersionRequest.cs @@ -12,6 +12,8 @@ namespace Tango.PPC.Common.Web { public String Version { get; set; } + public String FirmwareVersion { get; set; } + public String MachineVersionGuid { get; set; } public String Comments { get; set; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config b/Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config index d13fa64fc..50785f217 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config @@ -6,6 +6,7 @@ <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> <package id="Ionic.Zip" version="1.9.1.8" targetFramework="net461" /> + <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" /> <package id="System.Data.SQLite" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.Core" version="1.0.108.0" targetFramework="net46" /> <package id="System.Data.SQLite.EF6" version="1.0.108.0" targetFramework="net46" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index 92deb6bca..02099e659 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.0.49.0")] +[assembly: AssemblyVersion("1.0.50.0")] |
