Skip to content

Commit 3c5a7ae

Browse files
Only update BuildInfo.cs if changed (#1673)
This prevents `dotnet` from unnecessarily rebuilding the library, though we lose the precise time and instead only have the date.
1 parent 0021fe8 commit 3c5a7ae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

PowerShellEditorServices.build.ps1

+5-2
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ task CreateBuildInfo -Before Build {
189189
$buildOrigin = $env:PSES_BUILD_ORIGIN
190190
}
191191

192-
[string]$buildTime = [datetime]::Now.ToString("s", [System.Globalization.CultureInfo]::InvariantCulture)
192+
[string]$buildTime = [datetime]::Today.ToString("s", [System.Globalization.CultureInfo]::InvariantCulture)
193193

194194
$buildInfoContents = @"
195195
using System.Globalization;
@@ -206,7 +206,10 @@ namespace Microsoft.PowerShell.EditorServices.Hosting
206206
}
207207
"@
208208

209-
Set-Content -LiteralPath $script:BuildInfoPath -Value $buildInfoContents -Force
209+
if (Compare-Object $buildInfoContents.Split([Environment]::NewLine) (Get-Content $script:BuildInfoPath)) {
210+
Write-Host "Updating Build Info"
211+
Set-Content -LiteralPath $script:BuildInfoPath -Value $buildInfoContents -Force
212+
}
210213
}
211214

212215
task SetupHelpForTests {

0 commit comments

Comments
 (0)