added git version and git status in the compiler

shows in about window
This commit is contained in:
psyirius 2024-08-21 04:10:00 -07:00
parent 2748767a47
commit 73de4ac817
3 changed files with 16 additions and 4 deletions

View File

@ -56,7 +56,16 @@ Update-Progress "Adding: Header" 5
$script_content.Add($header)
Update-Progress "Adding: Version" 10
$script_content.Add($(Get-Content "$workingdir\scripts\start.ps1").replace('#{replaceme}',"$(Get-Date -Format yy.MM.dd)"))
$commitHash = (git rev-parse HEAD).Substring(0,16)
$gitStatus = if ((git status --porcelain=v1 2>$null).Count -gt 0) { "dirty" } else { "clean" }
$scriptPrelude = $(Get-Content "$workingdir\scripts\start.ps1")
$scriptPrelude = $scriptPrelude -replace '#{replaceme-version}', "$(Get-Date -Format yy.MM.dd)"
$scriptPrelude = $scriptPrelude -replace '#{replaceme-commit}', "$commitHash"
$scriptPrelude = $scriptPrelude -replace '#{replaceme-gitstat}', "$gitStatus"
$script_content.Add($scriptPrelude)
Update-Progress "Adding: Functions" 20
Get-ChildItem "$workingdir\functions" -Recurse -File | ForEach-Object {

View File

@ -157,7 +157,7 @@ $sync["Form"].TaskbarItemInfo = New-Object System.Windows.Shell.TaskbarItemInfo
Set-WinUtilTaskbaritem -state "None"
# Set the titlebar
$sync["Form"].title = $sync["Form"].title + " " + $sync.version
$sync["Form"].title = $sync["Form"].title + " " + $sync.version + " " + $sync.commit + " " + $sync.gitstat
# Set the commands that will run when the form is closed
$sync["Form"].Add_Closing({
$sync.runspace.Dispose()
@ -494,6 +494,7 @@ Runspace : <a href="https://github.com/DeveloperDurp">@DeveloperDurp</a>
MicroWin : <a href="https://github.com/KonTy">@KonTy</a>
GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a>
Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a>
Commit : <a href="https://github.com/ChrisTitusTech/winutil/commit/$($sync.commit)">$($sync.commit) ($($sync.gitstat))</a>
"@
$FontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSize
$HeaderFontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSizeHeader

View File

@ -3,7 +3,7 @@
Author : Chris Titus @christitustech
Runspace Author: @DeveloperDurp
GitHub : https://github.com/ChrisTitusTech
Version : #{replaceme}
Version : #{replaceme-version}
#>
param (
[switch]$Debug,
@ -40,7 +40,9 @@ Add-Type -AssemblyName System.Windows.Forms
# Variable to sync between runspaces
$sync = [Hashtable]::Synchronized(@{})
$sync.PSScriptRoot = $PSScriptRoot
$sync.version = "#{replaceme}"
$sync.version = "#{replaceme-version}"
$sync.commit = "#{replaceme-commit}"
$sync.gitstat = "#{replaceme-gitstat}"
$sync.configs = @{}
$sync.ProcessRunning = $false