-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathpre-build.ps1
More file actions
46 lines (32 loc) · 1.27 KB
/
pre-build.ps1
File metadata and controls
46 lines (32 loc) · 1.27 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$version = (Get-Content -Path .\docs\release-notes.md -First 1).Trim('#', ' ')
Write-Host "using version $version"
$v1 = ($version -replace "\.", ",") + ",0"
$v2 = $version + ".0"
Write-Host "Replacement values: vCommaed='$v1', vDotted='$v2'"
$Subfolder = "bt"
$rcFiles = Get-ChildItem -Path $Subfolder -Filter "*.rc" -File -Recurse
Write-Host "Found $($rcFiles.Count) .rc file(s)"
if ($rcFiles.Count -eq 0) {
Write-Host "No .rc files found under '$Subfolder'"
}
foreach ($rcFile in $rcFiles) {
Write-Host "Processing: $($rcFile.FullName)"
(Get-Content $rcFile.FullName) `
-replace "\d,\s*\d+,\s*\d+,\s*\d+", "$v1" |
Out-File $rcFile.FullName
(Get-Content $rcFile.FullName) `
-replace "\d\.\d+\.\d+\.\d+", "$v2" |
Out-File $rcFile.FullName
Write-Host "Updated: $($rcFile.FullName)"
}
Write-Host "Completed pre-build version update"
# update version in globals.h, which is set as:
# "#define APP_VERSION "0.0.0"
$globalsPath = Join-Path $Subfolder "globals.h"
if (Test-Path -Path $globalsPath) {
Write-Host "Updating version in: $globalsPath"
(Get-Content $globalsPath) `
-replace "#define APP_VERSION "".*""", "#define APP_VERSION `"$version`"" |
Out-File $globalsPath
Write-Host "Updated: $globalsPath"
}