From 30d94c17f57d37e69787a9559b583672f5662583 Mon Sep 17 00:00:00 2001 From: "Steve Lee [MSFT]" Date: Sat, 9 Sep 2017 17:00:16 -0700 Subject: [PATCH] validate the expected output package exists --- build.psm1 | 13 ++++++++++--- tools/packaging/packaging.psm1 | 31 ++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/build.psm1 b/build.psm1 index 75045560bff..c720de2ed95 100644 --- a/build.psm1 +++ b/build.psm1 @@ -688,7 +688,7 @@ function New-PSOptions { if($RootInfo.RepoPath -ne $RootInfo.ValidPath) { - $RootInfo['Warning'] = "Please ensure you repo is at the root of the file system and named 'PowerShell' (example: '$($RootInfo.ValidPath)'), when building and packaging for release!" + $RootInfo['Warning'] = "Please ensure your repo is at the root of the file system and named 'PowerShell' (example: '$($RootInfo.ValidPath)'), when building and packaging for release!" $RootInfo['IsValid'] = $false } else @@ -1813,8 +1813,15 @@ function New-MSIPackage Remove-Item -ErrorAction SilentlyContinue *.wixpdb -Force - Write-Verbose "You can find the MSI @ $msiLocationPath" -Verbose - $msiLocationPath + if (Test-Path $msiLocationPath) + { + Write-Verbose "You can find the MSI @ $msiLocationPath" -Verbose + $msiLocationPath + } + else + { + throw "Failed to create $msiLocationPath" + } } function Start-CrossGen { diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 9f1d3ab6d35..e8de7863553 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -534,7 +534,14 @@ function New-UnixPackage { } } - return $createdPackage + if (Test-Path $createdPackage) + { + return $createdPackage + } + else + { + throw "Failed to create $createdPackage" + } } function New-StagingFolder @@ -622,9 +629,15 @@ function New-ZipPackage Compress-Archive -Path $PackageSourcePath\* -DestinationPath $zipLocationPath } - log "You can find the Zip @ $zipLocationPath" - $zipLocationPath - + if (Test-Path $zipLocationPath) + { + log "You can find the Zip @ $zipLocationPath" + $zipLocationPath + } + else + { + throw "Failed to create $zipLocationPath" + } } #TODO: Use .NET Api to do compresss-archive equivalent if the pscmdlet is not present else @@ -706,7 +719,15 @@ function New-NugetPackage log "Use -verbose to see output..." Start-NativeExecution -sb {dotnet $arguments} | Foreach-Object {Write-Verbose $_} - Get-ChildItem $nugetFolder\* | Select-Object -ExpandProperty FullName + $nupkgFile = "${nugetFolder}\${nuspecPackageName}-${packageRuntime}.${nugetSemanticVersion}.nupkg" + if (Test-Path $nupkgFile) + { + Get-ChildItem $nugetFolder\* | Select-Object -ExpandProperty FullName + } + else + { + throw "Failed to create $nupkgFile" + } } function New-SubFolder