Skip to content

Commit ede53d8

Browse files
committed
Ensure built binaries names match with resources
1 parent a3a989a commit ede53d8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

UpdateLibgit2ToSha.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,22 @@ function Find-Git {
9191

9292
Push-Location $libgit2Directory
9393

94+
function Ensure-Property($expected, $propertyValue, $propertyName, $path) {
95+
if ($propertyValue -eq $expected) {
96+
return
97+
}
98+
99+
throw "Error: Invalid '$propertyName' property in generated '$path' (Expected: $expected - Actual: $propertyValue)"
100+
}
101+
102+
function Assert-Consistent-Naming($expected, $path) {
103+
$dll = get-item $path
104+
105+
Ensure-Property $expected $dll.Name "Name" $dll.Fullname
106+
Ensure-Property $expected $dll.VersionInfo.InternalName "VersionInfo.InternalName" $dll.Fullname
107+
Ensure-Property $expected $dll.VersionInfo.OriginalFilename "VersionInfo.OriginalFilename" $dll.Fullname
108+
}
109+
94110
& {
95111
trap {
96112
Pop-Location
@@ -112,6 +128,7 @@ Push-Location $libgit2Directory
112128
break
113129
}
114130
$shortsha = $sha.Substring(0,7)
131+
$expected = "git2-$shortsha.dll"
115132

116133
Write-Output "Checking out $sha..."
117134
Run-Command -Quiet -Fatal { & $git checkout $sha }
@@ -124,6 +141,7 @@ Push-Location $libgit2Directory
124141
Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration }
125142
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
126143
cd $configuration
144+
Assert-Consistent-Naming $expected "*.dll"
127145
Run-Command -Quiet { & rm *.exp }
128146
Run-Command -Quiet { & rm $x86Directory\* }
129147
Run-Command -Quiet -Fatal { & copy -fo * $x86Directory }
@@ -136,6 +154,7 @@ Push-Location $libgit2Directory
136154
Run-Command -Quiet -Fatal { & $cmake --build . --config $configuration }
137155
if ($test.IsPresent) { Run-Command -Quiet -Fatal { & $ctest -V . } }
138156
cd $configuration
157+
Assert-Consistent-Naming $expected "*.dll"
139158
Run-Command -Quiet { & rm *.exp }
140159
Run-Command -Quiet { & rm $x64Directory\* }
141160
Run-Command -Quiet -Fatal { & copy -fo * $x64Directory }

0 commit comments

Comments
 (0)