-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathSetVisionVersion.ps1
More file actions
32 lines (26 loc) · 1.51 KB
/
SetVisionVersion.ps1
File metadata and controls
32 lines (26 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
param(
[string]$version # new version (4 digits, e.g. "4.0.8.4" or "5.9.19.0")
)
if([string]::IsNullOrWhiteSpace($version)) { throw "Missing version parameter" }
$versionCheck = $version -as [version]
$versionDigits = $version.Split('.').Count
if($null -eq $versionCheck -or $versionDigits -ne 4) { throw "Invalid version '$version' (exactly 4 digits required)" }
$plcFolder = "$PSScriptRoot\PLC"
$cppFolder = "$PSScriptRoot\_internal\C++"
$ba = "Beckhoff Automation GmbH";
Get-ChildItem -Path $plcFolder -Filter *.tsproj -Recurse -File -Name | ForEach-Object {
$tsProjPath = "$plcFolder\$_"
(Get-Content $tsProjPath) -replace "$ba(\|(TcVision|TcIoGigEVision)\|)(\d+.\d+.\d+.\d+)", "$ba`${1}$version" | Set-Content $tsProjPath
}
Get-ChildItem -Path $cppFolder -Filter *.tsproj -Recurse -File -Name | ForEach-Object {
$tsProjPath = "$cppFolder\$_"
(Get-Content $tsProjPath) -replace "$ba(\|(Tc3_Vision|TcVision|TcIoGigEVision)\|)(\d+.\d+.\d+.\d+)", "$ba`${1}$version" | Set-Content $tsProjPath
}
Get-ChildItem -Path $cppFolder -Filter *.tmc -Recurse -File -Name | ForEach-Object {
$tmcPath = "$cppFolder\$_"
(Get-Content $tmcPath) -replace "$ba\|Tc3_Vision\|(\d+.\d+.\d+.\d+)", "$ba|Tc3_Vision|$version" | Set-Content $tmcPath
}
Get-ChildItem -Path $cppFolder -Filter *.props -Recurse -File -Name | ForEach-Object {
$propsPath = "$cppFolder\$_"
(Get-Content $propsPath) -replace "$ba\\Tc3_Vision\\(\d+.\d+.\d+.\d+)", "$ba\Tc3_Vision\$version" | Set-Content $propsPath
}