Files
eepp/projects/scripts/patch_commit_number.ps1

17 lines
486 B
PowerShell

Set-Location (Resolve-Path "$PSScriptRoot\..\..")
$COMMIT_NUMBER = git rev-list "$((git tag --sort=-creatordate | Select-String ecode | Select-Object -First 1).Line)..HEAD" --count
if ($LASTEXITCODE) {
Write-Error "Error: git binary not found"
exit $LASTEXITCODE
}
$FILE_PATH = ".\src\tools\ecode\version.hpp"
try {
(Get-Content $FILE_PATH) -replace '#define ECODE_COMMIT_NUMBER \d+', "#define ECODE_COMMIT_NUMBER $COMMIT_NUMBER" | Set-Content $FILE_PATH
} catch {
exit 1
}