mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-02-11 18:54:43 +00:00
- 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:
@@ -26,14 +26,23 @@ namespace PepperDash.Core
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the configuration file should be read on next boot
|
||||
/// </summary>
|
||||
public static bool DoNotLoadOnNextBoot { get; private set; }
|
||||
|
||||
static DebugContextCollection Contexts;
|
||||
|
||||
static int SaveTimeoutMs = 30000;
|
||||
|
||||
/// <summary>
|
||||
/// Version of the assembly
|
||||
/// </summary>
|
||||
public static string PepperDashCoreVersion { get; private set; }
|
||||
|
||||
static CTimer SaveTimer;
|
||||
@@ -52,10 +61,17 @@ namespace PepperDash.Core
|
||||
{
|
||||
// Get the assembly version and print it to console and the log
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
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.*")]
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
function Update-SourceVersion
|
||||
{
|
||||
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)
|
||||
{
|
||||
{
|
||||
Write-output $o.FullName
|
||||
$TmpFile = $o.FullName + “.tmp”
|
||||
get-content $o.FullName |
|
||||
%{$_ -replace ‘AssemblyVersion\("(\d+\.\d+\.\d+)\.\*"\)’, $NewVersion } > $TmpFile
|
||||
%{
|
||||
$_ -replace ‘AssemblyVersion\(".*"\)’, $NewAssemblyVersion} |
|
||||
%{
|
||||
$_ -replace ‘AssemblyInformationalVersion\(".*"\)’, $NewAssemblyInformationalVersion
|
||||
} > $TmpFile
|
||||
move-item $TmpFile $o.FullName -force
|
||||
}
|
||||
}
|
||||
@@ -21,10 +31,10 @@ function Update-AllAssemblyInfoFiles ( $version )
|
||||
}
|
||||
|
||||
# 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)
|
||||
{
|
||||
echo "Updating Assembly Version...";
|
||||
echo "Updating Assembly Version to $args ...";
|
||||
Update-AllAssemblyInfoFiles $args[0];
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user