mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 07:30:15 -04:00
Add update script version
GroupVM new breadcrumb code
This commit is contained in:
@@ -97,16 +97,15 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
var groups = new List<GroupVm>();
|
||||
var groups = new ObservableCollection<GroupVm>();
|
||||
var group = this;
|
||||
while (group.ParentGroup != null)
|
||||
{
|
||||
group = group.ParentGroup;
|
||||
groups.Add(group);
|
||||
groups.Insert(0, group);
|
||||
}
|
||||
|
||||
groups.Reverse();
|
||||
return new ObservableCollection<GroupVm>(groups);
|
||||
|
||||
return groups;
|
||||
}
|
||||
}
|
||||
|
||||
|
99
UpdateVersion.ps1
Normal file
99
UpdateVersion.ps1
Normal file
@@ -0,0 +1,99 @@
|
||||
#Based on https://www.visualstudio.com/docs/build/scripts/index
|
||||
# Enable -Verbose option
|
||||
[CmdletBinding()]
|
||||
|
||||
$VersionRegex = "\d+\.\d+\.\d+\.\d+"
|
||||
|
||||
$ManifestVersionRegex = " Version=""\d+\.\d+\.\d+\.\d+"""
|
||||
|
||||
if (-not $Env:BUILD_BUILDNUMBER)
|
||||
{
|
||||
Write-Error ("BUILD_BUILDNUMBER environment variable is missing.")
|
||||
exit 1
|
||||
}
|
||||
Write-Verbose "BUILD_BUILDNUMBER: $Env:BUILD_BUILDNUMBER"
|
||||
|
||||
$ScriptPath = $null
|
||||
try
|
||||
{
|
||||
$ScriptPath = (Get-Variable MyInvocation).Value.MyCommand.Path
|
||||
$ScriptDir = Split-Path -Parent $ScriptPath
|
||||
}
|
||||
catch {}
|
||||
|
||||
if (!$ScriptPath)
|
||||
{
|
||||
Write-Error "Current path not found!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Get and validate the version data
|
||||
$VersionData = [regex]::matches($Env:BUILD_BUILDNUMBER,$VersionRegex)
|
||||
switch($VersionData.Count)
|
||||
{
|
||||
0
|
||||
{
|
||||
Write-Error "Could not find version number data in BUILD_BUILDNUMBER."
|
||||
exit 1
|
||||
}
|
||||
1 {}
|
||||
default
|
||||
{
|
||||
Write-Warning "Found more than instance of version data in BUILD_BUILDNUMBER."
|
||||
Write-Warning "Will assume first instance is version."
|
||||
}
|
||||
}
|
||||
$NewVersion = $VersionData[0]
|
||||
Write-Verbose "Version: $NewVersion"
|
||||
|
||||
|
||||
$AssemblyVersion = $NewVersion
|
||||
$ManifestVersion = " Version=""$NewVersion"""
|
||||
|
||||
Write-Host "Version: $AssemblyVersion"
|
||||
Write-Host "Manifest: $ManifestVersion"
|
||||
Write-Host "ScriptDir: " $ScriptDir
|
||||
|
||||
# Apply the version to the assembly property files
|
||||
$assemblyInfoFiles = gci $ScriptDir -recurse -include "*Properties*","My Project" |
|
||||
?{ $_.PSIsContainer } |
|
||||
foreach { gci -Path $_.FullName -Recurse -include AssemblyInfo.* }
|
||||
|
||||
if($assemblyInfoFiles)
|
||||
{
|
||||
Write-Host "Will apply $AssemblyVersion to $($assemblyInfoFiles.count) Assembly Info Files."
|
||||
|
||||
foreach ($file in $assemblyInfoFiles) {
|
||||
$filecontent = Get-Content($file)
|
||||
attrib $file -r
|
||||
$filecontent -replace $VersionRegex, $AssemblyVersion | Out-File $file utf8
|
||||
|
||||
Write-Host "$file.FullName - version applied"
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Warning "No Assembly Info Files found."
|
||||
}
|
||||
|
||||
# Try Manifests
|
||||
$manifestFiles = gci .\ -recurse -include "Package.appxmanifest"
|
||||
|
||||
if($manifestFiles)
|
||||
{
|
||||
Write-Host "Will apply $ManifestVersion to $($manifestFiles.count) Manifests."
|
||||
|
||||
foreach ($file in $manifestFiles) {
|
||||
$filecontent = Get-Content($file)
|
||||
attrib $file -r
|
||||
$filecontent -replace $ManifestVersionRegex, $ManifestVersion | Out-File $file utf8
|
||||
|
||||
Write-Host "$file.FullName - version applied to Manifest"
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Warning "No Manifest files found."
|
||||
}
|
||||
|
||||
Write-Host ("##vso[task.setvariable variable=AppxVersion;]$NewVersion")
|
Reference in New Issue
Block a user