Skip to content

Commit 5d0df0c

Browse files
committed
Fix azure version check (#124)
* Fix CI check for version number match * Normalize the ICU version fro all scripts to use * Move version normalization before syncing ICU version with other scripts * Moving sanity check on ICU version number before normalization
1 parent 860c2ea commit 5d0df0c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

build/scripts/Set-ICUVersion.ps1

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ if (!$icuVersionData.ICU_version) {
2323
Write-Host 'ICU Version = ' $icuVersionData.ICU_version
2424
$ICUVersion = $icuVersionData.ICU_version
2525

26+
# Sanity check on the ICU version number
27+
$icuVersionArray = $ICUVersion.split('.')
28+
if ($icuVersionArray.length -ne 4) {
29+
Write-Host "Error: The ICU version number ($env:ICUVersion) should have exactly 4 parts!".
30+
throw "Error: Invalid ICU version number!"
31+
}
32+
33+
# Normalize the ICU version (ex: 72.0.1.0 -> 72.0.1)
34+
$ICUVersion = $ICUVersion -replace '(.0)+$', ''
35+
2636
# The Azure DevOps environment is a bit odd and requires doing the following
2737
# in order to persist variables from one build task to another build task.
2838
$vstsCommandString = 'vso[task.setvariable variable=ICUVersion]' + $ICUVersion
@@ -32,12 +42,6 @@ Write-Host "##$vstsCommandString"
3242
# as this script may be called by other scripts.
3343
$env:ICUVersion = $ICUVersion
3444

35-
# Sanity check on the ICU version number
36-
$icuVersionArray = $ICUVersion.split('.')
37-
if ($icuVersionArray.length -ne 4) {
38-
Write-Host "Error: The ICU version number ($env:ICUVersion) should have exactly 4 parts!".
39-
throw "Error: Invalid ICU version number!"
40-
}
4145
foreach ($versionPart in $icuVersionArray) {
4246
# Each part of the ICU version must fit within a uint8_t, so the max value for each part is 255.
4347
if ([int]$versionPart -gt [int]255) {

0 commit comments

Comments
 (0)