Skip to content

Commit b279ac7

Browse files
committed
Merge branch 'develop'
2 parents 09b91bd + 7a3d769 commit b279ac7

14 files changed

Lines changed: 279 additions & 184 deletions

File tree

Scripts/update-versions.cmd

Lines changed: 0 additions & 90 deletions
This file was deleted.

Scripts/update-versions.ps1

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<#
2+
.SYNOPSIS
3+
Update project and installer version numbers from version.txt.
4+
5+
.DESCRIPTION
6+
Replaces product/version fields in .csproj files and the VERSION define in the installer
7+
Version.wxi. Intended to run from the repository Scripts folder (the script sets location
8+
to its own folder automatically).
9+
10+
.USAGE
11+
.\update-versions.ps1 # reads version from version.txt
12+
.\update-versions.ps1 -NewVersion 1.6.0
13+
#>
14+
15+
param(
16+
[string]$NewVersion
17+
)
18+
19+
Set-StrictMode -Version Latest
20+
21+
try {
22+
# ensure script runs from its directory (matches batch behavior)
23+
Set-Location -Path $PSScriptRoot
24+
25+
if (-not $NewVersion) {
26+
$versionFile = Join-Path $PSScriptRoot 'version.txt'
27+
if (-not (Test-Path $versionFile)) {
28+
Write-Error "version.txt not found at $versionFile"
29+
exit 1
30+
}
31+
32+
$raw = Get-Content -Path $versionFile -Raw -ErrorAction Stop
33+
$NewVersion = $raw.Trim()
34+
}
35+
36+
if ([string]::IsNullOrWhiteSpace($NewVersion)) {
37+
Write-Error 'No version found or provided.'
38+
exit 1
39+
}
40+
41+
Write-Host "New Version: $NewVersion"
42+
43+
$txd = 'Trixter.XDream'
44+
45+
function Replace-InFile {
46+
param(
47+
[Parameter(Mandatory=$true)][string]$Path,
48+
[Parameter(Mandatory=$true)][string]$NewVersion,
49+
[Parameter(Mandatory=$true)][bool]$isCsproj
50+
)
51+
52+
if (-not (Test-Path $Path)) {
53+
Write-Error "File not found: $Path"
54+
return $false
55+
}
56+
57+
# Read/Write using UTF8 to match original script behavior
58+
[xml]$content = Get-Content -Path $Path -Raw -Encoding UTF8
59+
60+
if ($isCsProj) {
61+
$content.Project.PropertyGroup.Version = $NewVersion
62+
} else {
63+
$content.Include.define = 'VERSION = "'+$NewVersion+'"'
64+
}
65+
$content.Save($Path)
66+
Write-Host "Updated: $Path"
67+
68+
return $true
69+
}
70+
71+
Write-Host 'Updating API'
72+
$apiProj = Join-Path $PSScriptRoot "..\$txd.API\$txd.API.csproj"
73+
Replace-InFile -Path $apiProj -NewVersion $NewVersion -isCsproj $true
74+
75+
Write-Host 'Updating Diagnostics'
76+
$diagProj = Join-Path $PSScriptRoot "..\$txd.Diagnostics\$txd.Diagnostics.csproj"
77+
Replace-InFile -Path $diagProj -NewVersion $NewVersion -isCsproj $true
78+
79+
Write-Host 'Updating Test Controller'
80+
$tcProj = Join-Path $PSScriptRoot "..\$txd.TestController\$txd.TestController.csproj"
81+
Replace-InFile -Path $tcProj -NewVersion $NewVersion -isCsproj $true
82+
83+
Write-Host 'Updating installer project'
84+
$wxi = Join-Path $PSScriptRoot "..\$txd.Installer\Version.wxi"
85+
Replace-InFile -Path $wxi -NewVersion $NewVersion -isCsproj $false
86+
87+
Write-Host 'Done.'
88+
exit 0
89+
}
90+
catch {
91+
Write-Error $_.Exception.Message
92+
exit 1
93+
}

Scripts/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.0
1+
1.5.1

Trixter.XDream.API.Testing/Trixter.XDream.API.Testing.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net48</TargetFramework>
@@ -14,6 +14,7 @@
1414
<FileVersion>1.0.1</FileVersion>
1515
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1616
<IsTestingProject>true</IsTestingProject>
17+
<Configurations>Debug;Release;Signed Release</Configurations>
1718
</PropertyGroup>
1819

1920
<ItemGroup>
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<TargetFramework>netstandard2.0</TargetFramework>
54
<LangVersion>7.3</LangVersion>
@@ -10,13 +9,17 @@
109
<Authors>David Mason</Authors>
1110
<Description>A .NET Standard API for reading the state of a Trixter X-Dream exercise bike, and setting its resistance.</Description>
1211
<Copyright>(C) David Mason 2021-2026</Copyright>
13-
<AssemblyVersion>1.5.0</AssemblyVersion>
14-
<FileVersion>1.5.0</FileVersion>
15-
<Version>1.5.0</Version>
12+
<Version>1.5.1</Version>
13+
<AssemblyVersion>$(Version)</AssemblyVersion>
14+
<FileVersion>$(Version)</FileVersion>
15+
<Configurations>Debug;Release;Signed Release</Configurations>
1616
</PropertyGroup>
17-
1817
<ItemGroup>
1918
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
2019
</ItemGroup>
2120

22-
</Project>
21+
22+
<Target Condition="$(Configuration)=='Signed Release'" Name="PostBuild" AfterTargets="PostBuildEvent">
23+
<Exec Command="call ..\Scripts\sign-tool.cmd &quot;$(TargetPath)&quot; &quot;Trixter X-Dream API&quot; " />
24+
</Target>
25+
</Project>

0 commit comments

Comments
 (0)