- Adds print statement at startup to print/store full version.

- Sets default versions in AssemblyInfo.cs to 0.0.0
- Updates script to modify versions based on CI pipline input
This commit is contained in:
Neil Dorin
2020-03-04 14:53:12 -07:00
parent 0b8100a27d
commit d6bfc01127
3 changed files with 41 additions and 11 deletions

View File

@@ -26,14 +26,23 @@ namespace PepperDash.Core
/// </summary> /// </summary>
public static string FileName = string.Format(@"app{0}Debug.json", InitialParametersClass.ApplicationNumber); public static string FileName = string.Format(@"app{0}Debug.json", InitialParametersClass.ApplicationNumber);
/// <summary>
/// The current debug level
/// </summary>
public static int Level { get; private set; } public static int Level { get; private set; }
/// <summary>
/// Indicates if the configuration file should be read on next boot
/// </summary>
public static bool DoNotLoadOnNextBoot { get; private set; } public static bool DoNotLoadOnNextBoot { get; private set; }
static DebugContextCollection Contexts; static DebugContextCollection Contexts;
static int SaveTimeoutMs = 30000; static int SaveTimeoutMs = 30000;
/// <summary>
/// Version of the assembly
/// </summary>
public static string PepperDashCoreVersion { get; private set; } public static string PepperDashCoreVersion { get; private set; }
static CTimer SaveTimer; static CTimer SaveTimer;
@@ -52,10 +61,17 @@ namespace PepperDash.Core
{ {
// Get the assembly version and print it to console and the log // Get the assembly version and print it to console and the log
var version = Assembly.GetExecutingAssembly().GetName().Version; var version = Assembly.GetExecutingAssembly().GetName().Version;
var fullVersion = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false);
AssemblyInformationalVersionAttribute fullVersionAtt = fullVersion[0] as AssemblyInformationalVersionAttribute;
var msg = string.Format("[App {0}] Using PepperDash_Core v{1}", InitialParametersClass.ApplicationNumber, fullVersionAtt.InformationalVersion);
CrestronConsole.PrintLine(msg);
PepperDashCoreVersion = string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision); PepperDashCoreVersion = string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
var msg = string.Format("[App {0}] Using PepperDash_Core v{1}", InitialParametersClass.ApplicationNumber, PepperDashCoreVersion); msg = string.Format("[App {0}] Using PepperDash_Core v{1}", InitialParametersClass.ApplicationNumber, PepperDashCoreVersion);
CrestronConsole.PrintLine(msg); CrestronConsole.PrintLine(msg);

View File

@@ -1,7 +1,11 @@
using System.Reflection; using System.Reflection;
using Crestron.SimplSharp.Reflection;
[assembly: System.Reflection.AssemblyTitle("Pepperdash_Core")]
[assembly: System.Reflection.AssemblyCompany("PepperDash Technology Corporation")]
[assembly: System.Reflection.AssemblyProduct("Pepperdash_Core")]
[assembly: System.Reflection.AssemblyCopyright("Copyright © PepperDash 2019")]
[assembly: System.Reflection.AssemblyVersion("0.0.0.*")]
[assembly: System.Reflection.AssemblyInformationalVersion("0.0.0-buildType-buildNumber")]
[assembly: Crestron.SimplSharp.Reflection.AssemblyInformationalVersion("0.0.0-buildType-buildNumber")]
[assembly: AssemblyTitle("Pepperdash_Core")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Pepperdash_Core")]
[assembly: AssemblyCopyright("Copyright © PepperDash 2019")]
[assembly: AssemblyVersion("1.0.0.*")]

View File

@@ -1,13 +1,23 @@
function Update-SourceVersion function Update-SourceVersion
{ {
Param ([string]$Version) Param ([string]$Version)
$NewVersion = AssemblyVersion(" + $Version + .*"); $fullVersion = $Version
$baseVersion = [regex]::Match($Version, "(\d+.\d+.\d+).*").captures.groups[1].value
$NewAssemblyVersion = AssemblyVersion(" + $baseVersion + .*")
echo "AssemblyVersion = $NewAssemblyVersion"
$NewAssemblyInformationalVersion = AssemblyInformationalVersion(" + $Version + ")
echo "AssemblyInformationalVersion = $NewAssemblyInformationalVersion"
foreach ($o in $input) foreach ($o in $input)
{ {
Write-output $o.FullName Write-output $o.FullName
$TmpFile = $o.FullName + .tmp $TmpFile = $o.FullName + .tmp
get-content $o.FullName | get-content $o.FullName |
%{$_ -replace AssemblyVersion\("(\d+\.\d+\.\d+)\.\*"\), $NewVersion } > $TmpFile %{
$_ -replace AssemblyVersion\(".*"\), $NewAssemblyVersion} |
%{
$_ -replace AssemblyInformationalVersion\(".*"\), $NewAssemblyInformationalVersion
} > $TmpFile
move-item $TmpFile $o.FullName -force move-item $TmpFile $o.FullName -force
} }
} }
@@ -21,10 +31,10 @@ function Update-AllAssemblyInfoFiles ( $version )
} }
# validate arguments # validate arguments
$r= [System.Text.RegularExpressions.Regex]::Match($args[0], "^\d+\.\d+\.\d+$"); $r= [System.Text.RegularExpressions.Regex]::Match($args[0], "\d+\.\d+\.\d+.*");
if ($r.Success) if ($r.Success)
{ {
echo "Updating Assembly Version..."; echo "Updating Assembly Version to $args ...";
Update-AllAssemblyInfoFiles $args[0]; Update-AllAssemblyInfoFiles $args[0];
} }
else else