Skip to content

Commit 905ab44

Browse files
SteveL-MSFTlzybkr
authored andcommitted
ensure text files use crlf line endings (#872)
1 parent e486136 commit 905ab44

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

PSReadLine.build.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Write-Verbose "Building for '$target'" -Verbose
3232

3333
$CLI_VERSION = "2.1.300"
3434

35+
function ConvertTo-CRLF([string] $text) {
36+
$text.Replace("`r`n","`n").Replace("`n","`r`n")
37+
}
38+
3539
<#
3640
Synopsis: Ensure dotnet is installed
3741
#>
@@ -325,7 +329,9 @@ task LayoutModule BuildMainModule, BuildMamlHelp, {
325329

326330
foreach ($file in $extraFiles)
327331
{
328-
Copy-Item $file $targetDir
332+
# ensure files have \r\n line endings as the signing tool only uses those endings to avoid mixed endings
333+
$content = Get-Content -Path $file -Raw
334+
Set-Content -Path (Join-Path $targetDir (Split-Path $file -Leaf)) -Value (ConvertTo-CRLF $content) -Force
329335
}
330336

331337
$binPath = "PSReadLine/bin/$Configuration/$target/publish"
@@ -342,7 +348,7 @@ task LayoutModule BuildMainModule, BuildMamlHelp, {
342348

343349
# Copy module manifest, but fix the version to match what we've specified in the binary module.
344350
$version = (Get-ChildItem -Path $targetDir/Microsoft.PowerShell.PSReadLine2.dll).VersionInfo.FileVersion
345-
$moduleManifestContent = Get-Content -Path 'PSReadLine/PSReadLine.psd1' -Raw
351+
$moduleManifestContent = ConvertTo-CRLF (Get-Content -Path 'PSReadLine/PSReadLine.psd1' -Raw)
346352

347353
$getContentArgs = @{
348354
Raw = $true;

0 commit comments

Comments
 (0)