diff --git a/scripts/FetchLatestBuild.ps1 b/scripts/FetchLatestBuild.ps1 index a41ec0ce1..38b8bdbc1 100644 --- a/scripts/FetchLatestBuild.ps1 +++ b/scripts/FetchLatestBuild.ps1 @@ -8,7 +8,6 @@ $unpackedPackagesPath = [System.IO.Path]::GetFullPath("$releasePath\UnpackedPack mkdir $releasePath -Force | Out-Null # Install prerequisite packages -#Install-Package -Name "Nito.AsyncEx" -RequiredVersion "3.0.1" -Source "nuget.org" -ProviderName "NuGet" -Destination $buildPath -Force #Install-Package -Name "Newtonsoft.Json" -RequiredVersion "7.0.1" -Source "nuget.org" -ProviderName "NuGet" -Destination $buildPath -Force if ($buildVersion -eq $null) { @@ -20,25 +19,30 @@ if ($buildVersion -eq $null) { Write-Output "Latest build version on master is $buildVersion`r`n" } else { - Write-Error "PowerShellEditorServices build $buildVersion was not successful!" -ErrorAction "Stop" + Write-Error "PowerShellEditorServices build $buildVersion was not successful!" -ErrorAction "Stop" } } function Install-BuildPackage($packageName, $extension) { $uri = "https://ci.appveyor.com/nuget/powershelleditorservices/api/v2/package/{0}/{1}" -f $packageName.ToLower(), $buildVersion Write-Verbose "Fetching from URI: $uri" - + # Download the package and extract it $zipPath = "$releasePath\$packageName.zip" $packageContentPath = "$unpackedPackagesPath\$packageName" Invoke-WebRequest $uri -OutFile $zipPath -ErrorAction "Stop" Expand-Archive $zipPath -DestinationPath $packageContentPath -Force -ErrorAction "Stop" Remove-Item $zipPath -ErrorAction "Stop" - + # Copy the binary to the binary signing folder mkdir $binariesToSignPath -Force | Out-Null cp "$packageContentPath\lib\net45\$packageName.$extension" -Force -Destination $binariesToSignPath - + + # Don't forget the x86 exe + if ($extension -eq "exe") { + cp "$packageContentPath\lib\net45\$packageName.x86.$extension" -Force -Destination $binariesToSignPath + } + Write-Output "Extracted package $packageName ($buildVersion)" } @@ -46,7 +50,6 @@ function Install-BuildPackage($packageName, $extension) { Install-BuildPackage "Microsoft.PowerShell.EditorServices" "dll" Install-BuildPackage "Microsoft.PowerShell.EditorServices.Protocol" "dll" Install-BuildPackage "Microsoft.PowerShell.EditorServices.Host" "exe" -Install-BuildPackage "Microsoft.PowerShell.EditorServices.Host.x86" "exe" # Open the BinariesToSign folder & start $binariesToSignPath diff --git a/scripts/PackageSignedBinaries.ps1 b/scripts/PackageSignedBinaries.ps1 index 11d87de6a..d3dd92f9a 100644 --- a/scripts/PackageSignedBinaries.ps1 +++ b/scripts/PackageSignedBinaries.ps1 @@ -15,17 +15,20 @@ mkdir $finalPackagePath -Force | Out-Null $binaries = Get-ChildItem $binariesToSignPath foreach ($binaryPath in $binaries) { $signature = Get-AuthenticodeSignature $binaryPath.FullName - + # TODO: More validation here? if ($signature.Status -eq "NotSigned" -and $FailIfNotSigned) { Write-Error "Binary file is not authenticode signed: $binaryPath" -ErrorAction Stop } - - # Copy the file back where it belongs + + # Get the package name for the binary and account for 32-bit exe $packageName = [System.IO.Path]::GetFileNameWithoutExtension($binaryPath) + $packageName = $packageName.TrimEnd(".x86") + + # Copy the binary back to its package path $packagePath = "$unpackedPackagesPath\$packageName" cp $binaryPath.FullName -Destination "$packagePath\lib\net45\" -Force - + # Repackage the nupkg with NuGet Push-Location $finalPackagePath & $nugetPath pack "$packagePath\$packageName.nuspec"